Kinesia Online Course
Operating Systems
Kinesia LLC, 2003

  1. Introduction
  2. Processes
  3. Inter Process Communication
  4. Deadlocks
  5. Memory Management
 
  1. File Systems
  2. Protection and Security
  3. I/O Systems



I/O Systems

  1. Overview

    One of the important tasks of the operating system is to control all of the I/O devices, such as issuing commands concerning data transfer or status polling, catching and processing interrupts as well as handling different kind of errors. Two conflicting trends:

  2. increasing standardization of software and hardware interfaces
  3. inreasing broad variety of I/O devices
  4. I/O Hardware

  5. Special I/O ports -- special I/O instructions and ports for communication
  6. memory-mapped I/O -- device-control registers are mapped into the address space of the processor; accessing I/O is like accessing a memory location

  7. An I/O port usually consists of four registers
    • status register -- indicates current states such as whether current command has completed, whether any data for read ...
    • control register -- used to change the mode of the device
    • data-in register -- read by host to get input
    • data-out register -- written by host to send output
  8. handshake -- interaction between the host and a controller

  9. Polling
    busy waiting

  10. Interrupts

    Two kinds:

    • nonmaskable interrupt ( NMI ) -- cannot be masked off, reserved for serious errors
    • maskable interrupt -- can be turned off by the CPU before the execution of critical instruction sequences that must not be interrupted

  11. Direct Memory Access (DMA)
    • Overview DMA is an operational transfer mode which allows data transfer within memory or between memory and I/O device without processor's intervention. A special DMA controller manages that data transfer.

  12. Terminals

    character devices

    Two kinds:

  13. Clocks and Timers

  14. Maintaining the time of day;
  15. Preventing processes from running longer than they are allowed to;
  16. Accounting for CPU usage;
  17. Handling the ALARM system call made by user processes;
  18. Providing watch dog timers for parts of the system itself;
  19. Doing profiling, monitoring and gathering statistics.
  20. Disks

    provide the bulk of secondary storage

    Disk Structure:

  21. addressed as large one-dimensional logical blocks ~ 512 bytes

  22. Constant linear veloctiy ( CLV ) -- the density of bits per track is uniform; outer tracks can hold more sectors ( e.g. CD-ROM, DVD-ROM drives )

  23. Constant angular velocity ( CAV ) -- the disk rotation speed stay constant; the density of bits decreases from inner tracks to outer tracks to keep the data rate constant
  24. Disk Scheduling:

  25. requests are queued

  26. FCFS ( first-come-first-served ) scheduling

  27. SSTF ( Shortest-seek-time-first ) scheduling

  28. SCAN scheduling
      the disk arm starts at one end of the disk, and moves toward the other end, servicing requests as it reaches each cylinder; when it reaches the other end, the direction of head movement is reversed,

      e.g. queue = 98, 183, 37, 122, 14, 124, 65, 67
      current head position at 53, moving towards track 0
      service sequence: 37, 14, 65, 67, 98, 122, 124, 183

  29. C-SCAN ( circular scan ) scheduling
      when it reaches the other end, it immediately return to the beginning

      service sequence of above example: 65, 67, 98, 122, 124, 183, 14, 37

  30. RAID ( redundant arrays of inexpensive disks )

  31. RAID 0: non-redundant block-level striping ( improves speed but no fault tolerance )

  32. RAID 1: mirrored disks ( fault tolerance but no improvement in speed )

  33. RAID 2: memory-style error correcting ( ECC ), not used in practice because level 3 is better

  34. RAID 3: bit-level stripping with parity ( both speed and fault tolerance )

  35. RAID 4: block-level striping with parity ( both speed and fault toerance )
  36. Blocking and Nonblocking I/O

  37. blocking -- execution of application is suspended

  38. nonblocking -- continue application execution while waiting for I/O
  39. Performance

    I/O is a major factor in system performance