问题描述
并发性和并行性之间有什么区别?
What is the difference between concurrency and parallelism?
赞赏示例.
推荐答案
并发是两个或多个任务可以在重叠的时间段内启动,运行和完成的时间.并不一定意味着它们都将在同一时刻运行.例如,单核计算机上的多任务处理.
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.
这篇关于并发和并行性有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!