[go: up one dir, main page]

0% found this document useful (0 votes)
9 views2 pages

Chapter 6 Deadlocks Study Guide

Chapter 6 discusses deadlocks, which occur when processes are blocked due to holding and waiting for resources. It outlines conditions for deadlocks, detection methods, and strategies for avoidance and prevention, such as the Banker’s Algorithm and the Ostrich Algorithm. The chapter also addresses related issues like communication deadlocks and starvation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Chapter 6 Deadlocks Study Guide

Chapter 6 discusses deadlocks, which occur when processes are blocked due to holding and waiting for resources. It outlines conditions for deadlocks, detection methods, and strategies for avoidance and prevention, such as the Banker’s Algorithm and the Ostrich Algorithm. The chapter also addresses related issues like communication deadlocks and starvation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter 6: Deadlocks - Study Guide

1. Introduction to Deadlocks

- A deadlock is a state where a group of processes are blocked because each process is
holding a resource and waiting for another resource held by another process in the group.
- Deadlocks can happen locally or across machines, with hardware or software resources.

2. Resources

- Resources include devices, memory, files, etc. Two types:


* Preemptable: Can be taken without ill effects (e.g., CPU, memory).
* Nonpreemptable: Cannot be taken without risk (e.g., printer, CD-ROM).
- Resource Acquisition sequence: Request → Use → Release.
- Semaphores are often used for protection.

3. Conditions for Deadlocks

Four conditions must all hold simultaneously:


1. Mutual Exclusion: Resources cannot be shared.
2. Hold and Wait: Processes hold resources and request others.
3. No Preemption: Resources can only be released voluntarily.
4. Circular Wait: A circular chain of waiting processes exists.

4. Deadlock Modeling

- Represented using directed graphs:


* Processes = circles, Resources = squares.
* Arcs show holding or requesting a resource.
* Cycle in graph = potential deadlock.
5. The Ostrich Algorithm

- Strategy: Ignore deadlocks unless they become serious.


- Used when the cost of prevention is higher than risk.

6. Deadlock Detection and Recovery

- Detection (Single Resource Type): Look for cycles in resource graphs.


- Detection (Multiple Resource Types): Use resource allocation and request matrices.
- Recovery:
* Preemption: Take resources from a process.
* Rollback: Return process to an earlier checkpoint.
* Killing Processes: Terminate one or more to resolve the cycle.

7. Deadlock Avoidance

- System only grants requests if they leave it in a safe state.


- Safe State: All processes can eventually finish.
- Banker’s Algorithm: Determines if request is safe (single/multiple resources).

8. Deadlock Prevention

Avoid one or more of the four conditions:


- Mutual Exclusion: Use spooling where possible.
- Hold and Wait: Require all resources be requested at once.
- No Preemption: Preempt resources if request cannot be met.
- Circular Wait: Impose ordering on resource requests.

9. Other Issues

- Two-Phase Locking: Lock all required records before doing work.


- Communication Deadlocks: Use timeout to avoid blocking forever.
- Live Lock: Process runs but makes no progress.
- Starvation: Fair scheduling (e.g., FCFS) helps prevent it.

You might also like