---
title: "Critical section; mutual exclusion"
subject: "Operating System"
chapter: 3
key: "semester_6/operating_system:critical-section-mutual-exclusion-pc"
source: https://www.bctengineer.com/q/semester_6/operating_system/critical-section-mutual-exclusion-pc
site: BCT Engineering
---

# Critical section; mutual exclusion

Operating System · Chapter 3: Process Communication and Synchronization

- Asked in: 2070 Magh, 3 marks
- Video: [Critical Section Animation | Solution to Critical section in Operating System explained Easily](https://www.youtube.com/watch?v=6x_XMDCMyAk) — GSSK
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/critical-section-mutual-exclusion-pc
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-3

## Question

Define critical section and mutual exclusion with respect to multiple-process system.

## Short answer

A critical section is the code segment where a process accesses shared variables, files or tables. Mutual exclusion guarantees that only one process at a time executes its critical section for a given resource; others wait. A solution must also ensure progress and bounded waiting.

## Answer

#### Critical section

In a system of multiple cooperating processes, the **critical section (critical region)** is the segment of code in which a process accesses shared resources such as shared variables, files or tables. If two processes execute their critical sections on the same shared data at once, the result can be inconsistent (race condition). The structure of each process is:

```text
do {
    entry section        // request permission
        CRITICAL SECTION // access shared data
    exit section         // release permission
    remainder section
} while (TRUE);
```

#### Mutual exclusion

**Mutual exclusion** is the property that **only one process at a time** may be inside its critical section for a given shared resource; all others who want to enter must wait until it leaves. Hence the shared data are updated consistently and race conditions are avoided.

A correct solution must also satisfy **progress** (a process outside the critical section must not stop others from entering) and **bounded waiting** (no process waits forever), and must not assume anything about relative speeds or the number of CPUs. Mutual exclusion is achieved with locks, Peterson's algorithm, TSL, semaphores and monitors.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What is the correct order of sections in each process?
   A. Critical, entry, exit, remainder
   B. Entry, critical, exit, remainder
   C. Remainder, exit, critical, entry
   D. Entry, exit, critical, remainder
   Answer: B. A process requests permission (entry), accesses shared data (critical), releases (exit), then does other code. (Key point: Critical section structure)

2. What does mutual exclusion guarantee?
   A. Processes run at equal speed
   B. Every process gets the same CPU time
   C. Only one process at a time is inside its critical section for a given resource
   D. Processes never block
   Answer: C. Others wanting to enter must wait until the current process leaves, keeping shared data consistent. (Key point: Mutual exclusion definition)

3. Besides mutual exclusion, which pair must a correct solution satisfy?
   A. Priority and aging
   B. Progress and bounded waiting
   C. Speed and throughput
   D. Paging and swapping
   Answer: B. Progress (outside processes do not block others) and bounded waiting (no starvation) are also required. (Key point: Additional requirements)

## Related in Operating System

- [Race condition; mutual exclusion requirements](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Arace-mutual-exclusion-requirements) — Operating System, chapter 3
- [Semaphore for mutual exclusion](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Asemaphore-enforce-mutual-exclusion) — Operating System, chapter 3
- [Race condition; critical section approaches](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Arace-condition-critical-section-approaches) — Operating System, chapter 3
- [Critical section problem; why execute quickly](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Acritical-section-thread-quick) — Operating System, chapter 3
- [Process synchronization, Peterson, TSL](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Awhy-synchronize-peterson-tsl) — Operating System, chapter 3

## Related in other subjects

- [Token ring mutual exclusion](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Atoken-ring-mutex) — Distributed System, chapter 6, asked 3×
- [Ricart-Agrawala mutual exclusion](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aricart-agrawala) — Distributed System, chapter 6, asked 2×
- [Lamport algorithm for mutual exclusion](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Alamport-mutex) — Distributed System, chapter 6
- [Mutual exclusion via sleep and wake](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Amutual-exclusion-sleep-wake) — Embedded System, chapter 6
