Professional Documents
Culture Documents
Chapter 12 PDF
Chapter 12 PDF
$
I/O Hardware
Application I/O Interface
Kernel I/O Subsystem
Transforming I/O Requests to Hardware Operations
Performance
& %
' $
Operating System Concepts 12.1 Silberschatz and Galvin
1998
c
I/O Hardware
& %
Direct I/O instructions
Memory-mapped I/O
& %
' $
Operating System Concepts 12.3 Silberschatz and Galvin
1998
c
Interrupts
&
Operating System Concepts 12.4 Silberschatz and Galvin
1998
c
%
' Interrupt-drive I/O Cycle
$
CPU I/O controller
1
CPU executing 3
checks for interrupts between instructions
input ready, output
complete, or error
4 generates interrupt
CPU receiving interrupt, signal
transfers control to
7 interrupt handler
& %
interrupt handler
processes data,
returns from interrupt
CPU resumes
processing of
interrupted task
' $
Operating System Concepts 12.5 Silberschatz and Galvin
1998
c
&
Operating System Concepts 12.6 Silberschatz and Galvin
1998
c
%
' Six step process to perform DMA transfer
$
1. device driver is told to
transfer disk data to
buffer at address X CPU
5. DMA controller transfers 2. device driver tells disk
bytes to buffer X, controller to transfer C
increasing memory bytes from disk to buffer cache
address and decreasing at address X
C until C = 0
6. when C = 0, DMA DMA/bus/interrupt x
CPU memory bus memory buffer
interrupts CPU to signal controller
transfer completion
PCI bus
disk disk
& %
' $
Operating System Concepts 12.7 Silberschatz and Galvin
1998
c
& %
Sharable or dedicated
Speed of operation
read-write, read only, or write only
& %
' $
Operating System Concepts 12.9 Silberschatz and Galvin
1998
c
Network Devices
&
Operating System Concepts 12.10 Silberschatz and Galvin
1998
c
%
' Clocks and Timers
$
Provide current time, elapsed time, timer
it programmable interval timer used for timings, periodic
interrupts
ioctl (on UNIX) covers odd aspects of I/O such as clocks and
timers
& %
' $
Operating System Concepts 12.11 Silberschatz and Galvin
1998
c
& %
Asynchronous - process runs while I/O executes
Difficult to use
I/O subsystem signals process when I/O completed
& %
To maintain copy semantics
' $
Operating System Concepts 12.13 Silberschatz and Galvin
1998
c
& %
System calls for allocation and deallocation
Watch out for deadlock
& %
' $
Operating System Concepts 12.15 Silberschatz and Galvin
1998
c
Kernel keeps state info for I/O components, including open file
tables, network connections, character device state
Many, many complex data structures to track buffers, memory
allocation, dirty blocks
Some use object-oriented methods and message passing to
implement I/O
&
Operating System Concepts 12.16 Silberschatz and Galvin
1998
c
%
' I/O Requests to Hardware Operations
$
Consider reading a file from disk for a process
Determine device holding file
Translate name to device representation
Physically read data from disk into buffer
Make data available to requesting process
Return control to process
& %
' $
Operating System Concepts 12.17 Silberschatz and Galvin
1998
c
I/O completed,
user input data available, or
request I/O
process output completed
no
process request,
issue commands to controller, device determine which I/O completed,
configure controller to driver indicate state change to I/O subsystem
block until interrupted
receive interrupt,
interrupt
device controller commands store data in device driver buffer if input,
handler
signal to unblock device driver
& %
interrupt
keyboard
monitor device, I/O completed,
device
interrupt when I/O completed generate interrupt
controller
time
& %
' $
Operating System Concepts 12.19 Silberschatz and Galvin
1998
c
Intercomputer communications
network
character
system call packet
typed
completes received
network
device network
kernel kernel
driver subdaemon
& %
user network
kernel kernel
process daemon
&
Operating System Concepts 12.21 Silberschatz and Galvin
1998
c
%