Project 3 - Forum partitipation is expected. ====================================================================================== Deadlock - Deadlock can arise if four conditions hold simultaneously: * Mutual Exclusion: only one process at a time can use a resource. * Hold and Wait: a process holding at least one resource is waiting to acquire additional resources held by other processes. * No Preemption: a resource can be released only voluntarily by the process holding it, after that process has completed its task. * Circular Wait: there exists a set {P0, P1, …, Pn} of waiting processes such that: P0 is waiting for a resource held by P1 P1 is waiting for a resource held by P2 … Pn is waiting for a resource held by P0 These conditions are necessary but may not be sufficient. New Example shows actual prevention of hold and wait. Example that says pick up both or none actually prevents no pre-emption. How to avoid circular wait? Uses a counting semaphore. Initial value? 4 - Only four philosophers at the table or can try to eat. HW/Study: Try prevention solutions with a CCR or maybe a monitor. Deadlock - With singular resources, can use a Resource-Allocation (R-A) graph, sometimes referred to as System resource allocation graph - Dealing with it * Prevention - make sure at least one of four conditions can't occur * Avoidance - Analyze requests in system to be sure they can complete * Detection - Determine that deadlock has occurred and roll it back - Ignorance - No provision taken * Make sure you have an available process to kill the deadlocked one(s). Banker's Algorithm - Determines if granting a request for system resources can lead to deadlock. - When a request is made, ikt is simulated, and the safety algorithm is run to seek a safe sequence * Multiple sequences may need to be attempted before a safe one is found. - Based on future requests relative to current request Detection with R-A graph and singular resources - Collapse graph, eliminating resources - Arrows to and from resources bypass them, going from requesting process to process holding resource - Based on current requests s