QUESTION BANK. UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks)

Size: px
Start display at page:

Download "QUESTION BANK. UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks)"

Transcription

1 QUESTION BANK DEPARTMENT: EEE SEMESTER VII SUBJECT CODE: CS2411 SUBJECT NAME: OS UNIT II: PROCESS SCHEDULING AND SYNCHRONIZATION PART A (2 Marks) 1. What is deadlock? (AUC NOV2010) A deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does. 2. Distinguish pre-emption and No-pre-emption (AUC NOV2008,AUC MAY 2012) Preemption means the operating system moves a process from running to ready without the process requesting it. Without preemption, the system implements run to completion (or yield or block). The preempt arc in the diagram. Preemption needs a clock interrupt (or equivalent). Preemption is needed to guarantee fairness. Preemption is found in all modern general purpose operating systems. Even non preemptive systems can be multiprogrammed (e.g., when processes block for I/O). 3. Is it possible to have a deadlock involving only one process? Explain your answer. No. This follows directly from the hold-and-wait condition. 4. What are conditions under which a deadlock situation may arise? (AUC NOV2008) 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,, P0} of waiting processes such that P0 is waiting for a resource that is held by P1 5. What is critical section problem? (AUC NOV 2013) A critical section is a piece of code that accesses a shared resource that must not be concurrently accessed by more than one thread of execution. A critical section will usually terminate in fixed time, and a thread. 6. Define busy waiting and spin lock MAHALAKSHMI ENGINEERING COLLEGE Page 1

2 When a process is in its critical section, any other process that tries to enter its critical section must loop continuously in the entry code. This is called as busy waiting and this type of semaphore is also called a spinlock, because the process while waiting for the lock. 7. What are the four necessary conditions that are needed for deadlock can occur? (AUC MAY 2012) 8. What is a semaphore? State the two parameters. (AUC APR/MAY 2010,AUC NOV/DEC 2011) A semaphore S is integer variable that can be only be accessed via two indivisible (atomic) operations wait and signal. 9. What is deadlock? What are the schemes used in operating system to handle deadlocks? (AUC APR/MAY 2010) 1. Ensure that the system will never enter a deadlock state. 2. Allow the system to enter a deadlock state and then recover. 3. Ignore the problem and pretend that deadlocks never occur in the system; used by most operating systems, including UNIX. 10. What is dispatcher? Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves: o switching context o switching to user mode o jumping to the proper location in the user program to restart that program 11. What is dispatch latency? The dispatch latency is referred as time it takes for the dispatcher to stop one process and start another running. 12. Define Mutual Exclusion. (AUC NOV/DEC 2011) If process pi is executing in its critical section,then no other processes an be executing in their critical section. 13. What is turnaround time? turn around time is the difference of time between the time of arrival of process and time of dispatch of process or we can say the time of completion of process 14. Why CPU scheduling is required?. (AUC JUN 2009) Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. 15. List the three requirements that must be satisfy by the critical-section problem. (AUC JUN 2009) Mutual Exclusion. If process Pi is executing in its critical section, then no other processes can be executing in their critical sections. Progress. If no process is executing in its critical section and there exist some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely. MAHALAKSHMI ENGINEERING COLLEGE Page 2

3 Bounded Waiting. A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted. 16. Define throughput Throughput in CPU scheduling is the number of processes that are completed per unit time. For long processes, this rate may be one process per hour; for short transactions, throughput might be 10 processes per second. 17. Define race condition When several process access and manipulate same data concurrently, then the outcome of the execution depends on particular order in which the access takes place is called race condition. To avoid race condition, only one process at a time can manipulate the shared variable 18. What is a resource-allocation graph? Deadlock can be described through a resource allocation graph. The RAG consists of a set of vertices P={P1,P2,,P n} of processes and R={R1,R2,,Rm} of resources. A directed edge from a processes to a resource, Pi->R j, implies that Pi has requested Rj. A directed edge from a resource to a process, Rj->Pi, implies that Rj has been allocated by Pi. If the graph has no cycles, deadlock cannot exist. If the graph has a cycle, deadlock may exist. 19. Define deadlock prevention Deadlock prevention is a set of methods for ensuring that at least one of the four necessary conditions like mutual exclusion, hold and wait, no preemption and circular wait cannot hold. By ensuring that that at least one of these conditions cannot hold, the occurrence of a deadlock can be prevented. 20. Define deadlock avoidance. Avoiding deadlocks is to require additional information about how resources are to be requested. Each request requires the system consider the resources currently available, the resources currently allocated to each process, and the future requests and releases of each process, to decide whether the could be satisfied or must wait to avoid a possible future deadlock. 21. What are a safe state and an unsafe state? A state is safe if the system can allocate resources to each process in some order and still avoid a deadlock. A system is in safe state only if there exists a safe sequence. A sequence of processes <P1,P2,...Pn> is a safe sequence for the current allocation state if, for each Pi, the resource that Pi can still request can be satisfied by the current available resource plus the resource held by all the Pj, with j<i. if no such sequence exists, then the system state is said to be unsafe. 22. What is banker s algorithm? (AUC NOV 2013) Banker's algorithm is a deadlock avoidance algorithm that is applicable to a resource allocation system with multiple instances of each resource type. The two algorithms used for its implementation are: a. Safety algorithm: The algorithm for finding out whether or not a system is in a safe state. MAHALAKSHMI ENGINEERING COLLEGE Page 3

