Programming concurrency in C++

Click for: original source

The first in series of articles by Mehreen Tahir about programming C++ and introduce you to the features C++ offers in order to support concurrent programming. C++ was originally designed to support only single thread programming. In every application, there is one default thread.

Concurrent programming allows for the execution of multiple threads and thus, we can write highly efficient programs by taking advantage of any parallelism available in a computer system.

C++ version 11 acknowledged the existence of multi-threaded programs and the later standards also brought some improvements.

Following this article you will learn about:

  • Concurrency and concurrent programming
  • Concurrency and parallelization
  • Why even the need for concurrency?
  • The threading library in C++
  • Different ways of creating threads
  • Considerations for computation and / or IO intensive programs

A thread is basically a lightweight sub-process. It is an independent task running inside a program that can be started, interrupted, and stopped.

The article also has figures explaining the life cycle of a thread and example of code you can use for your own experiments with concurrent programming. Nice one!

[Read More]

Tags web-development programming software-architecture distributed