Syllabus   Blank Homework   Quizzes  
Notes   Labs   Scores   Blank

Lecture Notes
Dr. Tong Lai Yu, 2010

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

In a few hundred years, when the history of our time is written from
a long-term perspective, it is likely that the most important event
those historians will see is not technology, not the Internet, not
e-commerce.  It is the unprecedented change in human condition.  For
the first time -- literally -- substantial and rapidly growing numbers
of people have choices.  For the first time, they will have to manage

						Peter Drucker

I/O Systems

  1. Overview

    Von Neuman Architecture

    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. Briefly divided into two categories:

  5. block devices -- store data in fixed-size blocks; each block has its own address e.g. hard disks, CD-ROMs, USB disks
  6. character devices -- sends or accepts a stream of characters, not addressable e.g. printers, network cards, mice
  7. I/O Hardware

  8. Special I/O ports -- special I/O instructions and ports for communication
  9. 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

  10. 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
  11. handshake -- interaction between the host and a controller

  12. Polling
    busy waiting

  13. 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

  14. 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.

  15. Terminals

    character devices

    Two kinds:

  16. Clocks and Timers

    niehter belongs to block devices nor character devices

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

    provide the bulk of secondary storage

    Disk Structure:

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

  25. 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 )

  26. 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
  27. Disk Scheduling:

  28. requests are queued

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

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

  31. 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

  32. 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

  33. RAID ( redundant arrays of inexpensive disks )

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

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

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

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

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

  40. blocking -- execution of application is suspended

  41. nonblocking -- continue application execution while waiting for I/O
  42. Performance

    I/O is a major factor in system performance