Linux can grant RealTime (RT) rights to users, allowing RT applications to run as normal users. For this purpose, a customized kernel must be compiled and a corresponding module must be created. The following instructions are based on a Debian etch and are taken from the file /usr/share/doc/realtime-lsm/README.Debian
after installation and adapted.
aptitude install realtime-lsm
aptitude install realtime-lsm-source
aptitude install linux-source*
aptitude install module-assistent
/usr/src
cp /boot/config* /usr/src/linux-source*/.config
CONFIG_SECURITY_CAPABILITIES=y
to CONFIG_SECURITY_CAPABILITIES=m
in .config
make-kpkg –initrd –revision 1 –append-to-version -1-lsm kernel_image
dpkg -i /usr/src/*-1-lsm*.deb
/etc/grub/menu.lst
m-a prepare
m-a build realtime-lsm
/etc/default/realtime
:ENABLE=yes
PARAMETERS=“gid=1000 any=0 mlock=1”
(gid is the GROUP-ID of the realtime goup)jack hard priority 60
jack hard nice -19
jack hard rtprio 89
The package schedutils
is recommended for installation. It contains:
Manpages:
CHRT(1) Linux User’s Manual CHRT(1) NAME chrt - manipulate real-time attributes of a process SYNOPSIS chrt [options] [prio] [pid | command [arg]...] DESCRIPTION chrt(1) sets or retrieves the real-time scheduling attributes of an existing PID or runs COMMAND with the given attributes. Both policy (one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER) and priority can be set and retrieved. OPTIONS -p, --pid operate on an existing PID and do not launch a new task -f, --fifo set scheduling policy to SCHED_FIFO -m, --max show minimum and maximum valid priorities, then exit -o, --other set policy scheduling policy to SCHED_OTHER -r, --rr set scheduling policy to SCHED_RR (the default) -h, --help display usage information and exit -v, --version output version information and exit USAGE The default behavior is to run a new command:: chrt [prio] -- [command] [arguments] You can also retrieve the real-time attributes of an existing task: chrt -p [pid] Or set them: chrt -p [prio] [pid] PERMISSIONS A user must possess CAP_SYS_NICE to change the scheduling attributes of a process. Any user can retrieve the scheduling information. AUTHOR Written by Robert M. Love. REPORTING BUGS Report bugs to <rml@tech9.net>. COPYRIGHT Copyright © 2004 Robert M. Love This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO taskset(1), nice(1), renice(1) See sched_setscheduler(2) for a description of the Linux scheduling scheme. schedutils Apr 2003 CHRT(1)
ionice(1) ionice(1) NAME ionice - get/set program io scheduling class and priority SYNOPSIS ionice [-c] [-n] [-p] [COMMAND [ARG...]] DESCRIPTION This program sets the io scheduling class and priority for a program. As of this writing, Linux supports 3 scheduling classes: Idle. A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. The impact of idle io processes on normal system activity should be zero. This scheduling class does not take a priority argument. Best effort. This is the default scheduling class for any process that hasn’t asked for a specific io priority. Programs inherit the CPU nice setting for io priorities. This class takes a priority argument from 0-7, with lower number being higher priority. Programs running at the same best effort priority are served in a round-robin fashion. Real time. The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. As with the best effort class, 8 priority levels are defined denoting how big a time slice a given process will receive on each scheduling win‐ dow. If no arguments or just -p is given, ionice will query the current io scheduling class and priority for that process. OPTIONS -c The scheduling class. 1 for real time, 2 for best-effort, 3 for idle. -n The scheduling class data. This defines the class data, if the class accepts an argument. For real time and best-effort, 0-7 is valid data. -p Pass in a process pid to change an already running process. If this argument is not given, ionice will run the listed program with the given parameters. EXAMPLES # ionice -c3 -p89 Sets process with PID 89 as an idle io process. # ionice -c2 -n0 bash Runs ’bash’ as a best-effort program with highest priority. # ionice -p89 Returns the class and priority of the process with PID 89. NOTES Linux supports io scheduling priorities and classes since 2.6.13 with the CFQ io scheduler. AUTHORS Jens Axboe <axboe@suse.de> ionice August 2005 ionice(1)
Formatiere taskset(1) neu, bitte warten... TASKSET(1) Linux User’s Manual TASKSET(1) NAME taskset - retrieve or set a processes’s CPU affinity SYNOPSIS taskset [options] [mask | list ] [pid | command [arg]...] DESCRIPTION taskset is used to set or retrieve the CPU affinity of a running pro‐ cess given its PID or to launch a new COMMAND with a given CPU affin‐ ity. CPU affinity is a scheduler property that "bonds" a process to a given set of CPUs on the system. The Linux scheduler will honor the given CPU affinity and the process will not run on any other CPUs. Note that the Linux scheduler also supports natural CPU affinity: the scheduler attempts to keep processes on the same CPU as long as practi‐ cal for performance reasons. Therefore, forcing a specific CPU affin‐ ity is useful only in certain applications. The CPU affinity is represented as a bitmask, with the lowest order bit corresponding to the first logical CPU and the highest order bit corre‐ sponding to the last logical CPU. Not all CPUs may exist on a given system but a mask may specify more CPUs than are present. A retrieved mask will reflect only the bits that correspond to CPUs physically on the system. If an invalid mask is given (i.e., one that corresponds to no valid CPUs on the current system) an error is returned. The masks are typically given in hexadecimal. For example, 0x00000001 is processor #0 0x00000003 is processors #0 and #1 0xFFFFFFFF is all processors (#0 through #31) When taskset returns, it is guaranteed that the given program has been scheduled to a legal CPU. OPTIONS -p, --pid operate on an existing PID and not launch a new task -c, --cpu-list specifiy a numerical list of processors instead of a bitmask. The list may contain multiple items, separated by comma, and ranges. For example, 0,5,7,9-11. -h, --help display usage information and exit -V, --version output version information and exit USAGE The default behavior is to run a new command with a given affinity mask: taskset [mask] -- [command] [arguments] You can also retrieve the CPU affinity of an existing task: taskset -p [pid] Or set it: taskset -p [mask] [pid] PERMISSIONS A user must possess CAP_SYS_NICE to change the CPU affinity of a pro‐ cess. Any user can retrieve the affinity mask. AUTHOR Written by Robert M. Love. REPORTING BUGS Report bugs to <rml@tech9.net>. COPYRIGHT Copyright © 2004 Robert M. Love This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO chrt(1), nice(1), renice(1), sched_setaffinity(2), sched_getaffinity(2) See sched_setscheduler(2) for a description of the Linux scheduling scheme. schedutils Apr 2003 TASKSET(1)