简体   繁体   English

C#和Mono中的并行状态

[英]state of parallelism in MS C# and Mono

for a project I'm working on, I need to work with threads. 对于我正在从事的项目,我需要使用线程。 I was wondering: what is the state of parallelism in MS C# and, particularly, Mono , as compared for example to OpenMP and pthreads ? 我想知道:与OpenMPpthreads相比,MS C# (尤其是Mono的并行状态如何? How much control do I have over threads in C#? 我对C#中的线程有多少控制权? What will I not be able to do? 我将无法做什么? For instance, can I synchronize explicitly? 例如,我可以显式同步吗? Can I work directly with mutexes? 我可以直接使用互斥锁吗? Can I do conditional wait? 我可以有条件等待吗? Thanks. 谢谢。

You'll have virtually all the control over threads 您几乎可以控制所有线程

The .NET framework contains virtually all ( monitor , manualresetevent , autoresetevent , sempaphore , readerwriterlock etc) primitives. .NET框架包含几乎所有的( monitormanualreseteventautoreseteventsempaphorereaderwriterlock等)原语。 For special needs catering you can always P/Invoke (though you'll have to have multiple implementations to stay portable) 对于特殊需求的餐饮,您可以随时P / Invoke(尽管您必须具有多种实现方式才能保持便携性)

Mono has a PLINQ implementation (coming along) Mono具有PLINQ实现(附带)

See Miguel de Icaza's blog post on C# 3.0 and Parallel FX/LINQ in Mono . 请参阅Miguel de Icaza在C#3.0和Mono中的Parallel FX / LINQ上的博客文章。 It should be is in Mono 2.8 应该 单声道2.8

So yes yes yes and yes :) 是的,是的,是的,是的:)

在Mono上,您可以像在.Net上一样对待线程程序,托管代码的运行时兼容性是Mono项目的主要目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM