并发与并行性 - 有什么区别? [英] Concurrency vs Parallelism - What is the difference?

查看:118
本文介绍了并发与并行性 - 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

并发与并行性 - 有什么区别?任何示例

Concurrency vs Parallelism - What is the difference? Any examples

推荐答案

并发是指两个或多个任务可以重叠开始,运行和完成时间段。这并不一定意味着他们都会在同一时刻运行。例如。在单核机器上执行多任务。

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.

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

这篇关于并发与并行性 - 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