Exam 3/Final Review. Exam 3 u Mean adjusted score: 62% ( C ) u Correct multiple choice answers: 1. D 2. B 3. E 4. A 5. E 6. C 7. A 8. B or C 9. E 10.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

Chapter 7: Deadlocks.
Disk scheduling examples. Problem parameters: u Disk has 100 cylinders, labeled u Time to move from cylinder A to cylinder B is a linear function.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks (Continuation). 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Lecture 7: Deadlocks, Deadlock Risk Management. Lecture 7 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The Concept of Deadlock Resource-Allocation.
Deadlocks CS 3100 Deadlocks1. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
Chapter 7. Deadlocks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Lecture 14 Chapter 7: Deadlocks (cont)
Chapter 8: Deadlocks System Model Deadlock Characterization
03/07/2007CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
03/03/2004CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
What we will cover…  The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Objectives Understand the Deadlock.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
Chapter 7: Deadlocks Adapted to COP4610 by Robert van Engelen.
1 Deadlock Definition of deadlock Condition for its occurrence Solutions for avoiding and breaking deadlock –Deadlock Prevention –Deadlock Avoidance –Deadlock.
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Chapter 7: Deadlocks. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-6 Deadlocks Department of Computer Science and Software Engineering.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
CHAPTER 8: DEADLOCKS System Model Deadlock Characterization
Chapter 8: Deadlocks Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Dr. Kalpakis CMSC 421, Operating Systems Deadlocks.
Operating System Concepts 7th Edition Abraham SilBerschatz Peter Baer Galvin Greg Gagne Prerequisite: CSE212.
1 Advanced Operating Systems - Spring 2009 Lecture 10 – February 11, 2009 Dan C. Marinescu Office: HEC 439 B. Office.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks System Model Deadlock Characterization Methods.
Chapter 7: Deadlock Course Administration n Midterm exam next week in class l Closed book n Final exam time changed to during class.
Lecture 12 Handling Deadlock – Prevention, avoidance and detection.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Chapter 7: Deadlocks. 7.2CSCI 380 – Operating Systems Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
CS307 Operating Systems Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
國立台灣大學 資訊工程學系 Chapter 7: Deadlocks. 資工系網媒所 NEWS 實驗室 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes.
Chap 7 Deadlocks. Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
Deadlocks Introduction to Operating Systems: Module 7.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
1 Deadlock.  System Model  Process must request a resource before using  Process must release the resource when done  Deadlock  A set of processes.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter Objectives To develop a description of deadlocks, which.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
7.1 CSE Department MAITSandeep Tayal 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
CSE Operating System Principles Deadlocks. CSE – Operating System Principles2 Overview System Model Deadlock Characterization Methods for.
Chapter 7: Deadlocks. The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
OPERATING SYSTEM CONCEPTS AND PRACTISE
Chapter 7: Deadlocks.
Process Deadlocks.
G.Anuradha Ref:- Galvin
Outline Deadlocks, dead lock prevention, avoidance.
Deadlock Prevention Restrain the ways request can be made.
Deadlocks Session - 14.
Presentation transcript:

Exam 3/Final Review

Exam 3 u Mean adjusted score: 62% ( C ) u Correct multiple choice answers: 1. D 2. B 3. E 4. A 5. E 6. C 7. A 8. B or C 9. E 10. B 11. C

Problem 4 u Assume a disk has 100 cylinders labeled 0-99, the read- write head is positioned over cylinder 52 heading toward cylinder 0, accessing data requires 1 time unit, and incoming requests arrive as follows: u What is the order of the requests which will be serviced by time 64 (cylinder of request is given) by the LOOK disk scheduling algorithm? Arrival time Cylinder

Problem (52,0) (26,27) (20,34) (10,45) (29,64) Time Cylinder

Problem 5 u Assume a disk has 100 cylinders labeled 0-99, the read- write head is positioned over cylinder 21 heading toward cylinder 0, accessing data requires 1 time unit, and pending requests are as follows: 1, 16, 24, 71, 8, 18, 94, 3 (listed in order of arrival). Which disk scheduling algorithm will finish servicing the requests first?  SSTF (break tie by moving toward cylinder 0.)  LOOK  FCFS  C-Scan  None of the above: there is a tie.

Problem 5 u SSTF (21 – 18) + 1 Tie between 18 and 24, move to 18 +(18 – 16) + 1 +(16 – 8) + 1 Tie between 8 and 24, move to 8 +(8 – 3) + 1 +(3 – 1) + 1 +(24 – 1) + 1 +(71 – 24) + 1 +(94 – 71) + 1 =

