deadlock
play

Deadlock CS 450: Operating Systems Sean Wallace - PowerPoint PPT Presentation

Deadlock CS 450: Operating Systems Sean Wallace <swallac6@iit.edu> Computer Science Science deadlock | ded lk| noun 1 [ in sing. ] a situation, typically one involving opposing parties, in which no progress can be made: an attempt


  1. All problems in NP can be reduced to another problem in the NP-complete class, and all problem in NP-complete can be reduced to each other 79

  2. If you can prove that any NP-complete , then all NP problems are in problem is in P P! (More motivation: you also win $1M) 80

  3. If you can prove that P ≠ NP , we can stop looking for fast solutions to many hard problems (Motivation: you still win $1M) 81

  4. input decision algorithm yes no A decision problem 82

  5. resources available request & allocations, running programs Will the system deadlock? yes no Deadlock prevention 83

  6. description of a program and its inputs Will the system halt (or run forever)? yes no The halting problem 84

  7. E.g., write the function: half(f) → bool - return true if f will halt 
 - return false otherwise 85

  8. def halt(f): # your code here halt(loop_forever) # => False def loop_forever() while True: pass halt(just_return) # => True def just_return(): return True 86

  9. def gotcha(): if halt(gotcha): loop_forever halt(gotcha) else: just_return !@#$%^&*!!!! 87

  10. Yes Does this program halt? No 88

  11. Proof by contradiction: the halting problem is undecidable 89

  12. Generally speaking, deadlock prediction can be reduced to the halting problem 90

  13. I.e., determining if a system is deadlocked is, in general, provably impossible !!! 91

  14. Deadlock Detection & Recovery 92

  15. Basic approach: cycle detection 93

  16. E.g., Tarjan’s strongly connected components algorithm; O(|V|+|E|) 94

  17. Need only run on mutex resources and “involved” processes …still, would be nice to reduce the size of the resource allocation graph 95

  18. Actual resources involved are unimportant —only care about relationships between processes 96

  19. Resource Allocation Graph P 2 P 1 P 2 P 2 P 2 97

  20. “Wait-for” Graph P 2 P 1 P 2 P 2 P 2 98

  21. P 2 P 2 P 1 P 2 P 2 P 1 P 2 P 2 P 2 P 2 Substantial optimization! 99

  22. …but not very useful when we have multi- instance resources (false positives are likely) 100

Recommend


More recommend