4 b. Resource-request algorithm: if the resulting resource allocation is safe, the transaction is completed and process Pi is allocated its resources. If the new state is unsafe Pi must wait and the old resource-allocation state is restored. PART-B (16 Marks ) 1. Explain in detail about any two CPU scheduling algorithms with suitable examples. (16) (AUC APR 10,NOV 11) CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: Switches from running to waiting state. Switches from running to ready state. Switches from waiting to ready. Terminates. Scheduling under 1 and 4 is non preemptive. All other scheduling is preemptive Scheduling Criteria CPU utilization keep the CPU as busy as possible Throughput # of processes that complete their execution per time unit Turnaround time amount of time to execute a particular process Waiting time amount of time a process has been waiting in the ready queue Response time amount of time it takes from when a request was submitted until the first response is produced, not output Scheduling Algorithm First-Come, First-Served (FCFS) Scheduling 1. Suppose that the processes arrive in the order: P1, P2, and P3 The Gantt chart for the schedule is 2. Waiting time for P1 = 0; P2 = 24; P3 = Average waiting time: ( )/3 = 17 Suppose that the processes arrive in the order P2, P3, P1..n The Gantt chart for the schedule is: MAHALAKSHMI ENGINEERING COLLEGE Page 4

5 Average waiting time: ( )/3 = 3 Convoy effect short process behind long process Waiting time for P1 = 6; P2 = 0; P3 = 3 Average waiting time: ( )/3 = 3 Convoy effect short process behind long process Shortest-Job-First (SJR) Scheduling 1. Associate with each process the length of its next CPU burst. Use these lengths toschedule the process with the shortest time. 2. Two schemes: a. nonpreemptive once CPU given to the process it cannot be preempted until Completes its CPU burst. b. preemptive if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is known as the Shortest-Remaining-Time-First (SRTF). 3. SJF is optimal gives minimum average waiting time for a given set of processes Example of Non-Preemptive SJF Process Arrival Time Burst Time P P P P SJF (non-preemptive) Average waiting time = ( )/4-4 Example of Preemptive SJF 2. SJF (preemptive) 4. Average waiting time = ( )/4 3 MAHALAKSHMI ENGINEERING COLLEGE Page 5

6 Determining Length of Next CPU Burst o tn actual length of n th CPU burst. o tn+1=predicted value for the next CPU burst o α, 0 α 1 o Define : Examples of Exponential Averaging Recent history does not count. Only the actual last CPU burst counts. 2. What is a deadlock? What are the necessary conditions for a deadlock to occur? (AUC NOV/DEC 2011) A process requests resources; if the resources are not available at that time, the process enters a wait state. Waiting processes may never again change state, because the resources they have requested are held by other waiting processes. This situation is called a 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,, P0} of waiting processes such that P0 is waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2,, Pn 1 is waiting for a resource that is held by Pn, and P0 is waiting for a resource that is held by P0. Resource-Allocation Graph A set of vertices V and a set of edges E. a. P = {P1, P2 Pn}, the set consisting of all the processes in the system. b. R = {R1, R2 Rm}, the set consisting of all resource types in the system. MAHALAKSHMI ENGINEERING COLLEGE Page 6

7 directed edge 1P Rj directed edge Rj Pi Pi requests instance of Rj Pi is holding an instance of Rj If graph contains no cycles no deadlock. If graph contains a cycle a. if only one instance per resource type, then deadlock. b. if several instances per resource type, possibility of deadlock. 3. How can a system recover from deadlock? (10) (AUCNOV/DEC 2011) When a detection algorithm determines that a deadlock exists, several alternatives exist. One possibility is to inform the operator that a deadlock has spurred, and to let the operator deal with the deadlock manually. The other possibility is to let the system recover from the deadlock automatically. There are two options for breaking a deadlock. One solution is simply to abort one or more processes to break the circular wait. The second option is to preempt some resources from one or more of the deadlocked processes. 1. Process Termination To eliminate deadlocks by aborting a process, we use one of two methods. In both methods, the system reclaims all resources allocated to the terminated processes. Abort all deadlocked processes: This method clearly will break the dead lock cycle, but at a great expense, since these processes may have computed for a long time, and the results of these partial computations must be discarded, and probably must be recomputed. MAHALAKSHMI ENGINEERING COLLEGE Page 7

8 Abort one process at a time until the deadlock cycle is eliminated: This method incurs considerable overhead, since after each process is aborted a deadlock-detection algorithm must be invoked to determine whether a processes are still deadlocked. 2. Resource Preemption To eliminate deadlocks using resource preemption, we successively preempt some resources from processes and give these resources to other processes until he deadlock cycle is broken. Selecting a victim minimize cost. Rollback return to some safe state, restart process for that state. Starvation same process may always be picked as victim, include number of rollback incost factor. Combined Approach to Deadlock Handling Combine the three basic approaches prevention avoidance detection allowing the use of the optimal approach for each of resources in the system. Partition resources into hierarchically ordered classes. Use most appropriate technique for handling deadlocks within each class 4. What is synchronization? Explain how semaphores can be used to deal with n-process critical section problem. ( 8) (AUC MAY 2006 APR/MAY 2010)] 1. Synchronization tool that does not require busy waiting. 2. Semaphore S integer variable 3. can only be accessed via two indivisible (atomic) operations wait (S): while S 0 do no-op; S--; signal (S): S++; Critical Section of n Processes Shared data: semaphore mutex; //initially mutex = 1 Process Pi: do { wait(mutex); critical section signal(mutex); remainder section } while (1); Semaphore Implementation MAHALAKSHMI ENGINEERING COLLEGE Page 8

9 Define a semaphore as a record typedef struct { int value; struct process *L; } semaphore; Assume two simple operations: Block suspends the process that invokes it. Wakeup (P) resumes the execution of a blocked process P. Implementation Semaphore operations now defined as wait(s): S.value--; if (S.value < 0) { block; add this process to S.L; } signal(s): S.value++; if (S.value <= 0) { remove a process P from S.L; wakeup(p); } Semaphore as a General Synchronization Tool 1) Execute B in Pj only after A executed in Pi 2) Use semaphore flag initialized to 0 3) Code: Pi Pj A wait (flag) Signal (flag) B 5. Explain Banker's deadlock-avoidance algorithm with an illustration. (8) (AUC APR/MAY 2010) Banker s Algorithm Data Structures for the Banker s Algorithm Let n = number of processes, and m = number of resources types. 1. Available: Vector of length m. If available [j] = k, there are k instances of resource type Rj available. 2. Max: n x m matrix. If Max [i,j] = k, then process Pi may request at most k instances of resource type Rj. 3. Allocation: n x m matrix. If Allocation[i,j] = k then Pi is currently allocated k instances of Rj. 4. Need: n x m matrix. If Need[i,j] = k, then Pi may need k more instances of Rj to complete its MAHALAKSHMI ENGINEERING COLLEGE Page 9

10 task. 5. Need [i,j] = Max[i,j] Allocation [i,j]. Safety Algorithm 1. Let Work and Finish be vectors of length m and n, respectively. Initialize: Work = Available Finish [i] = false for i - 1,3,, n. 2. Find Available [i] (a) Finish [i] = false (b) Need [i] = work If so such i exists, go to step Work = Work + Allocation[i] Finish[i] = true go to step If Finish [i] == true for all i, then the system is in a safe state. Resource-Request Algorithm for Process Pi Request = request vector for process Pi. If Request i [j] = k then process Pi wants k instances of resource type Rj. 5..If Request [i]=need [i] go to step 2. Otherwise, raise error condition, since process has exceeded its maximum claim. 6. If Request [i]=available, go to step 3. Otherwise Pi must wait, since resources are not available. Pretend to allocate requested resources to Pi by modifying the state as follows: Available = Request [i]; Allocation [i] = Allocation [i] + Request [i]; Need [i] = Need [i] Request [i]; If safe the resources are allocated to Pi. If unsafe Pi must wait, and the old resource-allocation state is restored Example of Banker s Algorithm 1. 5 processes P0 through P4; 3 resource types A (10 instances), B (5instances, and C (7 instances). 2. Snapshot at time T0: The content of the matrix. Need is defined to be Max Allocation. MAHALAKSHMI ENGINEERING COLLEGE Page 10

11 The system is in a safe state since the sequence < P1, P3, P4, P2, P0> satisfies safety criteria. 6. (i) What is a Gantt chart? Explain how it is used? (ii) Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority P P2 1 1 P3 2 3 P4 1 4 P5 5 2 The processes are arrived in the order P1, P2, P3, P4, P5, ALL AT TIME 0. (1) Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a non preemptive priority (a smaller priority number implies a higher priority), and RR (quantum=1) scheduling. (2) What is the turnaround time of each process for each of the scheduling algorithms in part a? (3) What is the waiting time of each process for each of the scheduling algorithms in part a? (4) Which of the schedules in part a results in the minimal average waiting time (overall processes)? (16) (AUC MAY/JUNE 2012) a)fcfs algorithm P1 P2 P3 P4 P5 MAHALAKSHMI ENGINEERING COLLEGE Page 11

12 i)waiting time process schedule time arrival time = waiting time p p p p p Average Waiting time=48/5=9.6 ii)turn around time process complete time arrival time =Turnaround time p p p p p Average turn around time = 67/5 = 13.4 b)waiting time process schedule time arrival time = waiting time p p p p p Average waiting time = 16/5 =3.2 ii)turn around time process completed time arrival time = waiting time p p p p p MAHALAKSHMI ENGINEERING COLLEGE Page 12

