<p>I was wondering if any of you have any ideas for a fun project to work on where I could implement concurrency to get a better understanding. I've done a lot of reading about about it but I have yet to really get my hands dirty. I would love any ideas I could try out though to really learn.</p>
<hr/>**评论:**<br/><br/>jahayhurst: <pre><p>I've been writing a sudoku solver to look at concurrency. I adopted a few rules:</p>
<ul>
<li>I'm not using any mutexes within the project, instead just using channels - channels everywhere.</li>
<li>Plan on building a state machine for the puzzle - at least, that's what I'm thinking of it as. Given a board state, it searches everythign for updates, and kicks the updates back into itself, applies them to the board state, then given the new board state it searches for updates.</li>
</ul>
<p>All of that continues until:</p>
<ul>
<li>the puzzle is solved</li>
<li>the puzzle is stalled - no new changes</li>
<li>there's an error in the puzzle (any cell is impossible)</li>
</ul>
<p>If the puzzle stalls, wait for a new external change/read a new external change.</p>
<p>If there's an error in the puzzle, take the board state from before the last external update, make that the board state, and mark the last external update as bad. Treat the puzzle as stale then and wait for another update.</p>
<p>If the puzzle is solved, simply check every new change against the puzzle - if it matches, it's correct, otherwise it was incorrect.</p>
<p>With all of that in mind, the internal workings of the program end up looking pretty cool, and it's cool to see how the internal stuff dies off in steps.</p></pre>dbrecht: <pre><p>Not sure whether or not this has been done before, but something I've been meaning to do in my non existent spare time was to find sources for rap lyrics since the dawn of time and run some sentiment analysis against them, and then classify the results based on year, geographic location and stage of career (i.e. how long they've been around for). And then, of course, write a blog post with some pretty visualizations.</p>
<p>Not something that /requires/ concurrency, but it would definitely speed up the process.</p>
<p>A completely useless but fun exercise (IMHO are any rate) :)</p></pre>edbonet: <pre><p>I thought of a sophisticated version of the producer/consumer. </p>
<p>Let's say you have have a bakery, where customers keep coming and each ask for a list of some products. </p>
<p>Each product is made from 3 or 4 ingredients ou of 10 different ingredients, and their availability is defined by a set of producers, each creating 1 ingredient at a time at specific speeds.</p>
<p>The challenge is to coordinate the producers to produce the ingredients needed so you can fullfill orders given a specific goal: lowest average waiting time, lowest waiting time, etc. </p>
<p>Tis example should cover racing conditions (use of mutexes), channels and workers pattern.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传