SlideShare a Scribd company logo
6
Most read
7
Most read
8
Most read
Operating System
SUBMITTED BY
SHASHANK YENURKAR Deadlock
What is a DEADLOCK?
 A deadlock is a situation in which two computer programs sharing the same resource are
effectively preventing each other from accessing the resource, resulting in both programs
ceasing to function.
 Deadlock is a situation where a set of processes are blocked because each process is
holding a resource and waiting for another resource acquired by some other process.
 Learning to deal with deadlocks had a major impact on the development of operating
systems and the structure of databases. Data was structured and the order of requests was
constrained in order to avoid creating deadlocks.
Deadlock Condition in Real Life
Deadlock Condition in COMPUTER
Why DEADLOCK Occurs?
 The earliest computer operating systems ran only one program at a time. All of the resources of the
system were available to this one program. Later, operating systems ran multiple programs at once,
interleaving them. Programs were required to specify in advance what resources they needed so that
they could avoid conflicts with other programs running at the same time.
 Eventually some operating systems offered dynamic allocation of resources. Programs could request
further allocations of resources after they had begun running. This led to the problem of the deadlock.
Due to Multiprogramming
Why DEADLOCK Occurs?
 Deadlock can arise if following four conditions hold simultaneously (Necessary Conditions)
1) Mutual Exclusion: One or more than one resource are non-sharable (Only one process
can use at a time).
2) Hold and Wait: A process is holding at least one resource and waiting for resources.
3) No Preemption: A resource cannot be taken from a process unless the process releases
the resource.
4) Circular Wait: A set of processes are waiting for each other in circular form.
Methods for handling DEADLOCKS
There are three ways to handle deadlock :-
1) Deadlock prevention or avoidance: The idea is to not let the system into deadlock
state.
2) Deadlock detection and recovery: Let deadlock occur, then do preemption to handle it
once occurred.
3) Ignore the problem all together: If deadlock is very rare, then let it happen and reboot
the system. This is the approach that both Windows and UNIX take.
Banker’s Algorithm
The banker’s algorithm is a
resource allocation and deadlock
avoidance algorithm that tests for
safety by simulating the
allocation for predetermined
maximum possible amounts of all
resources, then makes an “s-
state” check to test for possible
activities, before deciding
whether allocation should be
allowed to continue.
Safe sequence is the sequence in which the processes can be safely executed.
Example of Banker’s Algorithm
Considering a system with five processes P0 through P4 and three resources types A, B, C.
Resource type A has 10 instances, B has 5 instances and type C has 7 instances. Suppose at time
t0 following snapshot of the system has been taken:
Need [i , j] = Max [i , j] – Allocation [i , j] Need Matrix
Applying the Safety algorithm on the given system
The Safe Sequence is
P1, P3, P4, P0, P2 .

More Related Content

PPTX
Deadlock Presentation
PPTX
Dead Lock in operating system
PPS
Deadlock
PPTX
Deadlocks in operating system
PPT
Classical problem of synchronization
PPTX
Deadlock- Operating System
PDF
Deadlock
Deadlock Presentation
Dead Lock in operating system
Deadlock
Deadlocks in operating system
Classical problem of synchronization
Deadlock- Operating System
Deadlock

What's hot (20)

PPT
Os Threads
PPT
File access methods.54
PPTX
Deadlock ppt
PPTX
System calls
PDF
OS - Deadlock
PPTX
Operating system 23 process synchronization
PPTX
Memory Management
PPT
File Management in Operating Systems
PDF
OS - Process Concepts
PPTX
Deadlock Avoidance in Operating System
PPT
Deadlock
PDF
Operating systems system structures
PPTX
Os unit 3 , process management
PPTX
DeadLock in Operating-Systems
PDF
Deadlock Avoidance - OS
PPTX
Memory Management in OS
PPTX
INTER PROCESS COMMUNICATION (IPC).pptx
PPT
Chapter 7 - Deadlocks
PDF
Memory management
PPTX
Process synchronization
Os Threads
File access methods.54
Deadlock ppt
System calls
OS - Deadlock
Operating system 23 process synchronization
Memory Management
File Management in Operating Systems
OS - Process Concepts
Deadlock Avoidance in Operating System
Deadlock
Operating systems system structures
Os unit 3 , process management
DeadLock in Operating-Systems
Deadlock Avoidance - OS
Memory Management in OS
INTER PROCESS COMMUNICATION (IPC).pptx
Chapter 7 - Deadlocks
Memory management
Process synchronization
Ad

Similar to Operating system - Deadlock (20)

PPTX
Deadlock and memory management -- Operating System
PDF
“Understanding Distributed Deadlocks: Causes, Detection
PDF
Deadlock in distribute system by saeed siddik
PPTX
Deadlocks and Deadlock Detection Other Issues
DOCX
Deadlocks with example in Operating System.docx
PDF
ikh311-05
PPT
Process Synchronization And Deadlocks
PDF
Unit 3 part 2(DEADLOCK)
PPT
Os module 2 d
PPTX
Os presentation final.pptxjjjjjdakajwsjjdhdfjff
PPTX
operating system
PPTX
operating system
PPTX
OS 7.pptx
PPTX
Deadlocks
PPT
Deadlock in operating systems
PPTX
Deadlocks in operating system
PPTX
DEADLOCK PREVENTION AND AVOIDANCE.pptx
PDF
Distributed deadlock
PPTX
Bankers algorithm pbl project based ppt.
PDF
Deadlock in operating system powerpoint presentation
Deadlock and memory management -- Operating System
“Understanding Distributed Deadlocks: Causes, Detection
Deadlock in distribute system by saeed siddik
Deadlocks and Deadlock Detection Other Issues
Deadlocks with example in Operating System.docx
ikh311-05
Process Synchronization And Deadlocks
Unit 3 part 2(DEADLOCK)
Os module 2 d
Os presentation final.pptxjjjjjdakajwsjjdhdfjff
operating system
operating system
OS 7.pptx
Deadlocks
Deadlock in operating systems
Deadlocks in operating system
DEADLOCK PREVENTION AND AVOIDANCE.pptx
Distributed deadlock
Bankers algorithm pbl project based ppt.
Deadlock in operating system powerpoint presentation
Ad

Recently uploaded (20)

PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Pre independence Education in Inndia.pdf
PDF
Insiders guide to clinical Medicine.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
master seminar digital applications in india
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Sports Quiz easy sports quiz sports quiz
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
102 student loan defaulters named and shamed – Is someone you know on the list?
Pre independence Education in Inndia.pdf
Insiders guide to clinical Medicine.pdf
GDM (1) (1).pptx small presentation for students
2.FourierTransform-ShortQuestionswithAnswers.pdf
01-Introduction-to-Information-Management.pdf
Complications of Minimal Access Surgery at WLH
Anesthesia in Laparoscopic Surgery in India
master seminar digital applications in india
STATICS OF THE RIGID BODIES Hibbelers.pdf
Pharma ospi slides which help in ospi learning
Renaissance Architecture: A Journey from Faith to Humanism
O7-L3 Supply Chain Operations - ICLT Program
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
VCE English Exam - Section C Student Revision Booklet
human mycosis Human fungal infections are called human mycosis..pptx
Sports Quiz easy sports quiz sports quiz
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O5-L3 Freight Transport Ops (International) V1.pdf

Operating system - Deadlock

  • 2. What is a DEADLOCK?  A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.  Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process.  Learning to deal with deadlocks had a major impact on the development of operating systems and the structure of databases. Data was structured and the order of requests was constrained in order to avoid creating deadlocks.
  • 5. Why DEADLOCK Occurs?  The earliest computer operating systems ran only one program at a time. All of the resources of the system were available to this one program. Later, operating systems ran multiple programs at once, interleaving them. Programs were required to specify in advance what resources they needed so that they could avoid conflicts with other programs running at the same time.  Eventually some operating systems offered dynamic allocation of resources. Programs could request further allocations of resources after they had begun running. This led to the problem of the deadlock. Due to Multiprogramming
  • 6. Why DEADLOCK Occurs?  Deadlock can arise if following four conditions hold simultaneously (Necessary Conditions) 1) Mutual Exclusion: One or more than one resource are non-sharable (Only one process can use at a time). 2) Hold and Wait: A process is holding at least one resource and waiting for resources. 3) No Preemption: A resource cannot be taken from a process unless the process releases the resource. 4) Circular Wait: A set of processes are waiting for each other in circular form.
  • 7. Methods for handling DEADLOCKS There are three ways to handle deadlock :- 1) Deadlock prevention or avoidance: The idea is to not let the system into deadlock state. 2) Deadlock detection and recovery: Let deadlock occur, then do preemption to handle it once occurred. 3) Ignore the problem all together: If deadlock is very rare, then let it happen and reboot the system. This is the approach that both Windows and UNIX take.
  • 8. Banker’s Algorithm The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources, then makes an “s- state” check to test for possible activities, before deciding whether allocation should be allowed to continue. Safe sequence is the sequence in which the processes can be safely executed.
  • 9. Example of Banker’s Algorithm Considering a system with five processes P0 through P4 and three resources types A, B, C. Resource type A has 10 instances, B has 5 instances and type C has 7 instances. Suppose at time t0 following snapshot of the system has been taken: Need [i , j] = Max [i , j] – Allocation [i , j] Need Matrix
  • 10. Applying the Safety algorithm on the given system The Safe Sequence is P1, P3, P4, P0, P2 .