反应性扩展(Rx)会取代任务并行库吗? [英] Will Reactive Extensions (Rx) supersede the Task Parallel Library?

查看:70
本文介绍了反应性扩展(Rx)会取代任务并行库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在仔细阅读了Rx.NET的示例之后,我感到震惊的是Reactive Extensions的概念和实现.它似乎为开发人员提供了一种更易于维护的模式,以实现.NET 4.0的任务并行库提供的相同类型的多线程并行编码.

After following through the samples of Rx.NET, I'm gob smacked at how brilliant the concept and implementation of Reactive Extensions are. It appears to offer developers a more maintainable pattern for achieving the same sort of multi-threaded parallel coding that .NET 4.0's task parallel library offers.

Rx.NET会取代TPL吗?应该吗?

Will Rx.NET supersede TPL? Should it?

推荐答案

总之,不.

任务并行库(TPL)提供了工作分配(并发性)以及大型工作的并发优化(并行性),同时抽象了实际机制工作分配(线程).

The Task Parallel Library (TPL) provides provides distribution of work (concurrency), as well as the concurrent optimisation of larger work (parallelism) while abstracting the actual mechanism of work distribution (threads).

C#添加了async关键字,以帮助从语言级别管理异步. Rx已更新为支持此功能.

C# adds the async keyword to help manage asynchrony from a language level. Rx has already been updated to support this feature.

Rx提供了使用标准运算符组成和管理异步数据流的框架.尽管Rx在使用调度程序方面存在一些交叉,但这仅是一种抽象.实际上,推荐的并行性调度程序是TaskScheduler,它使用TPL.

Rx provides a framework to compose and manage asynchronous data streams using standard operators. While there is some crossover in Rx's use of schedulers, this is only an abstraction. In fact, the recommended scheduler for parallelism is the TaskScheduler, which uses the TPL.

另请参见 Jeffrey梵高对Rx论坛上完全相反的问题的回答.

此外,这个问题可能有用.

这篇关于反应性扩展(Rx)会取代任务并行库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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