(Latest revision: Sat Oct 17, 2015) 
CS 3750 First C++ Concurrent Programming Assignment (prog #1)
-  Look over the contents of the directory "ThreadInfo" in our web space.
     Read the file HiHo.cpp in that directory.  It illustrates everything you
     need to know about using function calls from the pthreads package, and
     about using the counting and queuing semaphores implemented by the
     sem.cpp and sem.h files. Make copies of sem.cpp and sem.h for your own
     use.  (We will go over this in class.)  
 -  Make a copy of the foodPass.cpp program.  Read the program header
     comments in order to figure out what the requirements of a solution are.
     Read the rest of foodPass.cpp, including all the comments, to gain a
     better understanding of what is required of you.  
 -  Insert declarations and instructions into a copy of the program so
     that it properly performs the required job.  
     You may employ (only) ordinary variables and semaphores, as implemented
     by sem.cpp and sem.h, to achieve the synchronization of threads.
     
 
Errors in concurrent programs tend to be intermittant.  They tend to be
manifested only under certain timings of events.  The random delays in the
program will tend to make the timing of events change considerably each
time the program is executed.  If you run the program several times and
check the output you are more likely to find out about possible errors than
if you just run the program one time and check the output.  
For this assignment, you may work in teams of two (2) people.  If you work
in a team, make sure that both names are in your comments!  
More Discussion of the Assignment
When you think about doing this assignment, assume that the program will
execute on a (tightly coupled) multiprocessor.  That means all the threads
(the server, busser, and all the diners) could run simultaneously on separate
CPU's.  While this may or may not actually be true, it will help you write
code that will work on *any* computing system on which multiple threads can
execute concurrently while sharing variables.  
A tightly-coupled multiprocessing system can be diagrammed this
way:
  CPU     CPU     CPU      CPU     CPU     CPU   CPU    MEMORY
    |       |       |        |       |       |     |    |
 ------------------------------------------------------------ BUS
       |      |       |     |     |     |     |     |     |
     CPU    CPU     CPU   CPU   CPU   CPU   CPU   CPU   CPU
Here we have a RAM memory being shared over a common bus by several CPU's.
It is possible that the different CPU's have radically different speeds.
Speed can be affected by the inherent power of the CPU, or by the current
load on the CPU.  Besides that, it is impossible to tell which CPU will be
assigned to which thread.  And also, each time we run the program, the
assignment can be different.  
In your program, the mother process creates child threads to be the diners
and the food server.  Then the mother thread plays the role of the busser.
The mother does nothing to direct the server and diners after she creates
them.  
In general it is a bad idea to create "traffic cop" threads, because the
traffic cop too often becomes a bottleneck.  When every action has to be
approved by a master, events can only happen as fast as the master can
approve them.  This would defeat the purpose of parallel processing.
 The general rules for submitting assignments by e-mail are:
    -  Always send me e-mail as plain text in the main message
	 body.  Never send me attachments.  
         ( If you use a unix command like this:  
    mail -s "mySubjectLine" john@ishi.csustan.edu < myFilename
    
  
    Then the contents of myFilename will be sent to me - the way I want
    - inline, not attached.)
    
     -  When you send a program source file, you also send 
a script
         of your tests.  Combine the source file and the script
	 into one
shell archive (shar) file. 
    -  I will tell you what subject line to use with each
	 message, and I need you to use exactly the
	 subject lines I give you.  (I get hundreds of e-mail
	 messages at a time and your subject line allows me to
	 sort messages.)
     -  Send each submission before midnight on the due date.  
 
 
By the due date e-mail me a
shar file 
 
containing: 
-  a completed copy of the foodPass.cpp source file, 
     (Do not send me copies of sem.h or sem.cpp.  I will compile your copy of
     foodPass.cpp on a CS Lab Mac with my own copies of sem.h and sem.cpp.  To
     do the compile, I will use a "make" file just like the one I am giving
     you.  Your program should work for me if it worked for you.)  
 -  script(s) showing several successful test runs 
 
 
Use this subject line: CS3750Prog1 
Note that there are no spaces in the subject line given.  It is important
that you do not insert any spaces.  My e-mail address is:
 
john@ishi.csustan.edu.  
DUE DATES:
For due dates, see
the class schedule.