Showing posts with label Os 8. Show all posts
Showing posts with label Os 8. Show all posts

Thursday, August 27, 2009

3.Deadlock Prevention
>Mutual Exclusion- Not required for sharable resources;
must hold for nonshareable resources.
>Hold and Wait- must guarantee that whenever a process request a resource, it does not hold any other resources.
-require process to request and be allocated all its resource before it begins execution, or allow process to request a resource only when the process has none.
- low resource utilization: starvation possible.

>No Preemption
if a process that is holding some resoureces requests
another resource that cannot be immediately allocated to it,
then all resources currently being held are released
- preemted resources are added to the list of resources for which the process is waiting.
process will be restarted only when it can regain its old resources, as well as the new
ones that it is requesting
>Circular wait- impose a total ordering of all resource types, and require that each process requests resources in an incresing order of enumeration..,


Thursday, August 20, 2009

Deadlock


5.Deadlock Recovery



•Deadlock must be untangled once detected, so the system returns to normal quickly
•All recovery methods have at least one victim
•Recovery Methods:
–Terminate every job that’s active in the system and restart them from the beginning
–Terminate only the jobs involved in the deadlock and ask their users to resubmit them
–Identify jobs involved in deadlock and terminate them one at a time



–Jobs that keep a record (snapshot) of their progress can be interrupted
–Select a nondeadlocked job, preempt its resources, allocate them to a deadlocked process
–Stop new jobs from entering system, which allows nondeadlocked jobs to run to completion so they’ll release their resources (no victim)




•Select the victim that will have the least-negative effect on the system
•Factors to be considered to select a victim:
–Priority of job under consideration: high-priority jobs are usually untouched
–CPU time used by job: jobs close to completion are usually left alone
–Number of other jobs that would be affected if this job were selected as the victim
–Jobs that are modifying data shouldn’t be selected for termination



-By flushing one or more process that involved in deadlock until there is no deadlock