Homework #3

Assigned: October 5
Due: October 14, 2:00pm, in class


(32 points) In problem #3 of HW #1, you were asked to spawn and sychronize 20 processes, each with a single thread of control, to produce the desired output. In this problem, you are asked to write a Java program /home/<logname>/homeworks/hw3/OS.java as one process with 20 threads of control, and sychronize those threads to print the following (of course, with different thread ids):
Thread 10: operating
Thread 11: systems
Thread 12: operating
Thread 13: systems
Thread 14: operating
Thread 15: systems
Thread 16: operating
Thread 17: systems
Thread 18: operating
Thread 19: systems
Thread 20: operating
Thread 21: systems
Thread 22: operating
Thread 23: systems
Thread 24: operating
Thread 25: systems
Thread 25: operating
Thread 26: systems
Thread 27: operating
Thread 28: systems

Each line must be printed by a different thread, and you may not use Java synchronization mechanisms not presented in class. In other words, do not use any Java constructs not presented in class.

Keep your program to approximately 30 lines and submit a pretty-printed listing of it in class using a2ps.


Return Home