并行parallel和并发concurrent的区别

本文详细解释了并发和并行的概念及其区别。并发是指两个或多个任务可以在重叠的时间段内开始、运行和完成,但不一定同时运行;而并行则是指任务能够真正地在同一时刻运行,通常发生在多核处理器上。

http://stackoverflow.com/questions/1050222/concurrency-vs-parallelism-what-is-the-difference

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. Eg. 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:

  • 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.

 

参考:

http://www.cnblogs.com/ty408/p/5801148.html

http://www.cnblogs.com/zlcxbb/p/5754346.html

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值