Question:medium

What is a ‘race condition’ in concurrent programming?

Show Hint

A race condition occurs when the outcome of a program depends on the unpredictable order of execution of threads or processes accessing shared resources.
Updated On: Jan 16, 2026
  • When two processes compete for CPU time
  • When the outcome depends on the unpredictable order of execution of threads
  • When a program terminates unexpectedly
  • When memory allocation fails during execution
Show Solution

The Correct Option is B

Solution and Explanation

A race condition in concurrent programming arises when multiple processes or threads contend for shared resources. The final outcome is contingent upon the unpredictable sequence of their execution, potentially causing unforeseen behavior or defects due to variations in thread execution timing.
- CPU time competition (A) pertains to CPU scheduling but is not inherently a race condition.
- Unexpected program termination (C) signifies an error with diverse causes, not exclusively linked to race conditions.
- Memory allocation failure (D) is a memory management problem, distinct from race conditions.
Therefore, the accurate answer is (B), where the result is determined by the thread execution order.
Was this answer helpful?
0


Questions Asked in CUET (UG) exam