The Heart Of The Problem: Uncontrolled Scheduling

Let's try to find the root cause of the problem faced in threads' problem from the last lesson.

We'll cover the following

You saw in the last lesson an example of two threads trying to update a shared variable. It was noticed that incorrect value was being evaluated by the program. The code snippet is reproduced below:

Get hands-on with 1200+ tech skills courses.