(Latest Revision: Fri Mar 31 16:50:36 PDT 2017 )
=================================== These are runs of my solution program. There is synchronization. The messages are printed in an order consistent with the star being formed according to a correct sequence. The program does not have the same output each time it is run, because many things happen 'by chance' depending on which thread the scheduler chooses to run, and when. (Also, this version of the program has its own programmed random delays.) However, the execution of the protocol assures that the outputs are always correct - assuming there are no bugs - none are known at this time. =================================== john@lucifer: head star.cpp /* ------------5----------------- --------1-------2------------- ----8-------0-------6--------- --------4-------3------------- ------------7----------------- */ john@lucifer: star Welcome to The Star Chamber! Mother Begins Spawning Threads. Mother Finishes Spawning Threads. Child # 0 is now in position. Child # 2 is now in position. Child # 4 is now in position. Child # 3 is now in position. Child # 6 is now in position. Child # 1 is now in position. Child # 8 is now in position. Child # 5 is now in position. Child # 7 is now in position. All children are now in position. Mother exiting ... john@lucifer: star Welcome to The Star Chamber! Mother Begins Spawning Threads. Mother Finishes Spawning Threads. Child # 0 is now in position. Child # 1 is now in position. Child # 2 is now in position. Child # 5 is now in position. Child # 4 is now in position. Child # 8 is now in position. Child # 3 is now in position. Child # 6 is now in position. Child # 7 is now in position. All children are now in position. Mother exiting ... john@lucifer: star Welcome to The Star Chamber! Mother Begins Spawning Threads. Mother Finishes Spawning Threads. Child # 0 is now in position. Child # 3 is now in position. Child # 2 is now in position. Child # 4 is now in position. Child # 1 is now in position. Child # 7 is now in position. Child # 6 is now in position. Child # 8 is now in position. Child # 5 is now in position. All children are now in position. Mother exiting ... john@lucifer: