Data Races and Race Conditions

In this lesson, you will learn about data races which in most cases lead to race conditions.

One of the reasons why concurrency is hard to achieve is because of data races.

Data Race

A data race happens when processes have to access the same variable concur­rently i.e. one process reads from a memory location while another simultaneously writes to the exact same memory location.

The following function is an example of a data race:

Get hands-on with 1200+ tech skills courses.