Oprting System (Lecture) - Chapter-05
Oprting System (Lecture) - Chapter-05
Input/Output
5.1 Principles of I/O hardware
5.2 Principles of I/O software
5.3 I/O software layers
5.4 Disks
5.5 Clocks
5.6 Character-oriented terminals
5.7 Graphical user interfaces
5.8 Network terminals
5.9 Power management
1
Principles of I/O Hardware
7
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 which machine
• Error handling
– handle as close to the hardware as possible
8
Goals of I/O Software (2)
• Synchronous vs. asynchronous transfers
– blocked transfers vs. interrupt-driven
• Buffering
– data coming off a device cannot be stored in
final destination
• Sharable vs. dedicated devices
– disks are sharable
– tape drives would not be
9
Programmed I/O (1)
12
I/O Using DMA
13
I/O Software Layers
14
Interrupt Handlers (1)
• Interrupt handlers are best hidden
– have driver starting an I/O operation block until
interrupt notifies of completion
• Interrupt procedure does its task
– then unblocks driver that started it
• Steps must be performed in software after
interrupt completed
1. Save regs not already saved by interrupt hardware
2. Set up context for interrupt service procedure
15
Interrupt Handlers (2)
3. Set up stack for interrupt service procedure
4. Ack interrupt controller, reenable interrupts
5. Copy registers from where saved
6. Run service procedure
7. Set up MMU context for process to run next
8. Load new process' registers
9. Start running the new process
16
Device Drivers
17
Device-Independent I/O Software (1)
Layers of the I/O system and the main functions of each layer
22
Disks
Disk Hardware (1)
29
Disk Hardware (8)
30
Disk Formatting (1)
A disk sector
31
Disk Formatting (2)
• No interleaving
• Single interleaving
• Double interleaving
33
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
34
Disk Arm Scheduling Algorithms (2)
Initial Pending
position requests
35
Disk Arm Scheduling Algorithms (3)
38
Clocks
Clock Hardware
A programmable clock
39
Clock Software (1)
40
Clock Software (2)
45
Output Software
46
Display Hardware (1)
Parallel port
Memory-mapped displays
• driver writes directly into display's video RAM
47
Display Hardware (2)
48
Input Software
• Keyboard driver delivers a number
– driver converts to characters
– uses a ASCII table
49
Output Software for Windows (1)
54
Output Software for Windows (6)
58
The SLIM Network Terminal (2)
Messages used in the SLIM protocol from the server to the terminals
59
Power Management (1)
60
Power management (2)
61
Power Management (3)
62
Power Management (4)
• Telling the programs to use less energy
– may mean poorer user experience
• Examples
– change from color output to black and white
– speech recognition reduces vocabulary
– less resolution or detail in an image
63