[英]Platform-independent concurrent programming libraries for C++
I am familiar with concurrent programming in Java which provides a lot of tools for this. 我熟悉Java中的并发编程,它提供了很多工具。 However, C++ concurrent programming isn't so easy to start using. 但是,C ++并发编程并不是那么容易开始使用。
What is the best way to start programming concurrently on C++? 在C ++上同时开始编程的最佳方法是什么? Are there any nice libraries which wrap concurrent programming primitives and provide you with more high-level constructs? 是否有任何好的库包装并发编程基元并为您提供更多高级构造?
I tried QtConcurrent which provides you with nice MapReduce functionality but it is heavily biased towards concurrent computation using Qt so it's not a good choice if you don't want to use Qt. 我尝试了QtConcurrent ,它为你提供了很好的MapReduce功能,但它严重偏向于使用Qt的并发计算,所以如果你不想使用Qt,它不是一个好的选择。
Are there any other similar libraries? 还有其他类似的图书馆吗? What do people use here? 人们在这里使用什么?
Thanks for your help in advance, sneg 谢谢你的帮助提前,谢谢
There are several choices: 有几种选择:
ACE which provides some concurrency constructs ACE提供了一些并发结构
Intel Threading Building Blocks 英特尔线程构建模块
Morendil's suggestion (CSP - communicating sequential processes) is truly interesting to take a look at - it's a very different view of threading and one that works well once you wrap your head around it. Morendil的建议(CSP - 沟通顺序流程)真的很有意思 - 它是一个非常不同的线程视图,一旦你绕过它就能很好地工作。 I first encountered it in the rather esoteric Occam language for Transputers, but the idea has stuck with me. 我第一次用相当深奥的Occam语言为Transputers遇到它,但这个想法一直困扰着我。
A more conventional idea: boost::threads work quite well for building thread-based concurrent programs. 一个更传统的想法: boost :: threads在构建基于线程的并发程序时非常有效。 It's quite low level though. 但它的水平相当低。
OpenMP is at a higher level than threads and also quite well-supported. OpenMP处于比线程更高的级别,并且也得到了很好的支持。
这个问题以及答案可能对你有所帮助。
Intel's Threading Building Blocks is great for introducing concurrency at the level of individual data-parallel loops, and it takes care of managing threads and allocating work automagically. 英特尔的线程构建模块非常适合在单个数据并行循环级别引入并发,它负责管理线程并自动分配工作。 It can be used in similar ways to OpenMP, but without the need for explicit compiler support. 它可以以类似的方式用于OpenMP,但不需要显式编译器支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.