0% found this document useful (0 votes)
7 views6 pages

Device Types and Disk Scheduling Algorithms

Uploaded by

piyid14807
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

Device Types and Disk Scheduling Algorithms

Uploaded by

piyid14807
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

(1) Types of Devices:

● Block devices provides the main interface to all disk devices in a system. o
include all devices that allow random access to completely independent,
fixed-sized blocks of data, including hard disks and floppy disks, CD-ROMs, and
flash memory. o used to store file systems, but direct access to a block device
is also allowed so that programs can create and repair the file system that the
device contains.

● Character devices include most other devices, such as mice and keyboards. o
The fundamental difference between block and character devices is random
access—block devices may be accessed randomly, while character devices are
only accessed serially.

● Network devices Users cannot directly transfer data to network devices o


they must communicate indirectly by opening a connection to the kernel's
networking subsystem.

(2) Explain device driver in OS.


 Each Controller has some device registers used to give it commands or
read out its statues or both.
 For example mouse driver has to accept information about position of
pointer and which buttons are currently depressed.
 I/O devices which are plugged with computer have some specific code for
controlling them. This code is called the device driver.
 Each device driver normally handles one device type, or at most one class
of closely related devices.
 Generally device driver is delivered along with the device by device
manufacturer. Each driver handles one type of closely related devices.
 In order to access the device’s hardware, meaning the controller’s
registers, device driver should be a part of operation system kernel.
 Device drivers are normally positioned below the rest of Operating System.
 Functions of device drivers:
o Device driver accept abstract read and write requests from device
independent software.
o Device driver must initialize the device if needed. It also controls
power requirement and log event.
o It also checks statues of devices. If it is currently in use then queue
the request for latter processing. If device is in idle state then
request can be handled now.
o Controlling device means issuing a sequence of command to it.
Device driver is a place where command sequence is determined,
depending upon what has to be done.

Figure . Logical positioning of device drivers. In reality all


communication between drivers and device controllers goes
over the bus.
o Pluggable device can be added or removed while the computer
is running. At that time the device driver inform CPU that the
user has suddenly removed the device from system.

(3) Disk Arm Scheduling Algorithm.


 The time required to read or write a disk block is determined by three factors:
1. Seek time (the time to move the arm to the proper cylinder).
2. Rotational delay (the time for the proper sector to rotate under the head).
3. Actual data transfer time.
 For most disks, the seek time dominates the other two times, so reducing the
mean seek time can improve system performance substantially.
 Various types of disk arm scheduling algorithms are available to decrease mean
seek time.
1. FCSC (First come first serve)
2. SSTF (Shorted seek time first)
3. SCAN
4. C-SCAN
5. LOOK (Elevator)
6. C-LOOK
Example: Consider an imaginary disk with 51 cylinders. A
request comes in to read a block on cylinder 11. While the seek
to cylinder 11 is in progress, new requests come in for cylinders
1, 36, 16, 34, 9, and 12, in that order.
Starting from the current head position, what is the total distance (in
cylinders) that the disk arm moves to satisfy all the pending requests, for each of the
following disk scheduling Algorithms?
1. FCSC (First come first serve)
2. SSTF (Shorted seek time first)
3. SCAN
4. C-SCAN
5. LOOK (Elevator)
6. C-LOOK

FCSC (First come first serve) Scheduling

● Here requests are served in the order of their arrival.


● In given example disk movement will be 11, 1, 36, 16, 34, 9 and 12 as first
come first served.
● Total cylinder movement: (11-1)+ (36-1)+ (36-16) + (34-16) +(34-9)+(9-12) =
111

SSTF (Shortest seek time first)

● We can minimize the disk movement by serving the request closest to the
current position of the head.
● In given example starting head position is 11, closest to 11 is 12, closest to
12 is 9, and so on.
● As per SSTF request will be satisfied in order 11, 12, 9, 16, 1, 34, 36.
● Total cylinder movement: (12-11) + (12-9) + (16-9) + (16-1) + (34-1) + (36-34)
= 61

LOOK (Elevator) disk arm scheduling

● Keep moving in the same direction until there are no more outstanding
requests pending in that direction, then algorithm switches the direction.
● After switching the direction the arm will move to handle any request on
the way. Here first go it moves in up direction then goes in down direction.
● This is also called as elevator algorithm.
● In the elevator algorithm, the software maintains 1 bit: the current
direction bit, which takes the value either UP or DOWN.
● As per LOOK request will be satisfied in order 11, 12, 16, 34, 36, 9, 1.
● Total cylinder movement: (12-11) + (16-12) + (34-16) + (36-34) + (36-
9) + (9-1)=60 C-LOOK

● Keep moving in the same direction until there are no more outstanding
requests pending in that direction, then algorithm switches direction.
● When switching occurs the arm goes to the lowest numbered cylinder with
pending requests and from there it continues moving in upward direction
again.
● As per CLOOK requests will be satisfied in order 11, 12, 16, 34, 36, 1, 9
● Total cylinder movement: (12-11) + (16-12) + (34-16) + (36-34) +(36-1)+(9-
1)=68

SCAN

● From the current position disk arm starts in up direction and moves
towards the end, serving all the pending requests until end.
● At that end arm direction is reversed (down) and moves towards the other
end serving the pending requests on the way.
● As per SCAN request will be satisfied in order: 11, 12, 16, 34, 36, 50, 9, 1
● Total cylinder movement: (12-11) + (16-12) + (34-16) +(36-34) +(50-36) + (50-
9) + (9-1)
= 88

CSCAN
● From the current position disk arm starts in up direction and moves
towards the end, serving request until end.
● At the end the arm direction is reversed (down), and arm directly goes to
other end and again continues moving in upward direction.
● As per SCAN request will be satisfied in order: 11, 12, 16, 34, 36, 50, 0, 1,9
● Total cylinder movement: (12-11) + (16-12) + (34-16) +(36-34) +(50-36) + (50-
0) + (1-0)+
(9-1) = 98

You might also like