![]() ![]() For this, the kernel has to be compiled with the configuration parameter CONFIG_HIGH_RES_TIMERS enabled. With kernel version 2.6.21 onwards, high resolution timers (HRT) are available under Linux. A typical value of _SC_CLK_TCK is 100, giving a clock tick of 10 milliseconds. The times system call gives the time in different units of clock ticks and these number of clock ticks per second are given the system constant _SC_CLK_TCK. The value of HZ can be fixed as 100, 250 or 1000 at the time of kernel configuration prior to build, giving the the duration of a clock tick as 10, 4 or 1 millisecond(s) respectively. The number of jiffies in a second, or the frequency of the system tick, is defined by the HZ constant. In the Main Timing subsystem, the smallest time maintained is denoted by a jiffy, which is the duration of a tick of the system timer interrupt. There are two timing sub-systems in Linux, the Main Timing subsystem and the High Resolution Timing subsystem. In nanosleep, there is no restriction on the amount of time a thread goes on to sleep. The unslept time is returned in the timespec struct pointed by rem. The thread wakes up when the time is over or the sleep is interrupted by a signal which has not been ignored. With the nanosleep call, the calling thread goes to sleep as per the data pointed by req. Int nanosleep (const struct timespec *req, struct timespec *rem) nanosleep uses the struct timespec, which is, That is, the calling process can only sleep for less than a second.įinally, there is the nanosleep system call, which provides the high resolution sleep. ![]() The usleep function is similar to sleep, except that the argument usec is in microseconds. sleep can easily be implemented as a function using SIGALRM. So sleep and SIGALRM should not be used in the same process. Sleep might have been implemented using SIGALRM. The returned value is the unslept seconds. The process wakes up when s seconds are over or a signal, which is not ignored, is received. With the sleep function, a process can sleep for s seconds. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |