sun.com docs.sun.com My Sun Worldwide Sites

Previous Previous     Contents     Index     Next Next
Chapter 5

Resource Controls

This chapter describes resource controls and their properties.

Overview of Resource Controls

Use the extended accounting facility to determine the resource consumption of workloads on your system. After the resource consumption has been determined, use the resource control facility to place bounds on resource usage. Bounds that are placed on resources prevent workloads from over-consuming resources.

For an overview of resource controls and example commands for administering resource controls, see Chapter 6, "Resource Controls (Overview)," in System Administration Guide: Solaris Containers-Resource Management and Solaris Zones and Chapter 7, "Administering Resource Controls (Tasks)," in System Administration Guide: Solaris Containers-Resource Management and Solaris Zones.

The resource control facility adds the following benefits.

  • Dynamically set

    Resource controls can be adjusted while the system is running.

  • Containment level granularity

    Resource controls are arranged in a containment level of zone, project, task, or process. The containment level simplifies the configuration and aligns the collected values closer to the particular zone, project, task, or process.

Resource Controls Flags and Actions

This section describes flags, actions, and signals associated with resource controls.

rlimit, Resource Limit

rlimit is process-based. rlimit establishes a restricting boundary on the consumption of a variety of system resources by a process. Each process that the process creates inherits from the original process. A resource limit is defined by a pair of values. The values specify the current (soft) limit and the maximum (hard) limit.

A process might irreversibly lower its hard limit to any value that is greater than or equal to the soft limit. Only a process with superuser ID can raise the hard limit. See setrlimit() and getrlimit().

The rlimit structure contains two members that define the soft limit and hard limit.

rlim_t     rlim_cur;       /* current (soft) limit */
rlim_t     rlim_max        /* hard limit */

rctl, Resource Control

rctl extends the process-based limits of rlimit by controlling resource consumption by processes, tasks, and projects defined in the project database.


Note - The rctl mechanism is preferred to the use of rlimit to set resource limits. The only reason to use the rlimit facility is when portability is required across UNIX platforms.


Applications fall into the following broad categories depending on how an application deals with resource controls. Based on the action that is taken, resource controls can be further classified. Most report an error and terminate operation. Other resource controls allow applications to resume operation and adapt to the reduced resource usage. A progressive chain of actions at increasing values can be specified for each resource control.

The list of attributes for a resource control consists of a privilege level, a threshold value, and an action that is taken when the threshold is exceeded.

Resource Control Values and Privilege Levels

Each threshold value on a resource control must be associated with one of the following privilege levels:

RCPRIV_BASIC

Privilege level can be modified by the owner of the calling process. RCPRIV_BASIC is associated with a resource's soft limit.

RCPRIV_PRIVILEGED

Privilege level can be modified only by privileged (superuser) callers. RCPRIV_PRIVILEGED is associated with a resource's hard limit.

RCPRIV_SYSTEM

Privilege level remains fixed for the duration of the operating system instance.

Figure 5-2 shows the timeline for setting privilege levels for signals that are defined by the /etc/project file process.max-cpu-time resource control.

Local Actions and Local Flags

The local action and local flags are applied to the current resource control value represented by this resource control block. Local actions and local flags are value-specific. For each threshold value that is placed on a resource control, the following local actions and local flags are available:

RCTL_LOCAL_NOACTION

No local action is taken when this resource control value is exceeded.

RCTL_LOCAL_SIGNAL

The specified signal, set by rctlblk_set_local_action(), is sent to the process that placed this resource control value in the value sequence.

RCTL_LOCAL_DENY

When this resource control value is encountered, the request for the resource is denied. Set on all values if RCTL_GLOBAL_DENY_ALWAYS is set for this control. Cleared on all values if RCTL_GLOBAL_DENY_NEVER is set for this control.

RCTL_LOCAL_MAXIMAL

This resource control value represents a request for the maximum amount of resource for this control. If RCTL_GLOBAL_INFINITE is set for this resource control, RCTL_LOCAL_MAXIMAL indicates an unlimited resource control value that is never exceeded.

Global Actions and Global Flags

Global flags apply to all current resource control values represented by this resource control block. Global actions and global flags are set by rctladm(1M). Global actions and global flags cannot be set with setrctl(). Global flags apply to all resource controls. For each threshold value that is placed on a resource control, the following global actions and global flags are available:

RCTL_GLOBAL_NOACTION

No global action is taken when a resource control value is exceeded on this control.

RCTL_GLOBAL_SYSLOG

A standard message is logged by the syslog() facility when any resource control value on a sequence associated with this control is exceeded.

RCTL_GLOBAL_SECONDS

Defines the unit string of the limit value as seconds.

RCTL_GLOBAL_COUNT

Defines the unit string of the limit value as count.

RCTL_GLOBAL_BYTES

Defines the unit string of the limit value as bytes.

RCTL_GLOBAL_SYSLOG_NEVER

Flag means that RCTL_GLOBAL_SYSLOG cannot be set for this resource control through rctladm(1M).

RCTL_GLOBAL_NOBASIC

No values with the RCPRIV_BASIC privilege are permitted on this control.

RCTL_GLOBAL_LOWERABLE

Non-privileged callers are able to lower the value of privileged resource control values on this control.

RCTL_GLOBAL_DENY_ALWAYS

The action that is taken when a control value is exceeded on this control always includes denial of the resource.

RCTL_GLOBAL_DENY_NEVER

The action that is taken when a control value is exceeded on this control always excludes denial of the resource. The resource is always granted, although other actions can also be taken.

RCTL_GLOBAL_FILE_SIZE

The valid signals for local actions include the SIGXFSZ signal.

RCTL_GLOBAL_CPU_TIME

The valid signals for local actions include the SIGXCPU signal.

RCTL_GLOBAL_SIGNAL_NEVER

No local actions are permitted on this control. The resource is always granted.

RCTL_GLOBAL_INFINITE

This resource control supports the concept of an unlimited value. Generally, an unlimited value applies only to accumulation-oriented resources, such as CPU time.

RCTL_GLOBAL_UNOBSERVABLE

Generally, a task or project related resource control does not support observational control values. An RCPRIV_BASIC privileged control value placed on a task or process generates an action only if the value is exceeded by the process that placed the value.

Previous Previous     Contents     Index     Next Next
Company Info Contact Terms of Use Privacy Copyright 1994-2007 Sun Microsystems, Inc.