Configuring the system to allow priority changes

Start of changeBy default, non-root users on Linux® cannot raise the priority of a thread or process. You can change the system configuration to allow priority changes using the pam_limits module of the Pluggable Authentication Modules (PAM) for Linux.End of change

Start of changeIf you cannot change the priority of a thread or process using the chrt utility, you typically see the following message:
sched_setscheduler: Operation not permitted
End of change

Start of change On recent Linux kernels, you can change the configuration of the system to allow priority changes using the pam_limits module. This module allows you to configure the limits on system resources, which are taken from the limits configuration file. The default file is /etc/security/limits.conf.End of change

Start of changeAn entry in the /etc/security/limits.conf file has the following form:
<domain> <type> <item> <value>
where:
<domain> is either:
- a user name on the system that can alter limits on a resource.
- a group name, with the syntax @group, whose members can alter limits on a resource.
- a wildcard "*", which indicates that any user or group can alter limits on a resource.
<type> is either:
- hard, where hard limits are enforced by the kernel.
- soft, where soft limits apply, which can be moved within the range provided by the hard limits.
- a dash "-", which indicates hard and soft limits.
<item> is:
- a resource. Use rtprio for real-time priorities.
<value> is:
- a limit. Use a value in the range 1 - 100 to indicate the maximum limit for real-time priority setting.
For example,
* - rtprio 100
allows all users to change the priority of real-time processes, using chrt or other mechanisms.End of change

Start of changeBy default, the root user can increase real-time priorities without limits. To apply a limit to root, the root user must be explicitly specified. Group and wildcard limits in the configuration file do not apply to the root user. End of change

Start of changeIf you specify individual user limits in the file, these limits have priority over group limits.End of change

Changes to limits.conf do not take effect immediately. You must restart the affected services or reboot the system for a configuration change to take effect.

Start of changeThe ability to increase the real-time priority of a Java™ Virtual Machine (JVM) is not available on Linux kernels 2.6.12 and earlier. The table indicates whether support is available for this feature in some common Linux distributions.End of change

Start of change
Table 1.
Linux distribution Linux kernel version Support for real-time priority changes (yes/no)
Red Hat Enterprise Linux (RHEL) 4 2.6.9 no
RHEL 5 and later 2.6.18 and later yes
SUSE Linux Enterprise Server (SLES) 9 2.6.5-7 no
SLES 10 and later 2.6.16 and later yes
Red Hat Enterprise MRG - all versions 2.6.24 and later yes
SUSE Linux Enterprise Real Time (SLERT) - all versions 2.6.16 and later yes
Ubuntu 5.10 2.6.12 no
Ubuntu 6.06 and later 2.6.15 and later yes
End of change

Start of changeFor some examples of using chrt on a real-time Linux system, see http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaai/realtime/liaairtchrt.htm . To enable priority changes on a real-time Linux system you can add a user to the realtime group, which has an entry in the limits.conf file.End of change



© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)