modeling deadlocks csc 452 deadlocks
play

Modeling Deadlocks CSC 452: Deadlocks A B T C D R S U Dr. - PDF document

10/11/2018 Modeling Deadlocks CSC 452: Deadlocks A B T C D R S U Dr. Jonathan Misurda Hold Request Deadlock jmisurda@cs.arizona.edu http://www.u.arizona.edu/~jmisurda Dealing with Deadlocks 1. Ignore 2. Detect and recover A


  1. 10/11/2018 Modeling Deadlocks CSC 452: Deadlocks A B T C D R S U Dr. Jonathan Misurda Hold Request Deadlock jmisurda@cs.arizona.edu http://www.u.arizona.edu/~jmisurda Dealing with Deadlocks 1. Ignore 2. Detect and recover “A set of processes is deadlocked if each process in 3. Avoid the set is waiting for an event that only another process in the set can cause.” 4. Prevent 4 Conditions for Deadlock 1. Mutual exclusion – Resource can only be held by one process at a time 2. Hold and wait Ostrich Algorithm – Process gains one resource, holds it, then attempts to gain another, waiting if failed Do nothing – pretend like it didn’t happen 3. No preemption – Resource cannot be forcibly taken away 4. Circular wait – Process A is waiting for a resource held by Process B which is waiting for a resource held by Process A … 1

  2. 10/11/2018 Deadlock Detection Resource Trajectories R 1 2 3 S 4 T 5 6 U V W 7 Deadlock Detection Algorithm For each node N in the graph { Set L = empty list unmark all arcs Traverse (N,L) } Safe State If no deadlock reported by now, there isn’t any There exists a schedule that will not lead define Traverse (C,L) { If C in L, report deadlock! to deadlock Add C to L For each unmarked arc from C { Mark the arc Set A = arc destination /* NOTE: L is a local variable */ Traverse (A,L) } } Banker’s Algorithm Deadlock Avoidance Safe State Safe State Unsafe State 2

  3. 10/11/2018 Banker’s with Multiple Resources Deadlock Prevention • Attack Mutual Exclusion • Attack Hold and Wait • Attack No Preemption • Attack Circular Wait 3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend