1 / 94

Chapter 4 Device Management and Disk Scheduling

Chapter 4 Device Management and Disk Scheduling. Content. I/O device overview I/O organization and architecture I/O buffering Disk scheduling RAID Notes : Difficult to develop a general, consistent solution. Just a generally discuss. 4.1 I/O Devices (P452). Three categories :

Download Presentation

Chapter 4 Device Management and Disk Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4 Device Management and Disk Scheduling

  2. Content • I/O device overview • I/O organization and architecture • I/O buffering • Disk scheduling • RAID • Notes: Difficult to develop a general, consistent solution. Just a generally discuss.

  3. 4.1 I/O Devices (P452) Three categories: • Human Readable Devices • Such as Keyboard, Mouse, Display, Printer and so on; • Machine Readable Devices • Such as Actuator, Controller, Sensor, Tape Drive, Disk Drive and so on; • Communication Devices • Such as Modem, Network Adapter and so on.

  4. Classify • There are many sorting standard. E.g. data rates

  5. Data Rates of Devices

  6. Differences in I/O Devices • Application • Disk used to store files requires file-management software • Disk used to store virtual memory pages needs special hardware and software to support it • Terminal used by system administrator may have a higher priority than an ordinary user

  7. Differences in I/O Devices • Complexity of control • Unit of transfer • Data may be transferred as a stream of bytes for a terminal or in larger blocks for a disk • Data representation • Encoding schemes • Error conditions • Devices respond to errors differently

  8. 4.2 Techniques for Performing I/O (p453 11.2) • Cyclic Test /Programmed • Interrupt-Driven • DMA Control

  9. Programmed I/O --P29. • I/O module performs the action, not the processor • Sets appropriate bits in the I/O status register • No interrupts occur • Processor checks status until operation is complete • Busy-waits

  10. Interrupt-Driven I/O • Processor is interrupted when I/O module ready to exchange data • Processor is free to do other work • No needless waiting • Consumes a lot of processor time because every word read or written passes through the processor

  11. Direct Memory Access • Transfers a block of data directly to or from memory • An interrupt is sent when the task is complete • The processor is only involved at the beginning and end of the transfer

  12. Evolution of the I/O Function • Processor directly controls a peripheral device • Controller or I/O module is added • Processor uses programmed I/O without interrupts • Processor does not need to handle details of external devices

  13. Evolution of the I/O Function • Controller or I/O module with interrupts • Processor does not spend time waiting for an I/O operation to be performed • Direct Memory Access • Blocks of data are moved into memory without involving the processor • Processor involved at beginning and end only

  14. Evolution of the I/O Function • I/O channel • I/O module is a separate processor. Its with a specialized instruction set tailored(适合) for I/O. • I/O processor • I/O module has its own local memory • Its a computer in its own right

  15. Direct Memory Access • Takes control of the system from the CPU to transfer data to and from memory over the system bus • Cycle stealing is used to transfer data on the system bus • The instruction cycle is suspended so data can be transferred • The CPU pauses one bus cycle • No interrupts occur while cycle stealing • Do not save context

  16. Direct Memory Access

  17. DMA • The Starting location in memory to read from or write to, communicated on the data lines and stored by the DMA module in its address register. • The number of words to be read or written, again communicated via the data lines and stored in the data count register.

  18. DMA and Interrupt Breakpoint • The processor is suspended just before it needs to use the bus. The DMA unit then transfers one word and returns control to the processor. • Cycle stealing causes the CPU to execute more slowly.

  19. DMA and Interrupt Breakpoint

  20. DMA • Number of required bus cycles can be cut by integrating the DMA and I/O functions • Path between DMA module and I/O module that does not include the system bus

  21. DMA

  22. DMA

  23. DMA

  24. 4.3 Operating System Design Issues • Efficiency • Most I/O devices extremely slow compared to main memory • Use of multiprogramming allows for some processes to be waiting on I/O while another process executes • I/O cannot keep up with processor speed • Swapping is used to bring in additional ready processes which is an I/O operation • Thus, a major effort in I/O design has been schemes for improving the efficiency of I/O. e.g. disk I/O

  25. Operating System Design Issues • Generality • Desirable to handle all I/O devices in a uniform manner • Hide most of the details of device I/O in lower-level routines so that processes and upper levels see devices in general terms such as read, write, open, close, lock, unlock

  26. Struct general_op{ int (*read)(…) int (*write)(…) }; driver1: Struct general_op dev_op={ dev1_read, dev1_write }; driver2: Struct general_op dev_op={ dev2_read, dev2_write }; Gen_read(fd,…) { dev_op=map(fd); dev_op->read(…); }

  27. Logical Structure of the I/O Function (e.g. Hierarchical p458) • Logical I/O • Is concerned with general I/O function, and is not concerned with the detail of actually controlling. E.g. read, write… • Device I/O • Implement I/O instructions, channel commands, and controller orders. May use buffering techniques.

  28. Logical Structure of the I/O Function • Scheduling and Control • This is the level of software that actually interacts with the I/O module and the device hardware.

  29. 4.4I/O Buffering(p460) • Reasons for buffering • Processes must wait for I/O to complete before next proceeding. E.g: write to device (busy waiting or suspension on an interrupt) • Certain pages of the I/O request process must remain in main memory during I/O. • Single-process deadlock

  30. I/O Buffering • Block-oriented • Information is stored in fixed sized blocks • Transfers are made a block at a time • Used for disks and tapes • Stream-oriented • Transfer information as a stream of bytes • Used for terminals, printers, communication ports, mouse, and most other devices that are not secondary storage

  31. Single Buffer • Operating system assigns a buffer in the system portion of main memory for an I/O request • Block-oriented • Input transfers made to buffer • Block moved to user space when needed • Another block is moved into the buffer • Read ahead

  32. Single Buffer • Block-oriented • User process can process one block of data while next block is read in • Swapping can occur since input is taking place in system memory, not user memory • Operating system keeps track of assignment of system buffers to user processes

  33. Single Buffer • Stream-oriented • Used a line at time. • User input from a terminal is one line at a time with carriage return signaling(回车信号) the end of the line. • Output to the terminal is one line at a time.

  34. Single Buffer • Performance comparison with no buffering • T: the time to input a block • C: the time to computation • M: the time to move data • Max [C,T]+M and T+C

  35. Double Buffer • Use two system buffers instead of one. • A process can transfer data to or from one buffer while the operating system empties or fills the other buffer. • Performance: max(C,T).

  36. Circular Buffer • More than two buffers are used. • Each individual buffer is one unit in a circular buffer. • Used when I/O operation must keep up with process.

  37. Disk and Disk Scheduling(p463) • The speed of processors and main memory has far outstripped that for disk access. • The performance of disk storage subsystem is of vital concern. • How to improve the performance of disk? • General methods • Special methods

  38. Disk Structure • Headers • Cylinders • Tracks • Sectors • Capability=headers*cylinders*sectors*byte per sector

  39. Disk Performance Parameters • To read or write, the disk head must be positioned at the desired track and at the beginning of the desired sector • Seek time • movable-head system or fixed-head system • Time it takes to position the head at the desired track • Rotational delay or rotational latency • Time its takes for the beginning of the sector to reach the head

  40. Disk Performance Parameters • Data transfer time • Wait for device or channel

  41. RPS (Rotational Positional Sensing) • When seek command has been issued, the channel is released to handle other I/O operations. • RPS miss. Must rotate again and reconnect again.

  42. Seek Time Ts = m×n+s n=number of tracks traversed m=constant that depends on the disk drive s=startup time

  43. Rotational Delay Tr = 1/(2r) r=rotation speed, in revolutions per second Example: r=3600rpm, Tr=1/120=8.3ms r=300rpm, Tr=1/10=100ms

  44. Transfer Time T = b/(r×N) b=number of bytes to be transferred N=number of bytes on a track r=rotation speed,in revolutions per second

  45. Total Average Access Time Ta=Ts+Tr+T

  46. A Timing Comparison • Seek time: 20ms • Transfer rate: 1MB/s • r=3600rpm • 512byte per sector • 32 sector per track • Suppose to read 128k data

  47. A Timing Comparison • 60*16k=960k<1MB/s • Sequential organization (20+8.3+16.7)+(8.3+16.7)×7=220(ms) • Randomly organization (20+8.3+0.5)×256=7373(ms)

More Related