Presentation is loading. Please wait.

Presentation is loading. Please wait.

I/O System Chapter 5 Designed by .VAS.

Similar presentations


Presentation on theme: "I/O System Chapter 5 Designed by .VAS."— Presentation transcript:

1 I/O System Chapter 5 Designed by .VAS

2 I/O The two main jobs of a computer are I/O and processing.
The role of the operating system in computer I/0 is to manage and control I/0 operations and I/O devices. Because I/O devices vary so widely in their function and speed (consider a mouse, a hard disk, and a CD-ROM jukebox), a variety of methods are needed to control them. These methods form the I/O subsystem of the kernel, which separates the rest of the kernel from the complexity of managing I/O devices.

3 I/O Hardware Computers operate a great many kinds of devices. Most fit into the general categories of storage devices (disks, tapes), transmission devices (network cards, modems), and human-interface devices (screen, keyboard, mouse).

4 I/O Hardware Small Computer System Interface

5 Pooling Interaction between the host and a controller
2 bits are used to coordinate the producer- consumer relationship between the controller and the host. The controller indicates its state through the busy bit in the status register. (Recall that to set a bit means to write a 1 into the bit, and to clear a bit means to write a 0 into it.) The controller sets the busy bit when it is busy working, and clears the busy bit when it is ready to accept the next command. The host signals its wishes via the command-ready bit in the command register. The host sets the command- ready bit when a command is available for the controller to execute.

6 Pooling 1.The host repeatedly reads the busy bit until that bit becomes clear. 2. The host sets the write bit in the command register and writes a byte into the data-out register. 3. The host sets the command-ready bit. 4. When the controller notices that the command-ready bit is set, it sets the busy bit. 5. The controller reads the command register and sees the write command. It reads the data-out register to get the byte, and does the 1/0 to the device. 6. The controller clears the command-ready bit, clears the error bit in the status register to indicate that the device I/O succeeded, and clears the busy bit to indicate that it is finished.

7 Interrupts The CPU hardware has a wire called the interrupt-request line that the CPU senses after executing every instruction. When the CPU detects that a controller has asserted a signal on the interrupt request line, the CPU saves a small amount of state, such as the current value of the instruction pointer, and jumps to the interrupt-handler routine at a fixed address in memory.

8 DMA Many computers avoid burdening the main CPU with PI0 by offloading some of this work to a special-purpose processor called a direct memory access (DMA) controller.

9 Application I/O Interface
ATAPI (AT Attachment Packet Interface) is an interface between your computer and attached CD-ROM drives and tape backup drives. Application I/O Interface

10 Characteristics of I/O devices.

11 Kernel I/O Subsystem Kernels provide many services related to I/O. Several services- scheduling, buffering, caching, spooling, device reservation, and error handling are provided by the kernel's I/O subsystem and build on the hardware and device driver infrastructure.

12 UNIX I/O kernel structure

13 Transforming I/O to Hardware Operations

14 Disk Structure Disks provide the bulk of secondary storage for modern computer systems. Magnetic tape was used as an early secondary-storage medium, but the access time is much slower than for disks. Modern disk drives are addressed as large one-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. The one-dimensional array of logical blocks is mapped onto the sectors of the disk sequentially.

15 Disk Scheduling The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector. The rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head. The disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer.

16 Disk Scheduling ….. FCFS Scheduling
The simplest form of disk scheduling is, of course, the first-come, first-served (FCFS) algorithm. This algorithm is intrinsically fair, but it generally does not provide the fastest service.

17 Shortest-seek-time-first(SSTF) algorithm.

18 SCAN Scheduling Circular C-SCAN Scheduling

19 LOOK Scheduling

20 Disk Management Boot Block Bad Blocks
bootstrap program is stored in read-only memory (ROM Bad Blocks Physically damage

21

22 Swap-Space Management
Swap-space management is another low-level task of the operating system. Virtual memory uses disk space as an extension of main memory. Since disk access is much slower than memory access, using swap space significantly decreases system performance.

23 RAID Structure Disk drives have continued to get smaller and cheaper, so it is now economically feasible to attach a large number of disks to a computer system. Parallel operation of Disks in system. This offers the potential for improving the reliability of data storage, because redundant information can be stored on multiple disks. Thus, failure of one disk does not lead to loss of data. variety of disk-organization techniques, collectively called redundant arrays of inexpensive disks (RAID)

24 RAID … Improvement of Reliability via Redundancy – duplicate or Disk Mirroring Improvement in Performance via Parallelism - data striping consists of splitting the bits of each byte across multiple disks; such striping is called bit level striping.

25 RAID Levels Mirroring provides high reliability, but it is expensive. Striping provides high data-transfer rates, but it does not improve reliability.

26

27 RAID Level 0: RAID level 0 refers to disk arrays with striping at the level of blocks, but without any redundancy (such as mirroring or parity bits). Figure 14.9ashows an array of size 4. RAID Level 1: RAID level 1 refers to disk mirroring. Figure 14.9b shows a mirrored organization that holds four disks' worth of data. RAID Level 2: RAID level 2 is also known as memory-style error-correcting- code (ECC) organization. Memory systems have long implemented error detection using parity bits. Each byte in a memory system may have a parity bit associated with it that records whether the numbers of bits in the byte set to 1 is even (parity=O)or odd (parity=l).

28 RAID level 3: RAID level 3, or bit-interleaved parity organization, improves on level 2 by noting that, unlike memory systems, disk controllers can detect whether a sector has been read correctly, so a single parity bit can be used for error correction, as well as for detection. RAID Level 4: RAID level 4, or block-interleaved parity organization, uses block-level striping, as in RAID 0, and in addition keeps a parity block on a separate disk for corresponding blocks from N other disks. RAID level 5: RAID level 5, or block-interleaved distributed parity, differs from level 4 by spreading data and parity among all N +1 disks, rather than storing data in N disks and parity in one disk. For each block, one of the disks stores the parity, and the others store data.

29 RAID Level 6: RAID level 6, also called the P+Q redundancy scheme, is much like RAID level 5, but stores extra redundant information to guard against multiple disk failures. P indicates error-correcting bits and C indicates a second copy of the data . RAID level 0 + 1: RAID level refers to a combination of RAID levels 0 and 1. RAID 0 provides the performance, while RAID 1 provides the reliability. Generally, it provides better performance than RAID 5. It is common in environments where both performance and reliability are important. Unfortunately, it doubles the number of disks needed for storage, as does RAID 1, so it is also more expensive. In RAID 0 + 1, a set of disks are striped, and then the stripe is mirrored to another, equivalent stripe.


Download ppt "I/O System Chapter 5 Designed by .VAS."

Similar presentations


Ads by Google