13 Average waiting time= 35/5 =7 c) Non pre emptive scheduling P1 P5 P1 P3 P i)waiting time process schedule time arrival time = waiting time p p p p p Average waiting time = 32/5 =6.4 ii)turn around time process schedule time arrival time = waiting time p p p p p Average turn around time = 51/5 =10.2 MAHALAKSHMI ENGINEERING COLLEGE Page 13

14 7. What do you mean by busy waiting? What other kinds of waiting are there? Can busy waiting be avoided altogether? Explain your answer. (8) 2012) (AUC MAY/JUNE Busy waiting means that a process is waiting for a condition tobe satisfied in a tight loop without relinquish the processor. Alternatively,a process could wait by relinquishing the processor, and block on acondition and wait to be awakened at some appropriate time in thefuture. Busy waiting can be avoided but incurs the overhead associatedwith putting a process to sleep and having to wake it up when theappropriate program state is reached. To implement the wait() and signal() semaphore operations in multiprocessor environments using the TestAndSet() instruction. The solution should exhibit minimal busy waiting. MAHALAKSHMI ENGINEERING COLLEGE Page 14

15 Answer: Here is the pseudocode for implementing the operations: int guard = 0; int semaphore value = 0; wait() { while (TestAndSet(&guard) == 1); if (semaphore value == 0) { atomically add process to a queue of processes waiting for the semaphore and set guard to 0; } else { semaphore value--; guard = 0; } } signal() { while (TestAndSet(&guard) == 1); if (semaphore value == 0 && there is a process on the wait queue) wake up the first process in the queue of waiting processes else semaphore value++; guard = 0; } 8. Consider the following snapshot of a system: Allocation Max Available ABCD ABCD ABCD P P P P P Answer the following questions based on the bankers algorithm: (1) Define safety algorithm. (2) What is the content of the matrix need? (3) Is the system in a safe state? (4) If a request from process P1 arrives for (0, 4, 2, 0), can the request be granted immediately? (AUC NOV 2010, MAY2012) MAHALAKSHMI ENGINEERING COLLEGE Page 15

16 (b) The system is in a safe state. For example: P0, P1, P3, P4, is a safe sequence. (c) After satisfying P1 request, the system becomes the following state. By using the safety algorithm, the system is still in a safe state and P0, P2, P1, P3, P4 is a safe sequence. 9. What is critical section problem? Explain the two processes, multiple solutions. Explain the Dining philosopher s problem using semaphores. (AUCMAY 2006,NOV 2010) 1. n processes all competing to use some shared data 2. Each process has a code segment, called critical section, in which the shared data is accessed. 3. Problem ensure that when one process is executing in its critical section, no other process is allowed to execute in its critical section. Solution to Critical-Section Problem Mutual Exclusion. If process Pi is executing in its critical section, then no other processes canbe executing in their critical sections. Progress. If no process is executing in its critical section and there exist some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely. MAHALAKSHMI ENGINEERING COLLEGE Page 16

17 Bounded Waiting. A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted. Assume that each process executes at a nonzero speed No assumption concerning relative speed of the n processes. Initial Attempts to Solve Problem Only 2 processes, P0 and P1 General structure of process Pi (other process Pj) do { entry section critical section exit section reminder section } while (1); Processes may share some common variables to synchronize their actions. Algorithm 1 1. Shared variables: int turn; initially turn = 0 turn i // Pi can enter its critical section 2. Process Pi do { while (turn!= i) ; critical section turn = j; //reminder section } while (1); 3. Satisfies mutual exclusion, but not progress Algorithm 2 1) Shared variables a) boolean flag[2]; initially flag [0] = flag [1] = false. b) flag [i] = true => Pi ready to enter its critical section 2) Process Pi do { flag[i] := true; while (flag[j]) ; //critical section flag [i] = false; } while (1); MAHALAKSHMI ENGINEERING COLLEGE Page 17

18 i.remainder section 3) Satisfies mutual exclusion, but not progress requirement. Algorithm 3 Combined shared variables of algorithms 1 and 2. Process Pi do { flag [i]:= true; turn = j; while (flag [j] and turn = j); critical section flag [i] = false; remainder section } while (1); Meets all three requirements; solves the critical-section problem for two processes. Bakery Algorithm Critical section for n processes 1) Before entering its critical section, process receives a number. Holder of the smallest number enters the critical section. 2) If processes Pi and Pj receive the same number, if i < j, then Pi is served first; else Pj is served first. 3) The numbering scheme always generates numbers in increasing order of enumeration; i.e., 1,2,3,3,3,3,4,5... 4) Notation <lexicographical order (ticket #, process id #) a) (a,b) < c,d) if a < c or if a = c and b < d b) max (a0,, an-1) is a number, k, such that k ai for i - 0,, n 1 5) Shared data (a) boolean choosing[n]; (b) int number[n]; 6) Data structures are initialized to false and 0 respectively do { choosing[i] = true; number*i+ = max(number*0+, number*1+,, number *n 1])+1; choosing[i] = false; for (j = 0; j < n; j++) { while (choosing[j]) ; while ((number[j]!= 0) && (number[j,j] < number[i,i])) ; } critical section number[i] = 0; remainder section MAHALAKSHMI ENGINEERING COLLEGE Page 18

19 } while (1); Dining-Philosophers Problem The dining philosopher s problem is an example problem often used in concurrent algorithm design to illustrate synchronization issues and techniques for resolving them. IssuesThe problem was designed to illustrate the problem of avoiding deadlock, a system state inwhich no progress is possible. One idea is to instruct each philosopher to behave as follows: Think until the left fork is available and when it is pick it up Think until the right fork is available and when it is pick it up Eat for a fixed amount of time Put the right fork down Put the left fork down Repeat from the beginning. This attempt at a solution fails: It allows the system to reach a deadlock state in which each philosopher has picked up the fork to the left, waiting for the fork to the right to be put down which never happens, because A) Each right fork is another philosopher's left fork, and no philosopher will put down that forkuntil s/he eats, and B) no philosopher can eat until s/he acquires the fork to his/her own right, which has alreadybeen picked up by the philosopher to his/her right as described above. wait(mutex); readcount++; if (readcount == 1) wait(rt); signal(mutex); reading is performed wait(mutex); readcount--; if (readcount == 0) signal(wrt); signal(mutex): MAHALAKSHMI ENGINEERING COLLEGE Page 19

