NAME |LIBRARY |SYNOPSIS |DESCRIPTION |RETURN VALUE |FILES |STANDARDS |HISTORY |SEE ALSO |COLOPHON | |
PR_SET_TIMERSLACK(2const)PR_SET_TIMERSLACK(2const)PR_SET_TIMERSLACK - set the "current" timer slack value for the calling thread
Standard C library (libc,-lc)
#include <linux/prctl.h>/* Definition ofPR_*constants */#include <sys/prctl.h>int prctl(PR_SET_TIMERSLACK, unsigned longslack);
Each thread has two associated timer slack values: a "default" value, and a "current" value. This operation sets the "current" timer slack value for the calling thread.slack is an unsigned long value in the range [1L,ULONG_MAX]. If the nanosecond value supplied inslack is greater than zero, then the "current" value is set to this value. Ifslack is0L, the "current" timer slack is reset to the thread's "default" timer slack value. The "current" timer slack is used by the kernel to group timer expirations for the calling thread that are close to one another; as a consequence, timer expirations for the thread may be up to the specified number of nanoseconds late (but will never expire early). Grouping timer expirations can help reduce system power consumption by minimizing CPU wake-ups. The timer expirations affected by timer slack are those set byselect(2),pselect(2),poll(2),ppoll(2),epoll_wait(2),epoll_pwait(2),clock_nanosleep(2),nanosleep(2), andfutex(2) (and thus the library functions implemented via futexes, includingpthread_cond_timedwait(3),pthread_mutex_timedlock(3),pthread_rwlock_timedrdlock(3),pthread_rwlock_timedwrlock(3), andsem_timedwait(3)). Timer slack is not applied to threads that are scheduled under a real-time scheduling policy (seesched_setscheduler(2)). When a new thread is created, the two timer slack values are made the same as the "current" value of the creating thread. Thereafter, a thread can adjust its "current" timer slack value viaPR_SET_TIMERSLACK. The "default" value can't be changed. The timer slack values ofinit (PID 1), the ancestor of all processes, are 50,000 nanoseconds (50 microseconds). The timer slack value is inherited by a child created viafork(2), and is preserved acrossexecve(2).
On success, 0 is returned. On error, -1 is returned, anderrno is set to indicate the error.
/proc/pid/timerslack_ns Since Linux 4.6, the "current" timer slack value of any process can be examined and changed via this file.
Linux.
Linux 2.6.28.
prctl(2),PR_GET_TIMERSLACK(2const),proc_pid_timerslack_ns(5)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-05-17PR_SET_TIMERSLACK(2const)Pages that refer to this page:prctl(2), PR_GET_TIMERSLACK(2const)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |