Scenario A – race condition not happening

Thread A reads the value (1), posts 1 to the API, then increments it to 2, and saves it back. Right after this, the scheduler pauses Thread A, and runs Thread B. Thread B reads the value (now 2), posts 2 to the API, increments it to 3, and saves it back.

At this point, after the operation has happened twice, the value stored is correct: 1 + 2 = 3. Moreover, the API has been called with both 1 and 2, correctly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.31.73