(Latest Revision: 09/16/2001)  
Week 03 Notes for CS 3750 -- Fall 2001 
-  Take Roll.
 -  Look at the upcoming schedule and homework.
 -  Announcements
     
     -  I'm trying to decide between teaching Operating Systems
	  II and Theory of Algorithms in the spring.
     
 
 -  Chapter Three Lecture Ideas
     
   
     -  For a personal computer user, what are the advantages
	  of multiprogramming?
     
 -  How does Unix accomplish these aspects of process control?
          
          -  process creation and destruction?
          
 -  suspension/resumption
          
 -  synchronization
          
 -  communication
          
 -  deadlock handling
          
 
      -  do a "ps" on a Unix system and discuss interesting
	  processes that are running (probably check processes
	  that are vital to the running system first, then other
	  processes owned by root.).
     
 -  Discuss generally how the OS could do the following
          tasks connected with file management:
          
          -  create/delete files
          
 -  create delete directories
          
 -  support file access primitives
          
 -  map files to secondary storage
          
 -  back-up files in RAM onto stable storage
          
 
      -  Discuss generally how the OS could do the following
          tasks connected with disk management:
          
          -  free-space management
          
 -  storage allocation
          
 -  disk scheduling
          
 
          (Management of this bottleneck is critical.  One of the
	  big developments of Unix was the re-design of the file
	  system.  It greatly improved throughput.)
      -  Discuss these basic OS services:
          
          -  program execution
          
 -  I/O operations
          
 -  File-System manipulation
          
 -  Communications
          
 -  Error detection
          
 -  Resource allocation -- something like a
	       request/release paradigm is necessary in a
	       multiprogramming environment.
          
 -  Accounting
          
 -  Protection
          
 
      -  System Calls
          
          -  the operating system services mentioned above are
	       furnished by means of OS system calls.
          
 -  If we think of the OS as a data structure, then
	       system calls are the operations of the data
	       structure.
          
 -  The "system call instruction" generates a trap (interrupt).
          
 -  System call parameters may be left in registers,
	       RAM, or program stack.  Registers can hold
	       pointers to areas in RAM containing parameters.
          
 -  Look on page 66 at the list of system call types.
	       Do we understand what all these operations do?
          
 
      -  Discuss "single-tasking approach" of DOS versus
          "multi-tasking" approach of Unix.
     
 -  Any questions about the "message passing" and "shared
          memory" communication paradigms?
     
 -  Discussion of shells?
     
 -  Operating System Structuring
          
          -  Some OS's are not very modular
          
 -  Some are built in layers, but the layers can
	       "bypass" each other.
          
 -  Some are more strictly layered -- bypassing is not
	       common.  Each layer depends on the one underneath.
          
 -  layered design facilitates testing.
          
 -  It's not easy to design layers without any
	       "circular" dependencies -- (e.g. backing store
	       driver depends on CPU-scheduler and vice-versa.)
          
 -  Microkernel design puts just a few essential
	       services (say process & memory management plus
	       process communication) in the kernel and the rest
	       is pushed to "user-level"
          
 -  With microkernel architecture it becomes fairly
	       easy (if not maximally efficient) to emulate many
	       different operating systems "on top of" the
	       microkernel.  The idea is to interpret foreign
	       system calls with microkernel system calls.
          
 
      -  The virtual machine idea is to implement in software
	  "an interface that is identical to the underlying bare
	  hardware." -- nice way to isolate users -- secure --
	  each user can run a different operating system.  A user
	  can experiment on a new operating system design without
	  risking bringing down the part of the system being used
	  by others.  The Java virtual machine is a modern
	  instance of this type of design.  The IBM version dates
	  back to the late sixties.
     
 -  OS Implementation Principles
          
 
          -  Separate policy from mechanism.
          
 -  Write most of the OS in a high level language.
	       (one writes code faster; code is more compact;
	       code is easier to understand and debug; the
	       operating system is "portable." -- There is really
	       no downside -- modern compilers generate efficient
	       assembly code.  Increases in efficiency of OS
	       usually comes by using better data structures and
	       algorithms -- we can write a few small pieces of
	       the OS in assembly where that is really needed for
	       efficiency or for compatability with the
	       hardware.)
          
 
      -  System generation -- setting compile parameters for the
	  OS versus table driven systems that are pre-compiled.
	  The trend is toward pre-compiling.
     
 
 -  Chapter Four Lecture Ideas
     
     -  What is a process?
     
 -  What is a thread?
     
 -  What is process state?
     
 -  What is the relation of "process state" to the term
	  "state" as used in science?
     
 -  What is a process control block?
     
 -  What is process context?
     
 -  What information should be in a process control block?
	  Relation to what is needed to restart the process?
     
 -  Discuss ready queueue
     
 -  Discuss device queues
     
 -  Discuss representing a computing system as a network of
	  queues -- you can get a lot of good insight from
	  studying characteristics of the network of queues.
     
 -  Discuss how the lifetime of a process is described as a
          journey through a queueing network.
     
 -  Discuss job pools and long term scheduling in batch
          systems
     
 -  Discuss short-term scheduling in multiprogramming systems. 
     
 -  What is medium-term scheduling?
     
 -  Discuss the importance of having a good job mix to keep
	  the CPU and I/O channels busy.  (I/O-bound vs CPU-bound
	  jobs) This is something the scheduler must consider.
     
 -  What are context switching and swapping -- important to
	  understand the difference and to use the terms
	  correctly.
     
 -  Discuss fork, (forms of) exec, wait, exit and the
	  relation to the functionality we see in the unix shell.
	  -- Note the OS serves as an intermediary between parent
	  and child processes, allowing them to synchronize some
	  of their activities.
     
 -  Discuss the "shared-memory solution of the bounded
	  buffer problem" -- the producer-consumer problem.  Note
	  that busy waiting is used -- effective if process time
	  in CPU is limited by a timer, or if there is more than
	  one CPU, but wasteful of CPU time.  Note that one slot
	  in the buffer is "reserved".  It's a "trick" question
	  to ask how to remove this restriction!!
     
 -  Communication between processes can be done with shared
	  memory, but also can be done using an IPC facility
	  furnished by the OS.
     
 -  Message passing of the OS can be implemented with
	  shared memory, hardware bus, network, or ...  there has
	  to be some type of communication link.
     
 -  Discuss Mach and/or Windows 2000 message passing
     
 -  Discuss client/server communication via socket
          interface.
     
 -  Discuss how RPC abstracts the procedure call mechanism
	  so that a process on machine X can in effect make a
	  function call that is carried out by a process on
	  machine Y connected to X by a communication link.  --
	  Typical implementation is for a client on X to connect
	  to an RPC server daemon on Y.  The RPC daemon spawns a
	  process that executes the function and returns the
	  results to the daemon, which then send the results back
	  to the client on X.  Stubs provide the "glue."
	  Difference in machine representation of data is an
	  issue.  Timestamps can be used to prevent duplication
	  of procedure call if RPC message is duplicated on the
	  network.
     
 -  One may implement a distributed file system by using
	  RPC for doing the file operations like read, write,
	  rename, delete, and so forth.