Question
Write two programs, Ping and Pong.
The Ping program creates a message queue, which the Pong program connects to.
The Ping program sends a message, of type 1L, containing an integer
(initially 0) on the message queue.
The Pong program receives this message, outputs to the screen the integer
value, sleeps for a second, then sends back a message of type 2L,
containing the integer plus 1.
The Ping program receives this integer, and while it has not reached some
maximum value loops, i.e., sends it back on the queue to the Pong program.
If the integer has reached the maximal value, the Ping program removes the
message queue.
The Pong program exits when it tries to receive a message and finds that
the queue has been removed.
Answer