Concurrency vs Parallelism From Stackoverflow

Stackoverflow 精彩答案整理…

本人英语水平渣渣,翻译的主要目的自己整理加深理解。如果不幸误导您,请见谅。如果您好心提醒我,可以直接底下留言。

原文链接

Concurrency is when two 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:

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

并行:在这样的条件下出现:至少两个线程正在同时执行。



另一个比较形象的解释:

Rob usually talks about Go and usually addresses the question of Concurrency vs Parallelism in a visual and intuitive explanation! Here is a short summary:

Task: Let’s burn a pile of obsolete language manuals! One at a time!

任务:烧掉一堆古老的语言参考手册。顺序执行:

Concurrency: There are many concurrently decompositions of the task! One example:

并发:任务分解,并发执行:

Parallelism: The previous configuration occurs in parallel if there are at least 2 gophers working at the same time or not.

至少要两只土拔鼠同时工作才能算的得上是并行。



Confusion exists because dictionary meanings of both these words are almost the same:

因为字典中把并发和并行解释的意思基本是相同的,所以有疑惑很正常。

Concurrent: existing, happening, or done at the same time(dictionary.com)

Parallel: very similar and often happening at the same time(merriam webster).

Yet the way they are used in computer science and programming are quite different. Here is my interpretation:

但是它们在CS中使用时有很大区别。这里是我的解释:

Concurrency: Interruptability

并发:可中断。

Parallelism: Independentability

并行:无相互依赖关系。

篇幅有限,更多解释可以看原文,链接在最上面。

时间: 2024-10-06 21:27:40

Concurrency vs Parallelism From Stackoverflow的相关文章

Concurrency vs. Parallelism

http://getakka.net/docs/concepts/terminology Terminology and Concepts In this chapter we attempt to establish a common terminology to define a solid ground for communicating about concurrent, distributed systems which Akka.NET targets. Please note th

Differences between concurrency and parallelism

this problem answered by Mason Wheeler on stackexchange: "Concurrency and parallelism are two related but distinct concepts. Concurrency means, essentially, that task A and task B both need to happen independently of each other, and A starts running,

Concurrency and Parallelism

0 Concurrency and Parallelism 当一个CPU执行一个线程时,另一个CPU可以执行另一个线程,两个线程互不抢占CPU资源,可以同时进行,这种方式我们称之为并行(Parallel).区别:并发和并行是即相似又有区别的两个概念,并行是指两个或者多个事件在同一时刻发生:而并发是指两个或多个事件在同一时间间隔内发生. 1. 网络编程 1.1 TCP/IP网络编程 Client: socket connect write recv Server: socket bind list

Concurrency Is Not Parallelism (Rob pike)

Rob pike发表过一个有名的演讲<Concurrency is not parallelism>(https://blog.golang.org/concurrency-is-not-parallelism), 演讲胶片在talks.golang.org中可以找到(https://talks.golang.org/2012/waza.slide#1), 演讲视频地址 :https://vimeo.com/49718712 以下是根据视频转换的文本信息. if you looked at t

actor concurrency

The hardware we rely on is changing rapidly as ever-faster chips are replaced by ever-increasing numbers of cores. As a result, concurrency and parallelism, niche features today, will soon be a basic requirement for most software. Application develop

转 GCD

GCD 深入理解:第一部分 本文翻译自 http://www.raywenderlich.com/60749/grand-central-dispatch-in-depth-part-1 原作者:Derek Selander 译者:@nixzhu 虽然 GCD 已经出现过一段时间了,但不是每个人都明了其主要内容.这是可以理解的:并发一直很棘手,而 GCD 是基于 C 的 API ,它们就像一组尖锐的棱角戳进 Objective-C 的平滑世界.我们将分两个部分的教程来深入学习 GCD . 在这两

Python著名的lib和开发框架(均为转载)

第一,https://github.com/vinta/awesome-python Awesome Python A curated list of awesome Python frameworks, libraries, software and resources. Inspired by awesome-php. Awesome Python Admin Panels Algorithms and Design Patterns Anti-spam Asset Management A

GCD - 多线程

什么是 GCD GCD 是 libdispatch 的市场名称,而 libdispatch 作为 Apple 的一个库,为并发代码在多核硬件(跑 iOS 或 OS X )上执行提供有力支持.它具有以下优点: 1.GCD 能通过推迟昂贵计算任务,并在后台运行它们改善应用的响应性能. 2.GCD 提供一个易于使用的并发模型而不仅仅只是锁和线程,以帮助我们避开并发陷阱. 3.GCD 具有在常见模式(例如单例),用更高性能的原语优化你的代码. GCD 术语 Serial vs. Concurrent 串

Akka学习——术语和概念

(大部分为翻译) Concurrency vs. Parallelism 并发 vs 并行 并发并不一定同时运行,比如使用时间片,使得两个任务交替执行.而并行是执两个任务真正的同时执行. Asynchronous vs. Synchronous   同步 vs 异步   如果一个方法被调用后,调用者只能等到此方法返回值或抛出异常才能继续前进,那这个方法就被称为是"同步"的. 而"异步"调用,是指调用者在经历有限的步骤之后,可以继续前进.方法的完成可以通过其它的机制进