Beruflich Dokumente
Kultur Dokumente
Subsystem
COMS
W4118
Prof.
Kaustubh
R.
Joshi
krj@cs.columbia.edu
hDp://www.cs.columbia.edu/~krj/os
References:
OperaWng
Systems
Concepts
(9e),
Linux
Kernel
Development,
previous
W4118s
Copyright
no2ce:
care
has
been
taken
to
use
only
those
web
images
deemed
by
the
instructor
to
be
in
the
public
domain.
If
you
see
a
copyrighted
image
on
any
slide
and
are
the
copyright
owner,
please
contact
the
instructor.
It
will
be
removed.
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
I/O Subsystem
Goals
Architecture
Device
CharacterisWcs
OS
Mechanisms
Transferring
data
NoWcaWon
Buering
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
I/O Subsystem
Goals
Architecture
Device
CharacterisWcs
OS
Mechanisms
Transferring
data
NoWcaWon
Buering
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
Handles
memory
Graphics
Southbridge:
PCI
bus
Disk
controllers
USB
controllers
Audio
Serial
I/O
Interrupt
controller
Timers
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
CPU
Bus
Adaptor
Interrupt
Controller
Other
Devices
or
Buses
Regular
Memory
Bus
Adaptor
Address+
Data
Interrupt Request
Device
Controller
Bus
Interface
read
write
control
status
Registers
(port
0x20)
Hardware
Controller
Addressable
Memory
and/or
Queues
Memory
Mapped
Region:
0x8f008020
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
10
Memory-Mapped
I/O:
No
need
for
special
instrucWons
(can
use
in
C)
Allows
user-based
I/O
Caching
addresses
must
be
prevented
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
11
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
12
Memory-Mapped I/O
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
13
Memory-Mapped I/O
Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
COMS
W4118.
Spring
2013,
Columbia
University.
Instructor:
Dr.
Kaustubh
Joshi,
AT&T
Labs.
14
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
15
Device
Drivers
Device Drivers
Device-specic
code
in
the
kernel
that
interacts
directly
with
the
device
hardware
Supports
a
standard,
internal
interface
Same
kernel
I/O
system
can
interact
easily
with
dierent
device
drivers
Special
device-specic
conguraWon
supported
with
the
ioctl()
system
call
Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
16
Increased specicity
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
17
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
18
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
19
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
20
I/O Subsystem
Goals
Architecture
Device
CharacterisWcs
OS
Mechanisms
Transferring
data
NoWcaWon
Buering
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
21
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
22
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
23
Network
Devices
Dierent
enough
from
block
and
character
to
have
own
interface
Unix
and
Windows
NT/9x/2000
include
socket
interface
Separates
network
protocol
from
network
operaWon
Includes
select
funcWonality
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
24
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
25
Clock
Hardware
A
programmable
clock.
Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
26
I/O Subsystem
Goals
Architecture
Device
CharacterisWcs
OS
Mechanisms
Transferring
data
NoWcaWon
Buering
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
27
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
28
Programmed
I/O
WriWng
a
string
to
the
printer
using
programmed
I/O.
Figure from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
29
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
30
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
31
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
32
I/O
Performance
I/O
a
major
factor
in
system
performance:
Improving performance:
Use
DMA
Reduce/eliminate
data
copying
Reduce
number
of
context
switches
Reduce
interrupts
by
using
large
transfers,
smart
controllers,
polling
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
33
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
34
Asynchronous I/O
Synchronous"
5/1/13
Asynchronous"
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
35
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
36
Buering
Buering
-
store
data
in
memory
while
transferring
between
devices
To
cope
with
device
speed
mismatch
To
cope
with
device
transfer
size
mismatch
To
maintain
copy
semanWcs
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
37
Buering
Unbuered
input
Buering
in
user
space
Buering
in
the
kernel
followed
by
copying
to
user
space
Double
buering
in
the
kernel.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
38
Buering
Networking
may
involve
many
copies
of
a
packet.
May
reduce
performance.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
39
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
40
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
41
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
42
I/O
ProtecWon
User
process
may
accidentally
or
purposefully
aDempt
to
disrupt
normal
operaWon
via
illegal
I/O
instrucWons
All
I/O
instrucWons
dened
to
be
privileged
I/O
must
be
performed
via
system
calls
Memory-mapped
and
I/O
port
memory
locaWons
must
be
protected
too
5/1/13
COMS W4118. Spring 2013, Columbia University. Instructor: Dr. Kaustubh Joshi, AT&T Labs.
43