Docsity

Input and Output - Applied Operating System - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Input and Output - Applied Operating System - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Input/Output

Chapter 5

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

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

Memory-Mapped I/O (2)

(a) A single-bus architecture

(b) A dual-bus memory architecture

Direct Memory Access (DMA)

Operation of a DMA transfer

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

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

Programmed I/O (2)

Writing a string to the printer using

programmed I/O

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

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

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

Device-Independent I/O Software (1)

Functions of the device-independent I/O software

Uniform interfacing for device drivers

Buffering

Error reporting

Allocating and releasing dedicate devices

Providing a deice-independent block size

Device-Independent I/O Software (2)

(a) Without a standard driver interface

(b) With a standard driver interface

Device-Independent I/O Software (4)

Networking may involve many copies

User-Space I/O Software

Layers of the I/O system and the main functions of each layer