You are on page 1of 42

I/O Management

Device Controllers and Device Drivers


Basic Approaches in I/O
(Polled, Overlapped e.g. interrupt driven / DMA
I/O Bu!!ering
"#nchronous vs. as#nchronous I/O
Dis$ Cache
I/O Architecture
(e%amples in &'I( and or )indo*s
Dis$ Drives and Controllers
"tructure o! Dis$ "ectors
Ph#sical and +ogical "ector Address
Bloc$ing Dis$ "cheduling
(,C,", "hortest "ee$ -ime ,irst, .levator Algorithm, C#clic "can
Dis$ Drives
and
Controllers
Dis$ Drives

A disk drive is a device implementing


such a storage mechanism *ith !i%ed or
remova/le media0 'ota/le t#pes are
the hard dis$ drive (1DD containing a
non2remova/le dis$, the !lopp# dis$
drive (,DD and its remova/le !lopp# dis$,
and various optical disc drives and
associated optical disc media.
Dis$ Controllers

-he disk controller is the circuit *hich


ena/les the CP& to communicate *ith
a hard dis$, !lopp# dis$ or other $ind
o! dis$ drive.
.arl# Dis$ Controller

identi!ied /# their storage methods and


data encoding

t#picall# implemented on a separate


controller card
Modi!ied ,re3uenc# Modulation

(M,M controllers *ere the most common


t#pe in small computers, used !or /oth
!lopp# dis$ and hard dis$ drives.
4un +ength +imited

(4++ controllers used data compression


to increase storage capacit# /# a/out
567.
Modern Dis$ Controllers

are integrated into the dis$ drive. ,or e%ample, dis$s


called 8"C"I dis$s8 have /uilt2in "C"I controllers. In the
past, /e!ore most "C"I controller !unctionalit# *as
implemented in a single chip, separate "C"I controllers
inter!aced dis$s to the "C"I /us.

-he most common types of interfaces provided


no*ada#s /# dis$ controllers are PA-A (ID. and "erial
A-A !or home use. 1igh2end dis$s use "C"I, ,i/re
Channel or "erial Attached "C"I.
1ard Drive Inter!ace "tandards

Determine ho* a drive connect to the PC and other


characteristics

Common standards9

Parallel A-A (PA-A

"erial A-A ("A-A and serial A-A II ("A-A II

"C"I and the ne*er serial attached "C"I ("A"

,i/re Channel

,i/re Channel over .thernet (,Co.

e"A-A

.%ternal hard drives can also connect via &"B or ,ire)ire, /ut e"A-A
is closer in per!ormance to internal hard drives
PA-A (ID.
Parallel A- Attachment
Inter!ace standard !or the connection
o! storage devices such as hard dis$s, solid2state
drives, !lopp# drives, and optical disc
drives in computers.
"erial A-A
Serial ATA (SATA or Serial Advanced
Technology Attachment is a computer
/us inter!ace !or connecting host /us
adapters to mass storage devices such
as hard dis$ drives and optical drives. "erial
A-A *as designed to replace the
older parallel A-A (PA-A standard (o!ten
called /# the old name ID.,
"tructure o! Dis$ "ectors
Ph#sical and +ogical "ector Address
Ph#sical applies to the actual platters
in the hard dis$, *hile logical applies to !iles
in the !ile s#stem ( cross2inde%es the
ph#sical to the logical, ,A-, ,A-:;, '-,".
Bloc$ing Dis$ "cheduling
(,C,", "hortest "ee$ -ime
,irst, .levator Algorithm, C#clic
"can
5.< Motivation ,or Dis$ "cheduling
Primar# memor# is volatile
*hereas secondar# memor# is non2
volatile. )hen po*er is s*itched o!! the
primar# memor# loses the stored
in!ormation *hereas the secondar#
memories retain the stored in!ormation.
-he most common secondar# storage
is a dis$.
A dis$ has several platters. .ach
platter has several rings or trac$s. -he rings
are divided into sectors *here in!ormation is
actuall# stored. -he rings *ith similar
position on di!!erent platters are said to !orm
a c#linder. As the dis$ spins around a
spindle, the heads trans!er the in!ormation
!rom the sectors along the rings.
'ote that in!ormation can /e read !rom the
c#linder sur!ace *ithout an# additional lateral head
movement. "o it is al*a#s a good idea to organi=e
all se3uentiall#2related in!ormation along a c#linder.
-his is done /# !irst putting it along a ring and then
carr#ing on *ith it across to a di!!erent platter on
the c#linder. -his ensures that the in!ormation is
stored on a ring a/ove or /elo* this ring.
In!ormation on di!!erent c#linders can /e read /#
moving the arm /# relocating the head laterall#. -his
re3uires an additional arm movement resulting in
some dela#, o!ten re!erred to as see$ latenc# in
response. Clearl#, this dela# is due to the
mechanical structure o! dis$ drives. In other *ords,
there are t*o $inds o! mechanical dela#s involved in
data trans!er !rom dis$s.
-he see$ latenc#, as e%plained earlier, is due to
the time re3uired to move the arm to position the
head along a ring. -he other dela#, called
rotational latenc#, re!ers to the time spent in *aiting
!or a sector in rotation to come under the read or
*rite head. -he see$ dela# can /e considera/l#
reduced /# having a head per trac$ dis$. -he
motivation !or dis$ scheduling comes !rom the
need to $eep /oth the dela#s to a minimum.
&suall# a sector *hich stores a /loc$ o!
in!ormation, additionall# has a lot o! other in!ormation. In
,igure 5.>? *e see that a 5>; /#te /loc$ has nearl# >66
/#tes o! additional in!ormation *hich is utili=ed to
s#nchroni=e and also chec$ correctness o! the
in!ormation trans!er as it ta$es place. 'ote that in !igure
5.>? *e have t*o pre2am/les each o! ;5 /#tes, t*o
s#nchroni=ing /#tes, < /#tes !or chec$ing errors in data
trans!er and a post2am/le.
"cheduling Dis$ Operations
A user as *ell as a s#stem spends a lot
o! time o! operation communicating *ith !iles
(programs, data, s#stem utilities, etc. stored
on dis$s. All such communications have the
!ollo*ing components.
>. -he IO is to read !rom, or *rite into, a dis$.
;. -he starting address !or communication in
main memor#.
:. -he amount o! in!ormation to /e
communicated (in num/er o! /#tes / *ords
?. -he starting address in the dis$ and the
current status o! the trans!er.
First Come First Serve
-he !irst come !irst served polic# entails
that the service /e provided strictl# in the
se3uence in *hich the re3uests arrived.
"hortest "ee$ -ime ,irst
)e loo$ at the 3ueue and compute
the nearest c#linder location !rom the
current location.
.levator algorithm
+et us assume an initial arm
movement in a certain direction. All the
re3uests in that direction are serviced !irst.
Circular "can
In the C2scan polic# service is
provided in one direction and then *raps
round. In our e%ample i! the re3uests are
serviced as the c#linder num/ers increase
Let us consider an example in which we have some pending
requests. e only need to identify the cylinders for these requests.
Suppose! there are "## tracks or rings on each platter. e may have
pending requests that may have come in the order $%! &'! '("! (&! $"!
)$! '*%! '"! '%&! and )(.
,rom the response characteristics
*e can sense that ,C," is not a
ver# good polic#. In contrast, the
shortest see$ !irst and the elevator
algorithm seems to per!orm *ell as
these have the least arm
movements. -he circular scan too
could /e a ver# good scheduling
mechanism, i! the !l#2/ac$ time !or
the dis$ arm is ver# short.
-he .nd
@uestion 'o. >
It is the circuit *hich ena/les
the CP& to communicate *ith
a hard dis$, !lopp# dis$ or other
$ind o! dis$ drive.
Ans*er 'o. >
Dis$ Controllers
@uestion 'o. ;
A is a device implementing
such a storage mechanism *ith
!i%ed or remova/le media
Ans*er 'o. ;
disk drive
@uestion 'o. :
A is a device implementing
such a storage mechanism *ith
!i%ed or remova/le media
Ans*er 'o. :
Dis$ Drive
@uestion 'o. ?
It entails that the service /e
provided strictl# in the se3uence in
*hich the re3uests arrived.
Ans*er 'o. ?
,irst Come ,irst "erve
@uestion 'o. 5
)e loo$ at the 3ueue and
compute the nearest c#linder
location !rom the current
location.
Ans*er 'o. 5
"hortest "ee$ -ime ,irst

You might also like