Problem 5 u Look (21 – 18) + 1 +(18 – 16) + 1 +(16 – 8) + 1 +(8 – 3) + 1 +(3 – 1) + 1 Do not go to 0, turn around +(24 – 1) + 1 +(71 – 24) + 1 +(94 – 71) + 1 =

Problem 5 u FCFS (21 – 1) + 1 +(16 – 1) + 1 +(24 – 16) + 1 +(71 – 24) + 1 +(71 – 8) + 1 +(18 – 8) + 1 +(94 – 18) + 1 +(94 – 3) + 1 =

Problem 5 u C-Scan (read/write heading toward zero) (21 – 18) + 1 +(18 – 16) + 1 +(16 – 8) + 1 +(8 – 3) + 1 +(3 – 1) + 1 +(1 – 0) +(99 – 0) +(99 – 94) + 1 +(94 – 71) + 1 +(71 – 24) + 1 +(24 – 1) + 1 =

Final Exam Review u More disk scheduling u Exponential moving average for predicting next burst u Banker’s algorithm

SSTF (static) u Assume the R/W heads hold stationary when there is no pending request, and that seek decisions are never reversed on new arrival u What is the total time to service all requests? (28 – 3) (16 – 3) +1 + (58–16) (98 – 58) (98 – 71) (71 – 12) (56 – 12) + 1 = 256 Arrival TimeCylinder

SSTF (static) Arrival TimeCylinder

SSTF (static) Arrival TimeCylinder

SSTF (dynamic) u Assume the R/W heads continue moving toward cylinder 50 when there is no pending request, and that seek decisions can be changed dynamically u What is the total time to service all requests? (28 – 3) (16 – 3) +1 + (58–16) (98 – 58) (98 – 71) (71 – 48) + (56 – 48 ) (56 – 12) + 1 = 229 Arrival TimeCylinder

SSTF (dynamic) Arrival TimeCylinder

SSTF (dynamic) Arrival TimeCylinder

Page Replacement

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

Clock page replacement (2 nd chance) u The use bit is shown to the right of the frames u The arrow denotes the position of the clock pointer 0, 1, 3, 5, 2, 1, 4, 5,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

LRU approximation (shift bits) u Each ‘c’ denotes a clock shift event u The reference bit and clock bits are shown to the right of the frame 0, 1, 3, 5, c, 3, 2, c, 1, 2, 4, c,

Banker’s Algorithm

Example of Banker’s Algorithm u 5 processes P 0 through P 4 ; 3 resource types A (4 instances), B (5 instances), and C (6 instances). u Snapshot at time T 0 : AllocationMaxAvailable A B CA B C A B C P P P P P

Example of Banker’s Algorithm u Is the system currently safe? u Suppose a request for came from P 1. AllocationMaxAvailable A B CA B C A B C P P P P P Need A B C

Example of Banker’s Algorithm u Suppose a request for came from P 1  Is the request legal?  Are the resources available? AllocationMaxAvailable A B CA B C A B C P P P P P Need A B C

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxAvailable A B CA B C A B C P P P P P Need A B C

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P1

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P1

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P4P3P1P4P3

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P4P3P0P1P4P3P0

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P4P3P0P2P1P4P3P0P2

Example of Banker’s Algorithm u Suppose a request for came from P 1  Make a hypothetical grant of the resources  Test to see if the state is safe AllocationMaxWork A B CA B C A B C P P P P P Need A B C P1P4P3P0P2P1P4P3P0P2

Detection Algorithm 1.Let Work and Finish be vectors of length m and n, respectively Initialize: (a) Work :- Available (b)For i = 1,2, …, n, if Allocation i  0, then Finish[i] := false;otherwise, Finish[i] := true. 2.Find an index i such that both: (a)Finish[i] = false (b)Request i  Work If no such i exists, go to step 4.

Detection Algorithm 3.Work := Work + Allocation i Finish[i] := true go to step 2. 4.If Finish[i] = false, for some i, 1  i  n, then the system is in deadlock state. Moreover, if Finish[i] = false, then P i is deadlocked. Algorithm requires an order of m x n 2 operations to detect whether the system is in deadlocked state.

Example of Detection Algorithm u Five processes P 0 through P 4 ; three resource types A (7 instances), B (2 instances), and C (6 instances). u Snapshot at time T 0 : AllocationRequestAvailable A B C A B C A B C P P P P P u Sequence will result in Finish[i] = true for all i.

Example (Cont.) u P 2 requests an additional instance of type C. Request A B C P P P P P u State of system?  Can reclaim resources held by process P 0, but insufficient resources to fulfill other processes; requests.  Deadlock exists, consisting of processes P 1, P 2, P 3, and P 4.