Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 IO Management and Disk Scheduling Chapter 11. 2 Categories of I/O Devices n Human readable u used to communicate with the user u video display terminals.

Similar presentations


Presentation on theme: "1 IO Management and Disk Scheduling Chapter 11. 2 Categories of I/O Devices n Human readable u used to communicate with the user u video display terminals."— Presentation transcript:

1 1 IO Management and Disk Scheduling Chapter 11

2 2 Categories of I/O Devices n Human readable u used to communicate with the user u video display terminals u keyboard u mouse u printer

3 3 Categories of I/O Devices n Machine readable u used to communicate with electronic equipment u disk drives u tape drives u controllers u Sensors u actuators u USB keys

4 4 Categories of I/O Devices n Communication u used to communicate with remote devices u digital line drivers u modems

5 5 Differences in I/O Devices n Data Transfer Rate: may be different of several orders of magnitude between the data transfer rates n Application u disk used to store files must have file- management software u disk used to store virtual memory pages needs special hardware to support it u terminal used by system administrator may have a higher priority

6 6 Differences in I/O Devices n Complexity of control n Unit of transfer u data may be transferred as a stream of bytes for a terminal or in larger blocks for a disk n Data representation u encoding schemes n Error conditions u devices respond to errors differently

7 7 I/O Device Data Rates

8 8 Techniques for Performing I/O n Programmed I/O u process is busy-waiting for the operation to complete n Interrupt-driven I/O u I/O command is issued u processor continues executing instructions u I/O module sends an interrupt when done

9 9 Techniques for Performing I/O n Direct Memory Access (DMA) u DMA module controls exchange of data between main memory and the I/O device u processor interrupted only after entire block has been transferred

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

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

12 12 Evolution of the I/O Function n I/O module is a separate processor n I/O processor u I/O module has its own local memory u It is a computer in its own right

13 13 Direct Memory Address n Processor delegates I/O operation to the DMA module n DMA module transfers data directly to or from memory n When transfer is complete, DMA module sends an interrupt signal to the processor

14 14 DMA

15 15 DMA Configurations

16 16 DMA Configurations

17 17 Operating System Design Objectives – Non-functional Quality Attributes n Efficiency is an important issue u I/O cannot keep up with processor speed u Use of multiprogramming u Swapping is used to bring in additional Ready processes which is an I/O operation n Generality is an important issue u Desirable to handle all I/O devices in a uniform manner u 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, and Close

18 18 A Model of I/O Organization Scheduling & Control Device I/O Scheduling & Control Scheduling & Control Local peripheral deviceCommunications portFile System Device I/O Device I/O Hardware User Processes User Processes User Processes User Processes User Processes User Processes Logical I/O Comm. Architecture Directory Management File System Physical Organization General access methods

19 19 I/O Buffering n Reasons for buffering u Processes must wait for I/O to complete before proceeding u Certain pages must remain in main memory during I/O

20 20 I/O Buffering n Block-oriented u information is stored in fixed sized blocks u transfers are made a block at a time u used for disks and tapes n Stream-oriented u transfer information as a stream of bytes u used for terminals, printers, communication ports, mouse, and most other devices that are not secondary storage

21 21 No Buffering Operating SystemUser Process No buffering I/O Device In

22 22 Single Buffer n Operating system assigns a buffer in main memory for an I/O request n Block-oriented u input transfers made to buffer u block moved to user space when needed u another block is moved into the buffer F read ahead Operating SystemUser Process Single buffering I/O Device InMove

23 23 Single Buffer n Block-oriented u user process can process one block of data while next block is read in u swapping can occur since input is taking place in system memory, not user memory u operating system keeps track of assignment of system buffers to user processes u output is accomplished by the user process writing a block to the buffer and later actually written out

24 24 Single Buffer n Stream-oriented u used a line at time u user input from a terminal is one line at a time with carriage return signaling the end of the line u output to the terminal is one line at a time

25 25 Double Buffer n Use two system buffers instead of one n A process can transfer data to or from one buffer while the operating system empties or fills the other buffer I/O Device In Move Operating SystemUser Process Double buffering

26 26 Circular Buffer n More than two buffers are used n Each individual buffer is one unit in a circular buffer n Used when I/O operation must keep up with process I/O Device InMove Operating SystemUser Process Circular buffering..

27 27 Disk Performance Parameters n To read or write, the disk head must be positioned at the desired track and at the beginning of the desired sector n Seek time u time it takes to position the head at the desired track n Rotational delay or rotational latency u time its takes until desired sector is rotated to line up with the head

28 28 Disk Performance Parameters n Access time u sum of seek time and rotational delay u the time it takes to get in position to read or write n Data transfer time u Data transfer occurs as the sector moves under the head u Data transfer for an entire file is faster when the file is stored in the same cylinder and in adjacent sectors

29 29 Disk Scheduling Policies n Seek time is the reason for differences in performance n Why disk scheduling? u For a single disk there will be a number of I/O requests u If requests are selected randomly, we will get the worst possible performance

30 30 Disk Scheduling Policies n First-in, first-out (FIFO) u process request sequentially u fair to all processes u approaches random scheduling in performance if there are many processes

31 31 Disk Scheduling Policies n Priority u goal is not to optimize disk use but to meet other objectives u short batch jobs may have higher priority u provide good interactive response time

32 32 Disk Scheduling Policies n Last-in, first-out u good for transaction processing systems F the device is given to the most recent user so there should be little arm movement u possibility of starvation since a job may never regain the head of the line

33 33 Disk Scheduling Policies n Shortest Service Time First u select the disk I/O request that requires the least movement of the disk arm from its current position u always choose the minimum Seek time

34 34 Disk Scheduling Policies n SCAN u arm moves in one direction only, satisfying all outstanding requests until it reaches the last track in that direction u direction is reversed

35 35 Disk Scheduling Policies n C-SCAN u restricts scanning to one direction only u 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

36 36 Disk Scheduling Policies n N-step-SCAN u segments the disk request queue into subqueues of length N u subqueues are process one at a time, using SCAN u new requests added to other queue when queue is processed n FSCAN u two queues u one queue is empty for new request

37 37 Disk Scheduling Algorithms

38 38 RAID – Redundant Array of Independent Disks n Logical view: Set of physical disk drives viewed by the operating system as a single logical drive n Physical view: Data are distributed across the physical drives of an array n Redundant disk capacity is used to store parity or redundant information n Why RAID? u Reliability u Performance

39 39 RAID 0 (non-redundant) strip 0 strip 4 strip 8 strip 12 strip 1 strip 5 strip 9 strip 13 strip 2 strip 6 strip 10 strip 14 strip 3 strip 7 strip 11 strip 15

40 40 Data Mapping for RAID Level 0 Array strip 0 strip 4 strip 8 strip 12 strip 1 strip 5 strip 9 strip 13 strip 2 strip 6 strip 10 strip 14 strip 3 strip 7 strip 11 strip 15 Physical Disk 0 Physical Disk 1 Physical Disk 2 Physical Disk 3 strip 0 strip 1 strip 2 strip 3 strip 4 strip 15 strip 14 strip 13 strip 12 strip11 strip 10 strip 9 strip 8 strip 7 strip 6 strip 5 Array Management Software A single logical disk drive A Set of physical disk drives

41 41 RAID 0 (nonredundant)

42 42 RAID 1 (mirrored)

43 43 RAID 2 (redundancy through Hamming code)

44 44 RAID 3 (bit-interleaved parity)

45 45 RAID 4 (block-level parity)

46 46 RAID 5 (block-level distributed parity)

47 47 RAID 6 (dual redundancy)

48 48 Disk Cache n Buffer in main memory for disk sectors n Contains a copy of some of the sectors on the disk

49 49 Least Recently Used n The block that has been in the cache the longest with no reference to it is replaced n The cache consists of a stack of blocks n Most recently referenced block is on the top of the stack n When a block is referenced or brought into the cache, it is placed on the top of the stack

50 50 Least Recently Used n The block on the bottom of the stack is removed when a new block is brought in n Blocks don’t actually move around in main memory n A stack of pointers is used

51 51 Least Frequently Used n The block that has experienced the fewest references is replaced n A counter is associated with each block n Counter is incremented each time block accessed

52 52 Least Frequently Used n Block with smallest count is selected for replacement n Some blocks may be referenced many times in a short period of time and the reference count is misleading

53 53 Disk Cache Performance

54 54 Disk Cache Performance


Download ppt "1 IO Management and Disk Scheduling Chapter 11. 2 Categories of I/O Devices n Human readable u used to communicate with the user u video display terminals."

Similar presentations


Ads by Google