27
1 Copyright Notice: This file is only used for tutorial purpose. Any materials are copyrighted by their original authors, explicitly or implicitly. 版权申明 此套幻灯片仅用于教学目的。其中使用的材料来源于多个方面,不论是受知识产权保护或自由使用的材料,明确说明或隐含表达, 其版权均属于材料的原始作者,特此申明。如有疑问,请联络:[email protected] I/O Management and I/O Management and Disk Scheduling Disk Scheduling Coverage Ch11 Input/Output Management and Disk Scheduling 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 2 Lecture 10 Lecture 10- I/O I/O Manag Manag . and Disk Scheduling . and Disk Scheduling Learning objectives Identify the abstracting process from physical hardware to virtual devices conducted by OS Master some basic ideas and techniques for I/O management and disk scheduling Topics Abstracting device difference Buffering strategies Disk I/O and disk scheduling Disk cache RAID SPOOLing

Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

1

Copyright Notice: This file is only used for tutorial purpose. Any materials are copyrighted by their original authors, explicitly or implicitly.版权申明 此套幻灯片仅用于教学目的。其中使用的材料来源于多个方面,不论是受知识产权保护或自由使用的材料,明确说明或隐含表达,其版权均属于材料的原始作者,特此申明。如有疑问,请联络:[email protected]

I/O Management and I/O Management and Disk SchedulingDisk Scheduling

CoverageCh11 Input/Output Management

and Disk Scheduling

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

2

Lecture 10Lecture 10--I/O I/O ManagManag. and Disk Scheduling. and Disk Scheduling

Learning objectivesIdentify the abstracting process from physical hardware to virtual devices conducted by OS Master some basic ideas and techniques for I/O management and disk scheduling

TopicsAbstracting device differenceBuffering strategiesDisk I/O and disk scheduling Disk cacheRAIDSPOOLing

Page 2: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

2

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

3

Diversity in I/O DevicesDiversity in I/O Devices———— Data rate Data rate

May be different in several orders of magnitude for various devices

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

4

Diversity in I/O DevicesDiversity in I/O Devices———— ApplicationsApplications

The OS has to support variety of applications or utilities

Disk used to store files requires file management softwareDisk used to store virtual memory pages needs special hardware and softwareThese applications have an impact on disk scheduling algorithms…

Page 3: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

3

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

5

Diversity in I/O DevicesDiversity in I/O Devices———— OthersOthersUnit of transfer

Data may be transferred as a stream of bytes for a terminal or in larger blocks for a disk

Data representationEncoding schemes

Error conditionsDevices respond to errors differently

Complexity of control

It is difficult to develop a general, consistent solution

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

6

OS Design IssuesOS Design IssuesEfficiency

Problem: Most I/O devices are extremely slowercompared to main memory

Solution: Use of multiprogramming allows for some processes to be waiting on I/O while another process executes

GeneralityProblem: Diversity in every aspects

Solution: Use a hierarchical, modular approach to the design of the I/O function

Hide most of the details of device I/O in lower-level routinesUpper levels see devices in general terms such as read, write, open, close, lock, unlock

Page 4: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

4

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

7

High-level operation by

using device ID

I/O instructions and

buffering

Interrupt handling and

status reporting

Translating symbolic

filename into ID

Dealing with logical file

structure and user’s

commends

Translation from logical structure to physical one

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

8

Evolution of the I/O FunctionEvolution of the I/O Function

Processor directly controls peripheral devicesController or I/O module is added

Processor uses programmed I/O without interruptsProcessor does not need to handle details of external devices

Page 5: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

5

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

9

Evolution of the I/O FunctionEvolution of the I/O Function

Controller or I/O module with interruptsProcessor does not spend time waiting for an I/O operation to be performed

Direct Memory AccessBlocks of data are moved into memory without involving the processorProcessor involved at beginning and end only

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

10

Evolution of the I/O FunctionEvolution of the I/O Function

I/O module is with a separate processorI/O computer

I/O module has its own local memory

Notes:1. For the last three schemes, the DMA is appropriate2. As one proceeds along this evolutionary path, more and more of

the I/O function is performed without processor involvement3. With the last two steps, a major change occurs with the

introduction of the concept of an I/O channel capable of executing program

Page 6: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

6

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

11

Techniques for I/OTechniques for I/OProgrammed I/O

Process is busy-waiting for the operation to completeInterrupt-driven I/O

I/O command is issuedProcessor continues executing instructionsI/O module sends an interrupt when done

Direct Memory Access (DMA)DMA module controls exchange of data between main memory and the I/O deviceProcessor interrupted only after entire block has been transferred

In most computer systems, DMA is the dominant form of transfer that must be supported by the OS

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

12

Direct Memory Access (DMA)Direct Memory Access (DMA)Takes control of the system from the CPU to transfer data to and from memory over the system busTypically, the DMA module uses the bus only when the processor does not need itCycle stealing is used to transfer data on the system bus when conflicted

The CPU pauses one bus cycleNo interrupts occur

Do not save context

Page 7: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

7

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

13

Direct Memory Access (DMA)Direct Memory Access (DMA)

Cycle stealing causes the CPU to execute more slowly

• But, for a multiple-word I/O transfer, DMA is far more efficient than interrupt-driven or programmed I/O

• 2 interrupts only• No context storing/recovering

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

14

DMA ConfigurationsDMA Configurations

In configuration (a), all modules share the system bus, each transfer of a word consumes two bus cycles Number of required bus cycles can be cut by integrating the DMA and I/O functionsDedicate bus between DMA and I/O module

Page 8: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

8

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

15

Two Types of I/O Two Types of I/O

Block-orientedInformation is stored in fixed sized blocksTransfers are made a block at a time

Used for disks and tapes

Stream-orientedTransfer information as a stream of bytes

Used for terminals, printers, communication ports, mouse, and most other devices that are not secondary storage

It is sometimes convenient to perform input transfers in advance of requests being made and to perform output transfers some time after the request is made

BUFFERING

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

16

No BufferingNo Buffering

Reasons for bufferingProcesses have to wait for I/O to complete before proceedingCertain pages must remain in main memory during I/O, Otherwise, the risk of single-process deadlock

Executing time = T + CHere T stands for I/O time, and C the processing time

Page 9: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

9

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

17

Single BufferingSingle Buffering

Operating system assigns a buffer in the system area of main memory for an I/O requestBlock-oriented

Input transfers made to buffer (T )Block moved to user space when needed (M )Processes the data (C) while another block is moved into the buffer, simultaneously

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

18

Single BufferSingle Buffer

Block-orientedUser process can process one block of data while next block is read inSwapping can occur since input is taking place in system memory, not in user process spaceOperating system keeps track of assignment of system buffers to user processes

Stream-orientedUse producer/consumer model

Executing time = max(T, C) + M

Page 10: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

10

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

19

Double BufferDouble Buffer

Use two system buffers instead of oneA process can transfer data to or from one buffer while the operating system empties or fills the other buffer

Executing time = max(T, C)

Question What if we use a double sized buffer here

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

20

Circular BufferCircular Buffer

More than two buffers are usedOrganized as a circular bufferUsed when there are rapid bursts of I/O operations

Page 11: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

11

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

21

Remarks on BufferingRemarks on BufferingExample: watering troughBuffering is a technique that smoothing outpeaks in I/O demandThe more buffer size, the more effective and efficient, but the more complex in controlIt is hard to catch up with a process if its average I/O demand exceeds the I/O device ability

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

22

Disk Performance ParametersDisk Performance Parameters

Seek timetime it takes to position the head at the desired track

Rotational delay or rotational latencytime its takes for the beginning of the sector to reach the head

Access timeSum of seek time and rotational delayIt means the time it takes to get in position to read or write

Average access time = Ts+1/(2r)+b/(rN)Where, Ts: average seek time, r: rotation speed, in revolutions per second, N: number of

bytes on a track, and b: number of bytes to be transferred

Page 12: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

12

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

23

ExampleExample

Seek time is the reason for differences in performanceFor a single disk there will be a number of I/O requestsIf requests are selected randomly, we will get the worst possible performanceRearrange the disk accessing requests can improve the efficiency. This results in disk schedulingThe main gain comes from reduction of seek time

Random AccessingSequential organization

For any one track: average seek time 10 msaverage rotational delay 3 msreading 1 sector 0.01875 ms

subtotal 13.01875 msTotal reading time = 2560 × 13.01875 = 33328 ms

For the 1st track: average seek time 10 msaverage rotational delay 3 msreading 320 sectors 6 ms

subtotal 19 msTotal reading time = 10 + 8 × (3 + 6) = 82 ms

e.g. Average seek time 10 ms, rotate at 10000 rpm (average rotational delay = 3 ms) , 512 byte per sectors with 320 sectors per track, total 2560 sectors (320 × 8) to access

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

24

Disk SchedulingDisk Scheduling

MotivationsThe speed of disk drops behind that of memory significantlyThe disk accessing influences the system performance significantlyAs before, we can use scheduling policy to meet some criteria

The vital part of performance can be traced to seek time

Page 13: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

13

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

25

Disk Scheduling Policies Disk Scheduling Policies --FIFOFIFO

First-in, first-out (FIFO)Process request sequentiallyFair to all processesApproaches random scheduling in performance if there are many processesStatic sequence equals to the dynamic one

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

26

Disk Scheduling Policies Disk Scheduling Policies ––PriorityPriority--basedbasedPriority

Goal is not to optimize disk use but to meet other objectivesThe control of scheduling is outside of the control of disk management software (depends on the determination of priority)

