This document discusses input/output (I/O) concepts in operating systems. It covers I/O devices and controllers, principles of I/O software including device independence and uniform naming. Memory-mapped I/O, direct memory access, and interrupts are described. Page replacement algorithms like not recently used and first-in first-out are introduced. The document also examines disk hardware components, formatting, and scheduling algorithms. Error handling and stable storage concepts for disks are summarized. References for further reading on operating system concepts are provided.
3. Device Controllers
๎
I/O devices have components:
โ
mechanical component
โ
electronic component
๎
The electronic component is the device
controller
โ
may be able to handle multiple devices
๎
Controller's tasks
โ
convert serial bit stream to block of bytes
โ
perform error correction as necessary
โ
make available to main memory
4. Principles of I/O Software
Goals of I/O Software (1)
๎ Device independence
โ programs can access
any I/O device
โ without specifying
device in advance
โ (floppy, hard drive, or
CD-ROM)
๎ Uniform naming
โ name of a file or
device a string or an
integer
โ not depending on
9. Not Recently Used Page Replacement
Algorithm
๎ Each page has
Reference bit,
Modified bit
๎ bits are set when
page is
referenced,
modified
๎ Pages are classified
๎ not referenced,
not modified
๎ not referenced,
modified
10. Device-Independent I/O Software
(1)
Uniform interfacing for device drivers
Buffering
Error reporting
Allocating and releasing dedicate devices
Providing a deice-independent block size
Functions of the device-independent I/O software
10
11. FIFO Page Replacement
Algorithm
๎
Maintain a linked list of all pages
๎
in order they came into memory
๎
Page at beginning of list replaced
๎
Disadvantage
๎
page in memory the longest may be often used
12. Device-Independent I/O Software
(3)
(a) Unbuffered input
(b) Buffering in user space
(c) Buffering in the kernel followed by copying to user space
(d) Double buffering in the kernel 12
20. Disk Hardware (7)
๎
Cross section of a CD-R disk and laser
โ
not to scale
๎
Silver CD-ROM has similar structure
โ
without dye layer
โ
with pitted aluminum layer instead of gold 20
24. Disk Formatting (3)
๎
No interleaving
๎
Single interleaving
๎
Double interleaving
24
25. Disk Arm Scheduling Algorithms (1)
โข Time required to read or write a disk
block determined by 3 factors
1. Seek time
2. Rotational delay
3. Actual transfer time
โข Seek time dominates
โข Error checking is done by controllers
25
26. Disk Arm Scheduling Algorithms (2)
Initial Pending
position requests
Shortest Seek First (SSF) disk scheduling algorithm
26
27. Disk Arm Scheduling Algorithms (3)
The elevator algorithm for scheduling disk requests
27
28. Error Handling
๎
A disk track with a bad sector
๎
Substituting a spare for the bad sector
๎
Shifting all the sectors to bypass the bad one
28