2 ms·
Concepts such as "multi-threading" and "async/await" are particular implementations of concurrency and, potentially, parallelism. They are often used by people
by paskozdilar 4y ago
Concepts such as "multi-threading" and "async/await" are particular implementations of concurrency and, potentially, parallelism. They are often used by people who are used to a particular implementation and don't see a reason to use any more abstract word.
But mathematically speaking, "concurrency" and "parallelism" are very much related - by definition, in any concurrent algorithm, there are branches of computation that can be safely parallelized; and every parallel algorithm is, by definition, concurrent.
The difference between the two, I think, is that parallelism colloquialy implies parallel execution (e.g. OpenMP, Numpy), while concurrency does not (e.g. NodeJS) - concurrency is just independence of computation.
That's the reason functional languages generally excel at concurrency - by having explicit dependencies between computational objects, the compiler can just topologically sort the dependency graph, and trivially find which branches of computation can be parallelized.
- User23 4y agoAs I understand it the unifying concept is nondeterminism. It’s a logical framework that can make sense of parallelism, concurrency, and interrupts. Nondeterministic doesn’t mean unpredictable. For example a pure functional language without side effects is free to evaluate function parameters in any order and still always return the same result. Other times a nondeterministic algorithm can produce different results each execution but still produce a result that satisfies some predicate. For example iterating over a Go hash makes no promises about the order elements will be visited in, but it does promise they will all be visited. So if your reduce function is commutative and associative you’ll get the same result regardless of ordering.
- paskozdilar 4y agoI agree with your perspective. Nondeterminism == lack of ordering. As simple as that.