A timer allows a process to schedule a notification for itself to occur at some time in the future. Sleeping allows a process (or thread) to suspend execution for a period of time. This chapter describes the interfaces used for setting timers and for sleeping. It covers the following topics:
the classical UNIX APIs for setting interval timers (setitimer() and alarm()) to notify a process when a certain amount of time has passed;
the APIs that allow a process to sleep for a specified interval;
the POSIX.1b clocks and timers APIs; and
the Linux-specific timerfd facility, which allows the creation of timers whose expirations can be read from a file descriptor.
The setitimer() system call establishes an