OS-Chap5-2021 01 22
OS-Chap5-2021 01 22
2
Types of I/O devices
3
Common concepts
Common concepts
I/O Device Controller
I/O Port
I/O Bus
4
Device Controllers
Bus
5
Device Controllers
6
I/O Port
I/O Port is a register in device interface. Example: Device I/O Port Locations on PCs (partial)
7
A Typical PC Bus Structure
8
I/O address
9
Memory-Mapped I/O (1)
10
Memory-Mapped I/O (2)
11
Data transfer Method between
CPU and I/O device
Three Data I/O transfer Methods:
Programmed I/O
Interrupt-Driven I/O
Direct Memory Access
12
Programmed I/O, Polling
13
Interrupt-Driven I/O
How interrupts happens. Connections between devices and interrupt controller actually
use interrupt lines on the bus rather than dedicated wires
Bus
14
Example: Interrupts of PC computer
15
Direct Memory Access (DMA)
16
Example: DMA Transfer in PC Computer
17
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 is a string or an integer
not depending on which machine
Error handling
handle as close to the hardware as possible
18
Goals of I/O Software (2)
19
Programmed I/O (1)
20
Programmed I/O (2)
21
Interrupt-Driven I/O
22
I/O Using DMA
23
Hardware And Software
24
Disk management
Disk parameters for the original IBM PC floppy disk and a Western Digital WD
18300 hard disk
25
Disk Hardware (1)
26
Disk Hardware (2)
Physical geometry of a disk with two zones
A possible virtual geometry for this disk
27
Disk Hardware (3)
Raid levels 0 through 2
Backup and parity drives are shaded
28
Disk Hardware (4)
Raid levels 3 through 5
Backup and parity drives are shaded
29
Disk Hardware (5)
Recording structure of a CD or CD-ROM
30
Disk Hardware (6)
Logical data layout on a CD-ROM
31
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
32
Disk Hardware (8)
A double sided, dual layer DVD disk
33
Disk Formatting (1)
A disk sector
35
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
36
Disk Arm Scheduling Algorithms (2)
Shortest Seek First (SSF) disk scheduling algorithm
Initial Pending
position requests
37
Disk Arm Scheduling Algorithms (3)
The elevator algorithm for scheduling disk requests
38
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
39
User Interface management
Input Software
Output Software
04/30/2024 40
Input Software
Central buffer pool
Dedicated buffer for each terminal
41
Input Software
Characters handled specially in canonical mode
42
Input Software
Keyboard driver delivers a number
driver converts to characters
uses a ASCII table
43
Output Software
The ANSI escape sequences
accepted by terminal driver on output
ESC is ASCII character (0x1B)
n,m, and s are optional numeric parameters
44
Display Hardware (1)
Memory-mapped displays
driver writes directly into display's video RAM
Parallel port
45
Display Hardware (2)
A video RAM image
simple monochrome display
character mode
Corresponding screen
the xs are attribute bytes
46
Output Software for Windows
Sample window located at (200,100) on XGA display
47
Output Software for Windows
An example rectangle drawn using Rectangle
48
Output Software for Windows
Copying bitmaps using BitBlt.
(a) before
(b) after
49
Output Software for Windows
Examples of character outlines at different point sizes
50
SUMMARY
I/O hardware management
I/O software management
Disk management
User Interface management
51