Unformatted text preview:

MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-1. Some typical device, network, and bus data rates. I/O Devices Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-2. (a) Separate I/O and memory space. (b) Memory-mapped I/O. (c) Hybrid. Memory-Mapped I/O (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-3. (a) A single-bus architecture. (b) A dual-bus memory architecture. Memory-Mapped I/O (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-4. Operation of a DMA transfer. Direct Memory Access (DMA) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-5. How an interrupt happens. The connections between the devices and the interrupt controller actually use interrupt lines on the bus rather than dedicated wires. Interrupts Revisited Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Properties of a precise interrupt 1. PC (Program Counter) is saved in a known place. 2. All instructions before the one pointed to by the PC have fully executed. 3. No instruction beyond the one pointed to by the PC has been executed. 4. Execution state of the instruction pointed to by the PC is known. Precise and Imprecise Interrupts (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-6. (a) A precise interrupt. (b) An imprecise interrupt. Precise and Imprecise Interrupts (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-7. Steps in printing a string. Programmed I/O (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-8. Writing a string to the printer using programmed I/O. Programmed I/O (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-9. Writing a string to the printer using interrupt-driven I/O. (a) Code executed at the time the print system call is made. (b) Interrupt service procedure for the printer. Interrupt-Driven I/O Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-10. Printing a string using DMA. (a) Code executed when the print system call is made. (b) Interrupt service procedure. I/O Using DMA Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-11. Layers of the I/O software system. I/O Software Layers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Interrupt Handlers (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639 1. Save registers not already been saved by interrupt hardware. 2. Set up a context for the interrupt service procedure. 3. Set up a stack for the interrupt service procedure. 4. Acknowledge the interrupt controller. If there is no centralized interrupt controller, reenable interrupts. 5. Copy the registers from where they were saved to the process table.Interrupt Handlers (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639 6. Run the interrupt service procedure. 7. Choose which process to run next. 8. Set up the MMU context for the process to run next. 9. Load the new process’ registers, including its PSW. 10. Start running the new process.Figure 5-12. Logical positioning of device drivers. In reality all communication between drivers and device controllers goes over the bus. Device Drivers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-13. Functions of the device-independent I/O software. Device-Independent I/O Software Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-14. (a) Without a standard driver interface. (b) With a standard driver interface. Uniform Interfacing for Device Drivers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-15. (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. Buffering (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-16. Networking may involve many copies of a packet. Buffering (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-17. Layers of the I/O system and the main functions of each layer. User-Space I/O Software Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-18. Disk parameters for the original IBM PC 360-KB floppy disk and a Western Digital WD 18300 hard disk. Magnetic Disks (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-19. (a) Physical geometry of a disk with two zones. (b) A possible virtual geometry for this disk. Magnetic Disks (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-20. RAID levels 0 through 5. Backup and parity drives are shown shaded. RAID (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-20. RAID levels 0 through 5. Backup and parity drives are shown shaded. RAID (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-21. Recording structure of a compact disc or CD-ROM. CD-ROMs (1) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-22. Logical data layout on a CD-ROM. CD-ROMs (2) Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved. 0-13-6006639Figure 5-23. Cross section of a CD-R disk and laser. A silver CD-ROM has similar structure, except without


View Full Document

UCSC CMPS 111 - Chapter 5 Input/Output

Download Chapter 5 Input/Output
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter 5 Input/Output and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter 5 Input/Output 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?