*** Welcome to piglix ***

Uninterruptible sleep


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.

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.

On Windows, the Sleep() function takes a single parameter of the number of milliseconds to sleep. The Sleep() function is included in kernel32.dll, but no sleep command (executable) is natively available for scripts (batch files). It can be found in collections of Windows utilities like Windows 2003 Resource Kit.

On Unix-like operating systems, the sleep() function is called providing a single parameter of type unsigned integer of the number of seconds to sleep. (For more precise sleep times one can use the usleep() function.)

In Windows OS:

In Unix:

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 to absence of signals (other than the thread or its process being terminated), although the related SleepEx function can be used to put the thread into an alertable state, allowing APC calls being made while the thread is sleeping. Also, a thread can technically be "interrupted" in case e.g. the process terminates due to an exception in a different thread.


...
Wikipedia

...