20 The situation of the dining philosophers. 1. Shared data semaphore chopstick[5]; Initially all values are 1 2. Philosopher i: do { wait(chopstick[i]) wait(chopstick[(i+1) % 5]) eat signal(chopstick[i]); signal(chopstick[(i+1) % 5]); think } while (1); 10. Explain about the methods used to prevent deadlocks(8) Restrain the ways request can be made. 1. Mutual Exclusion not required for sharable resources; must hold for non-sharable resources. 2. Hold and Wait must guarantee that whenever a process requests a resource, it does not hold any other resources. Require process to request and be allocated all its resources before it begins execution, or allow process to request resources only when the process has none. MAHALAKSHMI ENGINEERING COLLEGE Page 20

21 Low resource utilization; starvation possible. 3. No Preemption If a process that is holding some resources requests another resource thatcannot be immediately allocated to it, then all resources currently being held are released. Preempted resources are added to the list of resources for which the process is waiting.process will be restarted only when it can regain its old resources, as well as the new ones that it is requesting. 4. Circular Wait impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration. B MAHALAKSHMI ENGINEERING COLLEGE Page 21

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU

More information

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices! " Silberschatz, Galvin and Gagne 2013!

Silberschatz, Galvin and Gagne 2013! CPU cycles, memory space, I/O devices!  Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter

More information

Process Synchronization

Process Synchronization Chapter 7 Process Synchronization 1 Chapter s Content Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors 2 Background

More information

Chapter 7: Process Synchronization. Background

Chapter 7: Process Synchronization. Background Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris

More information

The Deadlock Problem (1)

The Deadlock Problem (1) Deadlocks The Deadlock Problem (1) A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P 1 and P 2

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Chapter

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks Chapter 7: Deadlocks 7.1 System Model 7.2 Deadlock Characterization 7.3 Methods for Handling Deadlocks 7.4 Deadlock Prevention 7.5 Deadlock Avoidance 7.6 Deadlock Detection 7.7 Recovery

More information

Chapter 7: Process Synchronization. Background. Illustration

Chapter 7: Process Synchronization. Background. Illustration Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris

More information

Chapter 8: Deadlocks

Chapter 8: Deadlocks Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization

Chapter 8: Deadlocks. The Deadlock Problem. System Model. Bridge Crossing Example. Resource-Allocation Graph. Deadlock Characterization Chapter 8: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

The Deadlock Problem

The Deadlock Problem The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P 1 and P 2 each hold one

More information

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem?

What is the Race Condition? And what is its solution? What is a critical section? And what is the critical section problem? What is the Race Condition? And what is its solution? Race Condition: Where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular

More information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model

Module 7: Deadlocks. The Deadlock Problem. Bridge Crossing Example. System Model Module 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

CMSC 412. Announcements

CMSC 412. Announcements CMSC 412 Deadlock Reading Announcements Chapter 7 Midterm next Monday In class Will have a review on Wednesday Project 3 due Friday Project 4 will be posted the same day 1 1 The Deadlock Problem A set

More information

UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock.

UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock. UNIT-5 Q1. What is deadlock problem? Explain the system model of deadlock. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition, Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009!

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks Operating System Concepts 8 th Edition,! Silberschatz, Galvin and Gagne 2009! Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling

More information

Deadlocks. Deadlock Overview

Deadlocks. Deadlock Overview Deadlocks Gordon College Stephen Brinton Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Chapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14

Chapter 7: Deadlocks. Operating System Concepts 9th Edition DM510-14 Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Chapter

More information

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example

