Introduction to Deadlocks in processors (operating system) study notes, Lecture notes of Operating Systems

Introduction to Deadlocks in processors (operating system) study notes This Notes cover all the necessary points about topic

Typology: Lecture notes

2021/2022

Uploaded on 06/23/2022

muhammad-aqeel-4
muhammad-aqeel-4 🇵🇰

2 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Deadlock in OS
Introduction to Deadlock:
A 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.
Explanation:
Let us assume that there are three processes P1, P2 and P3.
There are three different resources R1, R2 and R3. R1 is assigned to P1, R2 is
assigned to P2 and R3 is assigned to P3.
After some time, P1 demands for R1 which is being used by P2. P1 halts its
execution since it can't complete without R2. P2 also demands for R3 which
is being used by P3. P2 also stops its execution because it can't continue
without R3. P3 also demands for R1 which is being used by P1 therefore P3
also stops its execution.
pf2

Partial preview of the text

Download Introduction to Deadlocks in processors (operating system) study notes and more Lecture notes Operating Systems in PDF only on Docsity!

Deadlock in OS

Introduction to Deadlock:

A 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.

Explanation:

Let us assume that there are three processes P1, P2 and P3. There are three different resources R1, R2 and R3. R1 is assigned to P1, R2 is assigned to P2 and R3 is assigned to P3. After some time, P1 demands for R1 which is being used by P2. P1 halts its execution since it can't complete without R2. P2 also demands for R3 which is being used by P3. P2 also stops its execution because it can't continue without R3. P3 also demands for R1 which is being used by P1 therefore P also stops its execution.

Deadlock in OS

In this scenario, a cycle is being formed among the three processes. None of the process is progressing and they are all waiting. The computer becomes unresponsive since all the processes got blocked.

Necessary conditions for Deadlocks

  1. Mutual Exclusion A resource can only be shared in mutually exclusive manner. It implies, if two process cannot use the same resource at the same time.
  2. Hold and Wait A process waits for some resources while holding another resource at the same time.
  3. No preemption The process which once scheduled will be executed till the completion. No other process can be scheduled by the scheduler meanwhile.
  4. Circular Wait All the processes must be waiting for the resources in a cyclic manner so that the last process is waiting for the resource which is being held by the first process.