Operating Systems · Critical Section Solutions
Requirements of a Synchronization Solution (Mutual Exclusion, Progress, Bounded Waiting, Architectural Neutrality)
Overview
Any synchronization mechanism must be checked against four rules before it is accepted: mutual exclusion, progress, bounded waiting, and portability (architectural neutrality).
The first two are mandatory — a solution lacking either is discarded — while the last two are desirable but tolerated if absent.
Key concepts
- Mutual Exclusion — If one process is inside the critical section, the other process must not be allowed to enter it. This is the entire reason synchronization is done; without it, race conditions occur.
- Progress — If a process does not want to enter the critical section, it must not stop other processes that are interested in entering it.
- Bounded Waiting — A process must not be held back for a very long time; you must be able to state the finite number of turns after which a waiting process is guaranteed a chance.
- Portability / Architectural Neutrality — The solution must not assume a particular operating system or hardware (for example, it must not depend on special hardware instructions), so it can run on all platforms.
- Dressing-room analogy — The critical section is a dressing room usable by only one person at a time, and the processes are the people.
Only one person may be inside at any time, and another may enter only after that person comes out.
How it works
- Design the synchronization mechanism.
- Verify it against the four rules.
- Check the two primary rules first: mutual exclusion and progress. If either is missing, the solution is not going to be implemented anyway — search for another solution that provides them.
- Check the two secondary rules: bounded waiting and portability. A solution that also has these is better, but their absence is tolerated.
Worked examples
Bounded waiting — acceptable bounds:
- "You enter one time, then you enter one time" (alternating).
- "You enter two times, then you enter one time."
- "You enter three times, then you enter one time."
Any finite bound is acceptable, because the other person will happily wait once the bound can be stated.
Bounded waiting — not acceptable:
- One process enters the critical section an infinite number of times while the other gets a chance only once. This means there is no bounded waiting.
Comparison
| Rule | Meaning | Priority | Consequence if not satisfied |
|---|---|---|---|
| Mutual Exclusion | Only one process inside the critical section at any time | Primary (very important) | Race conditions; solution rejected |
| Progress | A process not interested in the critical section must not block interested processes | Primary (very important) | Solution rejected; we look for other solutions |
| Bounded Waiting | After a finite number of turns (1, 2, 3 …) a waiting process is guaranteed a chance; the bound must be stateable | Secondary | Starvation (a process may wait forever) — tolerated |
| Portability / Architectural Neutrality | No assumptions about operating system or hardware (e.g. no dependence on special hardware instructions) | Secondary | Solution may fail on other hardware/OS platforms |
Revision summary
- Four requirements: mutual exclusion, progress, bounded waiting, portability (architectural neutrality).
- Mutual exclusion and progress are mandatory — a solution missing either is discarded outright.
- Bounded waiting and architectural neutrality are secondary: desirable, but their absence is tolerated.
- Lack of bounded waiting leads to starvation — one process waits forever — which is explicitly accepted as a secondary-level problem.
- "Infinite turns for one process" is not bounded waiting; the bound must be a finite, stateable number.
- A solution relying on special hardware instructions may fail on other hardware, so it is not architecturally neutral.
Previous-year exam insights
- The three mandatory conditions for the critical-section problem are mutual exclusion, progress and bounded waiting; a solution must satisfy all three.
Asked inUGC NET 2014 - The progress condition also forbids a process outside its critical section (in its remainder section) from blocking interested processes, and forbids indefinite postponement of the selection of the next entrant.
Asked inUGC NET 2014 - A correct solution must make no assumptions about the relative speeds of processes or the number of CPUs (no assumption about hardware speed or processor count).
Asked inUGC NET 2014 - Test-and-set based spin locks guarantee mutual exclusion and are deadlock-free, but they do not guarantee bounded waiting, so a process can starve.
Asked inGATE 2009 - Bounded waiting means there exists a finite bound on the number of times other processes may enter the critical section after a process has made its request and before that request is granted.
Asked inGATE 2009UGC NET 2014 - Starvation (indefinite blocking) is distinct from deadlock: in starvation processes keep making progress overall while one may wait forever; deadlock means no process can proceed.
Asked inGATE 2009