微软的CCR VS任务并行库微软、任务、CCR、VS

2023-09-03 02:48:06 作者:诉清风

微软至少有两个不同的刘美平,北方的并行操作改进的支持。

Microsoft has at least two different approches to improved support for concurrent operations.

1)是并发协调运行时(CCR),这是微软机器人工作室的一部分, CCR&放大器; DSS工具包

1) Is the Concurrency Coordination Runtime (CCR) which is part of Microsoft Robotics Studio and CCR & DSS Toolkit

2)任务Paralell库( TPL )(部分.NET 4.0,现在在Beta 1版)

2) Task Paralell Library (TPL) (Part of .NET 4.0 and now in Beta 1 release)

我想知道如果任何人有两种不同的软件经验,会比较和对比他们?

I would like to know if anyone has experience with these two different pieces of software and would compare and contrast them?

推荐答案

总的来说,这两个框架具有互补的,但不同的目标。

By and large, both frameworks have complementary but different goals.

在CCR提供原语协调并发进程。协调是使一堆原有的工作流程作为一个整体胶 - 这样的CCR提供原语,通过所谓的渠道交换消息。进程可以等待一个消息到一个信道,或多个信道,或一个信道数目等中的任何一个到达。这是为协调并发进程的特定范例,效果很好。还要注意的是它不是免费的 - 你必须要是从微软单独购买

The CCR offers primitives for coordination of concurrent processes. Coordination is the glue that makes a bunch of processes work as a whole - so the CCR offers primitives for exchanging messages through so called channels. Processes can wait for a message to arrive on a channel, or a number of channels, or any one of a number of channels and so forth. This is a particular paradigm for coordination of concurrent processes that works well. Note also that is it not free - you have to buy if from Microsoft separately.

在TPL提供原语和基础设施的 parallellize 的计算或算法半自动。其中最明显的原语的存在是并行循环 - 看起来有点像一个for循环,但会尝试并行执行循环

The TPL offers primitives and infrastructure to parallellize computations or algorithms semi-automatically. One of the most obvious primitives there is the parallel for loop - looks sort of like a for loop but tries to execute the loop in parallel.

所以,如果你有一堆,你想,以协调在一个较高的水平比使用共享状态​​和锁,使用CCR的过程。如果你有一个计算密集的过程,你想多核机器上高效运行,使用第三方物流。

So, if you have a bunch of process that you'd like to coordinate on a higher level than using shared state and locks, use the CCR. If you have a computation-intensive process that you'd like to run efficiently on a multi-core machine, use the TPL.

 
精彩推荐
图片推荐