2014-04-28 10:25:55 +00:00
|
|
|
.\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
|
2014-05-12 10:07:58 +00:00
|
|
|
.\" and Copyright (C) 2014 Peter Zijlstra <peterz@infradead.org>
|
|
|
|
.\" and Copyright (C) 2014 Juri Lelli <juri.lelli@gmail.com>
|
2014-04-28 10:25:55 +00:00
|
|
|
.\" Various pieces from the old sched_setscheduler(2) page
|
|
|
|
.\" Copyright (C) Tom Bjorkholm, Markus Kuhn & David A. Wheeler 1996-1999
|
|
|
|
.\" and Copyright (C) 2007 Carsten Emde <Carsten.Emde@osadl.org>
|
|
|
|
.\" and Copyright (C) 2008 Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, see
|
|
|
|
.\" <http://www.gnu.org/licenses/>.
|
|
|
|
.\" %%%LICENSE_END
|
|
|
|
.\"
|
|
|
|
.\" Worth looking at: http://rt.wiki.kernel.org/index.php
|
|
|
|
.\"
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1, _syscall.2, accept.2, add_key.2, adjtimex.2, bind.2, bpf.2, capget.2, chown.2, chroot.2, clock_getres.2, clone.2, connect.2, copy_file_range.2, epoll_ctl.2, epoll_wait.2, eventfd.2, fanotify_init.2, fanotify_mark.2, fcntl.2, fsync.2, futex.2, getcpu.2, getdents.2, getgid.2, getgroups.2, getpid.2, gettid.2, gettimeofday.2, getuid.2, getxattr.2, inotify_add_watch.2, inotify_init.2, ioctl_fat.2, ioctl_ns.2, ioctl_userfaultfd.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, listxattr.2, lseek.2, madvise.2, memfd_create.2, migrate_pages.2, mount.2, mprotect.2, mremap.2, msgctl.2, msgop.2, nfsservctl.2, open_by_handle_at.2, perf_event_open.2, pipe.2, pivot_root.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, readahead.2, readdir.2, readlink.2, reboot.2, recvmmsg.2, removexattr.2, rename.2, request_key.2, s390_guarded_storage.2, s390_runtime_instr.2, s390_sthyi.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, seccomp.2, select.2, select_tut.2, semctl.2, sendmmsg.2, set_thread_area.2, setgid.2, setns.2, setuid.2, setxattr.2, shmctl.2, sigaction.2, signalfd.2, sigsuspend.2, socket.2, socketpair.2, spu_run.2, stat.2, statx.2, subpage_prot.2, syscalls.2, sysctl.2, tee.2, timer_create.2, timerfd_create.2, truncate.2, uname.2, unshare.2, userfaultfd.2, ustat.2, vmsplice.2, write.2, CPU_SET.3, __ppc_get_timebase.3, alloca.3, argz_add.3, asprintf.3, backtrace.3, basename.3, bsd_signal.3, bstring.3, bswap.3, bzero.3, cacos.3, cacosh.3, catan.3, catanh.3, catgets.3, clock_getcpuclockid.3, cmsg.3, confstr.3, ctermid.3, ctime.3, des_crypt.3, dl_iterate_phdr.3, dlinfo.3, dlsym.3, duplocale.3, end.3, endian.3, errno.3, exec.3, exit.3, ferror.3, fgetws.3, fmemopen.3, fnmatch.3, fopencookie.3, fputws.3, frexp.3, ftw.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrouplist.3, getifaddrs.3, getline.3, getlogin.3, getmntent.3, getnameinfo.3, getopt.3, getpass.3, getprotoent_r.3, getpwnam.3, getservent_r.3, getsubopt.3, glob.3, gnu_get_libc_version.3, hsearch.3, if_nameindex.3, index.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isatty.3, iswblank.3, iswspace.3, lockf.3, makecontext.3, mallinfo.3, malloc.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbrtowc.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memchr.3, mq_getattr.3, mq_notify.3, newlocale.3, nl_langinfo.3, offsetof.3, perror.3, posix_spawn.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_mutexattr_setrobust.3, pthread_rwlockattr_setkind_np.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, putenv.3, qsort.3, rand.3, random.3, readdir.3, regex.3, resolver.3, rpmatch.3, rtime.3, scanf.3, sem_wait.3, setaliasent.3, setbuf.3, stpcpy.3, stpncpy.3, strcat.3, strchr.3, strcmp.3, strcpy.3, strdup.3, strerror.3, strfromd.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strsep.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, system.3, termios.3, trunc.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscat.3, wcscpy.3, wcslen.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wcsstr.3, wcstok.3, wcstombs.3, wcwidth.3, wprintf.3, xcrypt.3, console_codes.4, dsp56k.4, full.4, initrd.4, lirc.4, loop.4, st.4, tty.4, vcs.4, charmap.5, core.5, host.conf.5, locale.5, proc.5, repertoiremap.5, resolv.conf.5, termcap.5, tmpfs.5, tzfile.5, aio.7, capabilities.7, cgroup_namespaces.7, cgroups.7, charsets.7, complex.7, epoll.7, fanotify.7, feature_test_macros.7, inotify.7, ip.7, locale.7, man-pages.7, man.7, namespaces.7, pid_namespaces.7, pkeys.7, pthreads.7, rtld-audit.7, sched.7, signal.7, sock_diag.7, socket.7, tcp.7, udp.7, unicode.7, user_namespaces.7, utf-8.7, zdump.8, zic.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 14:11:03 +00:00
|
|
|
.TH SCHED 7 2019-03-06 "Linux" "Linux Programmer's Manual"
|
2014-04-28 10:25:55 +00:00
|
|
|
.SH NAME
|
2016-11-22 12:21:32 +00:00
|
|
|
sched \- overview of CPU scheduling
|
2014-04-28 10:25:55 +00:00
|
|
|
.SH DESCRIPTION
|
2016-11-27 14:26:15 +00:00
|
|
|
Since Linux 2.6.23, the default scheduler is CFS,
|
|
|
|
the "Completely Fair Scheduler".
|
|
|
|
The CFS scheduler replaced the earlier "O(1)" scheduler.
|
|
|
|
.\"
|
2014-04-28 10:27:56 +00:00
|
|
|
.SS API summary
|
2016-11-27 14:19:05 +00:00
|
|
|
Linux provides the following system calls for controlling
|
|
|
|
the CPU scheduling behavior, policy, and priority of processes
|
|
|
|
(or, more precisely, threads).
|
2014-04-28 10:27:56 +00:00
|
|
|
.TP
|
2016-11-28 06:03:26 +00:00
|
|
|
.BR nice (2)
|
|
|
|
Set a new nice value for the calling thread,
|
|
|
|
and return the new nice value.
|
|
|
|
.TP
|
|
|
|
.BR getpriority (2)
|
|
|
|
Return the nice value of a thread, a process group,
|
|
|
|
or the set of threads owned by a specified user.
|
|
|
|
.TP
|
|
|
|
.BR setpriority (2)
|
|
|
|
Set the nice value of a thread, a process group,
|
|
|
|
or the set of threads owned by a specified user.
|
|
|
|
.TP
|
2014-04-28 10:27:56 +00:00
|
|
|
.BR sched_setscheduler (2)
|
|
|
|
Set the scheduling policy and parameters of a specified thread.
|
|
|
|
.TP
|
|
|
|
.BR sched_getscheduler (2)
|
|
|
|
Return the scheduling policy of a specified thread.
|
|
|
|
.TP
|
|
|
|
.BR sched_setparam (2)
|
|
|
|
Set the scheduling parameters of a specified thread.
|
|
|
|
.TP
|
|
|
|
.BR sched_getparam (2)
|
|
|
|
Fetch the scheduling parameters of a specified thread.
|
|
|
|
.TP
|
|
|
|
.BR sched_get_priority_max (2)
|
2015-08-04 10:08:40 +00:00
|
|
|
Return the maximum priority available in a specified scheduling policy.
|
2014-04-28 10:27:56 +00:00
|
|
|
.TP
|
|
|
|
.BR sched_get_priority_min (2)
|
2015-08-04 10:08:40 +00:00
|
|
|
Return the minimum priority available in a specified scheduling policy.
|
2014-04-28 10:27:56 +00:00
|
|
|
.TP
|
2014-05-10 05:23:15 +00:00
|
|
|
.BR sched_rr_get_interval (2)
|
2014-04-28 10:27:56 +00:00
|
|
|
Fetch the quantum used for threads that are scheduled under
|
|
|
|
the "round-robin" scheduling policy.
|
|
|
|
.TP
|
|
|
|
.BR sched_yield (2)
|
|
|
|
Cause the caller to relinquish the CPU,
|
|
|
|
so that some other thread be executed.
|
|
|
|
.TP
|
|
|
|
.BR sched_setaffinity (2)
|
|
|
|
(Linux-specific)
|
|
|
|
Set the CPU affinity of a specified thread.
|
|
|
|
.TP
|
|
|
|
.BR sched_getaffinity (2)
|
|
|
|
(Linux-specific)
|
2014-05-10 14:27:15 +00:00
|
|
|
Get the CPU affinity of a specified thread.
|
2014-04-28 10:27:56 +00:00
|
|
|
.TP
|
|
|
|
.BR sched_setattr (2)
|
2014-05-12 07:21:37 +00:00
|
|
|
Set the scheduling policy and parameters of a specified thread.
|
|
|
|
This (Linux-specific) system call provides a superset of the functionality of
|
|
|
|
.BR sched_setscheduler (2)
|
|
|
|
and
|
|
|
|
.BR sched_setparam (2).
|
2014-04-28 10:27:56 +00:00
|
|
|
.TP
|
|
|
|
.BR sched_getattr (2)
|
2014-05-12 07:21:37 +00:00
|
|
|
Fetch the scheduling policy and parameters of a specified thread.
|
|
|
|
This (Linux-specific) system call provides a superset of the functionality of
|
|
|
|
.BR sched_getscheduler (2)
|
|
|
|
and
|
|
|
|
.BR sched_getparam (2).
|
2014-04-28 10:27:56 +00:00
|
|
|
.\"
|
2014-04-28 10:25:55 +00:00
|
|
|
.SS Scheduling policies
|
|
|
|
The scheduler is the kernel component that decides which runnable thread
|
|
|
|
will be executed by the CPU next.
|
|
|
|
Each thread has an associated scheduling policy and a \fIstatic\fP
|
2014-05-12 07:24:22 +00:00
|
|
|
scheduling priority,
|
|
|
|
.IR sched_priority .
|
2014-05-12 07:17:41 +00:00
|
|
|
The scheduler makes its decisions based on knowledge of the scheduling
|
2014-04-28 10:25:55 +00:00
|
|
|
policy and static priority of all threads on the system.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
For threads scheduled under one of the normal scheduling policies
|
|
|
|
(\fBSCHED_OTHER\fP, \fBSCHED_IDLE\fP, \fBSCHED_BATCH\fP),
|
|
|
|
\fIsched_priority\fP is not used in scheduling
|
|
|
|
decisions (it must be specified as 0).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
Processes scheduled under one of the real-time policies
|
|
|
|
(\fBSCHED_FIFO\fP, \fBSCHED_RR\fP) have a
|
|
|
|
\fIsched_priority\fP value in the range 1 (low) to 99 (high).
|
|
|
|
(As the numbers imply, real-time threads always have higher priority
|
|
|
|
than normal threads.)
|
2015-04-18 10:18:02 +00:00
|
|
|
Note well: POSIX.1 requires an implementation to support only a
|
2014-04-28 10:25:55 +00:00
|
|
|
minimum 32 distinct priority levels for the real-time policies,
|
|
|
|
and some systems supply just this minimum.
|
|
|
|
Portable programs should use
|
|
|
|
.BR sched_get_priority_min (2)
|
|
|
|
and
|
|
|
|
.BR sched_get_priority_max (2)
|
|
|
|
to find the range of priorities supported for a particular policy.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
Conceptually, the scheduler maintains a list of runnable
|
|
|
|
threads for each possible \fIsched_priority\fP value.
|
|
|
|
In order to determine which thread runs next, the scheduler looks for
|
|
|
|
the nonempty list with the highest static priority and selects the
|
|
|
|
thread at the head of this list.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
A thread's scheduling policy determines
|
|
|
|
where it will be inserted into the list of threads
|
|
|
|
with equal static priority and how it will move inside this list.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
All scheduling is preemptive: if a thread with a higher static
|
|
|
|
priority becomes ready to run, the currently running thread
|
|
|
|
will be preempted and
|
|
|
|
returned to the wait list for its static priority level.
|
|
|
|
The scheduling policy determines the
|
|
|
|
ordering only within the list of runnable threads with equal static
|
|
|
|
priority.
|
|
|
|
.SS SCHED_FIFO: First in-first out scheduling
|
|
|
|
\fBSCHED_FIFO\fP can be used only with static priorities higher than
|
|
|
|
0, which means that when a \fBSCHED_FIFO\fP threads becomes runnable,
|
|
|
|
it will always immediately preempt any currently running
|
|
|
|
\fBSCHED_OTHER\fP, \fBSCHED_BATCH\fP, or \fBSCHED_IDLE\fP thread.
|
|
|
|
\fBSCHED_FIFO\fP is a simple scheduling
|
|
|
|
algorithm without time slicing.
|
|
|
|
For threads scheduled under the
|
|
|
|
\fBSCHED_FIFO\fP policy, the following rules apply:
|
2017-12-19 09:22:09 +00:00
|
|
|
.IP 1) 3
|
2017-12-19 08:04:26 +00:00
|
|
|
A running \fBSCHED_FIFO\fP thread that has been preempted by another thread of
|
2014-04-28 10:25:55 +00:00
|
|
|
higher priority will stay at the head of the list for its priority and
|
|
|
|
will resume execution as soon as all threads of higher priority are
|
|
|
|
blocked again.
|
2017-12-19 09:22:09 +00:00
|
|
|
.IP 2)
|
2017-12-19 08:04:26 +00:00
|
|
|
When a blocked \fBSCHED_FIFO\fP thread becomes runnable, it
|
2014-04-28 10:25:55 +00:00
|
|
|
will be inserted at the end of the list for its priority.
|
2017-12-19 09:22:09 +00:00
|
|
|
.IP 3)
|
sched.7: Correctly describe effect of priority changes for RT threads
The placement of a thread in the run queue for its new
priority depends on the direction of movement in priority.
(This appears to contradict POSIX, except in the case of
pthread_setschedprio().)
As reported by Andrea, and followed up by me:
> I point out that the semantics of sched_setscheduler(2) for RT threads
> indicated in sched(7) and, in particular, in
>
> "A call to sched_setscheduler(2), sched_setparam(2), or
> sched_setattr(2) will put the SCHED_FIFO (or SCHED_RR) thread
> identified by pid at the start of the list if it was runnable."
>
> does not "reflect" the current implementation of this syscall(s) that, in
> turn; based on the source, I think a more appropriate description of this
> semantics would be:
>
> "... the effect on its position in the thread list depends on the
> direction of the modification, as follows:
>
> a. if the priority is raised, the thread becomes the tail of the
> thread list.
> b. if the priority is unchanged, the thread does not change position
> in the thread list.
> c. if the priority is lowered, the thread becomes the head of the
> thread list."
>
> (copied from
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_04_01
> ).
So, I did some testing, and can confirm that the above is the behavior
on Linux for changes to scheduling priorities for RT processes.
(My tests consisted of creating a multithreaded process where all
threads are confined to the same CPU with taskset(), and each thread
is in a CPU-bound loop. I then maipulated their priorities with
chrt(1) and watched the CPU time being consumed with ps(1).)
Back in SUSv2 there was this text:
[[
6. If a thread whose policy or priority has been modified is a running
thread or is runnable, it then becomes the tail of the thread list for
its new priority.
]]
And certainly Linux used to behave this way. I remember testing it,
and when one looks at the Linux 2.2 source code for example, one can
see that there is a call to move_first_runqueue() in this case. At some
point, things changed, and I have not investigated exactly where that
change occurred (but I imagine it was quite a long time ago).
Looking at SUSv4, let's expand the range of your quote, since
point 7 is interesting. Here's text from Section 2.8.4
"Process Scheduling" in POSIX.1-2008/SUSv4 TC2:
[[
7. If a thread whose policy or priority has been modified other
than by pthread_setschedprio() is a running thread or is runnable,
it then becomes the tail of the thread list for its new priority.
8. If a thread whose priority has been modified by pthread_setschedprio()
is a running thread or is runnable, the effect on its position in the
thread list depends on the direction of the modification, as follows:
a. If the priority is raised, the thread becomes the tail of the
thread list.
b. If the priority is unchanged, the thread does not change position
in the thread list.
c. If the priority is lowered, the thread becomes the head of the
thread list.
]]
(Note that the preceding points mention variously sched_setscheduler(),
sched_setsparam(), and pthread_setschedprio(), so that the mention of
just pthread_setschedprio() in points 7 and 8 is significant.)
Now, since chrt(1) uses sched_setscheduler(), rather than
pthread_setschedprio(), then arguably the Linux behavior is a
violation of POSIX. (Indeed, buried in the man-pages source, I find
that I many years ago wrote the comment:
In 2.2.x and 2.4.x, the thread is placed at the front of the queue
In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
But the Linux behavior seems reasonable to me and I'm inclined
to just document it (see the patch below).
Reported-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-12-19 09:25:00 +00:00
|
|
|
If a call to
|
2014-05-12 07:28:26 +00:00
|
|
|
.BR sched_setscheduler (2),
|
|
|
|
.BR sched_setparam (2),
|
sched.7: Correctly describe effect of priority changes for RT threads
The placement of a thread in the run queue for its new
priority depends on the direction of movement in priority.
(This appears to contradict POSIX, except in the case of
pthread_setschedprio().)
As reported by Andrea, and followed up by me:
> I point out that the semantics of sched_setscheduler(2) for RT threads
> indicated in sched(7) and, in particular, in
>
> "A call to sched_setscheduler(2), sched_setparam(2), or
> sched_setattr(2) will put the SCHED_FIFO (or SCHED_RR) thread
> identified by pid at the start of the list if it was runnable."
>
> does not "reflect" the current implementation of this syscall(s) that, in
> turn; based on the source, I think a more appropriate description of this
> semantics would be:
>
> "... the effect on its position in the thread list depends on the
> direction of the modification, as follows:
>
> a. if the priority is raised, the thread becomes the tail of the
> thread list.
> b. if the priority is unchanged, the thread does not change position
> in the thread list.
> c. if the priority is lowered, the thread becomes the head of the
> thread list."
>
> (copied from
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_04_01
> ).
So, I did some testing, and can confirm that the above is the behavior
on Linux for changes to scheduling priorities for RT processes.
(My tests consisted of creating a multithreaded process where all
threads are confined to the same CPU with taskset(), and each thread
is in a CPU-bound loop. I then maipulated their priorities with
chrt(1) and watched the CPU time being consumed with ps(1).)
Back in SUSv2 there was this text:
[[
6. If a thread whose policy or priority has been modified is a running
thread or is runnable, it then becomes the tail of the thread list for
its new priority.
]]
And certainly Linux used to behave this way. I remember testing it,
and when one looks at the Linux 2.2 source code for example, one can
see that there is a call to move_first_runqueue() in this case. At some
point, things changed, and I have not investigated exactly where that
change occurred (but I imagine it was quite a long time ago).
Looking at SUSv4, let's expand the range of your quote, since
point 7 is interesting. Here's text from Section 2.8.4
"Process Scheduling" in POSIX.1-2008/SUSv4 TC2:
[[
7. If a thread whose policy or priority has been modified other
than by pthread_setschedprio() is a running thread or is runnable,
it then becomes the tail of the thread list for its new priority.
8. If a thread whose priority has been modified by pthread_setschedprio()
is a running thread or is runnable, the effect on its position in the
thread list depends on the direction of the modification, as follows:
a. If the priority is raised, the thread becomes the tail of the
thread list.
b. If the priority is unchanged, the thread does not change position
in the thread list.
c. If the priority is lowered, the thread becomes the head of the
thread list.
]]
(Note that the preceding points mention variously sched_setscheduler(),
sched_setsparam(), and pthread_setschedprio(), so that the mention of
just pthread_setschedprio() in points 7 and 8 is significant.)
Now, since chrt(1) uses sched_setscheduler(), rather than
pthread_setschedprio(), then arguably the Linux behavior is a
violation of POSIX. (Indeed, buried in the man-pages source, I find
that I many years ago wrote the comment:
In 2.2.x and 2.4.x, the thread is placed at the front of the queue
In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
But the Linux behavior seems reasonable to me and I'm inclined
to just document it (see the patch below).
Reported-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-12-19 09:25:00 +00:00
|
|
|
.BR sched_setattr (2),
|
|
|
|
.BR pthread_setschedparam (3),
|
2014-04-28 10:25:55 +00:00
|
|
|
or
|
sched.7: Correctly describe effect of priority changes for RT threads
The placement of a thread in the run queue for its new
priority depends on the direction of movement in priority.
(This appears to contradict POSIX, except in the case of
pthread_setschedprio().)
As reported by Andrea, and followed up by me:
> I point out that the semantics of sched_setscheduler(2) for RT threads
> indicated in sched(7) and, in particular, in
>
> "A call to sched_setscheduler(2), sched_setparam(2), or
> sched_setattr(2) will put the SCHED_FIFO (or SCHED_RR) thread
> identified by pid at the start of the list if it was runnable."
>
> does not "reflect" the current implementation of this syscall(s) that, in
> turn; based on the source, I think a more appropriate description of this
> semantics would be:
>
> "... the effect on its position in the thread list depends on the
> direction of the modification, as follows:
>
> a. if the priority is raised, the thread becomes the tail of the
> thread list.
> b. if the priority is unchanged, the thread does not change position
> in the thread list.
> c. if the priority is lowered, the thread becomes the head of the
> thread list."
>
> (copied from
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_08_04_01
> ).
So, I did some testing, and can confirm that the above is the behavior
on Linux for changes to scheduling priorities for RT processes.
(My tests consisted of creating a multithreaded process where all
threads are confined to the same CPU with taskset(), and each thread
is in a CPU-bound loop. I then maipulated their priorities with
chrt(1) and watched the CPU time being consumed with ps(1).)
Back in SUSv2 there was this text:
[[
6. If a thread whose policy or priority has been modified is a running
thread or is runnable, it then becomes the tail of the thread list for
its new priority.
]]
And certainly Linux used to behave this way. I remember testing it,
and when one looks at the Linux 2.2 source code for example, one can
see that there is a call to move_first_runqueue() in this case. At some
point, things changed, and I have not investigated exactly where that
change occurred (but I imagine it was quite a long time ago).
Looking at SUSv4, let's expand the range of your quote, since
point 7 is interesting. Here's text from Section 2.8.4
"Process Scheduling" in POSIX.1-2008/SUSv4 TC2:
[[
7. If a thread whose policy or priority has been modified other
than by pthread_setschedprio() is a running thread or is runnable,
it then becomes the tail of the thread list for its new priority.
8. If a thread whose priority has been modified by pthread_setschedprio()
is a running thread or is runnable, the effect on its position in the
thread list depends on the direction of the modification, as follows:
a. If the priority is raised, the thread becomes the tail of the
thread list.
b. If the priority is unchanged, the thread does not change position
in the thread list.
c. If the priority is lowered, the thread becomes the head of the
thread list.
]]
(Note that the preceding points mention variously sched_setscheduler(),
sched_setsparam(), and pthread_setschedprio(), so that the mention of
just pthread_setschedprio() in points 7 and 8 is significant.)
Now, since chrt(1) uses sched_setscheduler(), rather than
pthread_setschedprio(), then arguably the Linux behavior is a
violation of POSIX. (Indeed, buried in the man-pages source, I find
that I many years ago wrote the comment:
In 2.2.x and 2.4.x, the thread is placed at the front of the queue
In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
But the Linux behavior seems reasonable to me and I'm inclined
to just document it (see the patch below).
Reported-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-12-19 09:25:00 +00:00
|
|
|
.BR pthread_setschedprio (3)
|
|
|
|
changes the priority of the running or runnable
|
|
|
|
.B SCHED_FIFO
|
|
|
|
thread identified by
|
|
|
|
.I pid
|
|
|
|
the effect on the thread's position in the list depends on
|
|
|
|
the direction of the change to threads priority:
|
|
|
|
.RS
|
|
|
|
.IP \(bu 3
|
|
|
|
If the thread's priority is raised,
|
|
|
|
it is placed at the end of the list for its new priority.
|
|
|
|
As a consequence,
|
|
|
|
it may preempt a currently running thread with the same priority.
|
|
|
|
.IP \(bu
|
|
|
|
If the thread's priority is unchanged,
|
|
|
|
its position in the run list is unchanged.
|
|
|
|
.IP \(bu
|
|
|
|
If the thread's priority is lowered,
|
|
|
|
it is placed at the front of the list for its new priority.
|
|
|
|
.RE
|
|
|
|
.IP
|
|
|
|
According to POSIX.1-2008,
|
|
|
|
changes to a thread's priority (or policy) using any mechanism other than
|
|
|
|
.BR pthread_setschedprio (3)
|
|
|
|
should result in the thread being placed at the end of
|
|
|
|
the list for its priority.
|
2014-04-28 10:25:55 +00:00
|
|
|
.\" In 2.2.x and 2.4.x, the thread is placed at the front of the queue
|
|
|
|
.\" In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
|
2017-12-19 09:22:09 +00:00
|
|
|
.IP 4)
|
2014-04-28 10:25:55 +00:00
|
|
|
A thread calling
|
|
|
|
.BR sched_yield (2)
|
|
|
|
will be put at the end of the list.
|
|
|
|
.PP
|
|
|
|
No other events will move a thread
|
|
|
|
scheduled under the \fBSCHED_FIFO\fP policy in the wait list of
|
|
|
|
runnable threads with equal static priority.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
A \fBSCHED_FIFO\fP
|
|
|
|
thread runs until either it is blocked by an I/O request, it is
|
|
|
|
preempted by a higher priority thread, or it calls
|
|
|
|
.BR sched_yield (2).
|
|
|
|
.SS SCHED_RR: Round-robin scheduling
|
|
|
|
\fBSCHED_RR\fP is a simple enhancement of \fBSCHED_FIFO\fP.
|
|
|
|
Everything
|
|
|
|
described above for \fBSCHED_FIFO\fP also applies to \fBSCHED_RR\fP,
|
|
|
|
except that each thread is allowed to run only for a maximum time
|
|
|
|
quantum.
|
|
|
|
If a \fBSCHED_RR\fP thread has been running for a time
|
|
|
|
period equal to or longer than the time quantum, it will be put at the
|
|
|
|
end of the list for its priority.
|
|
|
|
A \fBSCHED_RR\fP thread that has
|
|
|
|
been preempted by a higher priority thread and subsequently resumes
|
|
|
|
execution as a running thread will complete the unexpired portion of
|
|
|
|
its round-robin time quantum.
|
|
|
|
The length of the time quantum can be
|
|
|
|
retrieved using
|
|
|
|
.BR sched_rr_get_interval (2).
|
|
|
|
.\" On Linux 2.4, the length of the RR interval is influenced
|
|
|
|
.\" by the process nice value -- MTK
|
|
|
|
.\"
|
2014-05-12 10:07:58 +00:00
|
|
|
.SS SCHED_DEADLINE: Sporadic task model deadline scheduling
|
2014-05-12 13:18:43 +00:00
|
|
|
Since version 3.14, Linux provides a deadline scheduling policy
|
|
|
|
.RB ( SCHED_DEADLINE ).
|
|
|
|
This policy is currently implemented using
|
|
|
|
GEDF (Global Earliest Deadline First)
|
|
|
|
in conjunction with CBS (Constant Bandwidth Server).
|
|
|
|
To set and fetch this policy and associated attributes,
|
|
|
|
one must use the Linux-specific
|
|
|
|
.BR sched_setattr (2)
|
|
|
|
and
|
|
|
|
.BR sched_getattr (2)
|
|
|
|
system calls.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:07:58 +00:00
|
|
|
A sporadic task is one that has a sequence of jobs, where each
|
2014-05-12 10:30:49 +00:00
|
|
|
job is activated at most once per period.
|
2014-05-12 13:18:43 +00:00
|
|
|
Each job also has a
|
|
|
|
.IR "relative deadline" ,
|
2014-05-12 10:30:49 +00:00
|
|
|
before which it should finish execution, and a
|
2014-05-12 13:18:43 +00:00
|
|
|
.IR "computation time" ,
|
|
|
|
which is the CPU time necessary for executing the job.
|
|
|
|
The moment when a task wakes up
|
|
|
|
because a new job has to be executed is called the
|
|
|
|
.IR "arrival time"
|
|
|
|
(also referred to as the request time or release time).
|
|
|
|
The
|
|
|
|
.IR "start time"
|
|
|
|
is the time at which a task starts its execution.
|
|
|
|
The
|
2014-05-21 11:16:14 +00:00
|
|
|
.I "absolute deadline"
|
2014-05-12 13:18:43 +00:00
|
|
|
is thus obtained by adding the relative deadline to the arrival time.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:07:58 +00:00
|
|
|
The following diagram clarifies these terms:
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:30:49 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2014-05-13 17:55:13 +00:00
|
|
|
arrival/wakeup absolute deadline
|
|
|
|
| start time |
|
|
|
|
| | |
|
|
|
|
v v v
|
|
|
|
-----x--------xooooooooooooooooo--------x--------x---
|
2014-05-12 10:31:29 +00:00
|
|
|
|<- comp. time ->|
|
2014-05-13 17:55:13 +00:00
|
|
|
|<------- relative deadline ------>|
|
|
|
|
|<-------------- period ------------------->|
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2014-05-12 10:30:49 +00:00
|
|
|
.in
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
When setting a
|
2014-05-12 10:30:49 +00:00
|
|
|
.B SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
policy for a thread using
|
|
|
|
.BR sched_setattr (2),
|
|
|
|
one can specify three parameters:
|
|
|
|
.IR Runtime ,
|
|
|
|
.IR Deadline ,
|
|
|
|
and
|
|
|
|
.IR Period .
|
|
|
|
These parameters do not necessarily correspond to the aforementioned terms:
|
|
|
|
usual practice is to set Runtime to something bigger than the average
|
|
|
|
computation time (or worst-case execution time for hard real-time tasks),
|
|
|
|
Deadline to the relative deadline, and Period to the period of the task.
|
|
|
|
Thus, for
|
|
|
|
.BR SCHED_DEADLINE
|
|
|
|
scheduling, we have:
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:30:49 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2014-05-13 17:55:13 +00:00
|
|
|
arrival/wakeup absolute deadline
|
|
|
|
| start time |
|
|
|
|
| | |
|
|
|
|
v v v
|
|
|
|
-----x--------xooooooooooooooooo--------x--------x---
|
|
|
|
|<-- Runtime ------->|
|
|
|
|
|<----------- Deadline ----------->|
|
|
|
|
|<-------------- Period ------------------->|
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2014-05-12 10:30:49 +00:00
|
|
|
.in
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
The three deadline-scheduling parameters correspond to the
|
|
|
|
.IR sched_runtime ,
|
|
|
|
.IR sched_deadline ,
|
|
|
|
and
|
|
|
|
.IR sched_period
|
|
|
|
fields of the
|
|
|
|
.I sched_attr
|
|
|
|
structure; see
|
|
|
|
.BR sched_setattr (2).
|
2015-06-27 09:04:28 +00:00
|
|
|
These fields express values in nanoseconds.
|
2014-05-12 13:18:43 +00:00
|
|
|
.\" FIXME It looks as though specifying sched_period as 0 means
|
2016-10-29 10:47:46 +00:00
|
|
|
.\" "make sched_period the same as sched_deadline".
|
|
|
|
.\" This needs to be documented.
|
2014-05-12 13:18:43 +00:00
|
|
|
If
|
|
|
|
.IR sched_period
|
|
|
|
is specified as 0, then it is made the same as
|
|
|
|
.IR sched_deadline .
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
The kernel requires that:
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
sched_runtime <= sched_deadline <= sched_period
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
.\" See __checkparam_dl in kernel/sched/core.c
|
|
|
|
In addition, under the current implementation,
|
|
|
|
all of the parameter values must be at least 1024
|
|
|
|
(i.e., just over one microsecond,
|
2014-05-13 17:55:13 +00:00
|
|
|
which is the resolution of the implementation), and less than 2^63.
|
2014-05-12 13:18:43 +00:00
|
|
|
If any of these checks fails,
|
|
|
|
.BR sched_setattr (2)
|
|
|
|
fails with the error
|
|
|
|
.BR EINVAL .
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:07:58 +00:00
|
|
|
The CBS guarantees non-interference between tasks, by throttling
|
2014-05-12 13:18:43 +00:00
|
|
|
threads that attempt to over-run their specified Runtime.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
To ensure deadline scheduling guarantees,
|
2014-05-21 11:16:14 +00:00
|
|
|
the kernel must prevent situations where the set of
|
2014-05-12 10:30:49 +00:00
|
|
|
.B SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
threads is not feasible (schedulable) within the given constraints.
|
|
|
|
The kernel thus performs an admittance test when setting or changing
|
2014-05-12 10:30:49 +00:00
|
|
|
.B SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
policy and attributes.
|
|
|
|
This admission test calculates whether the change is feasible;
|
2015-06-26 09:04:44 +00:00
|
|
|
if it is not,
|
2014-05-12 10:30:49 +00:00
|
|
|
.BR sched_setattr (2)
|
2014-05-12 13:18:43 +00:00
|
|
|
fails with the error
|
|
|
|
.BR EBUSY .
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:07:58 +00:00
|
|
|
For example, it is required (but not necessarily sufficient) for
|
2014-05-12 13:18:43 +00:00
|
|
|
the total utilization to be less than or equal to the total number of
|
|
|
|
CPUs available, where, since each thread can maximally run for
|
|
|
|
Runtime per Period, that thread's utilization is its
|
|
|
|
Runtime divided by its Period.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-22 13:43:45 +00:00
|
|
|
In order to fulfill the guarantees that are made when
|
2014-05-12 13:18:43 +00:00
|
|
|
a thread is admitted to the
|
|
|
|
.BR SCHED_DEADLINE
|
|
|
|
policy,
|
2014-05-12 10:30:49 +00:00
|
|
|
.BR SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
threads are the highest priority (user controllable) threads in the
|
|
|
|
system; if any
|
2014-05-12 10:30:49 +00:00
|
|
|
.BR SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
thread is runnable,
|
|
|
|
it will preempt any thread scheduled under one of the other policies.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
A call to
|
2014-05-12 10:30:49 +00:00
|
|
|
.BR fork (2)
|
2014-05-12 13:18:43 +00:00
|
|
|
by a thread scheduled under the
|
|
|
|
.B SCHED_DEADLINE
|
access.2, delete_module.2, eventfd.2, fallocate.2, fcntl.2, getrandom.2, init_module.2, open.2, seccomp.2, timerfd_create.2, openpty.3, pthread_spin_lock.3, shm_open.3, tempnam.3, fifo.7, keyrings.7, pid_namespaces.7, sched.7, thread-keyring.7: wfix (will fail --> fail/fails)
Reported-by: Pedro Alves <palves@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-10-20 14:55:10 +00:00
|
|
|
policy fails with the error
|
2014-05-12 13:18:43 +00:00
|
|
|
.BR EAGAIN ,
|
|
|
|
unless the thread has its reset-on-fork flag set (see below).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 10:30:49 +00:00
|
|
|
A
|
|
|
|
.B SCHED_DEADLINE
|
2014-05-12 13:18:43 +00:00
|
|
|
thread that calls
|
2014-05-12 10:30:49 +00:00
|
|
|
.BR sched_yield (2)
|
2014-05-12 13:18:43 +00:00
|
|
|
will yield the current job and wait for a new period to begin.
|
|
|
|
.\"
|
|
|
|
.\" FIXME Calling sched_getparam() on a SCHED_DEADLINE thread
|
2016-10-29 10:47:46 +00:00
|
|
|
.\" fails with EINVAL, but sched_getscheduler() succeeds.
|
|
|
|
.\" Is that intended? (Why?)
|
2014-05-12 10:30:49 +00:00
|
|
|
.\"
|
2014-04-28 10:25:55 +00:00
|
|
|
.SS SCHED_OTHER: Default Linux time-sharing scheduling
|
2016-11-27 14:45:17 +00:00
|
|
|
\fBSCHED_OTHER\fP can be used at only static priority 0
|
|
|
|
(i.e., threads under real-time policies always have priority over
|
|
|
|
.B SCHED_OTHER
|
|
|
|
processes).
|
2014-04-28 10:25:55 +00:00
|
|
|
\fBSCHED_OTHER\fP is the standard Linux time-sharing scheduler that is
|
|
|
|
intended for all threads that do not require the special
|
|
|
|
real-time mechanisms.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
The thread to run is chosen from the static
|
|
|
|
priority 0 list based on a \fIdynamic\fP priority that is determined only
|
|
|
|
inside this list.
|
2016-11-27 18:25:05 +00:00
|
|
|
The dynamic priority is based on the nice value (see below)
|
2016-11-27 18:24:17 +00:00
|
|
|
and is increased for each time quantum the thread is ready to run,
|
2014-04-28 10:25:55 +00:00
|
|
|
but denied to run by the scheduler.
|
|
|
|
This ensures fair progress among all \fBSCHED_OTHER\fP threads.
|
2018-10-14 14:15:50 +00:00
|
|
|
.PP
|
|
|
|
In the Linux kernel source code, the
|
|
|
|
.B SCHED_OTHER
|
|
|
|
policy is actually named
|
|
|
|
.BR SCHED_NORMAL .
|
2014-04-28 10:25:55 +00:00
|
|
|
.\"
|
2016-11-27 15:26:27 +00:00
|
|
|
.SS The nice value
|
2016-11-28 06:06:59 +00:00
|
|
|
The nice value is an attribute
|
2016-11-27 18:22:05 +00:00
|
|
|
that can be used to influence the CPU scheduler to
|
|
|
|
favor or disfavor a process in scheduling decisions.
|
|
|
|
It affects the scheduling of
|
|
|
|
.BR SCHED_OTHER
|
|
|
|
and
|
|
|
|
.BR SCHED_BATCH
|
2016-11-28 06:06:59 +00:00
|
|
|
(see below) processes.
|
2016-11-27 18:25:05 +00:00
|
|
|
The nice value can be modified using
|
|
|
|
.BR nice (2),
|
|
|
|
.BR setpriority (2),
|
|
|
|
or
|
|
|
|
.BR sched_setattr (2).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-28 06:06:59 +00:00
|
|
|
According to POSIX.1, the nice value is a per-process attribute;
|
|
|
|
that is, the threads in a process should share a nice value.
|
|
|
|
However, on Linux, the nice value is a per-thread attribute:
|
|
|
|
different threads in the same process may have different nice values.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 15:26:27 +00:00
|
|
|
The range of the nice value
|
|
|
|
varies across UNIX systems.
|
|
|
|
On modern Linux, the range is \-20 (high priority) to +19 (low priority).
|
|
|
|
On some other systems, the range is \-20..20.
|
|
|
|
Very early Linux kernels (Before Linux 2.0) had the range \-infinity..15.
|
|
|
|
.\" Linux before 1.3.36 had \-infinity..15.
|
|
|
|
.\" Since kernel 1.3.43, Linux has the range \-20..19.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 15:26:27 +00:00
|
|
|
The degree to which the nice value affects the relative scheduling of
|
|
|
|
.BR SCHED_OTHER
|
|
|
|
processes likewise varies across UNIX systems and
|
|
|
|
across Linux kernel versions.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 15:26:27 +00:00
|
|
|
With the advent of the CFS scheduler in kernel 2.6.23,
|
|
|
|
Linux adopted an algorithm that causes
|
|
|
|
relative differences in nice values to have a much stronger effect.
|
2016-11-27 15:32:56 +00:00
|
|
|
In the current implementation, each unit of difference in the
|
|
|
|
nice values of two processes results in a factor of 1.25
|
|
|
|
in the degree to which the scheduler favors the higher priority process.
|
2016-11-27 15:26:27 +00:00
|
|
|
This causes very low nice values (+19) to truly provide little CPU
|
|
|
|
to a process whenever there is any other
|
|
|
|
higher priority load on the system,
|
|
|
|
and makes high nice values (\-20) deliver most of the CPU to applications
|
|
|
|
that require it (e.g., some audio applications).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 15:45:18 +00:00
|
|
|
On Linux, the
|
|
|
|
.BR RLIMIT_NICE
|
|
|
|
resource limit can be used to define a limit to which
|
|
|
|
an unprivileged process's nice value can be raised; see
|
|
|
|
.BR setrlimit (2)
|
|
|
|
for details.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 21:56:12 +00:00
|
|
|
For further details on the nice value, see the subsections on
|
|
|
|
the autogroup feature and group scheduling, below.
|
2016-11-27 19:18:08 +00:00
|
|
|
.\"
|
2014-04-28 10:25:55 +00:00
|
|
|
.SS SCHED_BATCH: Scheduling batch processes
|
|
|
|
(Since Linux 2.6.16.)
|
|
|
|
\fBSCHED_BATCH\fP can be used only at static priority 0.
|
|
|
|
This policy is similar to \fBSCHED_OTHER\fP in that it schedules
|
|
|
|
the thread according to its dynamic priority
|
|
|
|
(based on the nice value).
|
|
|
|
The difference is that this policy
|
|
|
|
will cause the scheduler to always assume
|
|
|
|
that the thread is CPU-intensive.
|
|
|
|
Consequently, the scheduler will apply a small scheduling
|
2014-06-16 20:25:04 +00:00
|
|
|
penalty with respect to wakeup behavior,
|
2014-04-28 10:25:55 +00:00
|
|
|
so that this thread is mildly disfavored in scheduling decisions.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
.\" The following paragraph is drawn largely from the text that
|
|
|
|
.\" accompanied Ingo Molnar's patch for the implementation of
|
|
|
|
.\" SCHED_BATCH.
|
|
|
|
.\" commit b0a9499c3dd50d333e2aedb7e894873c58da3785
|
|
|
|
This policy is useful for workloads that are noninteractive,
|
|
|
|
but do not want to lower their nice value,
|
|
|
|
and for workloads that want a deterministic scheduling policy without
|
|
|
|
interactivity causing extra preemptions (between the workload's tasks).
|
|
|
|
.\"
|
|
|
|
.SS SCHED_IDLE: Scheduling very low priority jobs
|
|
|
|
(Since Linux 2.6.23.)
|
|
|
|
\fBSCHED_IDLE\fP can be used only at static priority 0;
|
|
|
|
the process nice value has no influence for this policy.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
This policy is intended for running jobs at extremely low
|
|
|
|
priority (lower even than a +19 nice value with the
|
|
|
|
.B SCHED_OTHER
|
|
|
|
or
|
|
|
|
.B SCHED_BATCH
|
|
|
|
policies).
|
|
|
|
.\"
|
|
|
|
.SS Resetting scheduling policy for child processes
|
2014-05-10 05:22:47 +00:00
|
|
|
Each thread has a reset-on-fork scheduling flag.
|
|
|
|
When this flag is set, children created by
|
|
|
|
.BR fork (2)
|
|
|
|
do not inherit privileged scheduling policies.
|
|
|
|
The reset-on-fork flag can be set by either:
|
|
|
|
.IP * 3
|
|
|
|
ORing the
|
2014-04-28 10:25:55 +00:00
|
|
|
.B SCHED_RESET_ON_FORK
|
2014-05-10 05:22:47 +00:00
|
|
|
flag into the
|
2014-04-28 10:25:55 +00:00
|
|
|
.I policy
|
2014-05-10 05:22:47 +00:00
|
|
|
argument when calling
|
|
|
|
.BR sched_setscheduler (2)
|
|
|
|
(since Linux 2.6.32);
|
|
|
|
or
|
|
|
|
.IP *
|
|
|
|
specifying the
|
|
|
|
.B SCHED_FLAG_RESET_ON_FORK
|
|
|
|
flag in
|
|
|
|
.IR attr.sched_flags
|
2014-04-28 10:25:55 +00:00
|
|
|
when calling
|
2014-05-10 05:22:47 +00:00
|
|
|
.BR sched_setattr (2).
|
|
|
|
.PP
|
|
|
|
Note that the constants used with these two APIs have different names.
|
|
|
|
The state of the reset-on-fork flag can analogously be retrieved using
|
|
|
|
.BR sched_getscheduler (2)
|
|
|
|
and
|
|
|
|
.BR sched_getattr (2).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-10 05:22:47 +00:00
|
|
|
The reset-on-fork feature is intended for media-playback applications,
|
2014-04-28 10:25:55 +00:00
|
|
|
and can be used to prevent applications evading the
|
|
|
|
.BR RLIMIT_RTTIME
|
|
|
|
resource limit (see
|
|
|
|
.BR getrlimit (2))
|
|
|
|
by creating multiple child processes.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-10 05:22:47 +00:00
|
|
|
More precisely, if the reset-on-fork flag is set,
|
2014-04-28 10:25:55 +00:00
|
|
|
the following rules apply for subsequently created children:
|
|
|
|
.IP * 3
|
|
|
|
If the calling thread has a scheduling policy of
|
|
|
|
.B SCHED_FIFO
|
|
|
|
or
|
|
|
|
.BR SCHED_RR ,
|
|
|
|
the policy is reset to
|
|
|
|
.BR SCHED_OTHER
|
|
|
|
in child processes.
|
|
|
|
.IP *
|
|
|
|
If the calling process has a negative nice value,
|
|
|
|
the nice value is reset to zero in child processes.
|
|
|
|
.PP
|
2014-05-10 05:22:47 +00:00
|
|
|
After the reset-on-fork flag has been enabled,
|
2014-04-28 10:25:55 +00:00
|
|
|
it can be reset only if the thread has the
|
|
|
|
.BR CAP_SYS_NICE
|
|
|
|
capability.
|
|
|
|
This flag is disabled in child processes created by
|
|
|
|
.BR fork (2).
|
|
|
|
.\"
|
|
|
|
.SS Privileges and resource limits
|
|
|
|
In Linux kernels before 2.6.12, only privileged
|
|
|
|
.RB ( CAP_SYS_NICE )
|
|
|
|
threads can set a nonzero static priority (i.e., set a real-time
|
|
|
|
scheduling policy).
|
|
|
|
The only change that an unprivileged thread can make is to set the
|
|
|
|
.B SCHED_OTHER
|
2014-05-12 07:30:25 +00:00
|
|
|
policy, and this can be done only if the effective user ID of the caller
|
2014-04-28 10:25:55 +00:00
|
|
|
matches the real or effective user ID of the target thread
|
|
|
|
(i.e., the thread specified by
|
|
|
|
.IR pid )
|
|
|
|
whose policy is being changed.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 13:18:43 +00:00
|
|
|
A thread must be privileged
|
|
|
|
.RB ( CAP_SYS_NICE )
|
2014-05-21 11:16:14 +00:00
|
|
|
in order to set or modify a
|
2014-05-12 13:18:43 +00:00
|
|
|
.BR SCHED_DEADLINE
|
|
|
|
policy.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
Since Linux 2.6.12, the
|
|
|
|
.B RLIMIT_RTPRIO
|
|
|
|
resource limit defines a ceiling on an unprivileged thread's
|
|
|
|
static priority for the
|
|
|
|
.B SCHED_RR
|
|
|
|
and
|
|
|
|
.B SCHED_FIFO
|
|
|
|
policies.
|
|
|
|
The rules for changing scheduling policy and priority are as follows:
|
|
|
|
.IP * 3
|
|
|
|
If an unprivileged thread has a nonzero
|
|
|
|
.B RLIMIT_RTPRIO
|
|
|
|
soft limit, then it can change its scheduling policy and priority,
|
|
|
|
subject to the restriction that the priority cannot be set to a
|
|
|
|
value higher than the maximum of its current priority and its
|
|
|
|
.B RLIMIT_RTPRIO
|
|
|
|
soft limit.
|
|
|
|
.IP *
|
|
|
|
If the
|
|
|
|
.B RLIMIT_RTPRIO
|
|
|
|
soft limit is 0, then the only permitted changes are to lower the priority,
|
|
|
|
or to switch to a non-real-time policy.
|
|
|
|
.IP *
|
|
|
|
Subject to the same rules,
|
|
|
|
another unprivileged thread can also make these changes,
|
|
|
|
as long as the effective user ID of the thread making the change
|
|
|
|
matches the real or effective user ID of the target thread.
|
|
|
|
.IP *
|
|
|
|
Special rules apply for the
|
2014-05-12 08:10:06 +00:00
|
|
|
.BR SCHED_IDLE
|
|
|
|
policy.
|
2014-04-28 10:25:55 +00:00
|
|
|
In Linux kernels before 2.6.39,
|
|
|
|
an unprivileged thread operating under this policy cannot
|
|
|
|
change its policy, regardless of the value of its
|
|
|
|
.BR RLIMIT_RTPRIO
|
|
|
|
resource limit.
|
|
|
|
In Linux kernels since 2.6.39,
|
|
|
|
.\" commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
|
|
|
|
an unprivileged thread can switch to either the
|
|
|
|
.BR SCHED_BATCH
|
|
|
|
or the
|
2015-08-05 18:56:51 +00:00
|
|
|
.BR SCHED_OTHER
|
2014-04-28 10:25:55 +00:00
|
|
|
policy so long as its nice value falls within the range permitted by its
|
|
|
|
.BR RLIMIT_NICE
|
|
|
|
resource limit (see
|
|
|
|
.BR getrlimit (2)).
|
|
|
|
.PP
|
|
|
|
Privileged
|
|
|
|
.RB ( CAP_SYS_NICE )
|
|
|
|
threads ignore the
|
|
|
|
.B RLIMIT_RTPRIO
|
|
|
|
limit; as with older kernels,
|
|
|
|
they can make arbitrary changes to scheduling policy and priority.
|
|
|
|
See
|
|
|
|
.BR getrlimit (2)
|
|
|
|
for further information on
|
|
|
|
.BR RLIMIT_RTPRIO .
|
2014-05-12 09:28:23 +00:00
|
|
|
.SS Limiting the CPU usage of real-time and deadline processes
|
|
|
|
A nonblocking infinite loop in a thread scheduled under the
|
|
|
|
.BR SCHED_FIFO ,
|
|
|
|
.BR SCHED_RR ,
|
|
|
|
or
|
|
|
|
.BR SCHED_DEADLINE
|
2016-11-27 14:02:53 +00:00
|
|
|
policy can potentially block all other threads from accessing
|
|
|
|
the CPU forever.
|
2014-05-12 09:28:23 +00:00
|
|
|
Prior to Linux 2.6.25, the only way of preventing a runaway real-time
|
|
|
|
process from freezing the system was to run (at the console)
|
|
|
|
a shell scheduled under a higher static priority than the tested application.
|
|
|
|
This allows an emergency kill of tested
|
|
|
|
real-time applications that do not block or terminate as expected.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 09:28:23 +00:00
|
|
|
Since Linux 2.6.25, there are other techniques for dealing with runaway
|
|
|
|
real-time and deadline processes.
|
|
|
|
One of these is to use the
|
|
|
|
.BR RLIMIT_RTTIME
|
|
|
|
resource limit to set a ceiling on the CPU time that
|
|
|
|
a real-time process may consume.
|
|
|
|
See
|
|
|
|
.BR getrlimit (2)
|
|
|
|
for details.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-05-12 09:28:23 +00:00
|
|
|
Since version 2.6.25, Linux also provides two
|
|
|
|
.I /proc
|
|
|
|
files that can be used to reserve a certain amount of CPU time
|
|
|
|
to be used by non-real-time processes.
|
2016-11-27 13:57:30 +00:00
|
|
|
Reserving CPU time in this fashion allows some CPU time to be
|
2014-05-12 09:28:23 +00:00
|
|
|
allocated to (say) a root shell that can be used to kill a runaway process.
|
|
|
|
Both of these files specify time values in microseconds:
|
|
|
|
.TP
|
|
|
|
.IR /proc/sys/kernel/sched_rt_period_us
|
|
|
|
This file specifies a scheduling period that is equivalent to
|
|
|
|
100% CPU bandwidth.
|
|
|
|
The value in this file can range from 1 to
|
|
|
|
.BR INT_MAX ,
|
|
|
|
giving an operating range of 1 microsecond to around 35 minutes.
|
|
|
|
The default value in this file is 1,000,000 (1 second).
|
|
|
|
.TP
|
|
|
|
.IR /proc/sys/kernel/sched_rt_runtime_us
|
|
|
|
The value in this file specifies how much of the "period" time
|
|
|
|
can be used by all real-time and deadline scheduled processes
|
|
|
|
on the system.
|
|
|
|
The value in this file can range from \-1 to
|
|
|
|
.BR INT_MAX \-1.
|
2018-04-27 12:43:23 +00:00
|
|
|
Specifying \-1 makes the run time the same as the period;
|
2014-05-12 09:28:23 +00:00
|
|
|
that is, no CPU time is set aside for non-real-time processes
|
|
|
|
(which was the Linux behavior before kernel 2.6.25).
|
|
|
|
The default value in this file is 950,000 (0.95 seconds),
|
|
|
|
meaning that 5% of the CPU time is reserved for processes that
|
|
|
|
don't run under a real-time or deadline scheduling policy.
|
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
.SS Response time
|
2014-05-12 07:05:08 +00:00
|
|
|
A blocked high priority thread waiting for I/O has a certain
|
2014-04-28 10:25:55 +00:00
|
|
|
response time before it is scheduled again.
|
|
|
|
The device driver writer
|
|
|
|
can greatly reduce this response time by using a "slow interrupt"
|
|
|
|
interrupt handler.
|
|
|
|
.\" as described in
|
|
|
|
.\" .BR request_irq (9).
|
|
|
|
.SS Miscellaneous
|
|
|
|
Child processes inherit the scheduling policy and parameters across a
|
|
|
|
.BR fork (2).
|
|
|
|
The scheduling policy and parameters are preserved across
|
|
|
|
.BR execve (2).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
Memory locking is usually needed for real-time processes to avoid
|
|
|
|
paging delays; this can be done with
|
|
|
|
.BR mlock (2)
|
|
|
|
or
|
|
|
|
.BR mlockall (2).
|
2016-11-22 13:43:31 +00:00
|
|
|
.\"
|
|
|
|
.SS The autogroup feature
|
|
|
|
.\" commit 5091faa449ee0b7d73bc296a93bca9540fc51d0a
|
|
|
|
Since Linux 2.6.38,
|
|
|
|
the kernel provides a feature known as autogrouping to improve interactive
|
2016-11-24 20:20:03 +00:00
|
|
|
desktop performance in the face of multiprocess, CPU-intensive
|
2016-11-22 13:43:31 +00:00
|
|
|
workloads such as building the Linux kernel with large numbers of
|
|
|
|
parallel build processes (i.e., the
|
|
|
|
.BR make (1)
|
|
|
|
.BR \-j
|
|
|
|
flag).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-22 13:43:31 +00:00
|
|
|
This feature operates in conjunction with the
|
|
|
|
CFS scheduler and requires a kernel that is configured with
|
|
|
|
.BR CONFIG_SCHED_AUTOGROUP .
|
|
|
|
On a running system, this feature is enabled or disabled via the file
|
|
|
|
.IR /proc/sys/kernel/sched_autogroup_enabled ;
|
|
|
|
a value of 0 disables the feature, while a value of 1 enables it.
|
|
|
|
The default value in this file is 1, unless the kernel was booted with the
|
|
|
|
.IR noautogroup
|
|
|
|
parameter.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-12-27 16:42:13 +00:00
|
|
|
A new autogroup is created when a new session is created via
|
2016-11-24 20:20:03 +00:00
|
|
|
.BR setsid (2);
|
|
|
|
this happens, for example, when a new terminal window is started.
|
|
|
|
A new process created by
|
|
|
|
.BR fork (2)
|
|
|
|
inherits its parent's autogroup membership.
|
|
|
|
Thus, all of the processes in a session are members of the same autogroup.
|
|
|
|
An autogroup is automatically destroyed when the last process
|
2016-11-22 13:43:31 +00:00
|
|
|
in the group terminates.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-24 20:20:03 +00:00
|
|
|
When autogrouping is enabled, all of the members of an autogroup
|
|
|
|
are placed in the same kernel scheduler "task group".
|
|
|
|
The CFS scheduler employs an algorithm that equalizes the
|
|
|
|
distribution of CPU cycles across task groups.
|
|
|
|
The benefits of this for interactive desktop performance
|
|
|
|
can be described via the following example.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-25 14:54:20 +00:00
|
|
|
Suppose that there are two autogroups competing for the same CPU
|
|
|
|
(i.e., presume either a single CPU system or the use of
|
|
|
|
.BR taskset (1)
|
|
|
|
to confine all the processes to the same CPU on an SMP system).
|
2016-11-24 20:20:03 +00:00
|
|
|
The first group contains ten CPU-bound processes from
|
|
|
|
a kernel build started with
|
|
|
|
.IR "make\ \-j10" .
|
|
|
|
The other contains a single CPU-bound process: a video player.
|
|
|
|
The effect of autogrouping is that the two groups will
|
|
|
|
each receive half of the CPU cycles.
|
|
|
|
That is, the video player will receive 50% of the CPU cycles,
|
2016-11-25 13:03:35 +00:00
|
|
|
rather than just 9% of the cycles,
|
2016-11-24 20:20:03 +00:00
|
|
|
which would likely lead to degraded video playback.
|
2016-11-25 14:54:20 +00:00
|
|
|
The situation on an SMP system is more complex,
|
|
|
|
.\" Mike Galbraith, 25 Nov 2016:
|
|
|
|
.\" I'd say something more wishy-washy here, like cycles are
|
|
|
|
.\" distributed fairly across groups and leave it at that, as your
|
|
|
|
.\" detailed example is incorrect due to SMP fairness (which I don't
|
|
|
|
.\" like much because [very unlikely] worst case scenario
|
|
|
|
.\" renders a box sized group incapable of utilizing more that
|
|
|
|
.\" a single CPU total). For example, if a group of NR_CPUS
|
|
|
|
.\" size competes with a singleton, load balancing will try to give
|
|
|
|
.\" the singleton a full CPU of its very own. If groups intersect for
|
|
|
|
.\" whatever reason on say my quad lappy, distribution is 80/20 in
|
|
|
|
.\" favor of the singleton.
|
|
|
|
but the general effect is the same:
|
|
|
|
the scheduler distributes CPU cycles across task groups such that
|
2016-11-24 20:20:03 +00:00
|
|
|
an autogroup that contains a large number of CPU-bound processes
|
2016-11-26 14:17:27 +00:00
|
|
|
does not end up hogging CPU cycles at the expense of the other
|
2016-11-24 20:20:03 +00:00
|
|
|
jobs on the system.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-24 20:20:03 +00:00
|
|
|
A process's autogroup (task group) membership can be viewed via the file
|
2016-11-22 13:43:31 +00:00
|
|
|
.IR /proc/[pid]/autogroup :
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-22 13:43:31 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2016-11-22 13:43:31 +00:00
|
|
|
$ \fBcat /proc/1/autogroup\fP
|
|
|
|
/autogroup-1 nice 0
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
ioctl_console.2, ioctl_getfsmap.2, ioctl_iflags.2, ioctl_list.2, ioctl_ns.2, kcmp.2, kexec_load.2, keyctl.2, link.2, mmap.2, modify_ldt.2, msgctl.2, poll.2, query_module.2, quotactl.2, recv.2, recvmmsg.2, sched_setscheduler.2, seccomp.2, select.2, semctl.2, semop.2, send.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sysinfo.2, timer_create.2, timerfd_create.2, uname.2, unshare.2, userfaultfd.2, ustat.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, backtrace.3, bswap.3, btree.3, clock_getcpuclockid.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, fmemopen.3, fopencookie.3, frexp.3, fts.3, ftw.3, getaddrinfo.3, getaddrinfo_a.3, getcontext.3, getgrouplist.3, getifaddrs.3, getipnodebyname.3, getnameinfo.3, getopt.3, getprotoent_r.3, getpwent_r.3, getrpcent.3, getservent_r.3, getttyent.3, getumask.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, inet.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallopt.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, posix_openpt.3, printf.3, pthread_setname_np.3, pthread_setschedparam.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, sigvec.3, stdarg.3, strcat.3, strcpy.3, strftime.3, strtol.3, toupper.3, ttyslot.3, fuse.4, loop.4, st.4, elf.5, cgroup_namespaces.7, cgroups.7, feature_test_macros.7, inode.7, inotify.7, keyrings.7, man-pages.7, math_error.7, mount_namespaces.7, mq_overview.7, pthreads.7, sched.7, session-keyring.7, udplite.7, unix.7, vdso.7: Use consistent markup for code snippets
The preferred form is
.PP/.IP
.in +4n
.EX
<code>
.EE
.in
.PP/.IP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:37:55 +00:00
|
|
|
.in
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-22 13:43:31 +00:00
|
|
|
This file can also be used to modify the CPU bandwidth allocated
|
2016-11-24 20:20:03 +00:00
|
|
|
to an autogroup.
|
2016-11-22 13:43:31 +00:00
|
|
|
This is done by writing a number in the "nice" range to the file
|
2016-11-24 20:20:03 +00:00
|
|
|
to set the autogroup's nice value.
|
2016-11-26 14:16:29 +00:00
|
|
|
The allowed range is from +19 (low priority) to \-20 (high priority).
|
|
|
|
(Writing values outside of this range causes
|
|
|
|
.BR write (2)
|
|
|
|
to fail with the error
|
|
|
|
.BR EINVAL .)
|
2016-11-24 20:20:03 +00:00
|
|
|
.\" FIXME .
|
2016-11-23 14:31:07 +00:00
|
|
|
.\" Because of a bug introduced in Linux 4.7
|
|
|
|
.\" (commit 2159197d66770ec01f75c93fb11dc66df81fd45b made changes
|
|
|
|
.\" that exposed the fact that autogroup didn't call scale_load()),
|
|
|
|
.\" it happened that *all* values in this range caused a task group
|
|
|
|
.\" to be further disfavored by the scheduler, with \-20 resulting
|
2016-11-27 21:29:57 +00:00
|
|
|
.\" in the scheduler mildly disfavoring the task group and +19 greatly
|
2016-11-23 14:31:07 +00:00
|
|
|
.\" disfavoring it.
|
2016-11-22 13:43:31 +00:00
|
|
|
.\"
|
2016-11-23 14:31:07 +00:00
|
|
|
.\" A patch was posted on 23 Nov 2016
|
|
|
|
.\" ("sched/autogroup: Fix 64bit kernel nice adjustment";
|
|
|
|
.\" check later to see in which kernel version it lands.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 21:45:22 +00:00
|
|
|
The autogroup nice setting has the same meaning as the process nice value,
|
|
|
|
but applies to distribution of CPU cycles to the autogroup as a whole,
|
|
|
|
based on the relative nice values of other autogroups.
|
|
|
|
For a process inside an autogroup, the CPU cycles that it receives
|
|
|
|
will be a product of the autogroup's nice value
|
|
|
|
(compared to other autogroups)
|
|
|
|
and the process's nice value
|
|
|
|
(compared to other processes in the same autogroup.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-22 13:43:31 +00:00
|
|
|
The use of the
|
|
|
|
.BR cgroups (7)
|
2016-11-27 19:20:01 +00:00
|
|
|
CPU controller to place processes in cgroups other than the
|
|
|
|
root CPU cgroup overrides the effect of autogrouping.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-27 21:28:02 +00:00
|
|
|
The autogroup feature groups only processes scheduled under
|
|
|
|
non-real-time policies
|
|
|
|
.RB ( SCHED_OTHER ,
|
|
|
|
.BR SCHED_BATCH ,
|
|
|
|
and
|
|
|
|
.BR SCHED_IDLE ).
|
|
|
|
It does not group processes scheduled under real-time and
|
|
|
|
deadline policies.
|
2016-11-24 20:20:03 +00:00
|
|
|
Those processes are scheduled according to the rules described earlier.
|
2016-11-27 21:56:12 +00:00
|
|
|
.\"
|
|
|
|
.SS The nice value and group scheduling
|
|
|
|
When scheduling non-real-time processes (i.e., those scheduled under the
|
|
|
|
.BR SCHED_OTHER ,
|
|
|
|
.BR SCHED_BATCH ,
|
|
|
|
and
|
|
|
|
.BR SCHED_IDLE
|
|
|
|
policies), the CFS scheduler employs a technique known as "group scheduling",
|
|
|
|
if the kernel was configured with the
|
2016-11-29 06:34:53 +00:00
|
|
|
.BR CONFIG_FAIR_GROUP_SCHED
|
2016-11-27 21:56:12 +00:00
|
|
|
option (which is typical).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-29 06:34:53 +00:00
|
|
|
Under group scheduling, threads are scheduled in "task groups".
|
|
|
|
Task groups have a hierarchical relationship,
|
|
|
|
rooted under the initial task group on the system,
|
|
|
|
known as the "root task group".
|
|
|
|
Task groups are formed in the following circumstances:
|
2016-11-27 21:56:12 +00:00
|
|
|
.IP * 3
|
2016-11-29 06:34:53 +00:00
|
|
|
All of the threads in a CPU cgroup form a task group.
|
|
|
|
The parent of this task group is the task group of the
|
|
|
|
corresponding parent cgroup.
|
2016-11-27 21:56:12 +00:00
|
|
|
.IP *
|
2016-11-29 06:34:53 +00:00
|
|
|
If autogrouping is enabled,
|
|
|
|
then all of the threads that are (implicitly) placed in an autogroup
|
2016-11-27 21:56:12 +00:00
|
|
|
(i.e., the same session, as created by
|
|
|
|
.BR setsid (2))
|
2016-11-29 06:34:53 +00:00
|
|
|
form a task group.
|
|
|
|
Each new autogroup is thus a separate task group.
|
2016-12-12 09:47:17 +00:00
|
|
|
The root task group is the parent of all such autogroups.
|
2016-11-29 06:34:53 +00:00
|
|
|
.IP *
|
|
|
|
If autogrouping is enabled, then the root task group consists of
|
|
|
|
all processes in the root CPU cgroup that were not
|
|
|
|
otherwise implicitly placed into a new autogroup.
|
2016-11-27 21:56:12 +00:00
|
|
|
.IP *
|
2016-11-29 06:34:53 +00:00
|
|
|
If autogrouping is disabled, then the root task group consists of
|
|
|
|
all processes in the root CPU cgroup.
|
|
|
|
.IP *
|
|
|
|
If group scheduling was disabled (i.e., the kernel was configured without
|
|
|
|
.BR CONFIG_FAIR_GROUP_SCHED ),
|
|
|
|
then all of the processes on the system are notionally placed
|
|
|
|
in a single task group.
|
2014-04-28 10:25:55 +00:00
|
|
|
.PP
|
2016-11-27 21:56:12 +00:00
|
|
|
Under group scheduling,
|
2016-11-29 06:34:53 +00:00
|
|
|
a thread's nice value has an effect for scheduling decisions
|
|
|
|
.IR "only relative to other threads in the same task group" .
|
2016-11-27 21:56:12 +00:00
|
|
|
This has some surprising consequences in terms of the traditional semantics
|
|
|
|
of the nice value on UNIX systems.
|
|
|
|
In particular, if autogrouping
|
2016-12-04 10:53:16 +00:00
|
|
|
is enabled (which is the default in various distributions), then employing
|
2016-11-27 21:56:12 +00:00
|
|
|
.BR setpriority (2)
|
|
|
|
or
|
|
|
|
.BR nice (1)
|
|
|
|
on a process has an effect only for scheduling relative
|
|
|
|
to other processes executed in the same session
|
|
|
|
(typically: the same terminal window).
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-11-29 06:34:53 +00:00
|
|
|
Conversely, for two processes that are (for example)
|
|
|
|
the sole CPU-bound processes in different sessions
|
|
|
|
(e.g., different terminal windows,
|
|
|
|
each of whose jobs are tied to different autogroups),
|
2016-11-27 21:56:12 +00:00
|
|
|
.IR "modifying the nice value of the process in one of the sessions"
|
|
|
|
.IR "has no effect"
|
|
|
|
in terms of the scheduler's decisions relative to the
|
|
|
|
process in the other session.
|
2016-11-29 06:34:53 +00:00
|
|
|
.\" More succinctly: the nice(1) command is in many cases a no-op since
|
|
|
|
.\" Linux 2.6.38.
|
2016-11-27 21:56:12 +00:00
|
|
|
.\"
|
2016-12-02 09:22:04 +00:00
|
|
|
A possibly useful workaround here is to use a command such as
|
|
|
|
the following to modify the autogroup nice value for
|
|
|
|
.I all
|
|
|
|
of the processes in a terminal session:
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2016-12-02 09:22:04 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2016-12-02 09:22:04 +00:00
|
|
|
$ \fBecho 10 > /proc/self/autogroup\fP
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
ioctl_console.2, ioctl_getfsmap.2, ioctl_iflags.2, ioctl_list.2, ioctl_ns.2, kcmp.2, kexec_load.2, keyctl.2, link.2, mmap.2, modify_ldt.2, msgctl.2, poll.2, query_module.2, quotactl.2, recv.2, recvmmsg.2, sched_setscheduler.2, seccomp.2, select.2, semctl.2, semop.2, send.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sysinfo.2, timer_create.2, timerfd_create.2, uname.2, unshare.2, userfaultfd.2, ustat.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, backtrace.3, bswap.3, btree.3, clock_getcpuclockid.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, fmemopen.3, fopencookie.3, frexp.3, fts.3, ftw.3, getaddrinfo.3, getaddrinfo_a.3, getcontext.3, getgrouplist.3, getifaddrs.3, getipnodebyname.3, getnameinfo.3, getopt.3, getprotoent_r.3, getpwent_r.3, getrpcent.3, getservent_r.3, getttyent.3, getumask.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, inet.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallopt.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, posix_openpt.3, printf.3, pthread_setname_np.3, pthread_setschedparam.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, sigvec.3, stdarg.3, strcat.3, strcpy.3, strftime.3, strtol.3, toupper.3, ttyslot.3, fuse.4, loop.4, st.4, elf.5, cgroup_namespaces.7, cgroups.7, feature_test_macros.7, inode.7, inotify.7, keyrings.7, man-pages.7, math_error.7, mount_namespaces.7, mq_overview.7, pthreads.7, sched.7, session-keyring.7, udplite.7, unix.7, vdso.7: Use consistent markup for code snippets
The preferred form is
.PP/.IP
.in +4n
.EX
<code>
.EE
.in
.PP/.IP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:37:55 +00:00
|
|
|
.in
|
2014-04-28 10:25:55 +00:00
|
|
|
.SS Real-time features in the mainline Linux kernel
|
|
|
|
.\" FIXME . Probably this text will need some minor tweaking
|
2015-06-27 08:56:29 +00:00
|
|
|
.\" ask Carsten Emde about this.
|
2016-11-29 06:48:35 +00:00
|
|
|
Since kernel version 2.6.18, Linux is gradually
|
2014-04-28 10:25:55 +00:00
|
|
|
becoming equipped with real-time capabilities,
|
|
|
|
most of which are derived from the former
|
|
|
|
.I realtime-preempt
|
2016-11-27 14:10:46 +00:00
|
|
|
patch set.
|
2014-04-28 10:25:55 +00:00
|
|
|
Until the patches have been completely merged into the
|
2015-06-27 08:56:29 +00:00
|
|
|
mainline kernel,
|
2014-04-28 10:25:55 +00:00
|
|
|
they must be installed to achieve the best real-time performance.
|
|
|
|
These patches are named:
|
ioctl_console.2, ioctl_getfsmap.2, ioctl_iflags.2, ioctl_list.2, ioctl_ns.2, kcmp.2, kexec_load.2, keyctl.2, link.2, mmap.2, modify_ldt.2, msgctl.2, poll.2, query_module.2, quotactl.2, recv.2, recvmmsg.2, sched_setscheduler.2, seccomp.2, select.2, semctl.2, semop.2, send.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sysinfo.2, timer_create.2, timerfd_create.2, uname.2, unshare.2, userfaultfd.2, ustat.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, backtrace.3, bswap.3, btree.3, clock_getcpuclockid.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, fmemopen.3, fopencookie.3, frexp.3, fts.3, ftw.3, getaddrinfo.3, getaddrinfo_a.3, getcontext.3, getgrouplist.3, getifaddrs.3, getipnodebyname.3, getnameinfo.3, getopt.3, getprotoent_r.3, getpwent_r.3, getrpcent.3, getservent_r.3, getttyent.3, getumask.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, inet.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallopt.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, posix_openpt.3, printf.3, pthread_setname_np.3, pthread_setschedparam.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, sigvec.3, stdarg.3, strcat.3, strcpy.3, strftime.3, strtol.3, toupper.3, ttyslot.3, fuse.4, loop.4, st.4, elf.5, cgroup_namespaces.7, cgroups.7, feature_test_macros.7, inode.7, inotify.7, keyrings.7, man-pages.7, math_error.7, mount_namespaces.7, mq_overview.7, pthreads.7, sched.7, session-keyring.7, udplite.7, unix.7, vdso.7: Use consistent markup for code snippets
The preferred form is
.PP/.IP
.in +4n
.EX
<code>
.EE
.in
.PP/.IP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:37:55 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
.in +4n
|
ioctl_console.2, ioctl_getfsmap.2, ioctl_iflags.2, ioctl_list.2, ioctl_ns.2, kcmp.2, kexec_load.2, keyctl.2, link.2, mmap.2, modify_ldt.2, msgctl.2, poll.2, query_module.2, quotactl.2, recv.2, recvmmsg.2, sched_setscheduler.2, seccomp.2, select.2, semctl.2, semop.2, send.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sysinfo.2, timer_create.2, timerfd_create.2, uname.2, unshare.2, userfaultfd.2, ustat.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, backtrace.3, bswap.3, btree.3, clock_getcpuclockid.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, fmemopen.3, fopencookie.3, frexp.3, fts.3, ftw.3, getaddrinfo.3, getaddrinfo_a.3, getcontext.3, getgrouplist.3, getifaddrs.3, getipnodebyname.3, getnameinfo.3, getopt.3, getprotoent_r.3, getpwent_r.3, getrpcent.3, getservent_r.3, getttyent.3, getumask.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, inet.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallopt.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, posix_openpt.3, printf.3, pthread_setname_np.3, pthread_setschedparam.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, sigvec.3, stdarg.3, strcat.3, strcpy.3, strftime.3, strtol.3, toupper.3, ttyslot.3, fuse.4, loop.4, st.4, elf.5, cgroup_namespaces.7, cgroups.7, feature_test_macros.7, inode.7, inotify.7, keyrings.7, man-pages.7, math_error.7, mount_namespaces.7, mq_overview.7, pthreads.7, sched.7, session-keyring.7, udplite.7, unix.7, vdso.7: Use consistent markup for code snippets
The preferred form is
.PP/.IP
.in +4n
.EX
<code>
.EE
.in
.PP/.IP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:37:55 +00:00
|
|
|
.EX
|
2014-04-28 10:25:55 +00:00
|
|
|
patch-\fIkernelversion\fP-rt\fIpatchversion\fP
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2014-04-28 10:25:55 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
and can be downloaded from
|
|
|
|
.UR http://www.kernel.org\:/pub\:/linux\:/kernel\:/projects\:/rt/
|
|
|
|
.UE .
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
Without the patches and prior to their full inclusion into the mainline
|
|
|
|
kernel, the kernel configuration offers only the three preemption classes
|
|
|
|
.BR CONFIG_PREEMPT_NONE ,
|
|
|
|
.BR CONFIG_PREEMPT_VOLUNTARY ,
|
|
|
|
and
|
|
|
|
.B CONFIG_PREEMPT_DESKTOP
|
|
|
|
which respectively provide no, some, and considerable
|
|
|
|
reduction of the worst-case scheduling latency.
|
aio.7, arp.7, attributes.7, boot.7, cgroups.7, cpuset.7, credentials.7, fanotify.7, fifo.7, glob.7, hier.7, hostname.7, icmp.7, inode.7, inotify.7, keyrings.7, libc.7, mailaddr.7, mount_namespaces.7, mq_overview.7, nptl.7, numa.7, path_resolution.7, persistent-keyring.7, pid_namespaces.7, pipe.7, pkeys.7, process-keyring.7, pthreads.7, pty.7, random.7, sched.7, sem_overview.7, session-keyring.7, shm_overview.7, signal-safety.7, signal.7, spufs.7, standards.7, symlink.7, termio.7, thread-keyring.7, time.7, unicode.7, user-keyring.7, user-session-keyring.7, user_namespaces.7, utf-8.7, xattr.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:04 +00:00
|
|
|
.PP
|
2014-04-28 10:25:55 +00:00
|
|
|
With the patches applied or after their full inclusion into the mainline
|
|
|
|
kernel, the additional configuration item
|
|
|
|
.B CONFIG_PREEMPT_RT
|
|
|
|
becomes available.
|
|
|
|
If this is selected, Linux is transformed into a regular
|
|
|
|
real-time operating system.
|
2014-05-12 07:30:25 +00:00
|
|
|
The FIFO and RR scheduling policies are then used to run a thread
|
2014-04-28 10:25:55 +00:00
|
|
|
with true real-time priority and a minimum worst-case scheduling latency.
|
2016-11-27 21:56:12 +00:00
|
|
|
.SH NOTES
|
|
|
|
The
|
|
|
|
.BR cgroups (7)
|
|
|
|
CPU controller can be used to limit the CPU consumption of
|
|
|
|
groups of processes.
|
|
|
|
.PP
|
|
|
|
Originally, Standard Linux was intended as a general-purpose operating
|
|
|
|
system being able to handle background processes, interactive
|
|
|
|
applications, and less demanding real-time applications (applications that
|
|
|
|
need to usually meet timing deadlines).
|
|
|
|
Although the Linux kernel 2.6
|
|
|
|
allowed for kernel preemption and the newly introduced O(1) scheduler
|
|
|
|
ensures that the time needed to schedule is fixed and deterministic
|
|
|
|
irrespective of the number of active tasks, true real-time computing
|
|
|
|
was not possible up to kernel version 2.6.17.
|
2014-04-28 10:25:55 +00:00
|
|
|
.SH SEE ALSO
|
|
|
|
.ad l
|
|
|
|
.nh
|
2018-09-28 16:38:48 +00:00
|
|
|
.BR chcpu (1),
|
2014-04-28 10:25:55 +00:00
|
|
|
.BR chrt (1),
|
2018-09-28 16:38:48 +00:00
|
|
|
.BR lscpu (1),
|
2018-10-09 10:53:13 +00:00
|
|
|
.BR ps (1),
|
2014-09-15 09:03:58 +00:00
|
|
|
.BR taskset (1),
|
2018-10-09 10:53:13 +00:00
|
|
|
.BR top (1),
|
2014-04-28 10:25:55 +00:00
|
|
|
.BR getpriority (2),
|
|
|
|
.BR mlock (2),
|
|
|
|
.BR mlockall (2),
|
|
|
|
.BR munlock (2),
|
|
|
|
.BR munlockall (2),
|
|
|
|
.BR nice (2),
|
|
|
|
.BR sched_get_priority_max (2),
|
|
|
|
.BR sched_get_priority_min (2),
|
|
|
|
.BR sched_getaffinity (2),
|
|
|
|
.BR sched_getparam (2),
|
2016-08-07 18:58:27 +00:00
|
|
|
.BR sched_getscheduler (2),
|
2014-04-28 10:25:55 +00:00
|
|
|
.BR sched_rr_get_interval (2),
|
|
|
|
.BR sched_setaffinity (2),
|
|
|
|
.BR sched_setparam (2),
|
2016-08-07 18:58:27 +00:00
|
|
|
.BR sched_setscheduler (2),
|
2014-04-28 10:25:55 +00:00
|
|
|
.BR sched_yield (2),
|
|
|
|
.BR setpriority (2),
|
2014-04-28 10:27:34 +00:00
|
|
|
.BR pthread_getaffinity_np (3),
|
|
|
|
.BR pthread_setaffinity_np (3),
|
|
|
|
.BR sched_getcpu (3),
|
2014-04-28 10:25:55 +00:00
|
|
|
.BR capabilities (7),
|
|
|
|
.BR cpuset (7)
|
|
|
|
.ad
|
|
|
|
.PP
|
|
|
|
.I Programming for the real world \- POSIX.4
|
adjtimex.2, futex.2, mremap.2, seccomp.2, getnameinfo.3, random.3, console_codes.4, sysfs.5, sched.7, unicode.7: Use zero‐width space in appropriate locations
Quoting Branden:
*roff systems will interpret the period in the unpatched
page as sentence-ending punctuation and put inter-sentence
spacing after it. (This might not be visible on
nroff/terminal devices, but it is more likely to be on
typesetter/PostScript/PDF output).
groff_man(7) in groff 1.22.4 attempts to throw man page
writers a bone here:
\& Zero‐width space. Append to an input line to prevent
an end‐of‐ sentence punctuation sequence from being
recognized as such, or insert at the beginning of an
input line to prevent a dot or apostrophe from being
interpreted as the beginning of a roff request.
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 11:23:42 +00:00
|
|
|
by Bill O.\& Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0.
|
2014-04-28 10:25:55 +00:00
|
|
|
.PP
|
2014-05-08 12:38:36 +00:00
|
|
|
The Linux kernel source files
|
|
|
|
.IR Documentation/scheduler/sched-deadline.txt ,
|
|
|
|
.IR Documentation/scheduler/sched-rt-group.txt ,
|
2014-05-12 06:15:36 +00:00
|
|
|
.IR Documentation/scheduler/sched-design-CFS.txt ,
|
2014-05-08 12:38:36 +00:00
|
|
|
and
|
2014-05-12 06:15:50 +00:00
|
|
|
.IR Documentation/scheduler/sched-nice-design.txt
|