System Administration Guide: Resource Management and Network Services

Administering Resource Controls

The resource controls facility is configured through the project database (see Chapter 6, Projects and Tasks). Resource control attributes are set in the final field of the project database entry. The values that are associated with each resource control are enclosed in parentheses, and they appear as plain text that is separated by commas. The values in parentheses comprise an “action clause.” Each action clause is composed of a privilege level, a threshold value, and an action that is associated with the particular threshold. Each resource control can have multiple action clauses, which are also separated by commas. The following entry defines a per-process address-space limit and a per-task lightweight process limit on a project entity.


development:101:Developers:::task.max-lwps=(privileged,10,deny);
  process.max-address-space=(privileged,209715200,deny)

The rctladm(1M) command allows you to make runtime interrogations of and modifications to the resource controls facility, with global scope. The prctl(1) command allows you to make runtime interrogations of and modifications to the resource controls facility, with local scope.

Available Resource Controls

A list of the standard resource controls available in this release is shown in the following table.

The table describes the resource that is constrained by each control and identifies the default units that are used by the project database for that resource. The default units are of two types:

Thus, project.cpu-shares specifies the number of shares the project is entitled to, while process.max-file-descriptor specifies the highest file number that can be assigned to a process by the open(2) system call.

Table 8–1 Standard Resource Controls

Control Name 

Description 

Default Unit 

project.cpu-shares

The number of CPU shares that are granted to this project for use with FSS(7)

Quantity (shares) 

task.max-cpu-time

Maximum CPU time available to this task's processes 

Time (milliseconds) 

task.max-lwps

Maximum number of LWPs simultaneously available to this task's processes 

Quantity (LWPs) 

process.max-cpu-time

Maximum CPU time available to this process 

Time (milliseconds) 

process.max-file-descriptor

Maximum file descriptor index available to this process 

Index (maximum file descriptor) 

process.max-file-size

Maximum file offset available for writing by this process 

Size (bytes) 

process.max-core-size

Maximum size of a core file that is created by this process 

Size (bytes) 

process.max-data-size

Maximum heap memory available to this process 

Size (bytes) 

process.max-stack-size

Maximum stack memory segment available to this process 

Size (bytes) 

process.max-address-space

Maximum amount of address space, as summed over segment sizes, available to this process 

Size (bytes) 

Resource Control Values and Privilege Levels

A threshold value on a resource control constitutes an enforcement point where local actions can be triggered or global actions, such as logging, can occur.

Each threshold value must be associated with a privilege level, which will be one of the following three types.

A particular resource control is guaranteed to have one system value, which is defined by the system (or resource provider). The system value represents how much of the resource the current implementation of the operating system is capable of providing.

Any number of privileged values can be defined, and only one basic value is allowed. Operations that are performed without specifying a privilege value are assigned a basic privilege by default.

The privilege level for a resource control value is defined in the privilege field of the resource control block as RCTL_BASIC, RCTL_PRIVILEGED, or RCTL_SYSTEM. See getrctl(2) for more information. You can use the prctl command to modify values that are associated with basic and privileged levels.

Actions on Resource Control Values

For each threshold value that is placed on a resource control, you can associate one or more actions.

Because of implementation restrictions, the global properties of each control can restrict the set of available actions that can be set on the threshold value. A list of available signal actions is presented in the following table. For additional information on signals, see signal(3HEAD).

Table 8–2 Signals Available to Resource Control Values

Signal 

Notes 

SIGABRT 

 

SIGHUP 

 

SIGTERM 

 

SIGKILL 

 

SIGSTOP 

 

SIGXRES 

 

SIGXFSZ 

Available only to resource controls with the RCTL_GLOBAL_FILE_SIZE property (process.max-file-size). See rctlblk_set_value(3C) for more information.

SIGXCPU 

Available only to resource controls with the RCTL_GLOBAL_CPUTIME property (process.max-cpu-time). See rctlblk_set_value(3C) for more information.

Resource Control Flags and Properties

Each resource control available on the system has a certain set of properties that are associated with it. This set of properties is defined as a set of global flags, which are associated with all controlled instances of that resource. Global flags cannot be modified, but they can be retrieved by using either rctladm or the getrctl system call.

Local flags define the default behavior and configuration for a specific threshold value of that resource control on a specific process or process collective. The local flags for one threshold value do not affect the behavior of other defined threshold values for that same resource control. However, the global flags affect the behavior for every value that is associated with a particular control. Local flags can be modified, within the constraints that are supplied by their corresponding global flags, by the prctl command or the setrctl system call (see setrctl(2)).

For the complete list of local flags, global flags, and their definitions, see rctlblk_set_value(3C).

To determine system behavior when a threshold value for a particular resource control is reached, use rctladm to display the global flags for the resource control . For example, to display the values for process.max-cpu-time, type the following:


$ rctladm process.max-cpu-time
	process.max-cpu-time   syslog=off   [ lowerable no-deny cpu-time inf ]

The global flags indicate the following.

lowerable

Superuser privileges are not required to lower the privileged values for this control.

no-deny

Even when threshold values are exceeded, access to the resource is never denied.

cpu-time

SIGXCPU is available to be sent when threshold values of this resource are reached.

inf

Any value with RCTL_LOCAL_MAXIMAL defined actually represents an infinite quantity, and the value is never enforced.

Use prctl to display local values and actions for the resource control.


$ prctl -n process.max-cpu-time $$
	353939: -ksh
	process.max-cpu-time   [ lowerable no-deny cpu-time inf ]
		18446744073709551615 privileged signal=XCPU   [ max ]
		18446744073709551615 system     deny          [ max ]

The max (RCTL_LOCAL_MAXIMAL) flag is set for both threshold values, and the inf (RCTL_GLOBAL_INFINITE) flag is defined for this resource control. Hence, as configured, both threshold quantities represent infinite values and they are never exceeded.

Resource Control Enforcement

More than one resource control can exist on a resource, one at each containment level in the process model. If resource controls are active on the same resource at different container levels, the smallest container's control is enforced first. Thus, action is taken on process.max-cpu-time before task.max-cpu-time if both controls are encountered simultaneously.

Figure 8–1 Process Collectives, Container Relationships, and Their Resource Control Sets

Graphic

Global Monitoring of Resource Control Events

In situations where the resource consumption of processes is unknown, you can use the global resource control actions available with rctladm(1M). For example, consider a syslog action has been established on a resource control. Any encounter of a threshold value by any entity managed by that resource control results in a system message being logged at the configured logging level.