Casablanca如何处理不同类型的并发:计算绑定和IO绑定? [英] How does Casablanca deal with different kinds of concurrency: compute bound and IO bound ?

查看:118
本文介绍了Casablanca如何处理不同类型的并发:计算绑定和IO绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速查看文档,我看到该库使用Concurrency :: task来提供异步IO。

Looking quickly over the documentation I see that the library uses Concurrency::task to provide async IO.

我记得VS10-s ppl(例如task_group)在使用任务时没有IO的建议,因为调度的每个任务都不是IO订阅的调度程序。

I remember from VS10-s ppl (e.g. task_group) that the recommendation there was not to have IO when using tasks, because every task scheduled that was not IO bound under-subscribed the scheduler.

你如何在卡萨布兰卡处理这个问题,能够有效地做IO?我认为您甚至使用相同的构造混合IO和计算绑定工作,例如:task。

How do you deal with this in Casablanca, being able to do efficiently IO ? I think that you even mix IO and compute bound work using the same construct, e.g. : task.

推荐答案

优秀的问题!

VS 2010任务,隐含的由task_groups管理,确实用于计算工作,而不是I / O. VS 2010中支持的模式主要是将计算分解为可并行化的子工作单元。 I / O
并不适合这种范例。

The VS 2010 tasks, which were implicit and managed by task_groups, were indeed intended for computational work, not I/O. The patterns that were supported in VS 2010 were mostly about decomposition of a computation into parallelizable sub-units of work. I/O does not fit neatly into this paradigm.

在VS 11中,我们一直致力于扩展概念,并添加了明确的任务,这些任务用于组合进入依赖图,其中并行性不在图中(然后在图中建立边缘)。这些类型的任务是
更适合作为I / O的抽象,因此我们在Casablanca中使用它们,这在很大程度上是关于有效的I / O.显式任务适用于计算和I / O的组合,但它们的开销比
隐式任务高得多,因此它们不适合分解。

In VS 11, we've worked on expanding the concept and have added explicit tasks, which are used for composition of work into dependence graphs, where the parallelism falls out of the graph (.then establishes an edge in the graph). These kinds of tasks are much more well-suited as an abstraction also for I/O, and thus we're using them in Casablanca, which is to a large extent about efficient I/O. Explicit tasks work well for composition of both computation and I/O, but they have a much higher overhead than implicit tasks, so they are not well suited for decomposition.

由于我们在VS 2010中没有明确的任务,并且我们希望Casablanca能够使用该版本的IDE,因此我们将PPL任务反向移植到VS 2010并将卡塞布兰卡二进制文件中的端口运送到不同的命名空间," pplx"。

Since we didn't have explicit tasks in VS 2010, and we want Casablanca to work with that version of the IDE, we back-ported PPL tasks to VS 2010 and shipped the port in the Casablanca binaries, under a different namespace, "pplx".

Niklas


这篇关于Casablanca如何处理不同类型的并发:计算绑定和IO绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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