CPE 302 Operating System - Deadlock Lecture Notes PDF

Document Details

ThriftyGray511

Uploaded by ThriftyGray511

Bulacan State University

Wendy E. Ollero

Tags

operating systems deadlock resource allocation graph computer science

Summary

These are lecture notes on operating system deadlock, covering concepts like Resource Allocation Graph (RAG), and deadlock avoidance. Examples of safe and unsafe states are also included. This material is presented in a slide format.

Full Transcript

CPE 302 OPERATING SYSTEM DEADLOCK ENGR. WENDY E. OLLERO DEADLOCK Deadlock is a situation where each of the computer process waits for a resource which is being assigned to some another process. In this situation, none of the process gets executed since the resource it needs, is held by some other...

CPE 302 OPERATING SYSTEM DEADLOCK ENGR. WENDY E. OLLERO DEADLOCK Deadlock is a situation where each of the computer process waits for a resource which is being assigned to some another process. In this situation, none of the process gets executed since the resource it needs, is held by some other process which is also waiting for some other resource to be released. RESOURCE ALLOCATION GRAPH (RAG) The resource allocation graph is the pictorial representation of the state of a system. It is the complete information about all the processes which are holding some resources or waiting for some resources. It also contains the information about all the instances of all the resources whether they are available or being used by the processes. RESOURCE ALLOCATION GRAPH (RAG) where: P – process R – resources - denotes resources - denotes process - denotes number of instances P R – waiting / request edge R P – holding / assignment edge HOW TO CREATE RAG? 1. RAG SITUATION 3. PROCESS STATES Sets P, R and E (edge/ directed arrow) Process P1 is holding an instance of R1 P – { P1, P2, P3 } Process P2 is holding an instance of R2 and R – { R1, R2 } waiting for an instance of R1 E– Process P3 is waiting for an instance of R1 and R2 2. RESOURCE INSTANCES One instance of resource type R1 One instance of resource type R2 EXAMPLE 1 1. RAG SITUATION 2. RESOURCE INSTANCES P – { P1, P2, P3 } One instance of resource type R1 Two instance of resource type R2 R – { R1, R2, R3, R4 } One instance of resource type R3 E– Three instance of resource type R4 3. PROCESS STATES Process P1 is holding an instance of R2 and waiting for an instance of R1 Process P2 is holding an instance of R2 and R1 and waiting for an instance of R3 Process P3 is holding an instance of R3 EXAMPLE 1 - RAG EXAMPLE 2 1. RAG SITUATION 2. RESOURCE INSTANCES P – { P1, P2, P3 } One instance of resource type R1 Two instance of resource type R2 R – { R1, R2, R3, R4 } One instance of resource type R3 E– Three instance of resource type R4 3. PROCESS STATES Process P1 is holding an instance of R2 and waiting for an instance of R1 Process P2 is holding an instance of R2 and R1 and waiting for an instance of R3 Process P3 is holding an instance of R3 and waiting for an instance of R2 EXAMPLE 2 - RAG EXAMPLE 3 1. RAG SITUATION 2. RESOURCE INSTANCES P – { P1, P2, P3, P4 } Two instance of resource type R1 Two instance of resource type R2 R – { R1, R2} E– 3. PROCESS STATES Process P1 is holding an instance of R2 and waiting for an instance of R1 Process P2 is holding an instance of R1 Process P3 is holding an instance of R1 and waiting for an instance of R2 Process P4 is holding an instance of R2 EXAMPLE 3 - RAG DEADLOCK AVOIDANCE Example 1 – Safe State or Unsafe State Is the system safe? If safe, what is the safe sequence? Example 1 – Solution Example 2 – Safe State or Unsafe State 3 6 Is the system safe? If safe, what is the safe sequence? Example 2 – Solution 3 6 Example 3 – Safe State or Unsafe State Is the system safe? If safe, what is the safe sequence? Example 3 – Solution THANKS! ANY QUESTIONS? [email protected]

Use Quizgecko on...
Browser
Browser