Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Deadlocks: Understanding and Prevention, Assignments of Operating Systems

An overview of deadlocks in computer systems, including why they occur, dealing with them, and preventing deadlocks. It includes explanations of resources, their types, and the sequence of events required to use them. The document also covers the formal definition of deadlock and the four conditions that lead to deadlock. A resource allocation graph is used to model resource allocation and identify deadlocks.

What you will learn

  • Why do deadlocks occur in computer systems?
  • What is a resource allocation graph and how is it used to identify deadlocks?
  • What are the two types of resources in computer systems?
  • How can deadlocks be prevented?
  • What are the four conditions for deadlock?

Typology: Assignments

2019/2020

Uploaded on 12/19/2020

anoop-rana-1
anoop-rana-1 🇮🇳

4.5

(2)

6 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 3
Submitted by :-ANOOP RANA
BCA 3rd Yr
Deadlocks
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Deadlocks: Understanding and Prevention and more Assignments Operating Systems in PDF only on Docsity!

Chapter 3

Submitted by :-ANOOP RANA

BCA 3rd^ Yr

Deadlocks

Chapter 3 2 Overview  Resources  Why do deadlocks occur?  Dealing with deadlocks  Ignoring them: ostrich algorithm  Detecting & recovering from deadlock  Avoiding deadlock  Preventing deadlock

Chapter 3 4 When do deadlocks happen?  (^) Suppose  (^) Process 1 holds resource A and requests resource B  (^) Process 2 holds B and requests A  (^) Both can be blocked, with neither able to proceed  (^) Deadlocks occur when …  (^) Processes are granted exclusive access to devices or software constructs (resources)  (^) Each deadlocked process needs a resource held by

A

B

B

A

Process 1 (^) Process 2 DEADLOCK!

CS 1550, cs.pitt.edu Chapter 3 5 (originaly modified by Ethan Using resources  Sequence of events required to use a resource 

Request the resource

Use the resource

Release the resource

 Can’t use the resource if request is denied 

Requesting process has options

 (^) Block and wait for resource  (^) Continue (if possible) without it: may be able to use an alternate resource  (^) Process fails with error code 

Some of these may be able to prevent deadlock…

CS 1550, cs.pitt.edu Chapter 3 7 (originaly modified by Ethan Four conditions for deadlock 

Mutual exclusion

 (^) Each resource is assigned to at most one process 

Hold and wait

 (^) A process holding resources can request more resources 

No preemption

 (^) Previously granted resources cannot be forcibly taken away 

Circular wait

 (^) There must be a circular chain of 2 or more processes where each is waiting for a resource held by the next member of the chain

CS 1550, cs.pitt.edu Chapter 3 8 (originaly modified by Ethan Resource allocation graphs R  (^) Resource allocation modeled by directed graphs  (^) Example 1:  (^) Resource R assigned to process A  (^) Example 2:  (^) Process B is requesting / waiting for resource S  (^) Example 3:  (^) Process C holds T, waiting for U  (^) Process D holds U, waiting for T  (^) C and D are in deadlock! A S B U T C D

Graph With A Cycle But No Deadlock

Basic Facts  If graph contains no cycles  no deadlock  If graph contains a cycle   if only one instance per resource type, then deadlock  (^) necessary and sufficient condition  if several instances per resource type, possibility of deadlock  (^) necessary condition