B L O G G E R

--> This is JAN AUSTIN EVANGELISTA hir signing..

Deadlock Prevention


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
– Method 2: allow a process to request resources only when the process has none
– Example: copy data from tape drive to disk file, sort disk file, print
Disadvantage
• Low resource utilization
• Starvation possible
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

Often applied to resources whose state can be easily saved and restored later, such as CPU registers and memory space

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

Welcome

=] an eXciting WORLD awaits you [=

"dount count your
friends
on a
SUNNY DAY
when the sky is blue
and
laughter is
abundant.
Instead,
wait for the
STORM
when the clouds are dark
and
smiles are
scarce.
When someone
stands
besides
you
and
lift your
SPIRITs high,
then you'll
know who deserves
to be
called
FRIENDS..
"

Followers

Labels