If graph contains a cycle if only one instance per resource type then deadlock

If graph contains a cycle if only one instance per

This preview shows page 15 - 23 out of 45 pages.

If graph contains a cycle ± if only one instance per resource type, then deadlock ± if several instances per resource type, possibility of deadlock.
Image of page 15
Methods for handling deadlocks ° Ensure that the system will never enter a deadlock state. ° Allow the system to potentially enter a deadlock state, detect it and then recover ° Ignore the problem and pretend that deadlocks never occur in the system; ± Used by many operating systems, e.g. UNIX
Image of page 16
Deadlock Management ± Prevention ± Design the system in such a way that deadlocks can never occur ± Avoidance ± Impose less stringent conditions than for prevention, allowing the possibility of deadlock but sidestepping it as it occurs. ± Detection ± Allow possibility of deadlock, determine if deadlock has occurred and which processes and resources are involved. ± Recovery ± After detection, clear the problem, allow processes to complete and resources to be reused. May involve destroying and restarting processes.
Image of page 17
Deadlock Prevention ± If any one of the conditions for deadlock (with reusable resources) is denied, deadlock is impossible. ± Restrain ways in which requests can be made ° Mutual Exclusion ± non-issue for sharable resources ± cannot deny this for non-sharable resources (important) ° Hold and Wait - guarantee that when a process requests a resource, it does not hold other resources. ± Force each process to acquire all the required resources at once. Process cannot proceed until all resources have been acquired. ± Low resource utilization, starvation possible
Image of page 18
Deadlock Prevention (cont.) ° No Preemption ± If a process that is holding some resources requests another resource that cannot be immediately allocated to it, the process releases the resources currently being held. ± Preempted 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. ± Require that processes request resources in increasing order of enumeration; if a resource of type N is held, process can only request resources of types > N.
Image of page 19
Deadlock Avoidance ° Set of resources, set of customers, banker ° Rules ± Each customer tells banker maximum number of resources it needs. ± Customer borrows resources from banker. ± Customer returns resources to banker. ± Customer eventually pays back loan. ° Banker only lends resources if the system will be in a safe state after the loan.
Image of page 20
Deadlock Avoidance ° Requires that the system has some additional apriori information available. ± Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. ± The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. ± Resource allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes.
Image of page 21
Safe state ° When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state.
Image of page 22
Image of page 23

You've reached the end of your free preview.

Want to read all 45 pages?

  • One '20

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors