Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Advanced Administration
Previous Next

Managing Process Class Information

The following list identifies the process scheduling classes that can be configured on your system. Also included is the user priority range for the timesharing class.

The possible process scheduling classes are as follows:

  • Fair share (FSS)

  • Fixed (FX)

  • System (SYS)

  • Interactive (IA)

  • Real-time (RT)

  • Timesharing (TS)

    • The user-supplied priority ranges from -60 to +60.

    • The priority of a process is inherited from the parent process. This priority is referred to as the user-mode priority.

    • The system looks up the user-mode priority in the timesharing dispatch parameter table. Then, the system adds in any nice or priocntl (user-supplied) priority and ensures a 0–59 range to create a global priority.

Changing the Scheduling Priority of Processes (priocntl)

The scheduling priority of a process is the priority assigned by the process scheduler, according to scheduling policies. The dispadmin command lists the default scheduling policies. For more information, see the dispadmin(1M) man page.

You can use the priocntl command to assign processes to a priority class and to manage process priorities. For instructions on using the priocntl command to manage processes, see How to Designate a Process Priority (priocntl).

How to Display Basic Information About Process Classes (priocntl)

  • Display process scheduling classes and priority ranges with the priocntl -l command.
    $ priocntl -l
Example 12-5 Displaying Basic Information About Process Classes (priocntl)

The following example shows output from the priocntl -l command.

# priocntl -l
CONFIGURED CLASSES
==================

SYS (System Class)

TS (Time Sharing)
        Configured TS User Priority Range: -60 through 60

FX (Fixed priority)
        Configured FX User Priority Range: 0 through 60

IA (Interactive)
        Configured IA User Priority Range: -60 through 60

How to Display the Global Priority of a Process

  • Display the global priority of a process by using the ps command.
    $ ps -ecl

    The global priority is listed under the PRI column.

Example 12-6 Displaying the Global Priority of a Process

The following example shows ps -ecl command output. The values in the PRI column show that the pageout process has the highest priority, while the sh process has the lowest priority.

$ ps -ecl
 F S UID PID  PPID CLS PRI  ADDR      SZ  WCHAN    TTY      TIME   COMD
19 T 0   0    0    SYS 96   f00d05a8   0           ?        0:03  sched
 8 S 0   1    0    TS  50   ff0f4678 185  ff0f4848 ?       36:51   init
19 S 0   2    0    SYS 98   ff0f4018   0  f00c645c ?        0:01 pageout
19 S 0   3    0    SYS 60   ff0f5998   0  f00d0c68 ?      241:01 fsflush
 8 S 0   269  1    TS  58   ff0f5338 303  ff49837e ?        0:07    sac
 8 S 0   204  1    TS  43   ff2f6008  50  ff2f606e console  0:02     sh

How to Designate a Process Priority (priocntl)

  1. (Optional) Assume the Primary Administrator role, or become superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Start a process with a designated priority.
    # priocntl -e -c class -m user-limit -p pri command-name
    -e

    Executes the command.

    -c class

    Specifies the class within which to run the process. The valid classes are TS (timesharing), RT (real time), IA (interactive), FSS (fair share), and FX (fixed priority).

    -m user-limit

    When you use the -p option, specifies the maximum amount you can raise or lower your priority,

    -p pri command-name

    Lets you specify the relative priority in the RT class for a real-time thread. For a timesharing process, the -p option lets you specify the user-supplied priority, which ranges from -60 to +60.

  3. Verify the process status.
    # ps -ecl | grep command-name
Example 12-7 Designating a Process Priority (priocntl)

The following example shows how to start the find command with the highest possible user-supplied priority.

# priocntl -e -c TS -m 60 -p 60 find . -name core -print
# ps -ecl | grep find

How to Change Scheduling Parameters of a Timesharing Process (priocntl)

  1. (Optional) Assume the Primary Administrator role, or become superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Change the scheduling parameters of a running timesharing process.
    # priocntl -s -m user-limit [-p user-priority] -i idtype idlist
    -s

    Lets you set the upper limit on the user priority range and change the current priority.

    -m user-limit

    When you use the -p option, specifies the maximum amount you can raise or lower the priority.

    -p user-priority

    Allows you to designate a priority.

    -i xidtype xidlist

    Uses a combination of xidtype and xidlist to identify the process or processes. The xidtype specifies the type of ID, such as the process ID or the user ID. Use xidlist to identify a list of process IDs or user IDs.

  3. Verify the process status.
    # ps -ecl | grep idlist
