.net 中的 TPL 与异步?
我在 .net 4 中没有太多使用 TPL,但我知道它非常适合多核应用程序
,但在 PDC 中我看到他们宣布异步 CTP 和 TPL。我只在 F# 中看到了异步,
我的问题是它们和异步有什么区别?他们每个人的最佳做法是什么
提前致谢
i didnt use TPL that much in .net 4 but i know its great for multi-core Applications
but in PDC i saw them announcing Async CTP & i only saw Async in F#
my Question is what is the difference between them & what are the best practices for each of them
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C# 5 中的异步功能将使用 TPL...当然,它只是一个库。异步方法将使使用 TPL 变得更加容易...给定适当的相对较低级别的异步操作(例如“异步获取网页”或“异步读取数据块”) 构建更高级别的异步操作将相当容易
就最佳实践而言, - 对于 TAP(基于任务的异步模式),有一个有趣的白皮书。对于 .NET 的一般并行编程,有一本由 Patterns and Practices 编写的书组,“使用 Microsoft .NET 进行并行编程” 以及 Joe Duffy 的书“Windows 上的并发编程” - 尽管后者稍微早于 TPL。
The async features in C# 5 will use the TPL... which is just a library, of course. Asynchronous methods will simply make it a lot easier to use the TPL... given appropriate relatively-low-level async operations (e.g. "fetch a web page asynchronously" or "read a block of data asynchronously" it will be fairly easy to build higher-level asynchronous operations.
In terms of best practices - for TAP (Task-based Asynchronous Pattern) there's an interesting white paper. For parallel programming in general with .NET, there's a book by the Patterns and Practices group, "Parallel Programming with Microsoft .NET" and also Joe Duffy's book "Concurrent Programming on Windows" - although the latter predates the TPL slightly.