sched_setscheduler(2) System Calls Manual sched_setscheduler(2) sched_setscheduler, sched_getscheduler - / (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 . "" ( ) policy: SCHED_OTHER (round-robin) SCHED_BATCH "" SCHED_IDLE . param->sched_priority 0. " " . sched(7). policy : SCHED_FIFO SCHED_RR (round-robin). param->sched_priority . sched_get_priority_min(2) sched_get_priority_max(2) policy . 1 99 . 2.6.32 OR SCHED_RESET_ON_FORK policy sched_setscheduler(). fork(2) . sched(7) . sched_getscheduler() pid. pid . sched_setscheduler() . sched_getscheduler() ( ). -1 errno . EINVAL : pid param NULL. EINVAL (sched_setscheduler()) policy . EINVAL (sched_setscheduler()) param policy . EPERM . ESRCH (thread) pid. POSIX.1 sched_setscheduler() . Solaris 7 . . gettid(2) pid. pid 0 getpid(2) . ( POSIX pthread_setschedparam(3) pthread_getschedparam(3) pthread_setschedprio(3) sched_*(2).) POSIX.1-2024 ( ). SCHED_BATCH SCHED_IDLE . POSIX.1-2001. "" " " sched(7). SCHED_DEADLINE sched_setattr(2). POSIX sched_setscheduler() sched_getscheduler() _POSIX_PRIORITY_SCHEDULING . POSIX.1 sched_setscheduler() . 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) 3 . . : . 6.18 8 2026 sched_setscheduler(2)