]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man7/sched.7
standards.7: Add some more standards
[thirdparty/man-pages.git] / man7 / sched.7
index 172940018f39bf933762d48a041bb43078b7e9d4..6285b31794c630572337603a65b857779c0a880a 100644 (file)
@@ -29,7 +29,7 @@
 .\"
 .\" Worth looking at: http://rt.wiki.kernel.org/index.php
 .\"
-.TH SCHED 7 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH SCHED 7 2019-08-02 "Linux" "Linux Programmer's Manual"
 .SH NAME
 sched \- overview of CPU scheduling
 .SH DESCRIPTION
@@ -149,37 +149,57 @@ 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,
+0, which means that when a \fBSCHED_FIFO\fP thread 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:
-.IP * 3
+.IP 1) 3
 A running \fBSCHED_FIFO\fP thread that has been preempted by another thread of
 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.
-.IP *
+.IP 2)
 When a blocked \fBSCHED_FIFO\fP thread becomes runnable, it
 will be inserted at the end of the list for its priority.
-.IP *
-A call to
+.IP 3)
+If a call to
 .BR sched_setscheduler (2),
 .BR sched_setparam (2),
+.BR sched_setattr (2),
+.BR pthread_setschedparam (3),
 or
-.BR sched_setattr (2)
-will put the
-\fBSCHED_FIFO\fP thread identified by
-\fIpid\fP at the start of the list if it was runnable.
-As a consequence, it may preempt the currently running thread if
-it has the same priority.
-(POSIX.1 specifies that the thread should go to the end
-of the list.)
+.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.
 .\" 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
-.IP *
+.IP 4)
 A thread calling
 .BR sched_yield (2)
 will be put at the end of the list.
@@ -386,6 +406,11 @@ The dynamic priority is based on the nice value (see below)
 and is increased for each time quantum the thread is ready to run,
 but denied to run by the scheduler.
 This ensures fair progress among all \fBSCHED_OTHER\fP threads.
+.PP
+In the Linux kernel source code, the
+.B SCHED_OTHER
+policy is actually named
+.BR SCHED_NORMAL .
 .\"
 .SS The nice value
 The nice value is an attribute
@@ -655,7 +680,7 @@ 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.
-Specifying \-1 makes the runtime the same as the period;
+Specifying \-1 makes the run time the same as the period;
 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),
@@ -941,8 +966,12 @@ was not possible up to kernel version 2.6.17.
 .SH SEE ALSO
 .ad l
 .nh
+.BR chcpu (1),
 .BR chrt (1),
+.BR lscpu (1),
+.BR ps (1),
 .BR taskset (1),
+.BR top (1),
 .BR getpriority (2),
 .BR mlock (2),
 .BR mlockall (2),
@@ -961,6 +990,7 @@ was not possible up to kernel version 2.6.17.
 .BR sched_yield (2),
 .BR setpriority (2),
 .BR pthread_getaffinity_np (3),
+.BR pthread_getschedparam (3),
 .BR pthread_setaffinity_np (3),
 .BR sched_getcpu (3),
 .BR capabilities (7),
@@ -968,7 +998,7 @@ was not possible up to kernel version 2.6.17.
 .ad
 .PP
 .I Programming for the real world \- POSIX.4
-by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0.
+by Bill O.\& Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0.
 .PP
 The Linux kernel source files
 .IR Documentation/scheduler/sched-deadline.txt ,