0% found this document useful (0 votes)
39 views9 pages

OPERSYS Module17-Content-Lesson

The document discusses I/O management in operating systems. It describes how I/O devices connect to the computer system bus and have device controllers. It also discusses I/O software in the form of device drivers that allow the operating system to communicate with device controllers. Finally, it examines different disk scheduling algorithms like FCFS, SSTF, Scan, and C-Scan that are used to optimize disk access and minimize disk head movement.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views9 pages

OPERSYS Module17-Content-Lesson

The document discusses I/O management in operating systems. It describes how I/O devices connect to the computer system bus and have device controllers. It also discusses I/O software in the form of device drivers that allow the operating system to communicate with device controllers. Finally, it examines different disk scheduling algorithms like FCFS, SSTF, Scan, and C-Scan that are used to optimize disk access and minimize disk head movement.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Operating Systems Page 3 of 15

I/O Management

IV. LESSON PROPER

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.

The figure illustrates how I/O devices are


connected to the computer system bus. As
shown, each device has its own specific
device controller. For example, the printer
uses a printer controller to interface to the
computer system.

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.

The following events happen when performing an I/O operation:

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.

4. The device driver is blocked while


the device is executing the
requested operation. When the
operation is finished, the device
controller will send an interrupt
signal to the operating system to
indicate this event. The device
driver resumes its execution and
checks the status registers of the
controller. This is to see if the
operation was successful and then
it displays the necessary messages.
Operating Systems Page 5 of 15
I/O Management

Disk Scheduling Algorithms

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.

Some of the well-known DISKS SCHEDULING ALGORITHMS are:

1. FIRST-COME, FIRST-SERVED (FCFS) SCHEDULING ALGORITHM

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.

Assume the stream of track access requests:

118 59 110 25 105 63 100 28 80

The basic assumptions of the example are:

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.

c. No other requests will arrive.

The figure below shows the movement of


read/write head against a common
arbitrary time scale using FCFS
algorithm. Track 118 will be serviced first
since it came in first, followed by tracks
59, 110, 25, and so on. The graph does
not show the time period the read/write
Operating Systems Page 6 of 15
I/O Management

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 70 to track 118 From track 105 to track 63

= 118 - 70 = 48 tracks = 105 - 63 = 42 tracks

From track 118 to track 59 From track 63 to track 100

= 118 - 59 = 59 tracks = 100 - 63 = 37 tracks

From track 59 to track 110 From track 100 to track 28

= 110 - 59 = 51 tracks = 100 - 28 = 72 tracks

From track 110 to track 25 From track 28 to track 80

= 110 - 25 = 85 tracks = 80 - 28 = 52 tracks

From track 25 to track 105 The total number of read/write head movement is

= 105 - 25 = 80 tracks 48+59+51+85+80+42+37+72+52 = 526 tracks

2. SHORTEST SEEK TIME FIRST (SSTF) SCHEDULING ALGORITHM

In this algorithm, the request which is closest


to the current head position will be serviced
next. Using the previous example, the graph
for the movement of read/write head is

Since track 63 is nearest track 70, it will be


serviced next. This is followed by track 59
since it is nearest track 63, and so on.

The following are the number of tracks traversed by the read/write head:
From track 70 to track 63 = 63 - 59 = 4 tracks

= 70 - 63 = 7 tracks From track 59 to track 80

From track 63 to track 59 = 80 - 59 = 21 tracks


Operating Systems Page 7 of 15
I/O Management

From track 80 to track 100 = 118 -110 = 8 tracks

= 100 - 80 = 20 tracks From track 118 to track 28

From track 100 to track 105 = 118 - 28 = 90 tracks

= 105 - 100 = 5 tracks

From track 105 to track 110 The total number of read/write head movement is 7

= 110 - 105 = 5 tracks + 4 + 21+ 20 + 5 + 5 + 8 + 90 + 3 = 163 tracks

From track 110 to track 118

3. SCAN SCHEDULING ALGORITHM ALGORITHM

In this algorithm, the read/write head scans


from one end of the disk surface to the other
end continuously and services any disk
access request encountered. It is also known
as the elevator algorithm, since it is similar to
the way an elevator operates. Using the
previous example, the graph for the
movement of read/write head is

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

= 80 - 70 = 10 tracks From track 105 to track 110

From track 80 to track 100 = 110 - 105 = 5 tracks

= 100 - 80 = 20 tracks From track 110 to track 118

From track 100 to track 105 = 118 -110 = 8 tracks


Operating Systems Page 8 of 15
I/O Management

From track 118 to track 199 = 59 - 28 = 31 tracks

= 199 - 118 = 81 tracks From track 28 to track 25

From track 199 to track 63 = 28 - 25 = 3 tracks

= 199 - 63 = 136 tracks

From track 63 to track 59 The total number of read/write movement is 10 +

= 63 - 59 = 4 tracks 20 + 5 + 5 + 8 + 81 +136 + 4 + 31 + 3 = 303 tracks

From track 59 to track 28

4. CIRCULAR-SCAN (C-SCAN) SCHEDULING ALGORITHM

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

From track 80 to track 100 From track 0 to track 25

= 100 - 80 = 20 tracks = 25 - 0 = 25 tracks

From track 100 to track 105 From track 25 to track 28

= 105 - 100 = 5 tracks = 28 - 25 = 3 tracks

From track 105 to track 110 From track 28 to track 59

= 110 - 105 = 5 tracks = 59 - 28 = 31 tracks

From track 110 to track 118 From track 59 to track 63

= 118 -110 = 8 tracks = 63 - 59 = 4 tracks

From track 118 to track 199

= 199 - 118 = 81 tracks The total number of read/write movement is

From track 199 to track 0 10+20+5+5+8+81+199+25+3+31+4= 391 tracks

= 199 - 0 = 199 tracks

5. LOOK SCHEDULING ALGORITHM

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.

Using the previous example, the graph for the


movement of read/write head is

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

= 80 - 70 = 10 tracks = 118 - 63 = 55 tracks

From track 80 to track 100 From track 63 to track 59

= 100 - 80 = 20 tracks = 63 - 59 = 4 tracks

From track 100 to track 105 From track 59 to track 28

= 105 — 100 = 5 tracks = 59 - 28 = 31 tracks

From track 105 to track 110 From track 28 to track 25

= 110 - 105 = 5 tracks = 28 - 25 = 3 tracks

From track 110 to track 118 The total number of read/write movement is 10 +

= 118 -110 = 8 tracks 20 + 5 + 5 + 8 + 55 + 4 + 31 + 3 = 141 tracks

6. C-LOOK SCHEDULING ALGORITHM

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.

Using the previous example, the graph for the


movement read/write head is

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

= 80 - 70 = 10 tracks = 118 - 25 = 93 tracks

From track 80 to track 100 From track 25 to track 28

= 100 - 80 = 20 tracks = 28 - 25 = 3 tracks

From track 100 to track 105 From track 28 to track 59

= 105 - 100 = 5 tracks = 59 - 28 = 31 tracks

From track 105 to track 110 From track 59 to track 63

= 110 - 105 = 5 tracks = 63 - 59 = 4 tracks

From track 110 to track 118 The total number of read/write movement is

= 118 - 110 = 8 tracks 10+20+5+5+8+93+3+31+4=179 tracks

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy