The music player opens a message queue to communicate with the Juke_Box custom server using the function in jb_shared.c. The Juke_Box custom server and the music player can both send messages to, and receive messages from each other.
When the music player is initialized, either successfully or unsuccessfully, it sends the message Q_MSG_TYPE_INITIALIZED to the Juke_Box custom server.
The music player sends the message Q_MSG_TYPE_EXITING to the Juke_Box custom server before terminating. It sends this message even if initialization failed, or the rest of the music player process was not executed.
The Juke_Box custom server can send the message Q_MSG_TYPE_TERMINATE to the music player at any time. The music player releases any resources it is using and terminates.
When a music player terminates, the Juke_Box custom server receives SIGCHLD signals. The Juke_Box custom server knows which music player has terminated, and cleans up its own internal data structures.