(Latest Revision: Sat Nov 26 14:41:44 PST 2016 )
=================================== This a run of my solution program. It uses semaphores to synchronize the threads. In this run, we see that the various threads appear to process the data in the correct order. Naturally one should not expect the program to have the same output each time it is run, because many things happen 'by chance' depending on the random delays and how the threads are scheduled.) =================================== Script started on Sat Nov 26 14:25:50 2016 lucifer.local>> worker Welcome to the work site! Boss places Work Piece #1 in buffer #0. Worker number #2 processes Work Piece #1. Worker number #0 processes Work Piece #1. Worker number #1 processes Work Piece #1. Worker number #1 gives Work Piece #1 to the Finisher. Boss places Work Piece #2 in buffer #0. Finisher removes Work Piece #1 from buffer #1. Worker number #0 processes Work Piece #2. Worker number #2 processes Work Piece #2. Worker number #1 processes Work Piece #2. Worker number #1 gives Work Piece #2 to the Finisher. Boss places Work Piece #3 in buffer #0. Finisher removes Work Piece #2 from buffer #1. Worker number #0 processes Work Piece #3. Worker number #1 processes Work Piece #3. Worker number #2 processes Work Piece #3. Worker number #2 gives Work Piece #3 to the Finisher. Boss places Work Piece #4 in buffer #0. Finisher removes Work Piece #3 from buffer #1. Worker number #0 processes Work Piece #4. Worker number #1 processes Work Piece #4. Worker number #2 processes Work Piece #4. Worker number #2 gives Work Piece #4 to the Finisher. Finisher removes Work Piece #4 from buffer #1. Thank you for your visit! lucifer.local>> exit exit Script done on Sat Nov 26 14:26:02 2016