Deadlock in operating systems, undefined for Operating System. Hemwati Nandan Bahuguna Garhwal University

Operating System

Description: Deadlock in operating syatem
Showing pages  1  -  2  of  7
Computer Science 322
Operating Systems
Mount Holyoke College
Spring 2008
Topic Notes: Deadlock
The idea of deadlock has come up a few times so far:
A group of processes is deadlocked if each process is waiting for an event that can be caused only
by one of the other waiting processes.
Consider a one-lane tunnel (see
disk09/mvc-018f.jpg) or underpass:
One-lane traffic inside the tunnel
The lane in the tunnel is a shared resource
If a deadlock like this one occurs, we must tell one of the cars it has to give up its right to
the resource and rollback
This may mean more than one car has to back up
Starvation is possible if we keep allowing cars from one direction to enter
The traffic analogy can become more complex with two-way intersections – gridlock!
We have seen the potential for deadlock when using semaphores:
wait(Q); wait(R);
wait(R); wait(Q);
... ...
signal(R); signal(Q);
signal(Q); signal(R);
... ...
CS 322 Operating Systems Spring 2008
This is a situation that came up with the original “solution” to the dining philosophers.
We will consider processes that need access to more general resources. These could be any non-
preemptable resources, such as tape drives or CD burners, in addition to things like the semaphores.
Requirements for Deadlock
Four conditions must hold simultaneously for deadlock to arise:
1. Mutual exclusion: only one process at a time can use a resource
2. Hold and wait: a process is holding, but not necessarily using, at least one resource and is
waiting to acquire additional resources held by other processes
3. No preemption: a resource can be released only voluntarily by the process holding it, after
that process has completed its task
4. Circular wait: there exists a circular chain of waiting processes, each of which it waiting for
a resource held by the next process in the chain
If any one of these conditions does not hold, deadlock cannot occur.
Resource Allocation Graphs
We model systems for our study of deadlock using directed graphs.
The vertices of our graph are processes, represented by circles,
and resources, represented by squares, which may have a number of “dots” inside to indicate
multiple equivalent instances of a resource.
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Uploaded by: mohitsaini111
Views: 2401
Downloads : 6
Address: Engineering
University: Hemwati Nandan Bahuguna Garhwal University
Upload date: 17/03/2012
Embed this document:
Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome