6 ms·
These are tricky waters, but here's what I see as the difference: Two separate threads that can run completely independently without any synchronisation are co
by HenryR 15y ago
These are tricky waters, but here's what I see as the difference:
Two separate threads that can run completely independently without any synchronisation are concurrent because it doesn't matter what order you run them in. Therefore there are many, many 'sequentially equivalent' computations that are correct per the language semantics. From the perspective of the user it can seem like you ran Thread A to completion followed by Thread B, or Thread B then Thread A, or any interleaving of the two.
Threads are one way of expressing concurrency. Actors, to pick at random, are another. So I don't believe that threads <=> concurrency, but that threads usually express concurrency unless they have pathological synchronisation behaviour.
Which they would have, in your final example - there is no concurrency because there's only a single ordering of events that is correct.
- javert 15y agoI just realized you and I have multiple "threads of conversation" going on at once. (which is OK.) I like your Actors example. Yeah, concurrency can't be defined in terms of "threads" in a specific implementation sense, but only in a more generic sense of "threds of execution," as in "execution contexts".