3 ms·
For me, these drawings made it quite clear what the differences were: http://joearms.github.io/2013/04/05/concurrent-and-parallel-programming.html http://joear
by _nato_ 11y ago
For me, these drawings made it quite clear what the differences were:
http://joearms.github.io/2013/04/05/concurrent-and-parallel-programming.html http://joearms.github.io/2013/04/05/concurrent-and-parallel-...
- sean-duffy 11y agoThat example is not correct, a key concept in concurrency is that it gives way to potential parallelism, but this does not follow from the queues and coffee machines analogy.
- simoncion 11y ago> ...a key concept in concurrency is that it gives way to potential parallelism, but this does not follow from the queues and coffee machines analogy. How do you figure? From TFA: > A lot of software systems are useful to reason about as having multiple threads of control — for instance, separate clients connecting to a server, or separate UI widgets. Programs that are organized this way exhibit concurrency. The fact that multiple threads of control are a good way of organizing and reasoning about certain programs is orthogonal to whether those programs are running on one processor core or four or 1000. One queue of people executing the "get espresso from the coffee machine" routine and another queue executing the "get drip coffee from the coffee machine" routine seems like concurrency to me. Two different routines are competing for the use of a single resource, but neither routine needs to know about the other -if we presume that there's a work scheduling system in place-. What's more, this trivially gives way to parallelism: add another coffee machine (which is analogous to another CPU core) and assign one of the queues to that machine. BAM! Instant parallelism. What am I misunderstanding here?
- Sanddancer 11y agoIt's more complicated than that, but the pic could be a decent starting point. Concurrency is the person waiting in the line pulling out their cell phone and checking their email while they're waiting for their turn at the coffee machine. The get_coffee thread is scheduled, but blocked, so the person waiting is handling the check_email thread. They can only do one thing at a time, but that one thing can swap in and out as situations change.