Example 12-8 Changing Scheduling Parameters of a Timesharing Process (priocntl)

The following example shows how to execute a command with a 500-millisecond time slice, a priority of 20 in the RT class, and a global priority of 120.

# priocntl -e -c RT -m 500 -p 20 myprog
# ps -ecl | grep myprog

How to Change the Class of a Process (priocntl)

  1. (Optional) Become superuser or assume an equivalent role.
  2. Change the class of a process.
    # priocntl -s -c class -i idtype idlist
    -s

    Lets you set the upper limit on the user priority range and change the current priority.

    -c class

    Specifies the class, TS for time-sharing or RT for real-time, to which you are changing the process.

    -i idtype idlist

    Uses a combination of xidtype and xidlist to identify the process or processes. The xidtype specifies the type of ID, such as the process ID or user ID. Use xidlist to identify a list of process IDs or user IDs.


    Note - You must be superuser or working in a real-time shell to change a process from, or to, a real-time process. If, as superuser, you change a user process to the real-time class, the user cannot subsequently change the real-time scheduling parameters by using the priocntl -s command.


  3. Verify the process status.
    # ps -ecl | grep idlist
Example 12-9 Changing the Class of a Process (priocntl)

The following example shows how to change all the processes that belong to user 15249 to real-time processes.

# priocntl -s -c RT -i uid 15249
# ps -ecl | grep 15249

Changing the Priority of a Timesharing Process (nice)

The nice command is only supported for backward compatibility to previous Solaris releases. The priocntl command provides more flexibility in managing processes.

The priority of a process is determined by the policies of its scheduling class and by its nice number. Each timesharing process has a global priority. The global priority is calculated by adding the user-supplied priority, which can be influenced by the nice or priocntl commands, and the system-calculated priority.

The execution priority number of a process is assigned by the operating system. The priority number is determined by several factors, including the process's scheduling class, how much CPU time it has used, and in the case of a timesharing process, its nice number.

Each timesharing process starts with a default nice number, which it inherits from its parent process. The nice number is shown in the NI column of the ps report.

A user can lower the priority of a process by increasing its user-supplied priority. However, only superuser can lower a nice number to increase the priority of a process. This restriction prevents users from increasing the priorities of their own processes, thereby monopolizing a greater share of the CPU.

The nice numbers range from 0 to +39, with 0 representing the highest priority. The default nice value for each timesharing process is 20. Two versions of the command are available: the standard version, /usr/bin/nice, and the C shell built-in command.

How to Change the Priority of a Process (nice)

Using this procedure, a user can lower the priority of a process. However, superuser can raise or lower the priority of a process.


Note - This section describes the syntax of the /usr/bin/nice command and not the C-shell built-in nicecommand. For information about the C-shell nice command, see the csh(1) man page.


  1. Determine whether you want to change the priority of a process, either as a user or as superuser. Then, select one of the following:
    • As a user, follow the examples in Step 2 to lower the priority of a command.
    • As a superuser, follow the examples in Step 3 to raise or lower priorities of a command.
  2. As a user, lower the priority of a command by increasing the nice number.

    The following nice command executes command-name with a lower priority by raising the nice number by 5 units.

    $ /usr/bin/nice -5 command-name

    In the preceding command, the minus sign designates that what follows is an option. This command could also be specified as follows:

    % /usr/bin/nice -n 5 command-name

    The following nice command lowers the priority of command-name by raising the nice number by the default increment of 10 units, but not beyond the maximum value of 39.

    % /usr/bin/nice command-name
  3. As superuser or assuming an equivalent role, raise or lower the priority of a command by changing the nice number.

    The following nice command raises the priority of command-name by lowering the nice number by 10 units, but not below the minimum value of 0.

    # /usr/bin/nice --10 command-name

    In the preceding command, the first minus sign designates that what follows is an option. The second minus sign indicates a negative number.

    The following nice command lowers the priority of command-name by raising the nice number by 5 units, but not beyond the maximum value of 39.

    # /usr/bin/nice -5 command-name
See Also

For more information, see the nice(1) man page.

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire