Академический Документы
Профессиональный Документы
Культура Документы
CPU
Submitted To :- Submitted By
:-
Reg.No. 10808662
MCA-IInd
Because all the processes are waiting, none of them will ever
cause any of the events that could wake up any of the other
members of the set, and all the processes continue to wait
forever. For this model, we assume that processes have only a
single thread and that there are no interrupts possible to wake up
a blocked process. The no-interrupts condition is needed to
prevent an otherwise deadlocked process from being awakened
by, say, an alarm, and then causing events that release other
processes in the set.
In most cases, the event that each process is waiting for is the
release of some resource currently possessed by another member
of the set. In other words, each member of the set of deadlocked
processes is waiting for a resource that is owned by a deadlocked
process. None of the processes can run, none of them can release
any resources, and none of them can be awakened. The number
of processes and the number and kind of resources possessed
and requested are unimportant. This result holds for any kind of
resource, including both hardware and software.
Dining Philosophers:-
The dining philosophers problem is summarized as five
philosophers sitting at a table doing one of two things – eating or
thinking. While eating, they are not thinking, and while thinking,
they are not eating. The five philosophers sit at a circular table
with a large bowl of spaghetti in the center. A fork is placed in
between each philosopher, and as such, each philosopher has one
fork to his or her left and one fork to his or her right. As spaghetti
is difficult to serve and eat with a single fork, it is assumed that a
philosopher must eat with two forks. The philosopher can only use
the fork on his or her immediate left or right.
Deadlock Modeling:-
(c) Deadlock
State Graphs:-
Where a resource allocation graph describes the current state of a
system, a State Graph describes from the point of view of
deadlocks all the states of a system.
Detection techniques:-
Types of deadlocks:-
Distributed deadlock
Livelock
A livelock is similar to a deadlock, except that the states of the
processes involved in the livelock constantly change with
regard to one another, none progressing. Livelock is a special
case of resource starvation; the general definition only states
that a specific process is not progressing.
Deadlocks example:-
Deadlock Avoidance
Algorithm
Resources
Example:-
Assuming that the system distinguishes between four types of
resources, (A, B, C and D), the following is an example of how
those resources could be distributed. Note that this example
shows the system at an instant before a new request for
resources arrives. Also, the types and number of resources are
abstracted. Real systems, for example, would deal with much
larger quantities of each resource.
ABCD
3112
ABCD
P1 1 2 2 1
P2 1 0 3 3
P3 1 1 1 0
ABCD
P1 3 3 2 2
P2 1 2 3 4
P3 1 1 5 0
Safe and Unsafe States
Safe State
e.g.
Total of instances of resource = 12
Deadlock Prevention:-
It is easy to see that with this rule we will not get into
deadlocks. [Proof by contradiction.]
Here is an example of how we apply this rule. We are given a
process that uses resources ordered as A, B, C, D, E in the
following manner:
if any resource R1, ... Rn, does not exist or is not free, then
else
end if
Hierarchical Algorithm
Given a request from process P for resource R, the resource
manager follows these rules:
else
else
end if
end if
Deadlock degrade the performance of
CPU
Deeper Pipelines
o 1984: Many cycles per instruction
o 20 stage pipelines
Performance
o Main issue with lock performance used to be contention
References:-
1. ^ E. W. Dijkstra "EWD108: Een algorithme ter
voorkoming van de dodelijke omarming" (in Dutch; An
algorithm for the prevention of the deadly embrace)
3. ^ Concurrency