Add text on real-time features of mainline Linux kernel.

This commit is contained in:
Michael Kerrisk 2007-07-20 13:35:31 +00:00
parent ce7ce2a00e
commit cf9c27a6e4
1 changed files with 56 additions and 26 deletions

View File

@ -1,6 +1,7 @@
.\" Hey Emacs! This file is -*- nroff -*- source. .\" Hey Emacs! This file is -*- nroff -*- source.
.\" .\"
.\" Copyright (C) Tom Bjorkholm, Markus Kuhn & David A. Wheeler 1996-1999 .\" Copyright (C) Tom Bjorkholm, Markus Kuhn & David A. Wheeler 1996-1999
.\" and Copyright (C) 2007 Carsten Emde <Carsten.Emde@osadl.org>
.\" .\"
.\" This is free documentation; you can redistribute it and/or .\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as .\" modify it under the terms of the GNU General Public License as
@ -33,6 +34,9 @@
.\" A couple of grammar clean-ups .\" A couple of grammar clean-ups
.\" Modified 2004-05-27 by Michael Kerrisk <mtk-manpages@gmx.net> .\" Modified 2004-05-27 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" 2005-03-23, mtk, Added description of SCHED_BATCH. .\" 2005-03-23, mtk, Added description of SCHED_BATCH.
.\" 2007-07-10, Carsten Emde <Carsten.Emde@osadl.org>
.\" Add text on real-time features that are currently being
.\" added to the mainline kernel.
.\" .\"
.TH SCHED_SETSCHEDULER 2 2006-03-23 "Linux" "Linux Programmer's Manual" .TH SCHED_SETSCHEDULER 2 2006-03-23 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
@ -326,33 +330,59 @@ and details vary across systems.
For example, the Solaris 7 manual page says that For example, the Solaris 7 manual page says that
the real of effective user ID of the calling process the real of effective user ID of the calling process
match the real user ID or the save set-user-ID of the target process. match the real user ID or the save set-user-ID of the target process.
Standard Linux is a general-purpose operating system
and can handle background processes,
interactive applications, and soft real-time applications
(applications that need to usually meet timing deadlines).
This man page is directed at these kinds of applications.
.PP .PP
Standard Linux is Originally, Standard Linux was intended as a general-purpose operating
.I not system being able to handle background processes, interactive
designed to support applications, and less demanding real-time applications (applications that
hard real-time applications, that is, applications in which deadlines need to usually meet timing deadlines).
(often much shorter than a second) must be guaranteed or the system Although the Linux kernel 2.6
will fail catastrophically. allowed for kernel preemption and the newly introduced O(1) scheduler
Like all general-purpose operating systems, Linux ensures that the time needed to schedule is fixed and deterministic
is designed to maximize average case performance irrespective of the number of active tasks, true real-time computing
instead of worst case performance. was not possible up to kernel version 2.6.17.
Linux's worst case performance for .SS Real-time features in the mainline Linux kernel
interrupt handling is much poorer than its average case, its various .\" FIXME . Probably this text will need tome minor tweaking
kernel locks (such as for SMP) produce long maximum wait times, and .\" by about the time of 2.6.25; ask Carsten Emde about this then.
many of its performance improvement techniques decrease average time by From kernel version 2.6.18 onwards, however, Linux is gradually
increasing worst-case time. becoming equipped with real-time capabilities,
For most situations, that's what you want, but most of which are derived from the former
if you truly are developing a hard real-time application, realtime-preempt patches developed by Ingo Molnar, Thomas Gleixner and
consider using hard real-time extensions to Linux such as others.
RTLinux (http://www.rtlinux.org) or RTAI (http://www.rtai.org) Until the patches have been completely merged into the
or use a different operating system mainline kernel
designed specifically for hard real-time applications. (this is expected to be around kernel version 2.6.24 or 2.6.25),
the realtime-preempt patches must be installed to achieve the best
realtime performance.
These patches are named:
.in +0.5i
.nf
patch-\fIkernelversion\fP-rt\fIpatchversion\fP
.fi
.in
.PP
and can be downloaded from
.IR http://people.redhat.com/mingo/realtime-preempt/ .
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
.BR CONFIG_PREEMPT_DESKTOP
which respectively provide no, some, and considerable
reduction of the worst-case scheduling latency.
With the patches applied or after their full inclusion into the mainline
kernel, the additional configuration item
.BR CONFIG_PREEMPT_RT
becomes available.
If this is selected, Linux is transformed into a regular
real-time operating system.
The FIFO and RR scheduling policies that can be selected using
.BR sched_setscheduler ()
are then used to run a process
with true real-time priority and a minimum worst-case scheduling latency.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR getpriority (2), .BR getpriority (2),
.BR mlock (2), .BR mlock (2),