Situation where two or more processes are reading or writing some shared data and the final result depends on who runs precisely, when are called
Situation where two or more processes are reading or writing some shared data and the final result depends on who runs precisely, when are called Race condition.
In operating systems, processes that are working together
share some common storage (main memory, file etc.) that each process can read
and write. When two or more processes are reading or writing some shared data
and the final result depends on who runs precisely when, are called race
conditions. Concurrently executing threads that share data need to synchronize
their operations and processing in order to avoid race condition on shared
data. Only one ‘customer’ thread at a time should be allowed to examine and
update the shared variable.
Race conditions are also possible in Operating Systems. If
the ready queue is implemented as a linked list and if the ready queue is being
manipulated during the handling of an interrupt, then interrupts must be
disabled to prevent another interrupt before the first one completes. If
interrupts are not disabled than the linked list could become corrupt.