The alarm(2) system call allows a process to set up a simple timeout mechanism; its signature is as follows:
#include <unistd.h>unsigned int alarm(unsigned int seconds);
It is, indeed, quite self-explanatory. Let's take a simple example: A process wants to set up a timer that will expire in three seconds from now, so alarm(3) is essentially the code to use to do this.
What exactly happens in the aforementioned code? Three seconds after the alarm system call is issued—that is, after the timer has been armed—the kernel will send the signal SIGALRM to the process.
Thus, we expect the developer to catch the signal (via the sigaction(2) system ...