This compiles fine: This does not: Here is the error message obtained with GCC 7.2 with -std=c++1z -fconcepts: Hence, the conclusion that the order of definition matters. Is it as per the specification? Is it a compiler bug? Is it something that could be changed before concepts are released to C++20? I wish I could … Read more
In the previous article of this series about multithreading in C++11/14, I presented a first alternative to multithreading: GPU computing. Another obvious alternative is multi-process programming. This is the topic of this article, and the next one. In this article, I will start with some remainders about the concept of process, and show how to … Read more
Lately, whenever I drive, I listen to the excellent CppCast podcast. So far, I have listened to the first 20 episodes + some later episodes (mainly related to multithreading and distributed computing). If you’re interested in C++, you should definitely check out this podcast.
General-Purpose computing on Graphics Processing Units is a well-known technique to benefit from the huge parallelism of GPUs. An article about GPU computing in a series about multithreading can feel questionable. As we are about to see, GPUs are essentially multicores architectures, which are based on a multithreading programming model. This is the reason why … Read more
In the previous article about lock-free programming, we saw how complex concurrency can be. For some embedded systems and restrained environments, this is the way to go. However, for mainstream development on classic platforms, there is a wealth of libraries and frameworks that provide high level programming models. In this article, we will explore some … Read more
Lock-free programming is rather an expert-friendly topic. Unless you are developing a performance critical application in a restrained environment, you have measured that lock-based approaches are not sufficient, you don’t have access to a library of lock-free data structures and algorithms that abstract away the difficulties of lock-free programming, you tested alternatives based on GPGPU, … Read more
Before digging into the dark magic of atomics, let’s pause for a moment and have a look at some best practices when using C++11/14 multithreading facilities. Sensible patterns Use async: Task-based programming is superior to thread-base programming, because it provides a higher level of abstraction. std::async is the nearest thing to task-based programming so … Read more
When one thread A has to wait for the completion of a computation performed by a thread B, you are left with 2 choices. Thread A may keep asking thread B about its status: this is long polling. A smarter solution is to let B inform A when it is finished. This latter mechanism relies … Read more