Microsoft's CCR vs Task Parallel Library

后端 未结 2 1954
耶瑟儿~
耶瑟儿~ 2021-01-01 00:37

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

1) Is the Concurrency Coordination Runtime (CCR) which is part of Micro

2条回答
  •  温柔的废话
    2021-01-01 00:49

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

    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.

    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.

    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.

提交回复
热议问题