Deadlock summary - Deadlock Operating Systems 2002 William...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Deadlock Operating Systems 2002 William Fornaciari 1 2002 William Fornaciari 2002 William Fornaciari Politecnico di Milano Politecnico di Milano Deadlock Deadlock Lecturer Lecturer : Prof. Cristiana Prof. Cristiana Bolchini Bolchini Politecnico di Milano Politecnico di Milano bolchini@elet bolchini@elet .polimi polimi .it it www. www. elet elet .polimi polimi .it/upload/bolchini it/upload/bolchini Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 2 - Summary Summary What is a resource Conditions for deadlock Directed graph modeling of deadlock Detection, avoidance and prevention Starvation Deadlock in distributed systems Deadlock Operating Systems 2002 William Fornaciari 2 Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 3 - Resources Resources Resources: passive entities needed by processes/threads to do their work CPU time, disk space, memory Two types of resources: Preemptable can be taken away CPU, Embedded security chip Non-preemptable must be left with the thread/process Disk space, plotter, chunk of virtual address space Mutual exclusion the right to enter a critical section Resources may require exclusive access or may be sharable Read-only files are typically sharable Printers are not sharable during time of printing One of the major tasks of an operating system is to manage resources Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 4 - Use cycle of a resource Use cycle of a resource Request Wait Usage Release The process is blocked. More attempts to take the resource are possible. In some O.S. processes are automatically blocked and awakened when the resources become available Deadlock Operating Systems 2002 William Fornaciari 3 Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 5 - Example Example Deadlock not always deterministic Example 2 mutexes Thread A Thread B x.P(); y.P(); y.P(); x.P(); y.V(); x.V(); x.V(); y.V(); Deadlock wont always happen with this code Have to have exactly the right timing (wrong timing?) Deadlocks occur with multiple resources Means you cant decompose the problem Cant solve deadlock for each resource independently Example: System with 2 disk drives and two threads Each thread needs 2 disk drives to function Each thread gets one disk and waits for another one Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 6 - Example of deadlock Example of deadlock Processes P1, P2 need to use in exclusive manner resources R1 (lpr) and R2 (tape) that are not pre- emptable Possible situation P1 request to use R1 is granted P2 request to use R2 is granted P1 req.to use R2: P1 is blocked waiting for R2 P2 req. to use R1: P2 is blocked waiting for R1 P1 and P2 remain blocked forever with no chance to modify the situation Deadlock Operating Systems 2002 William Fornaciari 4 Deadlock Deadlock 2002 William Fornaciari 2002 William Fornaciari- - 7 - Deadlock: definition and conditions...
View Full Document

Page1 / 28

Deadlock summary - Deadlock Operating Systems 2002 William...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online