Introduction to Shared Data

This lesson gives an introduction to how data can be shared between threads in C++.

We'll cover the following

We only need to think about synchronization if we have shared, mutable data because such data is prone to data races. If we have concurrent non-synchronized read and write access to data, our program will have undefined behavior. The easiest way to visualize concurrent, unsynchronized read and write operations is to write something to std::cout​. Let’s have a look:

Get hands-on with 1200+ tech skills courses.