Page 14: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

14

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

27

Disk Scheduling Policies Disk Scheduling Policies --LIFOLIFO

Last-in, first-out (LIFO)Good for transaction processing systems

The device is given to the most recent user so there should be little arm movement

Localization characteristic guarantees better throughput and shorter queuePossibility of starvation WHEN???

These strategies are based solely on attributes of the queueor the requester. If we know current track position, we can select following strategies

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

28

Disk Scheduling Policies Disk Scheduling Policies --SSTFSSTF

Shortest Service Time First (SSTF)Select the disk I/O request that requires the least movement of the disk arm from its current positionAlways choose the minimum Seek timeLocal optimum does not mean global optimum, i.e. minimum seek time does not guarantee minimum average seek time WHY?? (Hint: distribution of requests)Starvation ???

Page 15: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

15

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

29

Disk Scheduling Policies Disk Scheduling Policies --SCANSCAN

SCANArm moves in one direction only, satisfying all outstanding requests until it reaches the last track in that direction or there is no requests in this directionThen, direction is reversedManage to be fair to all requests in a dynamic setting

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

30

Disk Scheduling Policies Disk Scheduling Policies -- CC--SCANSCAN

C-SCANRestricts scanning to one direction onlyWhen the last track has been visited in one direction, the arm is returned to the opposite end of the disk and the scan begins againManage to be fair to all requests, rather than requests near both ends in SCAN

Page 16: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

16

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

31

Disk Scheduling PoliciesDisk Scheduling Policies

N-step-SCANSegments the disk request queue into subqueues of length NSubqueues are processed one at a time, using SCANNew requests added to other queues when a queue is processed

FSCANTwo queuesNew request is put into the other queue to process further

To address the arm stickiness issue

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

32

Disk Scheduling AlgorithmsDisk Scheduling Algorithms

Note: ought to asses each strategy in a dynamic setting

Page 17: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

17

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

33

Disk CacheDisk CacheBuffer in main memory for disk sectorsContains a copy of some of the sectors on the diskRelies on the localization characteristicsDesign issues

Data delivery to requesting processes, can be divided into

Data deliveryPointer delivery

Entry replacement in disk cache

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

34

Least Recently Used (LRU)Least Recently Used (LRU)

The block that has been in the cache the longestwithout reference to it is replacedThe cache logically consists of a stack of blocks

Most recently referenced block is on the top of the stackWhen a block is referenced or brought into the cache, it is placed on the top of the stackThe block on the bottom of the stack is removed when a new block is brought in

Blocks don’t actually move around in main memory, rather a stack of pointers is used

Page 18: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

18

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

35

Least Frequently Used (LFU)Least Frequently Used (LFU)

The block that has experienced the fewestreferences is replaced (recently used does not mean frequently used)

A counter is associated with each blockThe counter is incremented each time the block is accessedBlock with smallest count is selected for replacement

Syndrome Some blocks may be referenced many times in a short period of time and then not needed any more

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

36

Modified LFUModified LFU

Frequency-Based ReplacementCombined with LRUDepress those speculators effectively, butHurt newcomer

Set up rooms to give new comers opportunity of growing up

Page 19: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

19

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

37

RAIDRAIDStands for Redundant Array of Independent DisksThe unique contribution is to address effectively the need for redundancy. This breaks the limitation of one storage device

To improve performance and reliabilityArrays of disks that operate independently and in parallelTypically, 7 levels (0~6)Common characteristics

Set of physical disk drives are viewed as a single driveData are distributed across the physical drives of an arrayRedundant disk capable of error tolerance

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

38

RAID LevelsRAID Levels

Page 20: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

20

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

39

RAID0RAID0

Not really belongs to RAID since no redundant dataUsed by supercomputers for its efficiencySettles down the concept stripe for RAID

Data are striped across disksThis yields high performance due to the parallel accessing to independent disksHigh throughput reduces the length of request queue

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

40

RAID0 IllustrationRAID0 Illustration

Page 21: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

21

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

41

RAID1RAID1(mirrored)(mirrored)

Differs from RAID level 2 through 6 in the way in which redundancy is achieved (mirrored vs. parity calculations)Pros

Read request can be served by either of the two disks (faster one)Parallel stripes updated for write request (slower one) Availability is good, rather than the failure recovery ability

Conscost

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

42

RAID2RAID2(Hamming Coded)(Hamming Coded)

All member disks participate in the execution of every I/O requestStripes are very small (e.g. single byte or word)Hamming code is used for error-correction, which is able to correct single-bit errors and detect double-bit errorsThe number of redundant disks is proportional to the log of the number of data disksRAID 2 would only be an effective choice in an environment in which many disk errors occur. For reliable disks, RAID 2 is overkill

Page 22: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

22

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

43

RAID 3RAID 3(bit(bit--interleaved parity)interleaved parity)

Similar to RAID 2 butOnly ONE redundant disk is neededUsing parity bit rather than error-correcting code

Data reconstruction using XORp(b) = b0 ⊕ b1 ⊕ b2 ⊕ b3

b1 = p(b) ⊕ b0 ⊕ b2 ⊕ b3A technology used in RAID3 through RAID6

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

44

RAID 4RAID 4(block(block--level parity)level parity)

Independent accessSuitable for applications that require high I/O request rateRelatively large stripesA bit-by-bit parity stripeTwo reads and two writes are needed for one stripe write

Before: X4 (i) = X0 (i) ⊕ X1 (i) ⊕ X2 (i) ⊕ X3 (i)After writing X1: X’4 (i) = X0 (i) ⊕ X’1 (i) ⊕ X2 (i) ⊕ X3 (i)

= X0 (i) ⊕ X’1 (i) ⊕ X2 (i) ⊕ X3 (i) ⊕ X1 (i) ⊕ X1 (i) = X4 (i) ⊕ X’1 (i) ⊕ X1 (i)

Page 23: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

23

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

45

RAID 5 RAID 5 (block(block--level distributed parity)level distributed parity)

Similar to RAID 4 except that RAID 5 distributes the parity stripes across all disksAvoid the potential I/O bottleneck found in RAID 4

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

46

RAID 6RAID 6(dual redundancy coded)(dual redundancy coded)

Two kinds of parity schemes (say, P and Q) are employedThese two parity stripes are storied in different disksData reconstruction can be achieved when two disks failPros. Excellent availabilityCons. Serious write penalty

Page 24: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

24

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

47

RAID FamilyRAID FamilyRAID 0: Striping RAID 1: Mirroring RAID 3: Striping with Dedicated Parity RAID 5: Striping with Rotational Parity RAID 0+1: Striping and Mirroring RAID 10: Spanning RAID 1 RAID 30: Spanning RAID 3 RAID 50: Spanning RAID 5Please refer to reading materials at our ftp site

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

48

SPOOLingSPOOLing

Stands for SimultaneousPeripheral Operations On-Line, a technique to simulate I/O controller by a processEnable a private device to be a sharable onComponents

Input Pool and Output Pool Two large chunks of space on diskInput and Output Buffers Buffersin memoryInput Process (PI) and Output Process (PO) simulate I/O controller

PI PO

Input buffer

Output buffer

Input Pool

Output Pool

Page 25: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

25

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

49

UNIX SVR4 I/OUNIX SVR4 I/OEvery device is treated as a special fileFile system acts as a uniform interface between application program and devicesTwo kinds of I/O

BufferedSystem buffer cache – DMA (memory-to-memory) Character queues – P/C model

Unbuffered – DMA + memory lock

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

50

Buffer Cache OrganizationBuffer Cache Organization

Is essentially a disk cacheUses a memory-memory DMA schemeAll buffers should be on the free list or on the driver I/O queue list

Page 26: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

26

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

51

Linux I/OLinux I/O

Disk SchedulingMerge requests to adjacent sectors to oneLinus Elevator (before V 2.6)For V 2.6

The deadline I/O scheduler to keep the disk as busy as possibleThe anticipatory I/O scheduler Using principle of locality, force the scheduling system to delay for a short period of time after satisfying a read request, to see if a new nearbyrequest is made

It is evidenced that the anticipatory I/O scheduler can provide a dramatic improvement

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

52

Windows 2000 I/OWindows 2000 I/OFour modules in I/O managerSynchronous and asynchronous I/OSignaling techniques for asynchronous I/O (at the end of I/O)

Signaling a device kernel object (for onerequest)Signaling an event kernel object (for multiple requests)Alterable I/O I/O completion ports

Soft RAID (RAID 1 and RAID 5)

Page 27: Ch11 IO Management and Disk Scheduling - pudn.comread.pudn.com/downloads55/ebook/189854/Slides/Ch11_IO...5 2005-11-30 Input/Output Management and Disk Scheduling (Ch11) 9 Evolution

27

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

53

SummarySummaryEfficiency and generality are two key points in I/O system designThe I/O function is generally organized in a hierarchical manner, from top to bottom, abstract to concreteA key aspect of I/O is the use of buffers that are controlled by I/O utilities. Buffer smoothes out the differences between the internal speeds of the computer system and the speeds of I/O devicesDisk I/O contributes to the overall system performance. Two of the most widely used approaches to improve disk I/O performance are disk scheduling and disk cache

2005-11-30 Input/Output Management and Disk Scheduling (Ch11)

54

Quiz and HomeworkQuiz and Homework

QuizWhat items of information about a task might be useful in real-time scheduling?

Homeworkp. 514 Problem 11.3, 11.12

Due: Next Wednesday Morning