{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

COMP 314 - U2C7

Operating System Concepts, Seventh Edition

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 314 – Unit 2 Chapter 7 (Deadlocks) Most current OS do not provide deadlock-prevention facilities. (245) System Model A system consists of a finite number of resources to be distributed among a number of competing processes. The resources are partitioned into seeral types, each consisting of some number of identical instances (e.g. Two CPUs). If a process requests a resource of that type, than any resource of that type should satisfy that request. If not, then the resources are not identical, and they should be separated into separate classes of resources. A process must request a resource prior to using it, and release it after using it. (246) A set of processes is in deadlock state when every process in teh set is waiting for an event that can be caused only by another process in the set. Deadlock Characterization (247) Necessary Conditions A deadlock situation arises if the following four conditions hold simultaneously in a system: Mutual Exclusion Hold and Wait – A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes. No Preemption – Resources cannot be preempted. Circular Wait – A set of waiting process must exit such that P0 is waiting for a resource held by P1, P1 is waiting for a resource held by P2, . .., Pn-1 is waiting for a resource held by Pn, and Pn is waiting for P0. Resource-Allocation Graphs (249) Deadlocks can be described in terms of directed graph called a system resource-allocation graph. This graph consists of a set of vertices and a set of edges. If a resource-allocation graph does not have any cycles, then it does not contain any deadlocks. Methods for Handling Deadlocks We can deal with a deadlock problem in one of three ways: (252) We can use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a deadlock state. We can allow the system to enter a deadlock state, detect it, and recover. We can ignore the problem altogether and pretend that deadlocks never occur in the system. The third solution is the one used by most OS's. Deadlock prevention provides a set of methods for ensuring that at least one of the necessary conditions cannot hold. Deadlock avoidance requires that the OS be given in advance additional information concerning which resource a process will request and use during its lifetime. If a system does not employ either a deadlock prevention or avoidance algorithm, then a deadlock may occur. Deadlock Prevention (253) Mutual Exclusion This condition must hold for non-shareable resources. For shareable resources, in contrast, do not require mutually exclusive access and thus cannot be involved in a deadlock.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

COMP 314 - U2C7 - COMP 314 Unit 2 Chapter 7(Deadlocks Most...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online