OPERSYS Module17-Content-Lesson
OPERSYS Module17-Content-Lesson
I/O Management
Based on the preliminary activities, what did you notice about it?
________________________________________________________
CONGRATULATIONS!
You may now proceed to the lesson.
I/O Hardware
Generally, I/O devices have two components: mechanical and electrical/electronic. The mechanical
component is the actual physical device. The electrical/electronic component, which is often called the
device controller, is responsible for controlling the communication between the computer system and the
I/O device.
Control registers and status registers are also present in most device controllers. Control registers receive
commands from the l/O software and then tell the device controller what to do. Status registers contain
information about the status of the I/O device, such as whether the device is currently in use or ready to
receive data.
I/O Software
A device driver is the software used by the operating system to communicate with the device controllers.
These are usually incorporated into the operating system. If not, manufacturers of I/O devices provide a
Operating Systems Page 4 of 15
I/O Management
copy of the device driver and this must be installed manually by the user. Each controller has its own
device driver.
1. The operating system sends a general I/O command (such as read or write) to the device driver.
The driver checks if the command has valid parameters. If there is an error, an error message will
appear. If there are no errors with the given command, the command is translated into a specific
sequence of instructions that the device controller understands.
2. The driver then checks the status registers of the device controller. If device is currently being
used, the I/O request is placed in a device queue. If not, it again checks the status registers to see
if the device can handle the request. For example, if the printer is needed, the driver checks if the
printer has paper in it.
3. If the device is available and capable of handling the request, the driver sends the necessary
commands to the control registers of the device controller.
One of the major reasons for slow access to files in the hard disk is the seek time. Seek time is the time it
takes to move the read/write head from its current track position to the desired track position where the
data to be accessed is located. A Disk Scheduling Algorithm is used by the operating system (specifically
the device driver of the disk) to schedule file accesses requested by users and processes such that
movement of the read/write head is minimized.
In this algorithm, requests for disk access made by processes are served on a first-come, first-
served basis. To better understand this algorithm, consider the following example.
a. There are a total of 200 tracks, numbered 0 (outermost track) to 199 (innermost track)
b. The read/write head is currently servicing a request for track 70 and all the requests given
above had arrived prior to its completion.
head stays at the track to finish the requested data access. The total number of tracks traversed
will determine the performance of an algorithm. The following are the number of tracks traversed
by the read/write head:
From track 25 to track 105 The total number of read/write head movement is
The following are the number of tracks traversed by the read/write head:
From track 70 to track 63 = 63 - 59 = 4 tracks
From track 105 to track 110 The total number of read/write head movement is 7
Assume that head is moving towards the innermost track when it serviced the request for track 70.
It then proceeds toward track 199 (innermost track), servicing tracks 80, 100, 105, 110, and 118
along the way. Upon reaching track 199, it goes back and moves toward the outermost track. It
then proceeds toward track 0 (outermost track), servicing tracks 63, 59, 28, and 25 along the way.
The following are the number of tracks traversed by the read/write head:
From track 70 to track 80 = 105 - 100 = 5 tracks
This algorithm is a modified version of the SCAN algorithm. The read/write head moves from the
outermost track to the innermost track and services any disk access request encountered. When
the innermost track is reached, it goes back to the outermost track without servicing any requests.
Upon reaching the outermost track,
the process is repeated. It goes back
to the innermost track again and
services disk requests along the way.
It treats the tracks in a circular fashion.
The next track after track 199 is track
0. Using the previous example, the
graph for the movement to read/write
head is
As the head moves toward the innermost track, it services requests tor tracks 80, 100, 105, 110,
and 118. It continues to move toward track 199 and then goes back to track 0 without servicing any
requests. It again moves toward the innermost track, servicing requests for tracks 25, 28, 59, and
63.
The following are the number of tracks traversed by the read/write head:
From track 70 to track 80 = 80 - 70 = 10 tracks
Operating Systems Page 9 of 15
I/O Management
This algorithm is a variation of the SCAN algorithm. It works like the SCAN algorithm. The
difference is that if there are no requests in the current direction that the head is moving, it reverses
direction. Based on the how the LOOK works,
many consider the term elevator algorithm
more suitable for the LOOK algorithm than the
SCAN algorithm.
The head proceeds toward track 199 (innermost track), servicing tracks 80, 100, 105, 110, and 118
along the way. However, because there are no requests after track 118, it reverses its direction. It
then proceeds toward track 0 (outermost track), servicing tracks 63, 59, 28, and 25 along the way.
Operating Systems Page 10 of 15
I/O Management
The following are the number of tracks traversed by the read/Write head
From track 70 to track 80 From track 118 to track 63
From track 110 to track 118 The total number of read/write movement is 10 +
This algorithm is a variation of the C—SCAN algorithm. It works like the C-SCAN algorithm. The
difference is that if there are no requests in the
current direction that the head is moving, it goes
back to the outermost track. However, the head
does not necessarily have to move to track 0.
Instead, it goes directly to the request for the
track nearest track 0.
The head proceeds toward track 199 (innermost track), servicing tracks 80, 100, 105, 110, and 118
along the way. However, because there are no requests after track 118, it reverses its direction. It
then proceeds toward track 25 (request for the track nearest track 0), servicing tracks 28, 59, and
63 along the way.
Operating Systems Page 11 of 15
I/O Management
The following are the number of tracks traversed by the read/write head:
From track 70 to track 80 From track 118 to track 25
From track 110 to track 118 The total number of read/write movement is