Showing Page:
1/2
Write down the Four Conditions of deadlock and prevention Methods for
Each.
Deadlock Conditions:
1. Mutual exclusion
The resources involved must be unshakeable; otherwise, the processes would not be
prevented from using the resource when necessary.
2. Hold and wait or partial allocation
The processes must hold the resources they have already been allocated while waiting for
other (requested) resources. If the process had to release its resources when a new
resource or resources were requested, deadlock could not occur because the process would
not prevent others from using resources that it controlled.
3. No pre-emption
The processes must not have resources taken away while that resource is being used.
Otherwise, deadlock could not occur since the operating system could simply take enough
resources from running processes to enable any process to finish.
4. Resource waiting or circular wait
A circular chain of processes, with each process holding resources which are
Currently being requested by the next process in the chain, cannot exist. If it does, the
cycle theorem (which states that "a cycle in the resource graph is necessary for deadlock
to occur") indicated that deadlock could occur
Showing Page:
2/2
Deadlock Prevention:
We can prevent Deadlock by eliminating any of the above four conditions.
1. Eliminate Mutual Exclusion
It is not possible to dis-satisfy the mutual exclusion because some resources, such as
the tape drive and printer, are inherently non-shareable.
2. Eliminate Hold and wait
Allocate all required resources to the process before the start of its
execution, this way hold and wait condition is eliminated but it will lead
to low device utilization. for example, if a process requires printer at a
later time and we have allocated printer before the start of its execution
printer will remain blocked till it has completed its execution.
The process will make a new request for resources after releasing the
current set of resources. This solution may lead to starvation.
3. Eliminate No Preemption
Preempt resources from the process when resources required by other high
priority processes.
4. Eliminate Circular Wait
Each resource will be assigned with a numerical number. A process can request
the resources increasing/decreasing. Order of numbering.
For Example, if P1 process is allocated R5 resources, now next time if P1 ask for R4,
R3 lesser than R5 such request will not be granted, only request for resources more
than R5 will be granted.

Unformatted Attachment Preview

Write down the Four Conditions of deadlock and prevention Methods for Each. Deadlock Conditions: 1. Mutual exclusion The resources involved must be unshakeable; otherwise, the processes wouldnot be prevented from using the resource when necessary. 2. Hold and wait or partial allocation The processes must hold the resources they have already been allocated while waiting for other (requested) resources. If the process had to release its resources when a new resource or resources were requested, deadlock could notoccur because the process would not prevent others from using resources that itcontrolled. 3. No pre-emption The processes must not have resources taken away while that resource is beingused. Otherwise, deadlock could not occur since the operating system could simply take enough resources from running processes to enable any process tofinish. 4. Resource waiting or circular wait A circular chain of processes, with each process holding resources which are Currently being requested by the next process in the chain, cannot exist. If itdoes, the cycle theorem (which states that "a cycle in the resource graph is necessary for deadlock to occur") indicated that deadlock could occur Deadlock Prevention: We can prevent Deadlock by eliminating any of the above four conditions. 1. Eliminate Mutual Exclusion It is not possible to dis-satisfy the mutual exclusion because some resources, such as thetape drive and printer, are inherently non-shareable. 2. Eliminate Hold and wait • Allocate all required resources to the process before the start of its execution, this way hold and wait condition is eliminated but it will lead tolow device utilization. for example, if a process requires printer at a later time and we have allocated printer before the start of its execution printer will remain blocked till it has completed its execution. • The process will make a new request for resources after releasing the currentset of resources. This solution may lead to starvation. 3. Eliminate No Preemption Preempt resources from the process when resources required by other high priorityprocesses. 4. Eliminate Circular Wait Each resource will be assigned with a numerical number. A process can request theresources increasing/decreasing. Order of numbering. For Example, if P1 process is allocated R5 resources, now next time if P1 ask for R4, R3lesser than R5 such request will not be granted, only request for resources more than R5 will be granted. Name: Description: ...
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4