
	 
	 Chapter 1: Computer Hardware Review
	 
	 
    
                    
  -  CPU
    
    -  Registers
      
      -  General purpose.
      
 -  Program counter.
      
 -  Stack pointer.
      
 -  “Program Status Register”
      
 
     -  Program state.  
      
      -  Saving and restoring state.
      
 -  Traps.
      
 -  Interrupts.
      
 -  Pipelines complicate the idea of the “current state”.
      
 
     -  Context switch.
      
      -  Change which program is running.
      
 -  Save the CPU registers and replace them with saved copies
      	  from another running program.
      
 
     -  Traditionally a single CPU with a single thread of execution.
      
      -  Multi-threaded processor.
        
	-  Hyperthreaded is Intel's term.
	
 -  Multiple register sets.
	
 -  Multiple threads running on the CPU at once.
	
 -  CPU can switch between them rapidly without copying to memory.
	
 
       -  Multi-core.  Essentially multiple CPUs on the same chip.
      
 
     
   -  Memory system.
    
    -  Addressing.
    
 -  Main memory.
    
 -  Cache.
    
 
   -  I/O
    
    -  Devices.
      
      -  Usually much slower than the CPU.
      
 -  Communication over buses.
        
	-  Disk buses: SATA now standard; older PC buses, SCSI, IDE
	
 -  General internal buses: PCIe (replaces PCI), previous ISA bus.
	
 -  External connections: USB.  Previously RS232 serial or PC parallel.
	
 
       -  Storage devices.
        
	-  Mechanical disks.
	  
	  -  Slow.
	  
 -  Operation order is important.
	  
 
	 -  Solid-State storage (flash).
	  
	  -  Reads are much faster than disks.
	  
 -  Order doesn't matter.
	  
 -  Writes wear the device, and must be distributed.
	  
 
	 
       
     -  I/O Device Communication
      
      -  Control registers.
        
        -  Memory mapped.
        
 -  Port address space.
        
 
       
     -  Device Control
      
      -  Polling.
      
 -  Interrupts
      
 -  DMA
      
 
     
   -  Hardware Features Needed by the Operating System.
    
    -  Traps and interrupts.  Allows the O/S to gain control.
    
 -  CPU modes: User and supervisor (or kernel) mode.
      
      -  Some instructions allowed only in supervisor mode.
      	  I/O instructions, for instance.
       -  Traps and interrupts (including syscall) enter supervisory.
      
 -  Switch to user before running user code.
      
 -  Reserves some operation to O/S kernel only.
      
 
     -  Memory Protection.  Enforce allocations of memory.
      
      -  OS can't do this when user code is running.
      
 -  Creates an interrupt on violations.
      
 
     -  Clock interrupt.  Preserves OS control.