|
|
|
|
|
Human readable |
|
used to communicate with the user |
|
video display terminals |
|
keyboard |
|
mouse |
|
printer |
|
|
|
|
|
Machine readable |
|
used to communicate with electronic equipment |
|
disk drives |
|
tape drives |
|
controllers |
|
actuators |
|
|
|
|
|
Communication |
|
used to communicate with remote devices |
|
digital line drivers |
|
modems |
|
|
|
|
|
Data Transfer Rate |
|
Application |
|
disk used to store files must have
file-management software |
|
disk used to store virtual memory pages needs
special hardware to support it |
|
terminal used by system administrator may have a
higher priority |
|
|
|
|
|
Complexity of control |
|
Unit of transfer |
|
data may be transferred as a stream of bytes for
a terminal or in larger blocks for a disk |
|
Data representation |
|
encoding schemes |
|
Error conditions |
|
devices respond to errors differently |
|
|
|
|
|
Programmed I/O |
|
process is busy-waiting for the operation to
complete |
|
Interrupt-driven I/O |
|
I/O command is issued |
|
processor continues executing instructions |
|
I/O module sends an interrupt when done |
|
|
|
|
|
Direct Memory Access (DMA) |
|
DMA module controls exchange of data between
main memory and the I/O device |
|
processor interrupted only after entire block
has been transferred |
|
|
|
|
I/O extremely slow compared to main memory |
|
Use of multiprogramming allows for some
processes to be waiting on I/O while another process executes |
|
I/O cannot keep up with processor speed |
|
Swapping is used to bring in additional Ready
processes which is an I/O operation |
|
Efficiency is an important issue |
|
|
|
|
Efficiency is an important issue |
|
Desirable to handle all I/O devices in a uniform
manner |
|
Hide most of the details of device I/O in
lower-level routines so that processes and upper levels see devices in
general terms such as Read, Write, Open, and Close |
|
Generality is an important issue |
|
|
|
|
|
|
Reasons for buffering |
|
Processes must wait for I/O to complete before
proceeding |
|
Certain pages must remain in main memory during
I/O |
|
|
|
|
|
Block-oriented |
|
information is stored in fixed sized blocks |
|
transfers are made a block at a time |
|
used for disks and tapes |
|
Stream-oriented |
|
transfer information as a stream of bytes |
|
used for terminals, printers, communication
ports, mouse, and most other devices that are not secondary storage |
|
|
|
|
|
|
|
Operating system assigns a buffer in main memory
for an I/O request |
|
Block-oriented |
|
input transfers made to buffer |
|
block moved to user space when needed |
|
another block is moved into the buffer |
|
read ahead |
|
|
|
|
|
Block-oriented |
|
user process can process one block of data while
next block is read in |
|
swapping can occur since input is taking place
in system memory, not user memory |
|
operating system keeps track of assignment of
system buffers to user processes |
|
output is accomplished by the user process
writing a block to the buffer and later actually written out |
|
|
|
|
|
Stream-oriented |
|
used a line at time |
|
user input from a terminal is one line at a time
with carriage return signaling the end of the line |
|
output to the terminal is one line at a time |
|
|
|
|
Use two system buffers instead of one |
|
A process can transfer data to or from one
buffer while the operating system empties or fills the other buffer |
|
|
|
|
More than two buffers are used |
|
Each individual buffer is one unit in a circular
buffer |
|
Used when I/O operation must keep up with
process |
|
|
|
|
|
To read or write, the disk head must be
positioned at the desired track and at the beginning of the desired sector |
|
Seek time |
|
time it takes to position the head at the
desired track |
|
Rotational delay or rotational latency |
|
time its takes until desired sector is rotated
to line up with the head |
|
|
|
|
|
Access time |
|
sum of seek time and rotational delay |
|
the time it takes to get in position to read or
write |
|
Data transfer occurs as the sector moves under
the head |
|
Data transfer for an entire file is faster when
the file is stored in the same cylinder and in adjacent sectors |
|
|
|
|
Seek time is the reason for differences in
performance |
|
For a single disk there will be a number of I/O
requests |
|
If requests are selected randomly, we will get
the worst possible performance |
|
|
|
|
|
|
|
First-in, first-out (FIFO) |
|
process request sequentially |
|
fair to all processes |
|
approaches random scheduling in performance if
there are many processes |
|
|
|
|
|
Priority |
|
goal is not to optimize disk use but to meet
other objectives |
|
short batch jobs may have higher priority |
|
provide good interactive response time |
|
|
|
|
|
|
Last-in, first-out |
|
good for transaction processing systems |
|
the device is given to the most recent user so
there should be little arm movement |
|
possibility of starvation since a job may never
regain the head of the line |
|
|
|
|
|
Shortest Service Time First |
|
select the disk I/O request that requires the
least movement of the disk arm from its current position |
|
always choose the minimum Seek time |
|
|
|
|
|
SCAN |
|
arm moves in one direction only, satisfying all
outstanding requests until it reaches the last track in that direction |
|
direction is reversed |
|
|
|
|
|
C-SCAN |
|
restricts scanning to one direction only |
|
when the last track has been visited in one
direction, the arm is returned to the opposite end of the disk and the scan
begins again |
|
|
|
|
|
N-step-SCAN |
|
segments the disk request queue into subqueues
of length N |
|
subqueues are process one at a time, using SCAN |
|
new requests added to other queue when queue is
processed |
|
FSCAN |
|
two queues |
|
one queue is empty for new request |
|
|
|
|
|
|
|
|