RTUComputer ScienceYr 2024 · Sem 52024

Q4Operating System

Question

2 marks

Define Race Condition.

Answer

A race condition is a situation where the outcome of a computation depends on the relative order of execution of multiple concurrent processes accessing shared data.

A race condition occurs when two or more processes/threads access and manipulate shared data concurrently, and the final result depends on the order of access. For example, if processes P1 and P2 both read a shared variable count (=5), increment it, and write back, the result may be 6 instead of 7 if their operations are interleaved. Race conditions lead to data inconsistency and are prevented by synchronization mechanisms (semaphores, mutex locks, monitors).

Back to Paper