What is a race condition? Give an example

      

What is a race condition? Give an example

  

Answers


Faith
When two (or even more) processes try to concurrently access a shared resource, leading to odd
behaviour, deadlocks or mistakenly overwriting memory addresses.
Typical example from lectures: Two processes simultaneously updating a counter (lol, Assignment 1
math.c). Say Process A reads the variable but process B steps in and reads and writes to it. Control is
passed back to process A, who just writes to it. You’ve just written to it twice. Ouch.
Titany answered the question on April 26, 2022 at 05:18


Next: Context switching between two threads of execution within the operating system is usually performed by a small assembly language function. In general terms, what does this small...
Previous: What is a critical region? How do they relate to controlling access to shared resources?

View More Operating Systems Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions