Signals in C
Write two programs named ping.c, pong.c. The ping will iteratebetween sending SIGUSR1 and SIGUSR2 to pong, when pong receives thesignal from ping, it will print “#: pong received signal # fromping” and it will send SIGUSR2 to ping if it received SIGUSR1 orSIGUSR1 if it received SIGUSR2. When ping receives a signal frompong, it will print “#: ping received signal # from pong”.(you mayuse sleep function to slowdown the execution of the program). Thetwo processes are independent.
EXAMPLE
Terminal 1:
./ ping
0: ping received signal 12 from pong
1: ping received signal 10 from pong
2: ping received signal 12 from pong
3: ping
OR
OR