0% found this document useful (0 votes)
18 views51 pages

OS-Chap5-2021 01 22

Uploaded by

hieuhn.22ds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views51 pages

OS-Chap5-2021 01 22

Uploaded by

hieuhn.22ds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

CHAPTER 5 – INPUT/OUTPUT

I/O hardware management


I/O software management
Disk management
User Interface management
Types of I/O devices

Two main groups: Block and Character Devices


Block devices include disk drives
 Commands include read, write, seek
 Raw I/O or file-system access
 Memory-mapped file access possible
Character devices include keyboards, mice, serial ports
 Commands include get, put
 Libraries layered on top allow line editing

2
Types of I/O devices

Some typical device, network, and data base rates

3
Common concepts

Common concepts
 I/O Device Controller
 I/O Port
 I/O Bus

4
Device Controllers

Components of a simple personal computer


Monitor

Bus

5
Device Controllers

I/O devices have components:


 electromechanical component
 electronic component
The electronic component is the device controller
 may be able to handle multiple devices
Controller's tasks (Disk)
 convert serial bit stream to block of bytes
 perform error correction as necessary
 make available to main memory

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

I/O instructions control devices


Devices have addresses, used by
 Direct I/O instructions
 Memory-mapped I/O

9
Memory-Mapped I/O (1)

Separate I/O and memory space


Memory-mapped I/O
Hybrid

10
Memory-Mapped I/O (2)

(a) A single-bus architecture


(b) A dual-bus memory architecture

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

Determines state of device


 ready
 busy
 Error
Busy-wait cycle to wait for I/O from device

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)

Operation of a DMA transfer

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)

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

19
Programmed I/O (1)

Steps in printing a string

20
Programmed I/O (2)

Writing a string to the printer using programmed I/O

21
Interrupt-Driven I/O

Writing a string to the printer using interrupt-driven I/O


 Code executed when print system call is made
 Interrupt service procedure

22
I/O Using DMA

Printing a string using DMA


 code executed when the print system call is made
 interrupt service procedure

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

An illustration of cylinder skew


34
Disk Formatting (2)
(a) No interleaving
(b) Single interleaving
(c) Double interleaving

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

Exceptions, adaptations needed for other languages


 many OS provide for loadable keymaps or code pages

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

You might also like