多线程与并发,并行与异步编程之间有什么区别? [英] What is the differences between multithreading vs concurrent vs parallel vs asynchronous programming?

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

问题描述

几天之内,我想知道这四种编程之间有什么区别.我在Google中搜索信息,但无法回答我的问题,所以我决定问你,有人可以向我解释吗?谢谢!

For a couple of days, I am wondering what is the difference between this four types of programming.I search information in Google but I cannot answer my question so I decide to ask you, can someone explain to me please? Thank you !

推荐答案

您提到的编程关键字指的是出于特定原因而发明的技术,用于解决计算和处理领域的问题.

The programming keywords you have mentioned refer to techniques invented for specific reasons to solve problems in the field of computation and processing.

每种技术旨在解决的问题的简要要点:

A concise essence of what each technique aims to solve:

  • 并发性:手头上有很多任务,我需要在每一个任务上都取得稳步的进展,而不是依次完成一个任务并转到下一个任务.让我来处理每个过程,以便在给定的时间点 中,在两个或多个任务中出现非零进度. (不一定同时)

  • Concurrency: There are many tasks at hand, I need a steadfast progress in each of them instead of completing one and moving on to the next in a serial approach. Let me work on each of the processes so that at a given point in time, there is non-zero progress in two or more tasks. (not necessarily in simultaneity)

并行性:鉴于我的设备资源,有可能在单位时间内完成更多工作.让我使用一些技术增加吞吐量可能牺牲延迟,以便我的任务更快地完成.

Parallelism: There is potential for doing more work in unit time given my device resources. Let me use some techniques to increase throughput, possibly sacrificing latency, so that my task(s) finish quicker.

多线程:我的设备硬件和软件都支持程序中多个执行线程;让我将需要大量计算的计算 分解到那些处理器/内核/线程池中

Multi-threading: Both my device hardware and software have support for more than one thread of execution in a program; Let me split the computationally intensive calculations across those processors/cores/thread-pools!

异步:一组要完成的任务. 我目前正在表演其中之一.让我打电话给朋友帮我完成另一项任务,希望他/她回到我身边,并在我继续执行任务的同时返回结果.

Asynchrony: A set of tasks to be completed. I am performing one of them currently. Let me call my friend to help me out with another task, I hope he/she comes back to me with the results while I continue performing my task.

请注意,上面讨论的技术不一定是相互的 独家的. 具体来说,多线程是一种并行性,这反过来又会导致并发度大于1(非平凡的多线程).

Note that the techniques discussed above are not necessarily mutually exclusive. Specifically, multi-threading is a type of parallelism, which in turn does result in degree of concurrency being more than 1 (non-trivial multi-threading).

偶然地,我维护了一个关于并行计算的博客.在其中一篇文章中,我写了同一领域中使用的行话.

Incidentally, I've maintained a blog about parallel computing. In one of the posts, I've written about the jargon used in the same field.

http://magical-parallel-computing. blogspot.in/2017/04/parallel-computing-jargon.html

我希望它能在概念上为您提供帮助.

I hope it helps you at a conceptual level.

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

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