Quick post about C++20 concepts

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

Multithreading in C++11/14 – Part 12

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

Hit the road with CppCast

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.

Dynamic structures in C++

I take a small break with the series of articles about multithreading in C++11/14. This article is a bit less serious. Actually, I wanted to see how far I could go with tuples and lambdas in bare C++14 to mimic the dynamic of JavaScript objects. Let’s start with what I tried to achieve.   Some  … Read more

Multithreading in C++11/14 – Part 11

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

Multithreading in C++11/14 – Part 10

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

Multithreading in C++11/14 – Part 9

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

Multithreading in C++11/14 – Part 8

C++ is often said to be a complex language, especially with respect to simpler dynamically-typed languages like JavaScript. Many programmers complain in particular about manual memory management, mainly because they are unaware that it is no longer a requirement. C++11/14 is not really more complex than Java or PHP, if it is used wisely. There  … Read more

Multithreading in C++11/14 – Part 7

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

Multithreading in C++11/14 – Part 6

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