



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















Klara
Nahrstedt/Sam
King
10/16/
-^
MP
is
out
Page
Replacement
and
Second
Chance
Start
early
D
dli
N
b^
5 2007 (M
d
8
)
Deadline
N
ovember
5
,^2007
(M
onday,
8
am)
-^
Re
‐grading
of
HW
and
Midterm
is
still
going
on
for online
‐Internet students
for
online
Internet
students
-^
On
‐campus
students
should
pick
up
their
midterms
from
Kenton’s
office
-^
Online
‐Internet
students
should
have
received
scanned
HW
and
Midterm
on
Friday
10/16/
DevicesDevices^ –
Storage
devices
(disk,
tapes)
Transmission devices (network card modem)
Transmission
devices
(network
card
,^
modem)
Human
interface
devices
(screen,
keyboard,
mouse)mouse)
Specialized
device
(joystick)
10/16/
Device
‐Computer/Device
‐Device
Communication
Physically: via signals over a cable or throughPhysically:
via
signals
over
a
cable
or
through
air
-^
Logically: via a connection point
port (e G
Logically:
via
a
connection
point
port
(e
Serial
port)
M l i l
d
i^
d
i^
b
ultiple
d
evices
are
connected
via
a
b
us
A
common
set
of
wires
and
a
rigidly
defined
l h
ifi
f^
h
protocol
that
specifies
a
set
of
messages
that
can
be
sent
on
the
wires
10/16/
4 registers
status control data
‐in data
‐out
registers
status
control
data
in
data
out
Status
‐
states
whether
the
current
command
is
completed byte is available device has an errorcompleted
,^ byte
is
available
,^ device
has
an
error
,
etc
Control
‐
host determines to start a command or
Control
host
determines
to
start
a
command
or
change
the
mode
of
a
device
Data
‐in
‐
host
reads
to
g
et
input g^
p
Data
‐out
‐
host
writes
to
send
output
Size of registers
1 to 4 bytes
10/16/
Size
of
registers
to
bytes
Interrupt
‐Driven
ll
i^
f^
ost
‐controller
i
nterface)
-^
CPU hardware has the interrupt report line thatCPU
hardware
has
the
interrupt
report
line
that
the
CPU
senses
after
executing
every
instruction
device raises an interruptdevice
raises
an
interrupt
CPU
catches
the
interrupt
and
saves
the
state
(e.g.,
Instruction
pointer)
CPU
dispatches
the
interrupt
handler
interrupt
handler
determines
cause,
services
the
device
and
clears
the
interrupt
-^
Why
interrupts?
10/16/
Programmed I/O (PIO)Programmed
use
CPU
to
watch
status
bits
and
feed
data
into
a
controller register 1 byte at a time
‐
EXPENSIVE for
controller
register
1
byte
at
a
time
EXPENSIVE
for
large
transfers
Direct memory access (DMA)Direct
memory
access
use
a
special
purpose
processor,
called
a
DMA
controllercontroller
10/16/
DMA
controller
feeds
the
characters
to
disk
one
at
the
time,
without
CPU
being
bothered.
DMA
is^ actually
the
programmed
IO,
only
with
DMA
controller
doing
the
work.
What are the issues with DMA?
10/16/
What
are
the
issues
with
DMA?
(a)
Separate
and
memory
space
(b) M
d I/O
(b)
emory
‐mapped
c)
Hybrid
10/16/
(a)
A
single
‐bus
architecture
(b)
A
dual
‐bus
memory
architecture
10/16/
-^
Three
ways
to
p
erform
I/O
y^
p^
/
-^
Interrupt
‐driven
IO
-^
IO
using
DMA
programmed IO
-^
programmed
IO
.
-^
Every
IO
operation
is
programmed
and
controlled.
-^
Example:
printing
a^
file
from
user
program
to
the
printer
means
that
data
is first copied to the kernel then the OS enters a tight loop outputting theis^
first
copied
to
the
kernel
,^ then
the
OS
enters
a^
tight
loop
outputting
the
characters
one
at
a^
time.
-^
Essential
aspect
of
programmed
IO
is
that
the
CPU
continuously
polls
the
device
to
see
if
it
is
ready
to
accept
another
character.
It
uses
p
olling
(or
y^
p^
p^
g^ (
busy
waiting)
behavior.
-^
Programmed
IO
is
simple
but
required
CPU
full
time
until
all
the
IO
is
done.
10/16/
Consider a producer
‐consumer relation
Consider
a
producer
consumer
relation
between
controller
and
host
Controller indicates through
busy bit
(status
Controller
indicates
through
busy
bit
(status
bit)
if
it
is
busy
to
work
or
not
i^
l^
i^
i h
i^
d
d
bi
ost
signals
i
ts
wishes
via
command
‐ready
bi
t
(command
register)
Polling
behavior
10/16/
Interrupt
‐driven
Interrupt
driven
Pro:
save
CPU
time
for
busy
polling
Con:
triggering
interrupt
takes
time,
too.
gg
g^
p
,
Programmed
Pro: require no interrupt or DMA supportPro:
require
no
interrupt
or
DMA
support
Con:
waste
CPU
time
I/O using DMA:I/O
using
Pro:
relieve
CPU
from
I/O
operation
Con: DMA is slower than CPU
10/16/
Con:
DMA
is
slower
than
CPU
Character
‐stream or block devices
Character
stream
or
block
devices
Sequential
or
random
access
devices
h
h
d
i
ynchronous
or
asynchronous
d
evices
Sharable
or
dedicated
devices
Speed
of
operation
WO RO RW devicesWO
devices
10/16/