---
title: "Parallelism, IPC deadlock and OS role"
subject: "Microprocessor"
chapter: 6
key: "semester_4/microprocessor:parallelism-deadlock-os-role"
source: https://www.bctengineer.com/q/semester_4/microprocessor/parallelism-deadlock-os-role
site: BCT Engineering
---

# Parallelism, IPC deadlock and OS role

Microprocessor · Chapter 6: Advanced Topics

- Asked in: 2069 Bhadra, 2+3+3 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/microprocessor/parallelism-deadlock-os-role
- Whole chapter: https://www.bctengineer.com/md/semester_4/microprocessor/chapter-6

## Question

What do you mean by parallelism? Explain the case of deadlock that may arise during inter process communication. What role does the operating system play in handling such deadlocks?

## Short answer

Parallelism means executing multiple tasks simultaneously for speedup. Deadlock in IPC arises when two processes each hold a resource and wait for the other's resource. The OS prevents it via ordered resource requests, avoids it with Banker's algorithm, detects cycles in wait-for graphs, and recovers by killing processes or preempting resources.

## Answer

#### Parallelism

Parallelism means doing more than one task or operation at the same time to increase throughput and speed. It can be at instruction level (pipelining, superscalar), thread level, or process level (multiprocessors, multicomputers).

#### Deadlock during inter-process communication

Processes that communicate or share resources (through semaphores, messages or shared memory) may wait for each other.

- Example 1: P1 has locked resource R1 and requests R2; P2 has locked R2 and requests R1. Neither can continue.
- Example 2: P1 does `receive(P2)` and P2 does `receive(P1)`, each waiting for a message the other never sends.

All four conditions hold: mutual exclusion, hold and wait, no preemption and circular wait.

#### Role of the operating system

The OS handles deadlock with these methods.

1. **Prevention:** it makes sure one condition cannot hold (e.g. ordered resource requests, or requesting all resources at once).
2. **Avoidance:** it examines each request using Banker's algorithm and grants it only if the system remains in a safe state.
3. **Detection:** it periodically builds a resource-allocation (wait-for) graph and looks for cycles.
4. **Recovery:** it ends one or more deadlocked processes, or preempts resources from some and rolls them back.
5. It also provides synchronisation tools (semaphores, monitors, time-outs) so programmers can avoid deadlock.

## Check yourself

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

1. What is parallelism?
   A. Doing more than one task or operation at the same time to raise throughput
   B. Doing one task very fast
   C. Running tasks only one after another
   D. Sharing a printer
   Answer: A. It can be at instruction, thread or process level. (Key point: Parallelism)

2. Which is an IPC deadlock example?
   A. P1 sends and P2 receives successfully
   B. P1 does receive(P2) and P2 does receive(P1)
   C. P1 receives from itself
   D. P2 terminates normally
   Answer: B. Each waits for a message the other never sends. (Key point: Example)

3. How does the OS avoid deadlock?
   A. It checks each request with Banker's algorithm and grants it only if the state stays safe
   B. It never allocates resources
   C. It waits for deadlock then reboots
   D. It disables multitasking
   Answer: A. Safe-state checks prevent entering deadlock. (Key point: Avoidance by OS)

4. How does the OS recover after detecting deadlock?
   A. By ending one or more processes or preempting resources and rolling back
   B. By adding more RAM
   C. By raising process priority
   D. By ignoring it
   Answer: A. Recovery breaks the cycle. (Key point: Recovery)

## Related in Microprocessor

- [Parallelism and features of an OS](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aparallelism-and-os-features) — Microprocessor, chapter 6
- [Instruction, thread, process level parallelism](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Ainstruction-thread-process-parallelism) — Microprocessor, chapter 6
- [Interprocess communication and deadlock](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aipc-deadlock-solution) — Microprocessor, chapter 6
- [Features of a typical operating system](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Afeatures-of-operating-system) — Microprocessor, chapter 6, asked 3×
- [Real and pseudo-parallelism](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Areal-pseudo-parallelism) — Microprocessor, chapter 6

## Related in other subjects

- [Case study: critical factors in process control](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Acs-critical-factors) — Instrumentation II, chapter 10, asked 2×
- [OS abstraction, extended machine, system call](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Aos-abstraction-system-call) — Operating System, chapter 1
- [Case study: new system vs existing (cost, manpower)](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Acs-cost-manpower-automation) — Instrumentation II, chapter 10, asked 4×
- [Case study: existing vs proposed system](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Acs-2074asoj) — Instrumentation II, chapter 10
