A computer program (process, task, or thread) may sleep, which places it into an inactive state for a period of time. Eventually the expiration of an interval timer, or the receipt of a signal or interrupt causes the program to resume execution. Usage A typical sleep system call takes a time value as a parameter, specifying the minimum amount of time that the process is to sleep before resuming execution. The parameter typically specifies seconds, although some operating systems provide finer resolution, such as milliseconds or microseconds. Windows On Windows, the Sleep() function takes a single parameter of the number of milliseconds to sleep. The Sleep() function is included in kernel32.dll. The function has a resolution no higher than the current timer resolution, typically 16ms but at minimum 1ms, adjustable via the family of "media timer" APIs. For higher precisions, it is necessary to use a busy loop over , such as the one used in gnulib. Unix On Unix-like and other POSIX operating systems, the sleep() function is called providing a single parameter of type unsigned integer of the number of seconds to sleep. A higher-precision version is the function and the now deprecated . POSIX also allows for choosing clock sources via the extended version . A version of was proposed to be part of the C programming language, but was rejected. The UTC time part of the same proposal was added to C11. C examples In Windows API: Sleep(2 * 1000); // Sleep for 2 seconds In Unix or POSIX system calls: sleep(2); // Sleep for 2 seconds Low level functionality Sleep causes the thread or process to give up the remainder of its time slice and stay in the Not Runnable state for the specified duration. While there is generally a guarantee for the minimum time period, there is no strict guarantee that the thread will run immediately or soon, or even at all, once the specified time has passed. It is up to the scheduler's discretion, and dependent on thread priorities and implementation details such as timer resolutions when the sleeping thread will run again. On POSIX systems, the nanosleep and related syscalls are interruptible by signals, returning the remaining sleep time. The sleep library function, on the other hand, is implemented via the alarm syscall on many older systems, thus it only works by delivering a signal. The Windows Sleep function is non-interruptible due