4 ms·
You said "All parallel execution is asynchronous, but not all asynchronous execution is parallel." But later you mentioned threads running in parallel on diffe
by sureglymop 2y ago
You said "All parallel execution is asynchronous, but not all asynchronous execution is parallel."
But later you mentioned threads running in parallel on different CPU cores.
The way I always understood it, is that this is the only real form of parallelism able to happen on a CPU. But that does seem kind of incompatible with your statement at the beginning.
- dekhn 2y agoThe way I think about it is, when Rob Pike says "Concurrency is not parallelism", I really rewrite it as "All concurrency is parallelism, but not all parallelism is concurrency." If you just think of concurrency as an instance of parallelism, you start to realize there are many ways to achieve concurrency, and thread-safe queues are one of the better ways to do it. Individual CPU cores are parallel because they are executing multiple instructions simultaneously (even though they are from the same instruction stream).
- yencabulator 2y ago> "All concurrency is parallelism, but not all parallelism is concurrency." The other way around. Alternating two executions on one CPU core is concurrency, but not parallelism.
- throwaway894345 2y ago> All concurrency is parallelism, but not all parallelism is concurrency As sibling notes, you have it exactly backwards. It should read "All parallelism is concurrency, but not all concurrency is parallelism." I thought maybe this was a typo, but then you said: > If you just think of concurrency as an instance of parallelism, you start to realize there are many ways to achieve concurrency, and thread-safe queues are one of the better ways to do it. This is demonstrating parallelism as an instance of concurrency, not the other way around. A thread-safe queue can be processed by multiple tasks running interleaved in a single thread in which case it is executing concurrently, but not in parallel. > Individual CPU cores are parallel because they are executing multiple instructions simultaneously This is an implementation detail of the CPU. Not all CPUs execute instructions in parallel.