Init done & count is 0. Mother will spawn 2 children. Mother 74012 is about to wait on semaphore . Thread 74012 has decremented semaphore value to: 0. Mother 74012 now completes her wait on semaphore Mother 74012 changes shared variable to 1. Mother 74012 has SPAWNED a child. Mother 74012 starts a signal on semaphore Thread 74012 has incremented semaphore value to: 1. Mother 74012 completes the signal on semaphore . Mother 74012 is about to wait on semaphore . Thread 74012 has decremented semaphore value to: 0. Mother 74012 now completes her wait on semaphore Mother 74012 changes shared variable to 2. Child 82548 is BORN with workload = 0 Child 82548 has finished his work of 0 cycles. Child 82548 is about to wait on semaphore . Thread 82548 has decremented semaphore value to: -1. Thread 82548 queues up on the semaphore. Thread 82548 now BLOCKS by doing a condition_wait. Mother 74012 has SPAWNED a child. Mother 74012 starts a signal on semaphore Thread 74012 has incremented semaphore value to: 0. Thread 74012 removes a PCB from the semaphore queue. Q state prior to Q serve: Printing Q .... Thread# ... 82548. Q state after Q serve: Printing Q .... Q is empty. Thread 74012 broadcasts to the processes waiting on the semaphore. Mother 74012 completes the signal on semaphore . Mother 74012 is about to wait on semaphore . She will check to see if the count is zero. Thread 74012 has decremented semaphore value to: -1. Thread 74012 queues up on the semaphore. Thread 74012 now BLOCKS by doing a condition_wait. Thread 82548 wakes up, and checks to see if a signal_sem op has taken it off the queue. Thread 82548 confirms that it has been removed from the queue, finishes doing wait_sem, and will now enter its critical section. Child 82548 completes wait on semaphore and starts to decrement count. Child 82548 has finished decrementing to 1. This Child 82548 sees that she is not the last child to exit, and she decides not to signal on semaphore . Child 82548 starts a signal on semaphore . Thread 82548 has incremented semaphore value to: 0. Thread 82548 removes a PCB from the semaphore queue. Q state prior to Q serve: Printing Q .... Thread# ... 74012. Q state after Q serve: Printing Q .... Q is empty. Thread 82548 broadcasts to the processes waiting on the semaphore. Child 82548 completes signal on semaphore . Child 82548 EXITS. Child 82812 is BORN with workload = 1 Thread 74012 wakes up, and checks to see if a signal_sem op has taken it off the queue. Thread 74012 confirms that it has been removed from the queue, finishes doing wait_sem, and will now enter its critical section. Mother 74012 completes her wait on semaphore . Mother 74012 starts a signal on semaphore . Thread 74012 has incremented semaphore value to: 1. Mother 74012 completes signal on semaphore . Mother 74012 is about to wait on semaphore . Thread 74012 has decremented semaphore value to: -1. Thread 74012 queues up on the semaphore. Thread 74012 now BLOCKS by doing a condition_wait. Child 82812 executes work unit # 0 Child 82812 has finished his work of 1 cycles. Child 82812 is about to wait on semaphore . Thread 82812 has decremented semaphore value to: 0. Child 82812 completes wait on semaphore and starts to decrement count. Child 82812 has finished decrementing to 0. The LAST child 82812 will now signal on semaphore . Thread 82812 has incremented semaphore value to: 0. Thread 82812 removes a PCB from the semaphore queue. Q state prior to Q serve: Printing Q .... Thread# ... 74012. Q state after Q serve: Printing Q .... Q is empty. Thread 82812 broadcasts to the processes waiting on the semaphore. LAST Child 82812 has now completed his signal on semaphore . Child 82812 starts a signal on semaphore . Thread 82812 has incremented semaphore value to: 1. Child 82812 completes signal on semaphore . Child 82812 EXITS. Thread 74012 wakes up, and checks to see if a signal_sem op has taken it off the queue. Thread 74012 confirms that it has been removed from the queue, finishes doing wait_sem, and will now enter its critical section. Mother 74012 completes wait on semaphore . Mother 74012 is about to wait on semaphore . She will check to see if the count is zero. Thread 74012 has decremented semaphore value to: 0. Mother 74012 completes her wait on semaphore . Mother 74012 starts a signal on semaphore . Thread 74012 has incremented semaphore value to: 1. Mother 74012 completes signal on semaphore . All 2 children have finished. Mother 74012 now EXITS.