Date post: | 16-Dec-2015 |
Category: |
Documents |
Upload: | domenic-pyne |
View: | 216 times |
Download: | 0 times |
Chapter 7 - Chapter 7 - Device ManagementDevice Management
Ivy Tech State College Northwest Region 01
CIS106 Microcomputer Operating Systems
Gina RueCIS Faculty
See Illustration p.145 2
Introduction - Introduction - Device ManagementDevice Management
Device Manager:Device Manager:
• Manages every peripheral device of Manages every peripheral device of the systemthe system
• Maintains a balance of the user’s Maintains a balance of the user’s demand and the system’s finite demand and the system’s finite supply of devicessupply of devices
3
Introduction - Introduction - Device ManagementDevice Management
• Four Basic FunctionsFour Basic Functions– tracking the status of each device, tape & disk tracking the status of each device, tape & disk
drives, printers, terminals, etc.drives, printers, terminals, etc.
– uses policies to determine which process will get uses policies to determine which process will get a device & for how longa device & for how long
– allocating devicesallocating devices
– deallocating devicesdeallocating devices• process levelprocess level
• job leveljob level
4
System DevicesSystem Devices
3 Peripheral Device categories3 Peripheral Device categories– dedicateddedicated
• assigned only one job at a time, tape drives, assigned only one job at a time, tape drives, printers, plottersprinters, plotters
– sharedshared• assigned to several processes, disk pack, other assigned to several processes, disk pack, other
storage devices by interleaving requestsstorage devices by interleaving requests
– virtualvirtual• combination dedicated & shared, printers, diskscombination dedicated & shared, printers, disks
5
Sequential Access Storage Sequential Access Storage MediaMedia
2 Groups of Storage Media2 Groups of Storage Media– Sequential access mediaSequential access media
• store records sequentially, one after store records sequentially, one after anotheranother
– Direct access storage devicesDirect access storage devices• can store either sequentially or direct can store either sequentially or direct
access, directly reading or writing to a access, directly reading or writing to a specific placespecific place
See Fig. 7.1 p.147 6
Sequential Access Storage Sequential Access Storage MediaMedia
Magnetic TapeMagnetic Tape– developed for early systems for routine secondary developed for early systems for routine secondary
storage, archiving, back-up datastorage, archiving, back-up data
– records are stored serially, each record can be any records are stored serially, each record can be any length stored in any location, record length usually length stored in any location, record length usually determined by applicationdetermined by application
– time consuming to locate records, “fast-forwarded” to time consuming to locate records, “fast-forwarded” to desired positiondesired position• parity bit used for routine error checkingparity bit used for routine error checking
• interrecord gap (IRG) inserted in between each recordinterrecord gap (IRG) inserted in between each record
7
Sequential Access Storage Sequential Access Storage MediaMedia
Magnetic TapeMagnetic Tape– blocking, grouping records into blocks blocking, grouping records into blocks
before recording them, performed while before recording them, performed while file is createdfile is created
– transfer rate, density of tape (number or transfer rate, density of tape (number or records in a block)records in a block)
– transport speed, speed of tape:transport speed, speed of tape:
transfer rate = density * transport speedtransfer rate = density * transport speed
8
Sequential Access Storage Sequential Access Storage MediaMedia
Magnetic TapeMagnetic Tape
Blocking Advantages:Blocking Advantages:
– fewer I/O operationsfewer I/O operations
– less tape is wastedless tape is wasted
Blocking DisadvantagesBlocking Disadvantages
– overhead & software routines are needed, overhead & software routines are needed, deblocking, and record keepingdeblocking, and record keeping
– buffer space may be wastedbuffer space may be wasted
Access times can vary widelyAccess times can vary widely
9
Direct Access Storage Direct Access Storage DevicesDevices
– (DASDs) any devices that can directly (DASDs) any devices that can directly read or write to a specific place on read or write to a specific place on diskdisk
– Also called random access storage Also called random access storage devicesdevices
– Grouped into 2 categoriesGrouped into 2 categories• fixed read/write headsfixed read/write heads
• movable read/write headsmovable read/write heads
See Fig. 7.4 & 7.5 p.150 10
Direct Access Storage DevicesDirect Access Storage Devices
• Fixed-Head Drums & DisksFixed-Head Drums & Disks
– one of the first DASDs developed in early one of the first DASDs developed in early 1950’s1950’s
– fixed-drum resembles a giant coffee can fixed-drum resembles a giant coffee can covered with magnetic film & formatted so covered with magnetic film & formatted so tracks run around ittracks run around it
– fixed-drum data is recorded serially on each fixed-drum data is recorded serially on each track by the read/write head positioned over ittrack by the read/write head positioned over it
11
Direct Access Storage DevicesDirect Access Storage Devices
• Fixed-Head Drums & DisksFixed-Head Drums & Disks
– fixed-disk looks like a phonograph album fixed-disk looks like a phonograph album covered with magnetic film that has been covered with magnetic film that has been formatted, into concentric circles (tracks)formatted, into concentric circles (tracks)
– fixed-disk data is recorded serially on fixed-disk data is recorded serially on each track by the read/write head each track by the read/write head positioned over itpositioned over it
See Fig. 7.6 p.151 12
Direct Access Storage DevicesDirect Access Storage Devices
• Movable-Head Drums & DisksMovable-Head Drums & Disks
– Movable-Head drums have only a few Movable-Head drums have only a few read/write heads that move from track to read/write heads that move from track to track to cover the entire surface of the track to cover the entire surface of the drumdrum• least expensive device with only one least expensive device with only one
read/write head for the entire drumread/write head for the entire drum
• conventional design device with several conventional design device with several read/write heads that move togetherread/write heads that move together
See Fig. 7.7 p.151 13
Direct Access Storage DevicesDirect Access Storage Devices• Movable-Head Drums & DisksMovable-Head Drums & Disks
– Movable-Head disk have only one read/write Movable-Head disk have only one read/write head that floats over the surface of the diskhead that floats over the surface of the disk• individual units, such as those with many PCsindividual units, such as those with many PCs
• disk packs, stack of disks, each disk has 2 disk packs, stack of disks, each disk has 2 surfaces for recording (top & bottom)surfaces for recording (top & bottom)
• tracks on disk varies by manufacturer, but tracks on disk varies by manufacturer, but typically range from 200 to 800typically range from 200 to 800
• tracks are numbered, Track 0 is the outermost tracks are numbered, Track 0 is the outermost concentric circleconcentric circle
14
Direct Access Storage DevicesDirect Access Storage Devices
• Optical Disc Storage (ODS)Optical Disc Storage (ODS)
– Includes CD-ROM, provides reliable high-Includes CD-ROM, provides reliable high-density storage for large amounts of datadensity storage for large amounts of data
– 1995 ODS were read only, now CD-R 1995 ODS were read only, now CD-R (recordable) available(recordable) available
– function similar to magnetic disk drivefunction similar to magnetic disk drive• read/write head on an armread/write head on an arm
• measure performance in data-transfer rate measure performance in data-transfer rate and average access timeand average access time
See Table 7.2 p.153 15
Direct Access Storage DevicesDirect Access Storage Devices
• Optical Disc Storage (ODS)Optical Disc Storage (ODS)
– data transfer rate measured in kilobytes per data transfer rate measured in kilobytes per second (Kps) refers to speed that data can be second (Kps) refers to speed that data can be read off discread off disc
– access time indicates the average time required access time indicates the average time required to move the read head to a specific place on the to move the read head to a specific place on the disc, expressed in milliseconds (ms)disc, expressed in milliseconds (ms)
– hardware cache acts like a buffer by transferring hardware cache acts like a buffer by transferring blocks of data from the diskblocks of data from the disk
16
Direct Access Storage DevicesDirect Access Storage DevicesAccess Time Required: Access Time Required:
3 factors that contribute to the time required to 3 factors that contribute to the time required to access a fileaccess a file• seek timeseek time
• time required to position the read/write head on the proper time required to position the read/write head on the proper track; slowest of 3 factorstrack; slowest of 3 factors
• search timesearch time• also known as rotational delay; time it takes to rotate the drum also known as rotational delay; time it takes to rotate the drum
or disk until the requested record is moved under the or disk until the requested record is moved under the read/write headread/write head
• transfer timetransfer time• when the data is actually transferred from secondary storage when the data is actually transferred from secondary storage
to main memory; fastest of 3 factorsto main memory; fastest of 3 factors
See Fig 7.8 p.154 17
Direct Access Storage DevicesDirect Access Storage Devices
Access Time for Fixed-Head DevicesAccess Time for Fixed-Head Devices
– access a record by knowing its track and access a record by knowing its track and record numberrecord number
– total amount of time required to access data total amount of time required to access data depends on 2 factors:depends on 2 factors:• rotational speedrotational speed
• position of the record relative to the position position of the record relative to the position of the read/write headof the read/write head
Access Time = Search Time + Transfer TimeAccess Time = Search Time + Transfer Time
18
Direct Access Storage DevicesDirect Access Storage Devices
Access Time for Movable-Head DevicesAccess Time for Movable-Head Devices
– adds a third time element to the computation adds a third time element to the computation of access time:of access time:
Access Time = Access Time =
Seek Time + Search Time + TransferSeek Time + Search Time + Transfer
– overall, moveable-head devices are much overall, moveable-head devices are much more common than fixed-head DASDsmore common than fixed-head DASDs• less costly and larger capacity; even though less costly and larger capacity; even though
retrieval time is longerretrieval time is longer
See Fig. 7.9 p.157 19
I/O System ComponentsI/O System Components• I/O subsystems work togetherI/O subsystems work together
– I/O Channels I/O Channels (dispatcher)(dispatcher)•keeps up with the I/O requests from the CPU keeps up with the I/O requests from the CPU
& pass them on to the appropriate control unit& pass them on to the appropriate control unit
•programmable units placed between the CPU programmable units placed between the CPU and the control unitand the control unit
•sends one signal for each functionsends one signal for each function
•synchronizes the fast speed of the CPU with synchronizes the fast speed of the CPU with the slow speed of the I/O devicethe slow speed of the I/O device
See Fig. 7.10 & 11 p.158 -159 20
I/O System ComponentsI/O System Components• I/O subsystems work togetherI/O subsystems work together
– I/O Control Unit I/O Control Unit (driver)(driver)
• interprets the channel signalinterprets the channel signal
• sometimes part of the devicesometimes part of the device
• each control unit can direct several deviceseach control unit can direct several devices
• flexibility, connect more than one channel for a flexibility, connect more than one channel for a control unit or connect more than one control unit to control unit or connect more than one control unit to a single devicea single device
• multiple paths increase reliability of the I/O subsystemmultiple paths increase reliability of the I/O subsystem
21
CommunicationCommunicationAmong DevicesAmong Devices
Demanding conditions of a busy Demanding conditions of a busy computer systemcomputer system
– Device Manager Device Manager (3 Problems)(3 Problems)•needs to know which components are busy needs to know which components are busy
& which are free& which are free
•must be able to handle requests that come must be able to handle requests that come in during heavy I/O trafficin during heavy I/O traffic
•must accommodate disparity of speeds must accommodate disparity of speeds between CPU & I/O devicesbetween CPU & I/O devices
22
CommunicationCommunicationAmong DevicesAmong Devices
Concurrent processing & I/OConcurrent processing & I/O•each unit in the I/O subsystem can finish its each unit in the I/O subsystem can finish its
operation independentlyoperation independently
•after a device has begun writing a record, & after a device has begun writing a record, & before completing the task, the connection before completing the task, the connection between the device & its controller can be between the device & its controller can be cut off to begin another I/O task with another cut off to begin another I/O task with another devicedevice
•CPU is free to process data while I/O is being CPU is free to process data while I/O is being performedperformed
23
CommunicationCommunicationAmong DevicesAmong Devices
How does the system know when a device How does the system know when a device has completed an operation?has completed an operation?
•Hardware flagHardware flag must be tested by the CPU must be tested by the CPU
•made up of 3 bits & resides in the Channel Status made up of 3 bits & resides in the Channel Status Word (CSW)Word (CSW)
– CSW, predefined location in main memory, contains CSW, predefined location in main memory, contains channel status informationchannel status information
•each bit represents one of the components each bit represents one of the components indicating channel statusindicating channel status
– channel bit, control unit, & devicechannel bit, control unit, & device– 0 free, 1 busy0 free, 1 busy
24
CommunicationCommunicationAmong DevicesAmong Devices
• Each component has access to the Each component has access to the flagflag
• can be tested before proceeding can be tested before proceeding with the next I/O operationwith the next I/O operation
– Common ways to perform this test:Common ways to perform this test:•pollingpolling
• interruptsinterrupts
25
CommunicationCommunicationAmong DevicesAmong Devices
• PollingPolling–use special machine instructions to test the use special machine instructions to test the
flagflag
–major disadvantage CPU wastes time major disadvantage CPU wastes time testing flagtesting flag
• InterruptsInterrupts–more efficient way to test flagsmore efficient way to test flags
– interrupt handler determines best course for interrupt handler determines best course for actionaction
See Fig. 7.12 p.161 26
CommunicationCommunicationAmong DevicesAmong Devices
• Direct Memory Access (DMA)Direct Memory Access (DMA)– allows a control unit to access main memory allows a control unit to access main memory
more directlymore directly
– data can be transferred to & from memory data can be transferred to & from memory without CPU interactionwithout CPU interaction
• BuffersBuffers– more efficient way to test flagsmore efficient way to test flags
– interrupt handler determines best course for interrupt handler determines best course for actionaction
27
Management of I/O Management of I/O RequestsRequests
• Device Manager divides the task Device Manager divides the task into 3 parts handled by a into 3 parts handled by a software component of the I/O software component of the I/O subsystemsubsystem• I/O traffic controllerI/O traffic controller
• I/O schedulerI/O scheduler
• I/O device handlerI/O device handler
See Table 7.5 p.162 28
Management of I/O Management of I/O RequestsRequests
• I/ traffic controllerI/ traffic controller– monitors every device status, control monitors every device status, control
unit, & channelunit, & channel
– maintains control blocksmaintains control blocks
– three main tasks:three main tasks:– determines if path is availabledetermines if path is available– determines best pathdetermines best path– determines when a path will become determines when a path will become
availableavailable
29
Management of I/O Management of I/O RequestsRequests
• I/O schedulerI/O scheduler• performs same job as the performs same job as the
Process SchedulerProcess Scheduler• allocates the devices, control allocates the devices, control
units, & channelsunits, & channels• decides which request will take decides which request will take
prioritypriority• synchronizes its work with the synchronizes its work with the
traffic controllertraffic controller
30
Management of I/O Management of I/O RequestsRequests
• I/O Device handlerI/O Device handler• processes the I/O interruptsprocesses the I/O interrupts
• handles error conditionshandles error conditions
• provides detailed scheduled provides detailed scheduled algorithmsalgorithms
• each type of I/O device has its each type of I/O device has its own device handler algorithmown device handler algorithm
31
Device Handler Device Handler Seek StrategiesSeek Strategies• Seek Strategy determines the order Seek Strategy determines the order
processes get the device, keeping seek processes get the device, keeping seek time to a minimumtime to a minimum
• Every scheduling algorithm should do Every scheduling algorithm should do the following:the following:•minimize movementminimize movement
•minimize mean response timeminimize mean response time
•minimize the variance in response timeminimize the variance in response time
See Fig. 7.13 p.164 32
Device Handler Device Handler Seek StrategiesSeek Strategies• First come first served (FCFS)First come first served (FCFS)
– simplest device-scheduling simplest device-scheduling algorithmalgorithm
– easy to users & fair to userseasy to users & fair to users
– seek time delay disadvantageseek time delay disadvantage
– seek time is the most time seek time is the most time consumingconsuming
See Fig. 7.14 p.164 33
Device Handler Device Handler Seek StrategiesSeek Strategies• Shortest seek time first (SSTF)Shortest seek time first (SSTF)
– shortest jobs are processed firstshortest jobs are processed first
– longer jobs are made to waitlonger jobs are made to wait
– requests the track closest to the requests the track closest to the one being servedone being served
– favors easy-to-reach requests & favors easy-to-reach requests & postpones long jobs farther awaypostpones long jobs farther away
See Fig. 7.15 p.165 34
Device Handler Device Handler Seek StrategiesSeek Strategies
• SCAN uses a directional bit to SCAN uses a directional bit to indicate arm movementindicate arm movement
• LOOK (elevator algorithm/SCAN LOOK (elevator algorithm/SCAN variation), arm does not go all the variation), arm does not go all the way to either edge unless requestedway to either edge unless requested
• N-step SCAN holds all requests until N-step SCAN holds all requests until the arm starts on its way backthe arm starts on its way back
35
Device Handler Device Handler Seek StrategiesSeek Strategies
•C-SCAN (Circular SCAN) the arm picks C-SCAN (Circular SCAN) the arm picks up requests on its path during inward up requests on its path during inward sweepsweep
• C-LOOK arm does not move all the C-LOOK arm does not move all the way back to last track unless requiredway back to last track unless required
The best scheduling algorithm may be a The best scheduling algorithm may be a combination of more than one schemecombination of more than one scheme
36
Search Strategies:Search Strategies:Rotational OrderingRotational Ordering
Optimize search times by Optimize search times by ordering requests once the ordering requests once the read/write heads have been read/write heads have been positionedpositioned
See Fig. 7.16 & table 7.6 p.167
37
Search Strategies:Search Strategies:Rotational OrderingRotational Ordering
• ““Rotational Ordering”Rotational Ordering”– amount of time wasted due to amount of time wasted due to
rotational delay can be reducedrotational delay can be reduced
– requests are ordered within each trackrequests are ordered within each track
– device controller must provide device controller must provide “rotational sensing” so the device “rotational sensing” so the device driver can “see” which sector is under driver can “see” which sector is under the read/write headthe read/write head
38
SummarySummary
• Device Manager’s job to manage all the Device Manager’s job to manage all the devices despite varying speeds & devices despite varying speeds & sharing abilitiessharing abilities
• Direct Access and Sequential AccessDirect Access and Sequential Access
• One or many read/write headsOne or many read/write heads
• Fixed position or heads move across Fixed position or heads move across surfacesurface
39
SummarySummary
• Complex task of balancing demand for Complex task of balancing demand for devices divided among hardware devices divided among hardware components:components:– channelschannels
– control unitscontrol units
– devicesdevices
• Success of the I/O subsystem depends on Success of the I/O subsystem depends on the communications that link these partsthe communications that link these parts
40
SummarySummary
• Seek strategies to optimize seek Seek strategies to optimize seek timetime– FCFS: First Come, First ServedFCFS: First Come, First Served
– SSTF: Shortest Seek Time FirstSSTF: Shortest Seek Time First
– SCAN/LOOKSCAN/LOOK
– N-step SCANN-step SCAN
– C-SCAN/C-LOOKC-SCAN/C-LOOK