(Last revision 10/09/96) ////////////////////////////////////////////////////// CS 3750 First C Programming Assignment More Directions ////////////////////////////////////////////////////// When you think about doing this assignment, imagine that the mother thread and each cheerleader thread will run on a separate CPU of a tightly-coupled multiprocessor. Of course, our NeXT computing systems are not tightly-coupled multiprocessors. Nevertheless, the point of this exercise is for you to write a program that will work on *any* computing system on which multiple processes 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 must create all the cheerleaders without delay immediately after the program starts running. The mother must do nothing to direct the creation of the pyramid. 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 only interactions a cheerleader is allowed to have with its mother, after its creation, is that each cheerleader will somehow notify the mother after it has positioned itself in the pyramid and written its message to standard output. This is done so that the mother can know when to exit. The cheerleaders must cooperate among themselves, using semaphores for synchronization, to create the pyramid. As to the decision of when a cheerleader X moves into position, only X and the cheerleaders that will be supporting X are allowed to participate in the making of that decision.