.NET的高级多线程/并发抽象 [英] High-level multithreading/concurrency abstractions for .NET

查看:102
本文介绍了.NET的高级多线程/并发抽象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道为什么,不像Scala,F#或Haskell,基本的.NET框架(如在C#或VB中可用)似乎对较高级别的并发模式只有很少的本机支持。



有可用的基本机制 - 锁,监视器,线程池 - 但是




  • 同步变量href =http://book.realworldhaskell.org/read/concurrent-and-multicore-programming.html =nofollow noreferrer> MVar

  • 同步频道

  • 异步频道(请参阅Go或 Haskell

  • 参与者/消息传递( Erlang-Style

  • Futures

  • 计算/列表函数

  • 通过Linq进行可组合的异步计算(如F#的 async {}



Haskell的STM



甚至考虑到ParallelFX,这个列表只被部分覆盖。



是否有更深层次的理由反对提供这样的功能

解决方案 div>

有积极和持续的研究,最好的和最有效的抽象,可以用来使并发软件没有掌握的细节b / c大多数开发商没有时间或倾向发展他们的技能水平。



鉴于这一点,BCL对新概念的入门有相当高的障碍,但这并不意味着他们没有发生。最近,在.Net 4中,将引入任务并行库。早期版本的TPL实际上包括未来< T> 类型,后来被更新 抽象



通过研究语言 Axum



我显然不是球队的一部分我不为微软工作,但我的理解是,有一个希望创新在这一领域已经广泛使用的。


I just wondered why, unlike Scala, F# or Haskell, the basic .NET framework (as available in C# or VB) seems to have very little native support for higher level concurrency patterns.

There are basic mechanisms available - locks, monitors, the thread pool - but what about

  • Synchronized variables (MVar)
  • Synchronous channels
  • Asynchronous channels (see Go or Haskell)
  • Actors / message passing (Erlang-Style)
  • Futures
  • Parallel computations/List functions
  • Composable asynchronous computations through Linq (like F#'s async {})

or even software transactional memory (STM for Haskell)

And even taken account of ParallelFX, this list is only partially covered.

Are there certain deeper reasons against providing such functionalities (and instead wanting people to mess around with IAsyncResult's) or is this planned to be integrated in future?

解决方案

There's active and ongoing research into the best and most effective abstractions that can be used to enable concurrent software without mastering the minutiae b/c most dev's either don't have the time or inclination to develop their skills to that level.

Given this, the BCL has a fairly high barrier to entry for new concepts, but that doesn't mean that they aren't happening. Most recently, in .Net 4, there will be the introduction of the Task Parallel Library. Earlier versions of the TPL actually included a Future<T> type that has since been supplanted by newer abstractions.

There's also active research going on in the arena of channels/etc via the research language Axum.

I'm obviously not part of the team and I don't work for Microsoft, but my understanding is that there's a desire to innovate in this area beyond what's already widely available.

这篇关于.NET的高级多线程/并发抽象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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