Tag : Race Condition

Say that you are eating some sweets while watching a movie. You had a look at your pack or sweets, counted five and continued watching the movie. Took the first one and deducted this in your mind (without looking at the sweets pack). In the mean time, and without you knowing, your daughter takes one. While you think that there are four sweets left, in reality there are only three. You will discover this at the end when you are looking for the last one. This is a Race Condition and in this article we will see how this occurs in programming and how we can avoid it.

Albert Attard
Author: 3 years ago