![]() |
![]() |
| ||||||||||||||||||||||||||||||||||||||
How to Display the Global Priority of a ProcessYou can display the global priority of a process by using the ps command.
The global priority is listed under the PRI column. Example--Displaying the Global Priority of a ProcessThe following example shows ps -ecl command output. The values in the PRI column show that the pageout process has the highest priority, while sh has the lowest.
|
# priocntl -e -c class -m userlimit -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), or FX (fixed priority). |
-m userlimit | Specifies the maximum amount you can raise or lower your priority, when using the -p option. |
-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. |
Verify the process status.
# ps -ecl | grep command-name |
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)Change the scheduling parameters of a running timesharing process.
# priocntl -s -m userlimit [-p userpriority] -i idtype idlist |
-s | Lets you set the upper limit on the user priority range and change the current priority. |
-m userlimit | Specifies the maximum amount you can raise or lower your priority, when you use the -p option. |
-p userpriority | Allows you to designate a priority. |
-i idtype idlist | Uses a combination of idtype and idlist to identify the process or processes. The idtype specifies the type of ID, such as pid or UID. Use idlist to identify a list of pids or UIDs. |
Verify the process status.
# ps -ecl | grep idlist |
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 -t 500 -p 20 myprog # ps -ecl | grep myprog |
How to Change the Class of a Process (priocntl)Note - You must be superuser or working in a real-time shell to change a process from, or to, a real-time process.
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 or RT, to which you are changing the process. |
-i idtype idlist | Uses a combination of idtype and idlist to identify the process or processes. The idtype specifies the type of ID, such as pid or UID. Use idlist to identify a list of pids or UIDs. |
Verify the process status.
# ps -ecl | grep idlist |
The following example shows how to change all the processes belonging to user 15249 to real-time processes.
# priocntl -s -c RT -i uid 15249 # ps -ecl | grep 15249 |
Note - 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.
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, and is determined by several factors, including its 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. But 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 between 0 and +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)Note - This section describes the syntax of the /usr/bin/nice command and not the C-shell nice built-in command. For information about the C-shell nice command, see csh(1).
Determine whether you want to lower the priority of a command as a user or raise or lower the priority of a command as superuser and select one of the following:
Follow the examples in step 2 to lower the priority of a command as a user.
Follow the examples in step 3 to raise or lower priorities of a command as superuser.
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 |
% /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 |
As superuser, 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 |
For more information, see nice(1).
Previous Contents Index Next ![]() |