Homework #3

Assigned: February 4
Due: February 11, 3:00pm, in class


  1. (3 points) Problems 1-3 are accessed and submitted through GOAL; see Gradiance student guide for more information.

  2. (29 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/Ping.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: ping
    Thread 11: pong
    Thread 12: ping
    Thread 13: pong
    Thread 14: ping
    Thread 15: pong
    Thread 16: ping
    Thread 17: pong
    Thread 18: ping
    Thread 19: pong
    Thread 20: ping
    Thread 21: pong
    Thread 22: ping
    Thread 23: pong
    Thread 24: ping
    Thread 25: pong
    Thread 25: ping
    Thread 26: pong
    Thread 27: ping
    Thread 28: pong
    

    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 listing of it in class using a2ps at 3:00pm.


Return Home