Deadlock. Concepts to discuss. A System Model. Deadlock Characterization. Deadlock: Dining-Philosophers Example. Deadlock: Bridge Crossing Example Concepts to discuss Deadlock CSCI 315 Operating Systems Design Department of Computer Science Deadlock Livelock Spinlock vs. Blocking Notice: The slides for this lecture have been largely based on those

More information

Chapter 7: Deadlocks. Operating System Concepts 8th Edition, modified by Stewart Weiss

Chapter 7: Deadlocks. Operating System Concepts 8th Edition, modified by Stewart Weiss Chapter 7: Deadlocks, Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance (briefly) Deadlock Detection

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013!

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition! Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013! Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. System Model Deadlock Characterization Methods of handling

More information

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example

Chapter 7: Deadlocks. Chapter 7: Deadlocks. The Deadlock Problem. Chapter Objectives. System Model. Bridge Crossing Example Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition

Chapter 7: Deadlocks. Operating System Concepts with Java 8 th Edition Chapter 7: Deadlocks 7.1 Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock

More information

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks

Chapter 7 : 7: Deadlocks Silberschatz, Galvin and Gagne 2009 Operating System Concepts 8th Edition, Chapter 7: Deadlocks Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance

More information

System Model. Types of resources Reusable Resources Consumable Resources

System Model. Types of resources Reusable Resources Consumable Resources Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock System Model Types

More information

Deadlocks. Prepared By: Kaushik Vaghani

Deadlocks. Prepared By: Kaushik Vaghani Deadlocks Prepared By : Kaushik Vaghani Outline System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection & Recovery The Deadlock Problem

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from

More information

Chapter 7: Deadlocks

Chapter 7: Deadlocks Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Lecture 7 Deadlocks (chapter 7)

Lecture 7 Deadlocks (chapter 7) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 7 Deadlocks (chapter 7) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are

More information

Background. Module 6: Process Synchronization. Bounded-Buffer (Cont.) Bounded-Buffer. Background

Background. Module 6: Process Synchronization. Bounded-Buffer (Cont.) Bounded-Buffer. Background Module 6: Process Synchronization Background Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization

More information

OPERATING SYSTEMS. Deadlocks

OPERATING SYSTEMS. Deadlocks OPERATING SYSTEMS CS3502 Spring 2018 Deadlocks Chapter 7 Resource Allocation and Deallocation When a process needs resources, it will normally follow the sequence: 1. Request a number of instances of one

More information

CS307 Operating Systems Deadlocks

CS307 Operating Systems Deadlocks CS307 Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Bridge Crossing Example Traffic only in one direction Each section of a bridge can be viewed

More information

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model

Deadlocks. Bridge Crossing Example. The Problem of Deadlock. Deadlock Characterization. Resource-Allocation Graph. System Model CS07 Bridge Crossing Example Deadlocks Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2016 Traffic only in one direction Each section of a bridge can be viewed

More information

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 16-17 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and

More information

Chapter 8: Deadlocks. Operating System Concepts with Java

Chapter 8: Deadlocks. Operating System Concepts with Java Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

CSE Opera+ng System Principles

CSE Opera+ng System Principles CSE 30341 Opera+ng System Principles Deadlocks Overview System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock

More information

Process Coordination

Process Coordination Process Coordination Why is it needed? Processes may need to share data More than one process reading/writing the same data (a shared file, a database record, ) Output of one process being used by another

More information

Module 7: Deadlocks. The Deadlock Problem

Module 7: Deadlocks. The Deadlock Problem Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 11 - Deadlocks Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian, and course

More information

Deadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources.

Deadlock Prevention. Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources. Deadlock Prevention Restrain the ways request can be made. Mutual Exclusion not required for sharable resources; must hold for nonsharable resources. Hold and Wait must guarantee that whenever a process

More information

CS420: Operating Systems. Deadlocks & Deadlock Prevention

CS420: Operating Systems. Deadlocks & Deadlock Prevention Deadlocks & Deadlock Prevention James Moscola Department of Physical Sciences York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne The Deadlock Problem

More information

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks. Zhi Wang Florida State University COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 7 Deadlocks Zhi Wang Florida State University Contents Deadlock problem System model Handling deadlocks deadlock prevention deadlock avoidance

More information

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3

Operating Systems Antonio Vivace revision 4 Licensed under GPLv3 Operating Systems Antonio Vivace - 2016 revision 4 Licensed under GPLv3 Process Synchronization Background A cooperating process can share directly a logical address space (code, data) or share data through

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST II Date: 04/04/2018 Max Marks: 40 Subject & Code: Operating Systems 15CS64 Semester: VI (A & B) Name of the faculty: Mrs.Sharmila Banu.A Time: 8.30 am 10.00 am Answer any FIVE

More information

Lecture 3: Synchronization & Deadlocks

Lecture 3: Synchronization & Deadlocks Lecture 3: Synchronization & Deadlocks Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

CHAPTER 7 - DEADLOCKS

CHAPTER 7 - DEADLOCKS CHAPTER 7 - DEADLOCKS 1 OBJECTIVES To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods for preventing

