ch8.ppt

41 410 0
ch8.ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Silberschatz, Galvin and Gagne 2002 8.1 Operating System Concepts Chapter 8: Deadlocks ■ System Model ■ Deadlock Characterization ■ Methods for Handling Deadlocks ■ Deadlock Prevention ■ Deadlock Avoidance ■ Deadlock Detection ■ Recovery from Deadlock ■ Combined Approach to Deadlock Handling Silberschatz, Galvin and Gagne 2002 8.2 Operating System Concepts 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 tape drives. ✦ P 1 and P 2 each hold one tape drive and each needs another one. ■ Example ✦ semaphores A and B, initialized to 1 P 0 P 1 wait (A); wait(B) wait (B); wait(A) Silberschatz, Galvin and Gagne 2002 8.3 Operating System Concepts Bridge Crossing Example ■ Traffic only in one direction. ■ Each section of a bridge can be viewed as a resource. ■ If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback). ■ Several cars may have to be backed up if a deadlock occurs. ■ Starvation is possible. Silberschatz, Galvin and Gagne 2002 8.4 Operating System Concepts System Model ■ Resource types R 1 , R 2 , . . ., R m CPU cycles, memory space, I/O devices ■ Each resource type R i has W i instances. ■ Each process utilizes a resource as follows: ✦ request ✦ use ✦ release Silberschatz, Galvin and Gagne 2002 8.5 Operating System Concepts Deadlock Characterization ■ 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 {P 0 , P 1 , …, P 0 } of waiting processes such that P 0 is waiting for a resource that is held by P 1 , P 1 is waiting for a resource that is held by P 2 , …, P n–1 is waiting for a resource that is held by P n , and P 0 is waiting for a resource that is held by P 0 . Deadlock can arise if four conditions hold simultaneously. Silberschatz, Galvin and Gagne 2002 8.6 Operating System Concepts Resource-Allocation Graph ■ V is partitioned into two types: ✦ P = {P 1 , P 2 , …, P n }, the set consisting of all the processes in the system. ✦ R = {R 1 , R 2 , …, R m }, the set consisting of all resource types in the system. ■ request edge – directed edge P 1 → R j ■ assignment edge – directed edge R j → P i A set of vertices V and a set of edges E. Silberschatz, Galvin and Gagne 2002 8.7 Operating System Concepts Resource-Allocation Graph (Cont.) ■ Process ■ Resource Type with 4 instances ■ P i requests instance of R j ■ P i is holding an instance of R j P i P i R j R j Silberschatz, Galvin and Gagne 2002 8.8 Operating System Concepts Example of a Resource Allocation Graph Silberschatz, Galvin and Gagne 2002 8.9 Operating System Concepts Resource Allocation Graph With A Deadlock Silberschatz, Galvin and Gagne 2002 8.10 Operating System Concepts Resource Allocation Graph With A Cycle But No Deadlock

Ngày đăng: 16/07/2014, 04:00

Mục lục

  • Chapter 8: Deadlocks

  • The Deadlock Problem

  • Bridge Crossing Example

  • System Model

  • Deadlock Characterization

  • Resource-Allocation Graph

  • Resource-Allocation Graph (Cont.)

  • Example of a Resource Allocation Graph

  • Resource Allocation Graph With A Deadlock

  • Resource Allocation Graph With A Cycle But No Deadlock

  • Basic Facts

  • Methods for Handling Deadlocks

  • Deadlock Prevention

  • Deadlock Prevention (Cont.)

  • Deadlock Avoidance

  • Safe State

  • Slide 17

  • Safe, Unsafe , Deadlock State

  • Resource-Allocation Graph Algorithm

  • Resource-Allocation Graph For Deadlock Avoidance

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan