Chapter 3 -- System Structure

  1. Structures
    1. Virtual Machine
      1. Idea:  Everyone runs on naked hardware, possibly augmented.  Kernel virtualizes the hardware as needed.
      2. For some systems, 'fake' instructions are added to do useful things, like get-a-file.
      3. Advantages:
        1. Can be very fast, since you write to hardware.
      4. Disadvantages
        1. Can be very slow, since hardware needs to be virtualized.
    2. Simple (or ad-hoc)
      1. DOS is an example.
      2. Can offer maximum performance
        1. Apps can read down to low-level operations if needed.
        2. System functions can call any other function, providing maximum flexibility and performance.
      3. Can be hard to code/debug.
        1. Can have infite loops that are hard to see
          1. Memory manager want to get new page -> Device driver tries to free buffer to read in page -> (go to start)
          2. Schedular tries to bring in new process -> File system calls device driver for data -> Device driver tries to WAIT for data to arive -> (go to start)
        2. Can be inhibited because you don't know what you can call.
    3. Layered
      1. UNIX/WinNT are examples
      2. Can offer ease of coding/debugging
        1. By avoiding infinite loops.
        2. By allowing development in stages.
      3. NOTES ON UNIX LAYERING
        1. Device drivers cannot call scheduler.
        2. Device driver cannot call memory manager (DMA must be set up at higher level).
      4. NOTES on VENUS LAYERING:
        1. Instruction interprater is micorcode for normal instructions.
        2. Virtual memory cannot call device drivers (must be able to do swapping with I/O channel).
      5. General layering concerns (hints, not laws).
        1. User programs always at top.
        2. Virtual Memory subsystem must be able to access disk drives.
        3. All drivers at level of Disk device driver must never cause a page fault.
        4. Other layers can exist (lock manager, etc.)
        5. No layer can call "system()" to do it's task.
    4. Modular Kernel
      1. Idea:  The kernel has some subsystem that can be loaded and unloaded like shared libraries
      2. The libraries are loaded as needed, and have an INIT section that runs when first loaded.
      3. The init section can be freeded after loading.
      4. Advantages:
        1. Can replace some subsystems as needed.
        2. Fast like normal kernel.
      5. Disadvantages
        1. Bugs in one section can crash whole system.
    5. Microkernel
      1. Idea:  Have a VERY SMALL kernel, and deamons to do real work
      2. Kernel can be just 30K, that's nothing.  Just does message passing, and sometimes handles VM
      3. Deamons implement file system, networking, graphics, etc.
      4. Advantages:
        1. Bugs in one subsystem don't crash whole system
        2. Can replace subsystems as needed.
        3. System programming easier
        4. Only need load those parts needed.
      5. Disadvantages
        1. SPEED (need to pass messaged, get deamons scheduled, etc.)
        2. When critical subsystems go down, system is unusable.