(Latest Revision: Sun Oct 29 00:47:29 PDT 2017 )
UN-SYNCHED Runs john@lucifer: head -29 sequence.cpp /* ---------------0--------------- -------3--------------5-------- ------------------------------- ------------------------------- -----------1-------2----------- ------------------------------- ------------------------------- ---------------4--------------- Constraints: * Threads 0, 1, and 2 should proceed to complete their work as soon as possible after they are created. * Thread 3 must wait for threads 0 and 1 to finish before thread 3 begins its work. However, thread 3 should begin and complete its work as soon as possible after threads 0 and 1 are finished. * The constraints for threads 4 and 5 are like those for thread 3, except that thread 4 waits for threads 1 and 2 to finish before starting, and thread 5 waits for threads 0 and 2. Also, each child thread increments the counter called thrds_finished just before exiting. (Note that access to this counter is a critical section problem.) The mother thread reports the value of thrds_finished just before the program stops. */ /* Thread Sequencing Program */ john@lucifer: sequence Welcome to The Child Thread Workplace! Mother Begins Spawning Threads. Child # 0 has completed its assignment. Child # 2 has completed its assignment. Child # 5 has completed its assignment. Child # 1 has completed its assignment. Child # 3 has completed its assignment. Child # 4 has completed its assignment. Mother Finishes Spawning Threads. All children have now reported that they finished. The value of the thrds_finished counter is: 2. BAD COUNTER VALUE!! - Critical Section Problem Failure!! Mother exiting ... john@lucifer: sequence Welcome to The Child Thread Workplace! Mother Begins Spawning Threads. Child # 3 has completed its assignment. Mother Finishes Spawning Threads. All children have now reported that they finished. The value of the thrds_finished counter is: 1. BAD COUNTER VALUE!! - Critical Section Problem Failure!! Mother exiting ... john@lucifer: sequence Welcome to The Child Thread Workplace! Mother Begins Spawning Threads. Child # 4 has completed its assignment. Mother Finishes Spawning Threads. All children have now reported that they finished. The value of the thrds_finished counter is: 1. BAD COUNTER VALUE!! - Critical Section Problem Failure!! Mother exiting ... john@lucifer: sequence Welcome to The Child Thread Workplace! Mother Begins Spawning Threads. Child # 0 has completed its assignment. Child # 1 has completed its assignment. Child # 3 has completed its assignment. Child # 2 has completed its assignment. Child # 5 has completed its assignment. Mother Finishes Spawning Threads. Child # 4 has completed its assignment. All children have now reported that they finished. The value of the thrds_finished counter is: 2. BAD COUNTER VALUE!! - Critical Section Problem Failure!! Mother exiting ... john@lucifer: