Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

language-agnostic - 并发和并行性有什么区别?(What is the difference between concurrency and parallelism?)

What is the difference between concurrency and parallelism?

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

Examples are appreciated.

(示例被赞赏。)

  ask by StackUnderflow translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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, eg, on a multicore processor.

(并行是指任务实际上在多核处理器上同时运行。)


Quoting Sun's Multithreaded Programming Guide :

(引用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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...