1 / 81

I/O Management and Disk Scheduling

I/O Management and Disk Scheduling. Chapter #11. I/O 장치의 분류 (1). 인간가독 장치 (Human readable) 사용자가 컴퓨터와 대화하는데 적합한 장치 Printers Video display terminals Display Keyboard Mouse. I/O 장치의 분류 (2). 기계가독 장치 (Machine readable) 전자장치와 통신하는데 사용되는 장치 Disk and tape drives Sensors Controllers

essied
Download Presentation

I/O 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. I/O Management and Disk Scheduling Chapter #11

  2. I/O 장치의 분류 (1) • 인간가독 장치(Human readable) • 사용자가 컴퓨터와 대화하는데 적합한 장치 • Printers • Video display terminals • Display • Keyboard • Mouse Operating System

  3. I/O 장치의 분류 (2) • 기계가독 장치(Machine readable) • 전자장치와 통신하는데 사용되는 장치 • Disk and tape drives • Sensors • Controllers • Actuators Operating System

  4. I/O 장치의 분류 (3) • 통신 장치(Communication) • 원격장치와 통신하는데 적합한 장치 • Digital line drivers • Network Interface devices • Modems Operating System

  5. I/O 장치의 차이점 (1) • 데이터 전송률(Data rate) • May be differences of several orders of magnitude between the data transfer rates • 응용(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 Operating System

  6. Operating System

  7. I/O 장치의 차이점 (2) • 제어복잡성(Complexity of control) • I/O 장치에 대한 제어 인터페이스의 복잡도 • 전송 단위(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 Operating System

  8. I/O 수행 방식 (1) • 프로그램에 의한 입출력(Programmed I/O) • 프로세스가 입출력 모듈에게 원하는 입출력 명령을 보낸다 • 프로세스는 입출력 작업이 완료될 때까지 빠쁜 대기(busy-waiting)을수행한다 • 인터럽트 구동 입출력(Interrupt-driven I/O) • 프로세스가 입출력 모듈에게 원하는 입출력 명령을 보내고 보류(blocking) 된다 • 프로세서는 다른 프로세스의 실행을 계속한다 • I/O 모듈은 입출력 작업이 완료되면 인터럽트를 발생시킨다 • 입출력을 요구한 프로세스를 활성화시켜 실행한다 Operating System

  9. I/O 수행 방식 (2) • 직접 메모리 접근(Direct Memory Access:DMA) • DMA module controls direct exchange of data between main memory and the I/O device • 프로세서는 DMA 모듈에게 데이터 블록 전송을 요청한다. • DMA 모듈은 요청된 데이터 블록 전송이 완료되면 인터럽트를 발생시킨다. Operating System

  10. I/O 수행 방식 (3) Operating System

  11. I/O 기능의 발달 (1) • 단계 1. 프로세스가 직접 주변장치를 제어함 • 단계 2. 입출력 제어기 또는 입출력 모듈이 추가됨 • Processor uses programmed I/O without interrupts • Processor does not need to handle details of external devices • 단계 3. 인터럽트을 지원하는 입출력 모듈 도입 • Processor does not spend time waiting for an I/O operation to be performed Operating System

  12. I/O 기능의 발달 (2) • 단계 4. DMA(Direct Memory Access) 도입 • Blocks of data are moved into memory without involving the processor • Processor involved at beginning and end only • 단계 5. 별도의 처리기로 동작하는 입출력채널(I/O Channel) 도입 • 입출력용 명령어 집합을 지원 • CPU는 입출력 명령어을 전송하고, 모든 입출력 명령어 실행이 종료된 후에 인터럽트를 받음 • 단계 6. 독립적인 입출력 프로세서(I/O Processor) 도입 • I/O module has its own local memory • Its a computer in its own right Operating System

  13. DMA(Direct Memory Access) (1) • Takes over control of the system from the CPU to transfer data to and from memory over the system bus • Cycle stealing is commonly used to transfer data on the system bus • processor is suspended just before it needs to use the bus • DMA transfers one word and returns control to the processor • processor pauses for one bus cycle Operating System

  14. DMA(Direct Memory Access) (2) • DMA 동작 방식 • Processor sends the following information • read or write? • address of I/O device involved • starting address in memory • number of words • DMA transfers the entire block • DMA sends an interrupt signal when done Operating System

  15. DMA(Direct Memory Access) (3) Operating System

  16. DMA(Direct Memory Access) (4) Operating System

  17. DMA 구성 방법 (1) Operating System • Single bus, detached DMA • all modules share the same system bus • inexpensive, but inefficient • Single bus, integrated DMA-I/O • there is a separate path between DMA and I/O modules • I/O bus • only one interface between DMA and I/O modules • provides for an easily expandable configuration

  18. DMA 구성 방법 (2) Operating System

  19. DMA 구성 방법 (3) Operating System

  20. Operating System Design Issues (1) • 효율성(Efficiency) • Most I/O devices extremely slow compared to main memory and the processor 입출력 연산이 병목현상(bottleneck)을 야기 • Solutions • Use of multiprogramming allows for some processes to be waiting on I/O while another process executes • Swapping is used to bring in additional Ready processes to keep the processor busy • Support efficient Disk I/O to improve the efficiency of the I/O Operating System

  21. Operating System Design Issues (2) • 일반성(Generality) • 간결성과 무결성을 지원하기 위해서는 모든 장치를 일관된 방식으로 다루는 것이 바람직함 • 입출력 장치의 특성이 다양하여 일반성을 얻기 어려움 • 계층적인 모듈 접근법을 이용한 입출력 기능 설계 • 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 Operating System

  22. Operating System Design Issues (3) Operating System

  23. I/O Buffering (1) • 버퍼링( buffering) 기법의 필요성 • Processes must wait for I/O to complete before proceeding • Certain pages must remain in main memory during I/O • Perform input transfers in advance of requests and perform output transfers sometime after the request is made • Schemes • 단일 버퍼링(single buffering) • 이중 버퍼링(double buffering) • 환형 버퍼링(circular buffering) Operating System

  24. I/O Buffering (2) • I/O 장치의 유형 • 블록형(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 other pointing devices, and most other devices that are not secondary storage Operating System

  25. Single Buffer (1) • Operating system assigns a buffer in 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 Operating System

  26. Single Buffer (2) • 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 • output is accomplished by the user process writing a block to the buffer and later actually written out Operating System

  27. Single Buffer (3) • 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 Operating System

  28. Single Buffer (4) Operating System

  29. 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 Double Buffer Operating System

  30. 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 Circular Buffer Operating System

  31. Disk Performance Parameters (1) • To read or write, the disk head must be positioned at the desired track and at the beginning of the desired sector • Disk I/O time = • queuing time (wait for device) + • channel waiting time (wait for channel) + • seek time + • rotational delay (latency) + • data transfer time Operating System

  32. Timing of a Disk I/O Transfer Operating System

  33. Disk Performance Parameters (2) • Seek time • time it takes to position the head at the desired track • Ts = m * n + s • Ts = estimated seek time, • n = number of tracks traversed, • m = constant that depends on the disk drive, • s = startup time • inexpensive disk : m = 0.3, s = 20ms • expensive disk : m = 0.1, s = 3ms Operating System

  34. Disk Performance Parameters (3) • Rotational delay or rotational latency • time its takes until desired sector is rotated to line up with the head • Tr = 1 / (2r) • Tr = average rotational delay time, r = rotation speed in revolutions per second • disk : 3600 rpm, 16.7 ms/rot, Tr = 8.3 ms ; • floppy : 300~600 rpm, 100~200 ms/rot, Tr = 50~100 ms Operating System

  35. Disk Performance Parameters (4) • Transfer time • time its takes while desired sector moves under the head • Tt = b / (rN) • Tt = transfer time • b = number of bytes to be transferred • N = number of bytes on a track • r = rotation speed in revolutions per second Operating System

  36. Disk Performance Parameters (5) • Access time • Sum of seek time and rotational delay • The time it takes to get in position to read or write • Data transfer occurs as the sector moves under the head • Total Access Time • Ta = Ts + Tr + Tt = Ts + 1/(2r) + b/(rN) Operating System

  37. Disk Scheduling Policies (1) • Seek time is the reason for differences in performance • Need to reduce the average seek time • OS maintains a queue of requests for each I/O devices • For a single disk there will be a number of I/O requests • If requests are selected randomly, we will poor performance Operating System

  38. Disk Scheduling Policies (2) Assume a disk with 200 tracks Starting at track 100 in the direction of increasing track number Requested tracks in the order received : 55, 58, 39, 18, 90, 160, 150, 38, 184 Operating System

  39. Disk Scheduling Policies (3) Random scheduling First-in, first-out (FIFO) Priority Last-in, first-out Shortest Service Time First SCAN C-SCAN N-step-SCAN FSCAN Operating System

  40. Disk Scheduling Policies (4) • Random scheduling • select requests from queue in random order • the worst possible performance • useful as a benchmark against which to evaluate other techniques Operating System

  41. First-in, first-out (FIFO) Process request sequentially Fair to all processes If there are only a few processes that require access and if many of the requests are to clustered, good performance can be hoped Approaches random scheduling in performance if there are many processes Disk Scheduling Policies (5) Operating System

  42. Disk Scheduling Policies (6) • Priority • Goal is not to optimize disk use but to meet other objectives • Short batch jobs may have higher priority • Provide good interactive response time • Longer jobs may have to wait long Operating System

  43. Disk Scheduling Policies (7) • Last-in, first-out • Good for transaction processing systems • The device is given to the most recent user so there should be little arm movement • improve throughput and reduce queue length • Possibility of starvation since a job may never regain the head of the line Operating System

  44. Shortest Service Time First Select the disk I/O request that requires the least movement of the disk arm from its current position Always choose the minimum Seek time Disk Scheduling Policies (8) Operating System

  45. SCAN Arm moves in one direction only, satisfying all outstanding requests until it reaches the last track in that direction Direction is reversed Disk Scheduling Policies (9) Operating System

  46. C-SCAN Restricts scanning to one direction only When the last track has been visited in one direction, the arm is returned to the opposite end of the disk and the scan begins again Disk Scheduling Policies (10) Operating System

  47. Disk Scheduling Policies (11) • N-step-SCAN • Segments the disk request queue into subqueues of length N • Subqueues are processed one at a time, using SCAN • New requests added to other queue when queue is processed • With large value of N, this is similar to SCAN • With N = 1, this is same as FIFO Operating System

  48. Disk Scheduling Policies (12) • FSCAN • Two queues • When a scan begins, all of the requests are in one of the queues, with the other empty • During the scan, all new requests are put into the other queue Operating System

  49. Disk Scheduling Algorithms (1) Operating System

  50. Disk Scheduling Algorithms (2) Operating System

More Related