More information

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance

Module 7: Deadlocks. System Model. Deadlock Characterization. Methods for Handling Deadlocks. Deadlock Prevention. Deadlock Avoidance Module 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian

ICS Principles of Operating Systems. Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian ICS 143 - Principles of Operating Systems Lectures Set 5- Deadlocks Prof. Nalini Venkatasubramanian nalini@ics.uci.edu Outline System Model Deadlock Characterization Methods for handling deadlocks Deadlock

More information

Deadlock Risk Management

Deadlock Risk Management Lecture 6: Deadlocks, Deadlock Risk Management Readers and Writers with Readers Priority Shared data semaphore wrt, readcountmutex; int readcount Initialization wrt = 1; readcountmutex = 1; readcount =

More information

Deadlock Risk Management

Deadlock Risk Management Lecture 5: Deadlocks, Deadlock Risk Management Contents The Concept of Deadlock Resource Allocation Graph Approaches to Handling Deadlocks Deadlock Avoidance Deadlock Detection Recovery from Deadlock AE3B33OSD

More information

Module 6: Process Synchronization

Module 6: Process Synchronization Module 6: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Critical Regions Monitors Synchronization in Solaris

More information

The Deadlock Problem

The Deadlock Problem Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock The Deadlock

More information

Process Synchronization

Process Synchronization Process Synchronization Mandar Mitra Indian Statistical Institute M. Mitra (ISI) Process Synchronization 1 / 28 Cooperating processes Reference: Section 4.4. Cooperating process: shares data with other

More information

Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK

Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK Operating Systems 2015 Spring by Euiseong Seo DEAD LOCK Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Deadlocks. Dr. Yingwu Zhu

Deadlocks. Dr. Yingwu Zhu Deadlocks Dr. Yingwu Zhu Deadlocks Synchronization is a live gun we can easily shoot ourselves in the foot Incorrect use of synchronization can block all processes You have likely been intuitively avoiding

More information

CHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

CHAPTER 7: DEADLOCKS. By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 7: DEADLOCKS By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Processes-Process Concept:

Processes-Process Concept: UNIT-II PROCESS MANAGEMENT Processes-Process Concept: An operating system executes a variety of programs: O Batch system jobs o Time-shared systems user programs or tasks We will use the terms job and

More information

Chapter 7: Process Synchronization!

Chapter 7: Process Synchronization! Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization Hardware Semaphores Classical Problems of Synchronization Monitors 7.1 Background Concurrent access to shared

More information

UNIT:2. Process Management

UNIT:2. Process Management 1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria

More information

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition,

Chapter 7: Deadlocks. Operating System Concepts 8 th Edition, Chapter 7: Deadlocks, Silberschatz, Galvin and Gagne 2009 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number

More information

Chapter 6: Process Synchronization

Chapter 6: Process Synchronization Chapter 6: Process Synchronization Chapter 6: Synchronization 6.1 Background 6.2 The Critical-Section Problem 6.3 Peterson s Solution 6.4 Synchronization Hardware 6.5 Mutex Locks 6.6 Semaphores 6.7 Classic

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Chapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6.

Chapter 6: Synchronization. Chapter 6: Synchronization. 6.1 Background. Part Three - Process Coordination. Consumer. Producer. 6. Part Three - Process Coordination Chapter 6: Synchronization 6.1 Background Concurrent access to shared data may result in data inconsistency Maintaining data consistency requires mechanisms to ensure

More information

Module 6: Deadlocks. Reading: Chapter 7

Module 6: Deadlocks. Reading: Chapter 7 Module 6: Deadlocks Reading: Chapter 7 Objective: To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To present a number of different methods

More information

Deadlocks. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Deadlocks. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Deadlocks Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics What is deadlock? Deadlock characterization Four conditions for deadlock

More information

University of Babylon / College of Information Technology / Network Department. Operating System / Dr. Mahdi S. Almhanna & Dr. Rafah M.

University of Babylon / College of Information Technology / Network Department. Operating System / Dr. Mahdi S. Almhanna & Dr. Rafah M. Chapter 6 Methods for Handling Deadlocks Generally speaking, we can deal with the deadlock problem in one of three ways: We can use a protocol to prevent or avoid deadlocks, ensuring that the system will

More information

Chapter 7: Deadlocks CS370 Operating Systems

Chapter 7: Deadlocks CS370 Operating Systems Chapter 7: Deadlocks CS370 Operating Systems Objectives: Description of deadlocks, which prevent sets of concurrent processes from completing their tasks Different methods for preventing or avoiding deadlocks

More information

Chapter 6: Synchronization. Operating System Concepts 8 th Edition,

Chapter 6: Synchronization. Operating System Concepts 8 th Edition, Chapter 6: Synchronization, Silberschatz, Galvin and Gagne 2009 Outline Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores Classic Problems of Synchronization

More information

Process Synchronisation (contd.) Deadlock. Operating Systems. Spring CS5212

