L6-Deadlock - Deadlock CSIS0230A Lecture Six Define...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Deadlock CSIS0230A Lecture Six Define Deadlock Problem Define the conditions of Deadlock Solutions Deadlock prevention Deadlock avoidance Deadlock detection and recovery
Image of page 1

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

View Full Document Right Arrow Icon
Recommended Reading Chapter 7 of Operating Systems, 3rd edition by Deitel et. al 2 CSIS0230A Principles of Operating Systems
Image of page 2
References Chapter 7 of Operating Systems, 3rd edition by Deitel et. al Chapter 7 of Operating System Principles, 7th edition by Silberschatz et. al Chapter 11 of Operating Systems - A Concept-Based Approach, 2nd edition by D.M. Dhamdhere Chapter 6 of Operating Systems - Internals and Design Principles, 6th edition by William Stallings 3 CSIS0230A Principles of Operating Systems
Image of page 3

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

View Full Document Right Arrow Icon
The Deadlock Problem 4 CSIS0230A Principles of Operating Systems
Image of page 4
The Deadlock Problem A set of threads each holding some resources and block waiting to acquire a resource held by another thread in the set. Example System has 2 disk drives. T1 and T2 each holds one disk drive and each needs another one. Example Two binary semaphores A and B 5 T0 T1 wait (A); wait(B) wait (B); wait(A) CSIS0230A Principles of Operating Systems
Image of page 5

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

View Full Document Right Arrow Icon
Classical Synchronization Problem Dining Philosophers Five philosophers sit around a circular table. Each leads a simple life alternating between thinking and eating spaghetti. In front of each philosopher is a dish of spaghetti that is constantly replenished by a dedicated wait staff. There are exactly five forks on the table, one between each adjacent pair of philosophers. Eating spaghetti (in the most proper manner) requires that a philosopher use both adjacent forks (simultaneously). Develop a concurrent program free of deadlock and indefinite postponement that models the activities of the philosophers. 6 CSIS0230A Principles of Operating Systems
Image of page 6
Dining Philosophers 7 philosopher while (true) { think(); eat(); } eat() { pickup Left Fork(); pickup Right Fork(); eatingSpaghetti(); putdown Right Fork(); putdown Left Fork(); } CSIS0230A Principles of Operating Systems
Image of page 7

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

View Full Document Right Arrow Icon
Deadlock vs. Indefinite Postponement Indefinite postponement Also called indefinite blocking or starvation A process may be delayed indefinitely while other processes could proceed Occurs due to biases in a system’s resource scheduling policies Aging Technique that prevents indefinite postponement by increasing process’s priority as it waits for resource 8 CSIS0230A Principles of Operating Systems
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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