Linux2009. 2. 22. 22:06
$ man -k sleep
Time::HiRes          (3pm)  - High resolution alarm, sleep, gettimeofday, interval timers
apmsleep             (1)  - go into suspend or standby mode and wake-up later
clock_nanosleep      (2)  - Suspend execution of the currently running thread
clock_nanosleep      (3p)  - high resolution sleep with specifiable clock (ADVANCED REALTIME)
nanosleep            (2)  - pause execution for a specified time
nanosleep            (3p)  - high resolution sleep (REALTIME)
sleep                (1)  - delay for a specified amount of time
sleep                (1p)  - suspend execution for an interval
sleep                (3)  - Sleep for the specified number of seconds
sleep                (3p)  - suspend execution for an interval of time
usleep               (1)  - sleep some number of microseconds
usleep               (3)  - suspend execution for microsecond intervals
usleep               (3p)  - suspend execution for an interval

usleep은 1초 까지만 잠재울수 있는 제약이 있다.(1,000,000usec = 1,000msec = 1sec)
USLEEP(P)                  POSIX Programmer’s Manual                 USLEEP(P)

NAME
       usleep - suspend execution for an interval

SYNOPSIS
       #include <unistd.h>

       int usleep(useconds_t useconds);

DESCRIPTION
       The  usleep()  function  shall cause the calling thread to be suspended from execution until either the number of
       realtime microseconds specified by the argument useconds has elapsed or a signal  is  delivered  to  the  calling
       thread  and  its action is to invoke a signal-catching function or to terminate the process.  The suspension time
       may be longer than requested due to the scheduling of other activity by the system.

       The useconds argument shall be less than one million. If the value of useconds is 0, then the call has no effect.

sleep은 1초 단위로 무제한으로 쓸수 있다.(실질적인 제약은 시스템에 따라 다르지만 32bit / 64bit unsigned int)
SLEEP(P)                   POSIX Programmer’s Manual                  SLEEP(P)

NAME
       sleep - suspend execution for an interval of time

SYNOPSIS
       #include <unistd.h>

       unsigned sleep(unsigned seconds);

DESCRIPTION
       The  sleep() function shall cause the calling thread to be suspended from execution until either the number of
       realtime seconds specified by the argument seconds has elapsed or a signal is delivered to the calling  thread
       and its action is to invoke a signal-catching function or to terminate the process. The suspension time may be
       longer than requested due to the scheduling of other activity by the system.

       If a SIGALRM signal is generated for the calling process during execution of sleep() and if the SIGALRM signal
       is  being  ignored or blocked from delivery, it is unspecified whether sleep() returns when the SIGALRM signal
       is scheduled. If the signal is being blocked, it is also unspecified whether it remains pending after  sleep()
       returns or it is discarded.

nanosleep은 REALTIME 확장인 듯 한데.. 먼지 모르겠다 ㄱ-
일단은 위의 sleep, usleep과는 다르게 include 파일이 다르다.
NANOSLEEP(P)               POSIX Programmer’s Manual              NANOSLEEP(P)

NAME
       nanosleep - high resolution sleep (REALTIME)

SYNOPSIS
       #include <time.h>

       int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);

DESCRIPTION
       The  nanosleep()  function shall cause the current thread to be suspended from execution until either the time
       interval specified by the rqtp argument has elapsed or a signal is delivered to the calling  thread,  and  its
       action  is to invoke a signal-catching function or to terminate the process. The suspension time may be longer
       than requested because the argument value is rounded up to an integer multiple  of  the  sleep  resolution  or
       because  of the scheduling of other activity by the system. But, except for the case of being interrupted by a
       signal, the suspension time shall not be less than the time specified by rqtp, as measured by the system clock
       CLOCK_REALTIME.

       The use of the nanosleep() function has no effect on the action or blockage of any signal.



Posted by 구차니