Process Synchronisation (contd.) Deadlock. Operating Systems. Spring CS5212 Operating Systems Spring 2009-2010 Outline Process Synchronisation (contd.) 1 Process Synchronisation (contd.) 2 Announcements Presentations: will be held on last teaching week during lectures make a 20-minute

More information

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

OPERATING SYSTEMS. Prescribed Text Book. Operating System Principles, Seventh Edition. Abraham Silberschatz, Peter Baer Galvin and Greg Gagne OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne 1 DEADLOCKS In a multi programming environment, several processes

More information

Bridge Crossing Example

Bridge Crossing Example CSCI 4401 Principles of Operating Systems I Deadlocks Vassil Roussev vassil@cs.uno.edu Bridge Crossing Example 2 Traffic only in one direction. Each section of a bridge can be viewed as a resource. If

More information

Deadlock. Chapter Objectives

Deadlock. Chapter Objectives Deadlock This chapter will discuss the following concepts: The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

The deadlock problem

The deadlock problem Deadlocks Arvind Krishnamurthy Spring 2004 The deadlock problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process. Example locks A and B P 0 P

More information

The Deadlock Problem

The Deadlock Problem Deadlocks The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Example System has 2 disk drives. P1 and P2 each

More information

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005

Deadlocks. Operating System Concepts - 7 th Edition, Feb 14, 2005 Deadlocks Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock 7.2 Silberschatz,

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

Fall 2015 COMP Operating Systems. Lab 06

Fall 2015 COMP Operating Systems. Lab 06 Fall 2015 COMP 3511 Operating Systems Lab 06 Outline Monitor Deadlocks Logical vs. Physical Address Space Segmentation Example of segmentation scheme Paging Example of paging scheme Paging-Segmentation

More information

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01

Unit-03 Deadlock and Memory Management Unit-03/Lecture-01 1 Unit-03 Deadlock and Memory Management Unit-03/Lecture-01 The Deadlock Problem 1. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

More information

Chapter 5: Process Synchronization. Operating System Concepts Essentials 2 nd Edition

Chapter 5: Process Synchronization. Operating System Concepts Essentials 2 nd Edition Chapter 5: Process Synchronization Silberschatz, Galvin and Gagne 2013 Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks

More information

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set.

The Deadlock Problem. A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. Deadlock The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set Example semaphores A and B, initialized to 1 P 0 P

More information

Roadmap. Deadlock Prevention. Deadlock Prevention (Cont.) Deadlock Detection. Exercise. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012

Roadmap. Deadlock Prevention. Deadlock Prevention (Cont.) Deadlock Detection. Exercise. Tevfik Koşar. CSE 421/521 - Operating Systems Fall 2012 CSE 421/521 - Operating Systems Fall 2012 Roadmap Lecture - XI Deadlocks - II Deadlocks Deadlock Prevention Deadlock Detection Deadlock Recovery Deadlock Avoidance Tevfik Koşar University at Buffalo October

More information

Chapter 8: Deadlocks. The Deadlock Problem

Chapter 8: Deadlocks. The Deadlock Problem Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined Approach to Deadlock

More information

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph

The Deadlock Problem. Chapter 8: Deadlocks. Bridge Crossing Example. System Model. Deadlock Characterization. Resource-Allocation Graph Chapter 8: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection Recovery from Deadlock Combined

More information

CHAPTER 6: PROCESS SYNCHRONIZATION

CHAPTER 6: PROCESS SYNCHRONIZATION CHAPTER 6: PROCESS SYNCHRONIZATION The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. TOPICS Background

More information

Interprocess Communication By: Kaushik Vaghani

Interprocess Communication By: Kaushik Vaghani Interprocess Communication By: Kaushik Vaghani Background Race Condition: A situation where several processes access and manipulate the same data concurrently and the outcome of execution depends on the

More information

Lesson 6: Process Synchronization

Lesson 6: Process Synchronization Lesson 6: Process Synchronization Chapter 5: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Mutex Locks Semaphores Classic Problems of Synchronization

More information

Operating Systems: Quiz2 December 15, Class: No. Name:

Operating Systems: Quiz2 December 15, Class: No. Name: Operating Systems: Quiz2 December 15, 2006 Class: No. Name: Part I (30%) Multiple Choice Each of the following questions has only one correct answer. Fill the correct one in the blank in front of each

More information

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Deadlocks. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University. Deadlocks Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University msryu@hanyang.ac.kr Topics Covered System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 1018 L11 Synchronization Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Multilevel feedback queue:

More information

Chapter 6: Process Synchronization. Operating System Concepts 8 th Edition,

Chapter 6: Process Synchronization. Operating System Concepts 8 th Edition, Chapter 6: Process Synchronization, Silberschatz, Galvin and Gagne 2009 Module 6: Process Synchronization Background The Critical-Section Problem Peterson s Solution Synchronization Hardware Semaphores

More information

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition

Chapter 7: Deadlocks. Operating System Concepts 9 th Edition Chapter 7: Deadlocks Silberschatz, Galvin and Gagne 2013 Chapter 7: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection

More information