You are on page 1of 12

RECOVERY FROM DEADLOCKS

Submitted To : Submitted By: BSCS-6A


Dr.Saira Andleeb Gillani -Abeer Asrar (02-134172-017)
-Abdul Hadi (02-134172-053)
-Bilal Dost Malik (02-134172-018)
CONTENT
SERIAL # TOPIC NAME SLIDE NUMBER

01 INTRODUCTION 3-5

02 PROCESS TERMINATION 6-8

03 RESOURCE PREEMPTION 9-11


INTRODUCTION

WHAT IS DEADLOCK?
• Definition
A situation where multiple processes are stopped due to the fact that
one process is waiting for a resource which is being used another
process.
For example in real life if two trains are coming from opposite
direction on the same track when they both face each other they will
stop because there is no way for them to continue on the same path
so that is a real life dead lock.
Explanation of Deadlock in reference of operation system :
-A sudden lock happening due to multiple processes waiting for one
resource to passed down for usage.
-For instance there are three processes using multiple resources but
one resource is common which is being used by process 1 and is taking
a lot of time so a deadlock will most probably occur between these
processes. PROCESS 1
ASSIGNED TO
-Diagram

RESOURCE 1 WAITING FOR PROCESS 1

WAITING FOR PROCESS 1


EXPLANATION
• A detection algorithm is applied through which a deadlock
is detected there are multiple ways to recover the
processes from deadlock. One of the many possibilities is
to inform/tell the operator so the deadlocks gets handle
by itself, or we give time to the system to recover itself.
The two options of breaking a deadlock are as follows:
1. Process Termination.
2. Resource Preemption
Process Termination
Definition : The term process termination means when a
process has been completely stopped and halted so a
problem might get solved or another process can continue.
These terminations are also of two types:
1. Abort one process at a time.
2. Abort all process in single time
The main difference between these two is that one
completely shuts off all processes in the same time and the
other selectively one by one shuts process until the
deadlock is eliminated.
Details
1. 1.Abort one process at a time:
One by one the processes gets shuts so whole procedure
which has been done doesn’t collapse but section by
section it closes until the main point of deadlock is reached
and solved.
This has an upper hand advantage that it doesn’t fully loses
all its systems achievements. On the other hand it acquires
considerable amount of overheards as detection algorithms
are repeatedly being called to check if the deadlock has
been resolved or not.
Details
2. Abort all processes in single time
If a deadlock occurs , from this method we terminate all the
processes taking place at that precise time. This might be
costly.
On the safe side without having overheads, the deadlock
cycle breaks off. But on the other hand the reason if it
being costly is we don’t know how much time and
resources have been consumed during those processes
which are abruptly stopped and aborted.
Resource Preemption
Definition :
The word “Preemption” literal meaning are to break on a
specific task which is being carried out.
This procedure has the duty to take some resources specific
ones from certain processes and give them to other
processes until deadlock cycle discontinues.
If preemption is required to deal with deadlocks, then three
issues need to be addressed:
1.Rollback.
2.Starvation.
3.Selecting a victim.
Details
1.Rollback – We preempt a resource from some processes
as those processes now are missing their part so they are
required to roll back in a safe state. As safe state is not
really defined in an operating so it is intelligent to up to an
halt.

This method has to keep much more information about the


process than any other resource preemption process.
abort those specific processes and restart until the
deadlock cycle has come
Details
2.Starvation – The specific issue is about repeatedly
selecting specific processes as victim and putting into
starvation state so they can’t complete their task which
might result into weakening of the system.
3. Selecting a victim – Deciding which resources to preempt
from which processes involves similar decision as follows:
• The priority of the process
• How much time has it take to be executed till now and
how much further time it will take.
• Number of resources already used or has to be used to
complete the process.
• Resources :
••
https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSyst
ems/7_Deadlocks.html
••
https://codescracker.com/operating-system/deadlock-reco
very.htm
• •Book – Operating System 9th edition by Abraham
Silberschatz, Peter B. Galvin, Greg Gagne

You might also like