Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 11 Deadlocks and Devices. Last Time CPSC 457 - Tyson Kendon 20161 Concurrency Some notes about Semaphores Spinlocks Classical Synchronization.

Similar presentations


Presentation on theme: "Lecture 11 Deadlocks and Devices. Last Time CPSC 457 - Tyson Kendon 20161 Concurrency Some notes about Semaphores Spinlocks Classical Synchronization."— Presentation transcript:

1 Lecture 11 Deadlocks and Devices

2 Last Time CPSC 457 - Tyson Kendon 20161 Concurrency Some notes about Semaphores Spinlocks Classical Synchronization Problems Monitors Monitor Construction Condition Variables Using Monitors Java

3 This Time CPSC 457 - Tyson Kendon 20162 Deadlocks Resource Allocation Detecting Deadlocks Resolving Deadlocks Devices Hosts and Controllers I/O Drivers

4 Deadlocks CPSC 457 - Tyson Kendon 20163 Two or more processes are unable to proceed because each is waiting for another process (which is waiting) to proceed.

5 System Model CPSC 457 - Tyson Kendon 20164 Processes Resources Requests Request Use Release

6 Deadlock Characterization CPSC 457 - Tyson Kendon 20165 1.Mutual Exclusion - resources cannot be shared, a second request must be delayed 2.Hold and wait - A process must be holding a resource and waiting for another resource 3.No preemption - resources cannot be taken from a process once it has them 4.Circular waiting - For a set of processes {P 1,..., P n } then P 1 must wait for P 2, which must wait for P 3 … which must wait for P n, which must wait for P 1

7 Resource-Allocation Graphs CPSC 457 - Tyson Kendon 20166

8 Handling Deadlocks CPSC 457 - Tyson Kendon 20167

9 Preventing Deadlocks CPSC 457 - Tyson Kendon 20168 Prevent one of the four characterizations from holding.

10 Avoiding Deadlocks CPSC 457 - Tyson Kendon 20169 Decide (at runtime) which situations are safe and which will lead to Deadlocks.

11 Detecting Deadlocks CPSC 457 - Tyson Kendon 201610 Look at our processes and resources and determine if they are deadlocked.

12 Recovering From Deadlocks CPSC 457 - Tyson Kendon 201611 Look at our processes and resources restore them to a point where the system is free of deadlocks.

13 Devices and I/O CPSC 457 - Tyson Kendon 201612

14 Devices and Hardware CPSC 457 - Tyson Kendon 201613 Host the CPU / Memory and OS, ”the computer” Controller the electronics and logic that operate the device, port or bus

15 Working with Controllers CPSC 457 - Tyson Kendon 201614 Registers Keep registers available to pass data can control between host and controller Memory Mapped I/O Map information from/for the controller directly into virtual memory

16 Controlling Controllers CPSC 457 - Tyson Kendon 201615 Polling OS Loops and waits for the device to work Interrupts Device does its work and interrupts the host Direct Memory Access Device moves a lot of memory then interrupts

17 Drivers CPSC 457 - Tyson Kendon 201616 Interface Define how a type of device should behave Driver Write the software to conform the device to the interface the OS expects

18 Device Characteristics aspectvariationexample Data-transfer modeCharacter block Terminal disk Access methodSequential random Modem DVD Transfer scheduleSynchronous asynchronous Tape keyboard sharingDedicated shareable Tape keyboard CPSC 457 - Tyson Kendon 201617

19 Device Characteristics (2) CPSC 457 - Tyson Kendon 201618 Device speedLatency Seek time Transfer rate Delay between ops Electronic? - memory Physical? - disk Mechanical? – tape- robot I/O directionRead-only Write-only read-write DVD Graphics controller disk

20 Next Time CPSC 457 - Tyson Kendon 201619 File Systems and Disks How do we organize data on secondary storage to make sense and access it quickly Devices What considerations do we have to make about the OS to work with Devices Multiprocessor Environments


Download ppt "Lecture 11 Deadlocks and Devices. Last Time CPSC 457 - Tyson Kendon 20161 Concurrency Some notes about Semaphores Spinlocks Classical Synchronization."

Similar presentations


Ads by Google