如何表达的异步和并行编程的区别? [英] How to articulate the difference between asynchronous and parallel programming?

查看:192
本文介绍了如何表达的异步和并行编程的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多平台促进异步和并行作为提高响应速度。我理解上的差异一般,但经常发现它在我自己的头脑阐明困难,以及为他人。

Many platforms promote asynchrony and parallelism as means for improving responsiveness. I understand the difference generally, but often find it difficult to articulate in my own mind, as well as for others.

我是一个平庸的程序员和使用异步和放大器;回调相当频繁。并行富有异国情调。

I am a workaday programmer and use async & callbacks fairly often. Parallelism feels exotic.

但我觉得他们很容易被混为一谈,尤其是在语言设计水平。喜欢的它们如何与(或没有),一个清晰的描述,其中每个最好是应用程序的类。

But I feel like they are easily conflated, especially at the language design level. Would love a clear description of how they relate (or don't), and the classes of programs where each is best applied.

推荐答案

当你运行一些异步这意味着它是非阻塞的,你执行它,而无需等待它完成,并与其他的东西矣。并行装置同时运行多个的东西,在平行。并行运作良好时,你可以任务分解为工作的独立部分。

When you run something asynchronously it means it is non-blocking, you execute it without waiting for it to complete and carry on with other things. Parallelism means to run multiple things at the same time, in parallel. Parallelism works well when you can separate tasks into independent pieces of work.

就以3D动画的渲染例子框架。为了渲染动画需要很长的时间,所以如果你要推出的动画编辑软件内的渲染,你会确保它运行的异步的所以没有锁定您的用户界面,你可以继续做其他的事情。现在,该动画的各帧也可被视​​为一个单独的任务。如果我们有多个CPU /内核或多台计算机可用,我们可以渲染多个帧的平行的要加快整体工作量。

Take for example rendering frames of a 3D animation. To render the animation takes a long time so if you were to launch that render from within your animation editing software you would make sure it was running asynchronously so it didn't lock up your UI and you could continue doing other things. Now, each frame of that animation can also be considered as an individual task. If we have multiple CPUs/Cores or multiple machines available, we can render multiple frames in parallel to speed up the overall workload.

这篇关于如何表达的异步和并行编程的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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