You are on page 1of 19

Chapter 6

Device Management
Device Management

 Device management is the OS component that manages hardware


devices.
 It provides a uniform interface to access devices with different
physical characteristics
 It Optimize the performance of individual devices
 Computing is not interesting without I/Os

2
Basics of I/O Devices
Three categories
A block device stores information in fixed-size blocks, each one with its
own address.
 Block size range from 512 bytes to 32,768 bytes. It is possible to read
and write each block independently of all other ones.
e.g., disks
A character device accepts a stream of characters, and individual
characters are not addressable
e.g., keyboards, printers
A network device transmit data packets

3
Cont’d….
 I/O devices cover a huge range in speeds, which puts considerable pressure on the
software to perform well over many orders of magnitude in data rates.

4
Device management: Characteristics of serial and parallel devices

 There are two ways of transmitting a byte between two digital devices.
 We can either transmit the byte in PARALLEL or we can transmit the byte
in SERIAL form.
 In parallel mode, each bit has a single wire devoted to it and all the bits are
transmitted at the same time.
 In serial mode, the bits are transmitted as a series of pulses.

5
6
Serial and Parallel Transmission
 Digital data transmission can occur in two basic modes: serial or parallel.
 Data within a computer system is transmitted via parallel mode on buses
with the width of the parallel bus matched to the word size of the computer
system.
 Data between computer systems is usually transmitted in bit serial mode.
 Consequently, it is necessary to make a parallel to serial conversion at a
computer interface when sending data from a computer system into a
network and a serial to parallel conversion at a computer interface when
receiving information from a network.
 The type of transmission mode used may also depend upon distance and
required data rate.

7
Parallel Transmission
 In parallel transmission, multiple bits (usually 8 bits or a byte/character) are sent
simultaneously on different channels (wires, frequency channels) within the same
cable, or radio path, and synchronized to a clock.
 Parallel devices have a wider data bus than serial devices and can therefore transfer
data in words of one or more bytes at a time.
 As a result, there is a speedup in parallel transmission bit rate over serial
transmission bit rate.
 However, this speedup is a tradeoff versus cost since multiple wires cost more than a
single wire, and as a parallel cable gets longer, the synchronization timing between
multiple channels becomes more sensitive to distance.
 The timing for parallel transmission is provided by a constant clocking signal sent
over a separate wire within the parallel cable, thus parallel transmission is considered
synchronous.

8
Serial Transmission
 In serial transmission, bits are sent sequentially on the same channel (wire)
which reduces costs for wire but also slows the speed of transmission.
 Also, for serial transmission, some overhead time is needed since bits must
be assembled and sent as a unit and then disassembled at the receiver.
 Serial transmission can be either synchronous or asynchronous.
 In synchronous transmission, groups of bits are combined into frames and
frames are sent continuously with or without data to be transmitted.
 In asynchronous transmission, groups of bits are sent as independent units
with start/stop flags and no data link synchronization, to allow for arbitrary
size gaps between frames.
 However, start/stop bits maintain physical bit level synchronization once
detected.

9
Abstracting Device differences

 An abstraction layer makes a convenient interface between device


drivers and I/O hardware.
 Many operating system vendors don't present a uniform interface
between the device drivers and the I/O hardware.
 An abstraction layer also enables customers to cost effectively evaluate
many different I/O products, operating systems, something they couldn't
otherwise do without a large investment in software, hardware, and
time.

10
Recovery from failures

Files and directories are kept both in main memory and on disk
 Care must be taken to ensure that a system failure does not result in loss
of data or in data inconsistency.
How to recover from such a failure
1. Consistency checking–compares data in directory structure with data
blocks on disk, and tries to fix inconsistencies
 Can be slow and sometimes fails
2. Use system programs to back up data from disk to another storage
device
Recover lost file or disk by restoring data from backup

11
Buffering Strategies

 Buffering : A buffer is a memory area that stores data being transferred


between two devices or between a device and application.
 Spooling: is a buffer that holds output for a device such as printer.
 Each application output is spooled to a separate disk file.
 When the application finished and printing the spooling system queues
the corresponding spool file for output to printer.

12
Disk Scheduling
 The operating system is responsible for using hardware efficiently — for the
disk drives, this means having a fast access time and disk bandwidth.
 Access time has two major components
o Seek time is the time for the disk to move the heads to the cylinder
containing the desired sector.
o Rotational latency is the additional time waiting for the disk to rotate the
desired sector to the disk head.
 Disk bandwidth is the total number of bytes transferred, divided by the
total time between the first request for service and the completion of the last
transfer.

13
FCFS : FIRST COME FIRST SERVED

 .First-come first served scheduling follow first in first out method.


 . It serves the request in the same order as they are received
 . The average waiting time for FCFS is often quite long.
Advantages :
 Simple ,fair to all request.
 No starvation.
Disadvantages :
* Not efficient because the average seek time is high.

14
SSTF : SHORTEST SEEKTIME FIRST SCHEDULING

 .Selects the request with the minimum seek time from the current head
position.
 . it may cause starvation of some requests.
Advantages :
 More efficient than FCFS.
Disadvantages :
*Starvation is possible for request involving longer seek-time.

15
SCAN SCHEDULING

 The disk arm starts at one end of the disk, and moves toward the other
end, serving requests until it gets to the other end of the disk, where the
head movement is reversed and serving continues.
 Sometimes called the elevator algorithm.
 The head starts at the one end of the disk and moves toward on the
another end. it serves all the request coming in the way.
 After reaching another end the direction of head movement is reverse.

16
Cont’d

Advantages :
 More efficient than FCFS.
 No starvation for any request.
Disadvantages :
* Not so fair, because cylinder which are just behind the head will wait
longer.
* Requires extra head movement between two extreme points.

17
Goals of the I/O software’s
 A key concept in the design of I/O software is known as device
independence.
Ex: A program that reads a file as input should be able to read a file on a
floppy disk, on a hard disk, or on a CD-ROM, without having to modify the
program for each different device.
 Device independence is the goal of uniform renaming. The name of the
file or a device should simply be a string or an integer and not depend on
the device in any way.
 Another issue for I/O software is error handling.
 In general errors should be handled as close to the hardware as possible.

18
The End!!!
19

You might also like