Concurrency Is Not Parallelism
Rob Pike – ‘Concurrency Is Not Parallelism’
Concurrency is
dealing
lots of things at once
Parallelism is
doing
lots of things at once
Not the same, but related
One is about structure and one is about execution
Concurrency is not parallelism, although it enables parallelism.
If you have only one processor, your program can still be concurrent but it cannot be parallel.
On the other hand, a well-written concurrent program might run efficiently in parallel on a multiprocessor. That property could be important…
简单理解:
1.单CPU只能做到并发(concurrency),不能做到并行(parallelism)。多CPU才能做到并行。
2.dealing可以理解为调度器在多个进程之间不断调用一部分程序进入CPU进行处理,待这部分程序处理完毕,再切换到另一部分程序进入CPU进行处理。doing可以理解为调度器将多个进程分配给多个CPU,让每一个进程在自己占有的CPU里从头跑到尾。