Chapter 5 Input/Output
Io devices can be divided into two categories: Block devices and character devices. Block devices store addresses in fixed-size blocks and each block has its own address, the character device sends or receives a batch stream in characters, regardless of the block structure.
The Controller's task is to transfer serial bits into byte blocks and perform necessary error correction. A byte block is usually first assembled by bit in a buffer inside the controller, and then verified and proved that the byte block is correct, and then copied to the primary memory.
Direct Memory Access (DMA): it can access the system bus independently from the CPU. It contains several registers that can be read and written by the CPU, including one memory address register, one Byte Count register and one or more control registers. The Control Register specifies the IO port to be used, the transfer direction (read from the I/O device will be written to the IO Device), the transfer unit (one byte or one word each time) and the number of bytes to be transferred during an emergency transfer.
Many bus can operate in two modes: one word mode and one block mode at a time.
Sleep state saves more energy than sleep state. To disable high-speed buffering, you enter sleep state, write the content of the primary storage to the disk, and then disable the primary storage itself. This method is sleep.
Chapter 6 deadlock
Resource: the objects that require exclusive use are called resources.
Resources can be preemptible: resources that can be preemptible from processes that own it without any side effects.
Resource cannot be preemptible: it is a resource that cannot be preemptible from the process that occupies it without causing any related computing failure.
Deadlock: if every process in a process set is waiting for events that can only be triggered by other processes in the process set, the process set is deadlocked.
Four Conditions for deadlock:
1) Mutual Exclusion condition. Each resource is either allocated to a process or available.
2) the process that has obtained a resource can request a new resource after the condition of possession and waiting.
3) The resource allocated to a process cannot be forcibly preemptible. It can only be released by the process that occupies it.
4) loop wait condition. When a deadlock occurs, there must be a loop composed of two or more processes in the system. Each process in the loop is waiting for the resources occupied by the next process.
Holt Model: The directed edge from the resource node to the process node indicates that the resource has been requested, authorized, and occupied by the process .; The directed edge from the process node to the Resource Node indicates that the current process is requesting the process, and the process has been blocked and is in the waiting state.
There are four policies to handle deadlocks:
1) ignore this issue
2) detect deadlocks and restore them
3) carefully allocate resources to avoid deadlocks dynamically
4) damage one of the four necessary conditions for causing a deadlock to prevent deadlock.
Security Status: If no deadlock occurs, and even if all the processes suddenly request the maximum resource demand, there is still a scheduling order that can make each process complete, this state is safe.
This article is from the blog of "Tiger brother", please be sure to keep this source http://7613577.blog.51cto.com/7603577/1551828
Input/Output and deadlock