sched_setscheduler(2) System Calls Manual sched_setscheduler(2) sched_setscheduler, sched_getscheduler - ( ) LIBRARY Standard C library (libc, -lc) #include int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); int sched_getscheduler(pid_t pid); sched_setscheduler() pid. pid , . param, : struct sched_param { ... int sched_priority; ... }; -- sched_priority. param . Linux <<>> (. . ) , policy: SCHED_OTHER ; SCHED_BATCH <<>> ; SCHED_IDLE . , , param->sched_priority 0. << >>, , , . , , sched(7). , policy: SCHED_FIFO << -- >>; SCHED_RR . param->sched_priority . , sched_get_priority_min(2) sched_get_priority_max(2) policy. Linux 1 99, . Linux 2.6.32, SCHED_RESET_ON_FORK (OR) policy sched_setscheduler(). , fork(2), . sched(7). sched_getscheduler() pid. pid , . On success, sched_setscheduler() returns zero. On success, sched_getscheduler() returns the policy for the thread (a nonnegative integer). On error, both calls return -1, and errno is set to indicate the error. EINVAL : pid param NULL. EINVAL (sched_setscheduler()) policy . EINVAL (sched_setscheduler()) param policy. EPERM . ESRCH pid . POSIX.1 , sched_setscheduler(), . , Solaris 7 , set-user-ID . , , Linux. , gettid(2), pid. pid 0 , , getpid(2), ( POSIX, pthread_setschedparam(3), pthread_getschedparam(3) pthread_setschedprio(3) sched_*(2)). POSIX.1-2008 (but see BUGS below). SCHED_BATCH and SCHED_IDLE are Linux-specific. POSIX.1-2001. (<<>> << >>) sched(7). , SCHED_DEADLINE, sched_setattr(2). POSIX, sched_setscheduler() sched_getscheduler(), _POSIX_PRIORITY_SCHEDULING. POSIX.1 , sched_setscheduler() . Linux sched_setscheduler() , 0. chrt(1), nice(2), sched_get_priority_max(2), sched_get_priority_min(2), sched_getaffinity(2), sched_getattr(2), sched_getparam(2), sched_rr_get_interval(2), sched_setaffinity(2), sched_setattr(2), sched_setparam(2), sched_yield(2), setpriority(2), capabilities(7), cpuset(7), sched(7) Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , <>. Linux man-pages 6.8 2 2024 . sched_setscheduler(2)