Chapter 4 Device Management and Disk Scheduling DEVICE MANAGEMENT Content I/O device overview I/O...
-
Upload
sonia-blizzard -
Category
Documents
-
view
239 -
download
0
Transcript of Chapter 4 Device Management and Disk Scheduling DEVICE MANAGEMENT Content I/O device overview I/O...
Chapter 4Chapter 4
Device Management and Disk Device Management and Disk SchedulingScheduling
DEVICE MANAGEMENTDEVICE MANAGEMENT
ContentContent
I/O device overviewI/O device overview
I/O organization and architectureI/O organization and architecture
I/O bufferingI/O buffering
Disk schedulingDisk scheduling
RAIDRAID
NotesNotes: Difficult to develop a general, consistent : Difficult to develop a general, consistent
solution. Just a generally discuss.solution. Just a generally discuss.
DEVICE MANAGEMENTDEVICE MANAGEMENT
4.1 I/O Devices (P452)4.1 I/O Devices (P452)
Three categories:Three categories:
Human Readable DevicesHuman Readable Devices
٭ Such as Keyboard, Mouse, Display, Printer and so Such as Keyboard, Mouse, Display, Printer and so
on;on;
Machine Readable DevicesMachine Readable Devices
٭ Such as Actuator, Controller, Sensor, Tape Drive, Such as Actuator, Controller, Sensor, Tape Drive,
Disk Drive and so on;Disk Drive and so on;
Communication DevicesCommunication Devices
٭ Such as Modem, Network Adapter and so on.Such as Modem, Network Adapter and so on.
DEVICE MANAGEMENTDEVICE MANAGEMENT
ClassifyClassify
There are many sorting standard. There are many sorting standard. E.g.E.g.
data ratesdata rates
DEVICE MANAGEMENTDEVICE MANAGEMENT
Data Rates of DevicesData Rates of Devices
DEVICE MANAGEMENTDEVICE MANAGEMENT
Differences in I/O DevicesDifferences in I/O Devices
ApplicationApplication٭ Disk used to store files requires Disk used to store files requires file-management file-management
softwaresoftware٭ Disk used to store virtual memory pages needs Disk used to store virtual memory pages needs
special hardware and softwarespecial hardware and software to support it to support it٭ Terminal used by system administrator may have Terminal used by system administrator may have
a higher priority than an ordinary usera higher priority than an ordinary user
DEVICE MANAGEMENTDEVICE MANAGEMENT
Differences in I/O DevicesDifferences in I/O Devices
Complexity of controlComplexity of control
Unit of transferUnit of transfer
٭ Data may be transferred as a stream of bytes for a Data may be transferred as a stream of bytes for a terminal or in larger blocks for a diskterminal or in larger blocks for a disk
Data representationData representation
٭ Encoding schemesEncoding schemes
Error conditionsError conditions
٭ Devices respond to errors differentlyDevices respond to errors differently
DEVICE MANAGEMENTDEVICE MANAGEMENT
4.2 Techniques for Performing I/O 4.2 Techniques for Performing I/O (p453 11.2)(p453 11.2)
Cyclic Test /Programmed Cyclic Test /Programmed
Interrupt-DrivenInterrupt-Driven
DMA ControlDMA Control
DEVICE MANAGEMENTDEVICE MANAGEMENT
Programmed I/O --P29.Programmed I/O --P29.
I/O module performs the action, not I/O module performs the action, not the processorthe processor
Sets appropriate bits in the I/O Sets appropriate bits in the I/O status registerstatus register
No interrupts occurNo interrupts occurProcessor checks status until Processor checks status until
operation is completeoperation is completeBusy-waitsBusy-waits
DEVICE MANAGEMENTDEVICE MANAGEMENT
Interrupt-Driven I/OInterrupt-Driven I/O
Processor is interrupted when I/O Processor is interrupted when I/O module ready to exchange datamodule ready to exchange data
Processor is free to do other workProcessor is free to do other work
No needless waitingNo needless waiting
Consumes a lot of processor time Consumes a lot of processor time because because every wordevery word read or written read or written passes through the processorpasses through the processor
DEVICE MANAGEMENTDEVICE MANAGEMENT
Direct Memory AccessDirect Memory Access
Transfers a block of data directly Transfers a block of data directly to or from memoryto or from memory
An interrupt is sent when the An interrupt is sent when the task is completetask is complete
The processor is only involved at The processor is only involved at the beginning and end of the the beginning and end of the transfertransfer
DEVICE MANAGEMENTDEVICE MANAGEMENT
Evolution of the I/O FunctionEvolution of the I/O Function
Processor directly controls a peripheral deviceProcessor directly controls a peripheral device
Controller or I/O module is addedController or I/O module is added
٭ Processor uses programmed I/O without Processor uses programmed I/O without
interruptsinterrupts
٭ Processor does not need to handle details of Processor does not need to handle details of
external devicesexternal devices
DEVICE MANAGEMENTDEVICE MANAGEMENT
Evolution of the I/O FunctionEvolution of the I/O Function
Controller or I/O module with interruptsController or I/O module with interrupts
٭ Processor does not spend time waiting for an I/O Processor does not spend time waiting for an I/O
operation to be performedoperation to be performed
Direct Memory AccessDirect Memory Access
٭ Blocks of data are moved into memory without Blocks of data are moved into memory without
involving the processorinvolving the processor
٭ Processor involved at beginning and end onlyProcessor involved at beginning and end only
DEVICE MANAGEMENTDEVICE MANAGEMENT
Evolution of the I/O FunctionEvolution of the I/O Function
I/O channelI/O channel٭ I/O module is a separate processor. Its with a I/O module is a separate processor. Its with a
specialized instruction set tailored(specialized instruction set tailored( 适合适合 ) for ) for I/O.I/O.
I/O processorI/O processor٭ I/O module has its own local memoryI/O module has its own local memory٭ Its a computer in its own rightIts a computer in its own right
DEVICE MANAGEMENTDEVICE MANAGEMENT
Direct Memory AccessDirect Memory Access
Takes control of the system from the CPU to Takes control of the system from the CPU to transfer data to and from memory over the system transfer data to and from memory over the system busbus
Cycle stealingCycle stealing is used to transfer data on the is used to transfer data on the system bussystem bus
The instruction cycle is suspended so data can be The instruction cycle is suspended so data can be transferredtransferred
The CPU pauses one bus cycleThe CPU pauses one bus cycleNo interrupts occur while cycle stealingNo interrupts occur while cycle stealing
٭ Do not save contextDo not save context
DEVICE MANAGEMENTDEVICE MANAGEMENT
Direct Memory Access Direct Memory Access
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMADMA
The Starting location in memory to read from or The Starting location in memory to read from or
write to, communicated on the data lines and stored write to, communicated on the data lines and stored
by the DMA module in its by the DMA module in its address registeraddress register..
The number of words to be read or written, again The number of words to be read or written, again
communicated via the data lines and stored in the communicated via the data lines and stored in the
data count registerdata count register..
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMA and Interrupt BreakpointDMA and Interrupt Breakpoint
The processor is suspended The processor is suspended just before it needs to just before it needs to use the bususe the bus. The DMA unit then transfers one word . The DMA unit then transfers one word and returns control to the processor.and returns control to the processor.
Cycle stealing causes the CPU to execute more Cycle stealing causes the CPU to execute more slowly.slowly.
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMA and Interrupt BreakpointDMA and Interrupt Breakpoint
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMADMA
Number of required bus cycles can be cut by Number of required bus cycles can be cut by
integrating the DMA and I/O functionsintegrating the DMA and I/O functions
Path between DMA module and I/O module that Path between DMA module and I/O module that
does not include the system busdoes not include the system bus
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMADMA
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMADMA
DEVICE MANAGEMENTDEVICE MANAGEMENT
DMADMA
DEVICE MANAGEMENTDEVICE MANAGEMENT
4.3 Operating System Design Issues4.3 Operating System Design Issues
EfficiencyEfficiency٭ Most I/O devices extremely slow compared to Most I/O devices extremely slow compared to
main memorymain memory٭ Use of Use of multiprogrammingmultiprogramming allows for some allows for some
processes to be waiting on I/O while another processes to be waiting on I/O while another process executesprocess executes
٭ I/O cannot keep up with processor speedI/O cannot keep up with processor speed٭ Swapping Swapping is used to bring in additional ready is used to bring in additional ready
processes which is an I/O operationprocesses which is an I/O operation٭ Thus, a major effort in I/O design has been Thus, a major effort in I/O design has been
schemes for improving the efficiency of I/O. schemes for improving the efficiency of I/O. e.g. disk I/Oe.g. disk I/O
DEVICE MANAGEMENTDEVICE MANAGEMENT
Operating System Design IssuesOperating System Design Issues
GeneralityGenerality٭ Desirable to handle all I/O devices in a Desirable to handle all I/O devices in a uniform uniform
mannermanner٭ Hide most of the details of device I/O in lower-Hide most of the details of device I/O in lower-
level routines so that processes and upper levels level routines so that processes and upper levels see devices in general terms such as read, write, see devices in general terms such as read, write, open, close, lock, unlockopen, close, lock, unlock
Struct general_op{Struct general_op{
int (*read)(…)int (*read)(…)
int (*write)(…)int (*write)(…)
};};
driver1:driver1:Struct general_op dev_op={ dev1_read,Struct general_op dev_op={ dev1_read,
dev1_writedev1_write};};
driver2:driver2:Struct general_op dev_op={ dev2_read,Struct general_op dev_op={ dev2_read,
dev2_writedev2_write};};
Gen_read(fd,…)Gen_read(fd,…){{ dev_op=dev_op=mapmap(fd);(fd);
dev_op->read(…);dev_op->read(…);}}
DEVICE MANAGEMENTDEVICE MANAGEMENT
Logical Structure of the I/O Function (e.g. Logical Structure of the I/O Function (e.g. Hierarchical p458)Hierarchical p458)
Logical I/OLogical I/O٭ Is concerned with general I/O function, and is not Is concerned with general I/O function, and is not
concerned with the detail of actually controlling. concerned with the detail of actually controlling. E.g. read, write…E.g. read, write…
Device I/ODevice I/O
٭ Implement I/O instructions, channel commands, Implement I/O instructions, channel commands, and controller orders. May use buffering and controller orders. May use buffering techniques.techniques.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Logical Structure of the I/O FunctionLogical Structure of the I/O Function
Scheduling and ControlScheduling and Control٭ This is the level of software that actually interacts This is the level of software that actually interacts
with the I/O module and the device hardware.with the I/O module and the device hardware.
DEVICE MANAGEMENTDEVICE MANAGEMENT
DEVICE MANAGEMENTDEVICE MANAGEMENT
4.44.4 I/O Buffering(p460)I/O Buffering(p460)
Reasons for bufferingReasons for buffering٭ Processes must wait for I/O to complete before Processes must wait for I/O to complete before
next proceeding. E.g: write to device (next proceeding. E.g: write to device (busy busy waiting or suspension on an interruptwaiting or suspension on an interrupt))
٭ Certain pages of the I/O request process must Certain pages of the I/O request process must remain in main memory during I/O.remain in main memory during I/O.
٭ Single-process deadlockSingle-process deadlock
DEVICE MANAGEMENTDEVICE MANAGEMENT
I/O BufferingI/O Buffering
Block-orientedBlock-oriented٭ Information is stored in fixed sized blocksInformation is stored in fixed sized blocks٭ Transfers are made a block at a timeTransfers are made a block at a time٭ Used for disks and tapesUsed for disks and tapes
Stream-orientedStream-oriented
٭ Transfer information as a stream of bytesTransfer information as a stream of bytes٭ Used for terminals, printers, communication Used for terminals, printers, communication
ports, mouse, and most other devices that are not ports, mouse, and most other devices that are not secondary storagesecondary storage
DEVICE MANAGEMENTDEVICE MANAGEMENT
Single BufferSingle Buffer
Operating system assigns a buffer in the Operating system assigns a buffer in the system system portionportion of main memory for an I/O request of main memory for an I/O request
Block-orientedBlock-oriented٭ Input transfers made to bufferInput transfers made to buffer٭ Block moved to user space when neededBlock moved to user space when needed٭ Another block is moved into the bufferAnother block is moved into the buffer
▪ Read aheadRead ahead
DEVICE MANAGEMENTDEVICE MANAGEMENT
DEVICE MANAGEMENTDEVICE MANAGEMENT
Single BufferSingle Buffer
Block-orientedBlock-oriented
٭ User process can process one block of data while User process can process one block of data while next block is read innext block is read in
٭ Swapping can occur since input is taking place in Swapping can occur since input is taking place in system memory, not user memorysystem memory, not user memory
٭ Operating system keeps track of assignment of Operating system keeps track of assignment of system buffers to user processessystem buffers to user processes
DEVICE MANAGEMENTDEVICE MANAGEMENT
Single BufferSingle Buffer
Stream-orientedStream-oriented٭ Used a line at time.Used a line at time.٭ User input from a terminal is one line at a time wiUser input from a terminal is one line at a time wi
th carriage return signaling(th carriage return signaling( 回车信号回车信号 ) the end o) the end of the line.f the line.
٭ Output to the terminal is one line at a time.Output to the terminal is one line at a time.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Single BufferSingle Buffer
Performance comparison with no bufferingPerformance comparison with no buffering
٭ T: the time to input a blockT: the time to input a block
٭ C: the time to computationC: the time to computation
٭ M: the time to move dataM: the time to move data
٭ Max [C,T]+M and T+CMax [C,T]+M and T+C
DEVICE MANAGEMENTDEVICE MANAGEMENT
Double BufferDouble Buffer
Use two system buffers instead of one.Use two system buffers instead of one.
A process can transfer data to or from one buffer A process can transfer data to or from one buffer while the operating system empties or fills the othwhile the operating system empties or fills the other buffer.er buffer.
Performance: max(C,T).Performance: max(C,T).
DEVICE MANAGEMENTDEVICE MANAGEMENT
Circular BufferCircular Buffer
More than two buffers are used.More than two buffers are used.
Each individual buffer is one unit in a circular Each individual buffer is one unit in a circular buffer.buffer.
Used when I/O operation must keep up with Used when I/O operation must keep up with process.process.
DEVICE MANAGEMENTDEVICE MANAGEMENT
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk and Disk Scheduling(p463)Disk and Disk Scheduling(p463)
The speed of processors and main memory has The speed of processors and main memory has far outstripped that for disk access.far outstripped that for disk access.
The performance of disk storage subsystem is of The performance of disk storage subsystem is of vital concern.vital concern.
How to improve the performance of disk?How to improve the performance of disk?
٭ General methodsGeneral methods٭ Special methodsSpecial methods
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk StructureDisk Structure
HeadersHeaders
CylindersCylinders
TracksTracks
SectorsSectors
Capability=headers*cylinders*sectors*byte per Capability=headers*cylinders*sectors*byte per sectorsector
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Performance ParametersDisk Performance Parameters
To read or write, the disk head must be positioned To read or write, the disk head must be positioned at the desired track and at the beginning of the at the desired track and at the beginning of the desired sectordesired sector
Seek time Seek time ٭ movable-head system or fixed-head systemmovable-head system or fixed-head system٭ Time it takes to position the head at the desired Time it takes to position the head at the desired
tracktrackRotational delay or rotational latencyRotational delay or rotational latency
٭ Time its takes for the beginning of the sector to Time its takes for the beginning of the sector to reach the headreach the head
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Performance ParametersDisk Performance Parameters
Data transfer timeData transfer timeWait for device or channelWait for device or channel
DEVICE MANAGEMENTDEVICE MANAGEMENT
RPS (Rotational Positional Sensing)RPS (Rotational Positional Sensing)
When seek command has been issued, the When seek command has been issued, the channel is released to handle other I/O channel is released to handle other I/O operations.operations.
RPS miss. Must rotate again and reconnect RPS miss. Must rotate again and reconnect again.again.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Seek TimeSeek Time
Ts Ts = = m×nm×n ++ ss
n=number of tracks traversedn=number of tracks traversed
m=constant that depends on the disk drivem=constant that depends on the disk drive
s=startup times=startup time
DEVICE MANAGEMENTDEVICE MANAGEMENT
Rotational DelayRotational Delay
Tr Tr = = 1/(2r)1/(2r)
r=rotation speed, in revolutions per secondr=rotation speed, in revolutions per second
Example:Example:
r=3600rpm, Tr=1/120=8.3msr=3600rpm, Tr=1/120=8.3ms
r=300rpm, Tr=1/10=100msr=300rpm, Tr=1/10=100ms
DEVICE MANAGEMENTDEVICE MANAGEMENT
Transfer TimeTransfer Time
T T = = bb // (r×N)(r×N)
b=number of bytes to be transferredb=number of bytes to be transferred
N=number of bytes on a trackN=number of bytes on a track
r=rotation speed,in revolutions per secondr=rotation speed,in revolutions per second
DEVICE MANAGEMENTDEVICE MANAGEMENT
Total Average Access TimeTotal Average Access Time
Ta=Ts+Tr+TTa=Ts+Tr+T
DEVICE MANAGEMENTDEVICE MANAGEMENT
A Timing ComparisonA Timing Comparison
Seek time: 20msSeek time: 20ms
Transfer rate: 1MB/sTransfer rate: 1MB/s
r=3600rpmr=3600rpm
512byte per sector512byte per sector
32 sector per track32 sector per track
Suppose to read 128k dataSuppose to read 128k data
DEVICE MANAGEMENTDEVICE MANAGEMENT
A Timing ComparisonA Timing Comparison
60*16k=960k<1MB/s60*16k=960k<1MB/s
Sequential organizationSequential organization
(20(20 ++ 8.38.3 ++ 16.7)16.7) ++ (8.3(8.3 ++ 16.7)×716.7)×7 == 220(ms)220(ms)
Randomly organizationRandomly organization
(20(20 ++ 8.38.3 ++ 0.5)×2560.5)×256 == 7373(ms)7373(ms)
DEVICE MANAGEMENTDEVICE MANAGEMENT
A Timing ComparisonA Timing Comparison
It is worthwhile to improve the I/O efficiency with It is worthwhile to improve the I/O efficiency with
purely random accesspurely random access to the disk to the disk
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
Seek time is the reason for differences in Seek time is the reason for differences in performance.performance.
For a single disk there will be a number of I/O For a single disk there will be a number of I/O requests.requests.
If requests are selected If requests are selected randomlyrandomly, we will get the , we will get the worst possible performance.worst possible performance.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
First-in, first-out (FIFO)First-in, first-out (FIFO)٭ Process request sequentially.Process request sequentially.٭ Fair to all processes.Fair to all processes.٭ Approaches random scheduling in performance Approaches random scheduling in performance
if there are many processes.if there are many processes.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
PriorityPriority٭ Goal is not to optimize disk use but to meet other Goal is not to optimize disk use but to meet other
objectives.objectives.٭ Short batch jobs may have higher priority.Short batch jobs may have higher priority.٭ Provide good interactive response time.Provide good interactive response time.
DEVICE MANAGEMENTDEVICE MANAGEMENT
FIFO (Starting at Track 100)FIFO (Starting at Track 100)
Next track accessed number of tracks traversed
55 45
58 3
39 19
18 21
90 72
160 70
150 10
38 112
184 146
Total seek length 498
Average seek length 55.3
5555 、、 5858 、、 3939 、、 1818 、、 9090 、、 160160 、、 150150 、、 3838 、、 184184
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
Last-in, first-outLast-in, first-out٭ The device is given to the most recent user so The device is given to the most recent user so
there should be little arm movementthere should be little arm movement٭ Possibility of starvation since a job may never Possibility of starvation since a job may never
regain the head of the lineregain the head of the line
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
Shortest Service Time FirstShortest Service Time First٭ Select the disk I/O request that requires the least Select the disk I/O request that requires the least
movement of the disk arm from its current movement of the disk arm from its current positionposition
٭ Always choose the minimum seek timeAlways choose the minimum seek time
DEVICE MANAGEMENTDEVICE MANAGEMENT
Next track Number of track traversed 90 10 58 32 55 3 39 16 38 1 18 20 150 132 160 10 184 24
Total seek length 248
Average seek length 27.6
5555、、 5858、、 3939、、 1818、、 9090、、 160160、、 150150、、 3838、、 118484
SSTFSSTF
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
SCANSCAN٭ Arm moves in one direction only, satisfying all Arm moves in one direction only, satisfying all
outstanding requests until it reaches the last outstanding requests until it reaches the last track in that directiontrack in that direction
٭ Direction is Direction is reversedreversed٭ Max delay:2T. T: a scan time from inner track to Max delay:2T. T: a scan time from inner track to
outer track outer track
DEVICE MANAGEMENTDEVICE MANAGEMENT
SCANSCAN
Next track Number of tracks traversed 150 50 160 10 184 24 90 94 58 32 55 3 39 16 38 1 18 20
total seek length 250
average seek length 27.8
5555、、 5858、、 3939、、 1818、、 9090、、 160160、、 150150、、 3838、、 118484
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
C-SCANC-SCAN٭ Restricts scanning to one direction onlyRestricts scanning to one direction only٭ When the last track has been visited in one directiWhen the last track has been visited in one directi
on, the arm is returned to the opposite end of the on, the arm is returned to the opposite end of the disk and the scan begins againdisk and the scan begins again
٭ Max delay: T+Smax. Smax is the maximum seek Max delay: T+Smax. Smax is the maximum seek time time
DEVICE MANAGEMENTDEVICE MANAGEMENT
CSCANCSCAN
Next track number of tracks traversed 150 50 160 10 184 24 18 166 38 20 39 1 55 16 58 3 90 32
total seek length 322
average seek length 35.8
5555、、 5858、、 3939、、 1818、、 9090、、 160160、、 150150、、 3838、、 118484
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Scheduling PoliciesDisk Scheduling Policies
N-step-SCANN-step-SCAN٭ Segments the disk request queue into subqueues oSegments the disk request queue into subqueues o
f length N.f length N.٭ Subqueues are process one at a time, using SCAN.Subqueues are process one at a time, using SCAN.
٭ New requests added to other queue when queue is New requests added to other queue when queue is processed.processed.
FSCANFSCAN
٭ Two queuesTwo queues٭ One queue is empty for new requestOne queue is empty for new request
DEVICE MANAGEMENTDEVICE MANAGEMENT
DEVICE MANAGEMENTDEVICE MANAGEMENT
Figure 11.7 P469Figure 11.7 P469
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID(p471)RAID(p471)
Redundant Array of Inexpensive DisksRedundant Array of Inexpensive Disks
Redundant Array of Independent DisksRedundant Array of Independent Disks
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID RAID
Using multiple disks can:Using multiple disks can:٭ I/O requests can be handled in I/O requests can be handled in parallelparallel..٭ The The reliabilityreliability of disk can be improved. of disk can be improved.
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID CharacteristicsRAID Characteristics
RAID is a set of physical disk drives viewed by the RAID is a set of physical disk drives viewed by the operating system as a single logical drive. operating system as a single logical drive. ((transparenttransparent))
Data are distributed across the physical drives of an Data are distributed across the physical drives of an array.(array.(distributeddistributed))
Redundant disk capacity is used to store parity Redundant disk capacity is used to store parity information, which guarantees data recoverability information, which guarantees data recoverability in case of disk failure.(in case of disk failure.(reliabilityreliability))
DEVICE MANAGEMENTDEVICE MANAGEMENT
Strip Unit(Strip Unit( 条化单元条化单元 ))
Data are striped across the available disks. (fig Data are striped across the available disks. (fig 11.9)The strips are mapped round robin to 11.9)The strips are mapped round robin to consecutive array members.consecutive array members.
Small strip: Small strip:
٭ Parallel Access TechniqueParallel Access Technique
Large strip: Large strip:
٭ Independent Access TechniqueIndependent Access Technique
DEVICE MANAGEMENTDEVICE MANAGEMENT
Verify MethodsVerify Methods
Mirror storageMirror storage
Hamming code(distance =n)Hamming code(distance =n)
Parity verify (distance =2)Parity verify (distance =2)
٭ X4(i)X4(i) == X3(i)+X2(i)+X1(i)+X0(i)X3(i)+X2(i)+X1(i)+X0(i)٭ X1(i)X1(i) = = X4(i)+X3(i)+X2(i)+X0(i)X4(i)+X3(i)+X2(i)+X0(i)٭ Distribute or centralize storageDistribute or centralize storage
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID CharacteristicsRAID Characteristics
Strip unit and storage methodStrip unit and storage method
Verify method and storage methodVerify method and storage method
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 0 (non-redundant)RAID 0 (non-redundant)
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 0RAID 0
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 0RAID 0
non-redundantnon-redundantnon-verifynon-verifydistributed storagedistributed storageLower reliabilityLower reliabilityLower costLower costParallel I/O accessParallel I/O access
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 1 (Mirrored)RAID 1 (Mirrored)
DistributedDistributedMirrored/redundancyMirrored/redundancyNo verifyNo verify
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 1RAID 1
Read performance is better than RAID 0 (choose the Read performance is better than RAID 0 (choose the seek time fewer disk to access)seek time fewer disk to access)
Write performance is worse than RAID 0Write performance is worse than RAID 0
Higher costHigher cost
Recovery is simpleRecovery is simple
It can have higher parallel performance than It can have higher parallel performance than RAID0RAID0
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 2 (Redundancy Through Hamming Code)RAID 2 (Redundancy Through Hamming Code)
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 2RAID 2
Strips are very small, as a single byte or word.Strips are very small, as a single byte or word.
Hamming code in special disksHamming code in special disks
Lower cost than RAID1 but higher than RAID3, 4,5Lower cost than RAID1 but higher than RAID3, 4,5
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 3 (Bit-Interleaved Parity)RAID 3 (Bit-Interleaved Parity)
Same as RAID2 but use parity verify,so it only need Same as RAID2 but use parity verify,so it only need a single redundant diska single redundant disk
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 3—PerformanceRAID 3—Performance
Small strip bringSmall strip bring Parallel Access Technique but onlParallel Access Technique but only one I/O request can be executed at a time.y one I/O request can be executed at a time.
Lower cost than RAID2.Lower cost than RAID2.
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 4 (Block-Level Parity)RAID 4 (Block-Level Parity)
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 4RAID 4
Large stripLarge strip
Parity verify and storage into a special diskParity verify and storage into a special disk
Parity disk become a bottleneckParity disk become a bottleneck
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 5 (Block-Level Distributed Parity)RAID 5 (Block-Level Distributed Parity)
DEVICE MANAGEMENTDEVICE MANAGEMENT
RAID 5RAID 5
Same as RAID4 but parity information distributedSame as RAID4 but parity information distributed
Avoid bottleneck found in RAID Level 4Avoid bottleneck found in RAID Level 4
DEVICE MANAGEMENTDEVICE MANAGEMENT
Disk Cache(p479)Disk Cache(p479)
Buffer in main memory for disk sectors.Buffer in main memory for disk sectors.Contains a copy of some of the sectors on the disk.Contains a copy of some of the sectors on the disk.According to locality principle to cache .According to locality principle to cache .
DEVICE MANAGEMENTDEVICE MANAGEMENT
Using MethodsUsing Methods
From disk-cache From disk-cache copycopy to user process space. to user process space.
Using a shared memory capability and passing a Using a shared memory capability and passing a pointer to the appropriate slot in the disk cache.pointer to the appropriate slot in the disk cache.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Least Recently Used (I)Least Recently Used (I)
The block that has been in the cache the longest The block that has been in the cache the longest with no reference to it is replaced.with no reference to it is replaced.
The cache consists of a stack of blocks.The cache consists of a stack of blocks.
Most recently referenced block is on the top of the Most recently referenced block is on the top of the stack.stack.
When a block is referenced or brought into the When a block is referenced or brought into the cache, it is placed on the top of the stack.cache, it is placed on the top of the stack.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Least Recently Used (I)Least Recently Used (I)
The block on the bottom of the stack is removed The block on the bottom of the stack is removed when a new block is brought in.when a new block is brought in.
Blocks don’t actually move around in main Blocks don’t actually move around in main memory.memory.
A stack of pointers is used.A stack of pointers is used.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Least Frequently Used (II)Least Frequently Used (II)
The block that has experienced the fewest references The block that has experienced the fewest references is replaced.is replaced.
A counter is associated with each block.A counter is associated with each block.
Counter is incremented each time block accessed.Counter is incremented each time block accessed.
Block with smallest count is selected for Block with smallest count is selected for replacement.replacement.
Some blocks may be referenced many times in a Some blocks may be referenced many times in a short period of time and then not needed any more.short period of time and then not needed any more.
DEVICE MANAGEMENTDEVICE MANAGEMENT
Integrate Methods(1)Integrate Methods(1)
New Section Old Section
Re-reference;
count unchangedRe-reference;
count: =count+1
Mi ss(new bl ock brought i n)
Count: =1
(a) FIFO
DEVICE MANAGEMENTDEVICE MANAGEMENT
Integrate Methods(1)Integrate Methods(1)
A area in new section , the count not add.A area in new section , the count not add.A area whose count is the least in old section will be A area whose count is the least in old section will be
replaced.replaced.The count remains at 1 as long as the block remains The count remains at 1 as long as the block remains
in the new sectionin the new section
DEVICE MANAGEMENTDEVICE MANAGEMENT
Integrate Methods(2)Integrate Methods(2)
(b) Use of Three Sections
New Secti on Mi ddl e Secti on Ol d Sect i on
DEVICE MANAGEMENTDEVICE MANAGEMENT
Integrate Methods(2)Integrate Methods(2)
The count in middle section can add , but not The count in middle section can add , but not replace the area in this sectionreplace the area in this section
DEVICE MANAGEMENTDEVICE MANAGEMENT
Appendix 11a p492Appendix 11a p492
Disk storage devicesDisk storage devices