简体   繁体   English

用于C ++的独立于平台的并发编程库

[英]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 谢谢你的帮助提前,谢谢

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处于比线程更高的级别,并且也得到了很好的支持。

You could look at CSP , which has a C++ implementation. 您可以查看具有C ++实现的CSP Way different from Java's threading primitives, though. 但是,与Java的线程原语不同。

这个问题以及答案可能对你有所帮助。

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.

相关问题 在 C++ 中生成独立于平台的 GUID? - Platform-independent GUID generation in C++? 获得最大C ++浮点值的平台无关方法 - Platform-independent way to obtain maximum C++ float value C / C ++库,用于平台无关的二进制文件I / O - C/C++ library for platform-independent binary file I/O C++:如何以独立于平台的方式读写多字节 integer 值? - C++: How to read and write multi-byte integer values in a platform-independent way? 使用Java本机代码或C ++(QT,WxWidgets等)进行平台无关的编程 - Platform-independent programmming with Java native code or C++ (QT, WxWidgets etc.) 如何以与平台无关的方式从c ++中调用.NET - How do I call .NET from c++ in as a platform-independent way as possible 为什么C ++哈希函数的返回类型为std :: size_t,而不是与平台无关的类型? - Why C++ hash functions' return type is std::size_t, instead of a platform-independent type? 独立于平台的C ++调试器IDE,它们遵循诸如Visual Studio之类的指针 - Platform-independent C++ Debugger IDEs that follow pointers like Visual Studio 平台无关的OpenSSL库 - Platform-independent OpenSSL library 是否有一个易于使用的,独立于平台的软件包,可用于在C ++下读写gzip流? - Is there an easy-to-use, platform-independent package that we can use to read & write gzip streams under C++?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM