且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

并发和并行性有什么区别?

更新时间:2023-09-19 17:37:46

并发是两个或多个任务可以在重叠的时间段内启动,运行和完成的时间.并不一定意味着它们都将在同一时刻运行.例如,单核计算机上的多任务处理.

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.

引用 Sun的多线程编程指南 :

  • 并发:至少有两个线程正在执行时存在的条件.并行性的一种更通用的形式,可以包括将时间切片作为虚拟并行性的一种形式.

  • Concurrency: A condition that exists when at least two threads are making progress. A more generalized form of parallelism that can include time-slicing as a form of virtual parallelism.

并行性:当至少两个线程同时执行时出现的条件.

Parallelism: A condition that arises when at least two threads are executing simultaneously.