并发Concurrency与并行Parallelism
并发Concurrency与并行Parallelism
并发指的是可以一起发生,这里的一起指的是 at the same period 而不是 at the same instant ,强调的是CPU具有处理多任务的能力
多个任务不是按照固定的先后顺序执行(sequential)
现有 两个任务 A B A B执行的先后顺序不固定 且二者的完成情况对对方无影响
即使是单核CPU也可以拥有任务处理能力
并行强调的是同一时刻,cup从物理上可以同一时刻执行多个任务
Concurrency is when two or more tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. For example, multitasking on a single-core machine.
Parallelism is when tasks literally run at the same time, e.g., on a multicore processor.
引自--What is the difference between concurrency and parallelism?