A **Race Condition** is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the same time, but because of the nature of the device or system, the operations must be done in the proper sequence to be done correctly.
Critical Section: The segment of code where shared resources (global variables, files, memory structures) are accessed. Only one process should be executing in its critical section at a time.
Requirements for a Critical Section Solution:
- Mutual Exclusion: If process $P_i$ is running in its critical section, no other processes can.
- Progress: If no process is running, only processes wishing to enter can choose who enters next; selection cannot be postponed indefinitely.
- Bounded Waiting: There must be a limit on the number of times other processes can enter before a requesting process is granted entry.