Question: To complete the signals - based chat program described above, do the following. We recommend doing them in order. Each is described in more detail
To complete the signalsbased chat program described above, do the following. We recommend doing them in order. Each is described in more detail below.
Note the above instructions regarding testing on portal.
I would recommend working in pairs on this lab, but note that both instances of the chat program need to run as the same user. You cant send signals to another users programs.
Start with the template program below that prints out its PID and reads in another PID into a global variable.
As described below, the template program sets up access to two shared memory regions:
myinbox which is this processs inbox for chat messages;
otherinbox which is the other processs inbox for chaat messages.
Your code will write to otherinbox and read from myinbox.
Create a signal handler for the SIGINT, SIGTERM, and SIGUSR signals
SIGTERM should invoke cleanupinboxes and then exit
SIGINT should invoke cleanupinboxes and then send SIGTERM to the other user and then exit
SIGUSR should display the contents of the inbox eventually in shared memory; make a pointer to a placeholder character array for now and then set its first character to be
Although normally one should take care to only use signalsafe functions in your signal handlers, for this lab, we do not care if you follow this rule.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
