week4_wed - CSCC 69H3 Operating Systems Winter 2010...

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

View Full Document Right Arrow Icon
CSCC 69H3 Operating Systems Winter 2010 Professor Bianca Schroeder U of T
Background image of page 1

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

View Full DocumentRight Arrow Icon
Short announcement We will grant you an extension for A1. New deadline is Monday Feb 1. Who is still looking for a partner? Please contact me.
Background image of page 2
Deadlock What is deadlock?
Background image of page 3

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

View Full DocumentRight Arrow Icon
Deadlock Defined The permanent blocking of a set of processes that either: Compete for system resources, or Communicate with each other Each process in the set is blocked, waiting for an event which can only be caused by another process in the set Resources are finite Processes wait if a resource they need is unavailable Resources may be held by other waiting processes
Background image of page 4
Example of Deadlock Suppose processes P and Q need (reusable) resources A and B : Process Q ... Process P ... A B Get A ... Get B Get B ... Get A ... Release A ... Release B ... Release B ... Release A
Background image of page 5

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

View Full DocumentRight Arrow Icon
Example: dining philosophers: A philosopher needs two forks to eat. Idea for protocol: When philosopher gets hungry grab right fork, then grab left fork. Is this a good solution?
Background image of page 6
Deadlock continued … What conditions must hold for a deadlock to occur? Necessary conditions Sufficient conditions
Background image of page 7

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

View Full DocumentRight Arrow Icon
Conditions for Deadlock 1. Mutual Exclusion Only one process may use a resource at a time 2. Hold and wait A process may hold allocated resources while awaiting assignment of others 3. No preemption No resource can be forcibly removed from a process holding it These are necessary conditions
Background image of page 8
One more condition… 4. Circular wait A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain Together, these four conditions are necessary and sufficient for deadlock Circular wait implies hold and wait, but the first results from a sequence of events, while the second is a policy decision
Background image of page 9

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

View Full DocumentRight Arrow Icon
Deadlock Prevention Ensure one of the four conditions doesn’t occur Break mutual exclusion - not much help here, as it is often required for correctness
Background image of page 10
Preventing Hold-and-Wait Break “hold and wait” - processes must request all
Background image of page 11

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

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

This note was uploaded on 05/22/2010 for the course CS CSCC69 taught by Professor Bianca during the Spring '10 term at University of Toronto- Toronto.

Page1 / 27

week4_wed - CSCC 69H3 Operating Systems Winter 2010...

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

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