-Ensure that at least one of the necessary conditions cannot hold
-Prevent deadlocks by constraining how requests for resources can be made
•Mutual Exclusion – not required for sharable resources; must hold for non-sharable resources
•Hold and Wait – must guarantee that whenever a process requests a resource, it does not hold any other resources.
–Method 1: require each process to request and be allocated all its resources before it begins execution
–Example: copy data from tape drive to disk file, sort disk file, print
•No Preemption – if process A holding resources requests another resource that cannot be immediately allocated to it
–Method 1: All resources currently being held by A are preempted
•Preempted resources are added to A’s waiting resource list
A will be restarted only when it can regain its old resources, as well as the new ones that it is requesting.
–Method 2: Check the requested resources for following conditions
•If it is allocated to a process waiting for additional resources, preempt it from the waiting process and allocate it to A
•If it is held by a process not waiting, A must wait
–A’s resources may be preempted, but only if another process requests them
•Circular Wait – impose a total ordering of all resource types
–Example: F(tape drive) = 1, F(disk drive) = 5, F(Printer) = 12
•F is defined according to the normal order of resource usage
–Method 1: require that each process requests resources in an increasing order of enumeration
•OK if tape drive è disk drive è Printer
•Not OK if disk drive è tape drive è Printer
–Method 2: Whenever a process requests an instance of Rj, it has released any resources Ri such that F(Ri) > F(Rj)
0 comments:
Post a Comment