z/OS UNIX System Services Planning
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Controlling dispatching priorities

z/OS UNIX System Services Planning
GA32-0884-00

The setpriority() and chpriority() functions let the caller set the dispatching priority for a process, a process group, or a user. The priority value specified can range from -20 to 19. On this scale, -20 is highest priority and 19 is lowest priority. The nice() function allows a calling process to change its own priority.

Resulting nice() values can range from 0 to 39, with 0 being the highest priority and 39 being the lowest. With all three services, appropriate privileges are required to increase the priority of one or more processes.

Priority values (-20 to 19) and nice() values (0 to 39) are mapped one-to-one such that nice() values are always 20 higher than priority values. All processes start with a priority value of 0 and a nice() value of 20.

               priority value                      nice value
          (setpriority and chpriority)                 (nice)
          ----------------------------               ----------
            -20    A                                      0
              .    | higher priority                      .
              .    |                                      .
              .    |                                      .
              0    -- start here                         20
              .    |                                      .
              .    |                                      .
              .    | lower priority                       .
            +19    V                                     39

Guideline: In general, do not enable nice(), setpriority(), and chpriority() support. Instead, you should only use normal SRM controls. However, nice(), setpriority(), and chpriority() support is provided. This support interfaces with SRM and workload manager to provide system control and monitoring support.

If your installation plans to support the cron daemon, setpriority() support might be needed. cron allows interactive users to schedule work to run in the background at various times in the future. Normally, this background work should run at a lower priority than other interactive work. By default, cron uses setpriority() to lower the priority of batch work it starts. The return code is not checked, so if the setpriority() call fails, the batch work runs at the same priority as other forked children. This could become a problem if background work started by cron begins to affect the responsiveness of foreground interactive work. In this case, it might be appropriate to customize your system to support three levels of dispatching priority (as illustrated in the following example).

To enable the nice(), setpriority(), and chpriority() functions, an installation must specify a PRIORITYPG statement or PRIORITYGOAL statement in BPXPRMxx. The first value corresponds to a priority value of -20 (very high priority). The next corresponds to a priority value of -19, and so on until the 40th value corresponds with a priority value of 19. If fewer than 40 values are specified, the last value is propagated through the remaining priority values. The same performance group can be specified several times.

Installations that are running in goal mode to exploit MVS™ workload manager can enable nice(), setpriority(), and chpriority() support using the PRIORITYGOAL statement in the BPXPRMxx parmlib member. They must specify a service class for each possible priority value (-20 to 19). If fewer than 40 service classes are specified, the last service class is propagated to all remaining priority values. The same service class can be specified several times. All service classes specified must appear in your current service policy.

Guideline: Do not specify PRIORITYPG and PRIORITYGOAL in BPXPRMxx unless you need nice() and setpriority() support. It is simplest and best to give MVS full control over priorities of work.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014