Question: Try running the program in Listing 23-3 (t_nanosleep.c) in the background with a 60-second sleep interval, while using the following command to send as many
Try running the program in Listing 23-3 (t_nanosleep.c) in the background with a 60-second sleep interval, while using the following command to send as many SIGINT signals as possible to the background process:
You should observe that the program sleeps rather longer than expected. Replace the use of nanosleep() with the use of clock_gettime() (use a CLOCK_REALTIME clock) and clock_nanosleep() with the TIMER_ABSTIME flag. (This exercise requires Linux 2.6.) Repeat the test with the modified program and explain the difference.
$ while true; do kill -INT pid; done
Step by Step Solution
There are 3 Steps involved in it
The given exercise involves modifying the program in Listing 233 tnanosleepc by replacing the usage of nanosleep with clockgettime and clocknanosleep ... View full answer
Get step-by-step solutions from verified subject matter experts
