<chapter id="spprocess-59633"><title>Managing System
Processes (Tasks)</title><highlights><para>This chapter describes the procedures for managing system processes.</para><itemizedlist><para>For information on the procedures associated with managing system processes,
see the following:</para><listitem><para><olink targetptr="ennba" remap="internal">Managing System Processes (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="enudn" remap="internal">Managing Process Class Information
(Task Map)</olink></para>
</listitem>
</itemizedlist><itemizedlist><para>For overview information about managing system processes, see the following:</para><listitem><para><olink targetptr="spprocess-1" remap="internal">Commands for Managing System
Processes</olink></para>
</listitem><listitem><para><olink targetptr="spprocess-18" remap="internal">Managing Process Class Information</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="ennba"><title>Managing System Processes (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>List processes.</para>
</entry><entry><para>Use the <command>ps</command> command to list all the processes on a
system.</para>
</entry><entry><para><olink targetptr="eobor" remap="internal">How to List Processes</olink></para>
</entry>
</row><row><entry><para>Display information about processes.</para>
</entry><entry><para>Use the <command>pgrep</command> command to obtain the process IDs for
processes that you want to display more information about. </para>
</entry><entry><para><olink targetptr="spprocess-29852" remap="internal">How to Display Information About
Processes</olink></para>
</entry>
</row><row><entry><para>Control processes.</para>
</entry><entry><para>Locate processes by using the <command>pgrep</command> command. Then,
use the appropriate <command>pcommand</command> (<filename>/proc</filename>)
to control the process. See <olink targetptr="spprocess-84452" remap="internal">Table&nbsp;12&ndash;3</olink> for a description of the (<filename>/proc</filename>) commands. </para>
</entry><entry><para><olink targetptr="spprocess-94781" remap="internal">How to Control Processes</olink></para>
</entry>
</row><row><entry><para>Kill a process.</para><para></para>
</entry><entry><para>Locate a process, either by process name or process ID. You can use
either the <command>pkill</command> or <command>kill</command> commands to
terminate the process.</para><para></para>
</entry><entry><para><olink targetptr="spprocess-95930" remap="internal">How to Terminate a Process (pkill)</olink></para><para><olink targetptr="eoizf" remap="internal">How to Terminate a Process (kill)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="spprocess-1"><title>Commands for Managing System Processes</title><para>The following table describes the commands for managing system processes.</para><table frame="topbot" id="spconcepts-tbl-26"><title>Commands for Managing
Processes</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="143.73*"/><colspec colname="colspec0" colwidth="146.75*"/><colspec colname="colspec2" colwidth="146.75*"/><thead><row rowsep="1"><entry><para>Command </para>
</entry><entry><para>Description</para>
</entry><entry><para>Man Page</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>ps</command>, <command>pgrep</command>, <command>prstat</command>, <command>pkill</command></para>
</entry><entry><para>Checks the status of active processes on a system, as well as displays
detailed information about the processes</para>
</entry><entry><para><olink targetdoc="refman" targetptr="ps-1" remap="external"><citerefentry><refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, <olink targetdoc="refman" targetptr="pgrep-1" remap="external"><citerefentry><refentrytitle>pgrep</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, and<olink targetdoc="refman" targetptr="prstat-1m" remap="external"><citerefentry><refentrytitle>prstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>pkill</command></para>
</entry><entry><para>Functions identically to <command>pgrep</command> but finds or signals
processes by  name or other attribute and terminates the process. Each matching
process is signaled as if by the <command>kill</command> command, instead
of having its process ID printed.</para>
</entry><entry><para><olink targetdoc="refman" targetptr="pgrep-1" remap="external"><citerefentry><refentrytitle>pgrep</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>,
and <olink targetdoc="refman" targetptr="pkill-1" remap="external"><citerefentry><refentrytitle>pkill</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para><para><olink targetdoc="group-refman" targetptr="kill-1" remap="external"><citerefentry><refentrytitle>kill</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>pargs, preap</command></para>
</entry><entry><para>Assists with processes debugging</para>
</entry><entry><para><olink targetdoc="refman" targetptr="pargs-1" remap="external"><citerefentry><refentrytitle>pargs</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>,
and <olink targetdoc="refman" targetptr="preap-1" remap="external"><citerefentry><refentrytitle>preap</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>dispadmin</command></para>
</entry><entry><para>Lists default process scheduling policies</para>
</entry><entry><para><olink targetdoc="refman" targetptr="dispadmin-1m" remap="external"><citerefentry><refentrytitle>dispadmin</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>priocntl</command></para>
</entry><entry><para>Assigns processes to a priority class and manages process priortities</para>
</entry><entry><para><olink targetdoc="refman" targetptr="priocntl-1" remap="external"><citerefentry><refentrytitle>priocntl</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>nice</command></para>
</entry><entry><para>Changes the priority of a timesharing process</para>
</entry><entry><para><olink targetdoc="refman" targetptr="nice-1" remap="external"><citerefentry><refentrytitle>nice</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>psrset</command></para>
</entry><entry><para>Binds specific process groups to a group of processors rather than to
just a single processor</para>
</entry><entry><para><olink targetdoc="refman" targetptr="psrset-1m" remap="external"><citerefentry><refentrytitle>psrset</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>The Solaris Management Console's Processes tool enables you to manage
processes with a user-friendly interface. For information on using and starting
the Solaris Management Console, see <olink targetdoc="sysadv1" targetptr="smcover-1" remap="external">Chapter 2, <citetitle remap="chapter">Working With the Solaris Management Console (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para><sect2 id="spprocess-47"><title>Using the <command>ps</command> Command</title><para>The <command>ps</command> command enables you to check the status of
active processes on a system, as well as display technical information about
the processes. This data is useful for administrative tasks such as determining
how to set process priorities.</para><itemizedlist><para>Depending on which options you use, the <command>ps</command> command
reports the following information:</para><listitem><para>Current status of the process</para>
</listitem><listitem><para>Process ID </para>
</listitem><listitem><para>Parent process ID</para>
</listitem><listitem><para>User ID</para>
</listitem><listitem><para>Scheduling class</para>
</listitem><listitem><para>Priority</para>
</listitem><listitem><para>Address of the process</para>
</listitem><listitem><para>Memory used</para>
</listitem><listitem><para>CPU time used</para>
</listitem>
</itemizedlist><para>The following table describes some
fields that are reported by the <command>ps</command> command. Which fields
are displayed depend on which option you choose. For a description of all
available options, see the <olink targetdoc="refman" targetptr="ps-1" remap="external"><citerefentry><refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para><table frame="topbot" id="spprocess-37245"><title>Summary of Fields in <command>ps</command> Reports</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="108*"/><colspec colname="column2" colwidth="252*"/><thead><row rowsep="1"><entry><para>Field</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>UID</literal> </para>
</entry><entry><para>The effective user ID of the process's owner.</para>
</entry>
</row><row><entry><para><literal>PID</literal> </para>
</entry><entry><para>The process ID.</para>
</entry>
</row><row><entry><para><literal>PPID</literal> </para>
</entry><entry><para>The parent process ID.</para>
</entry>
</row><row><entry><para><literal>C</literal>  </para>
</entry><entry><para>The processor xutilization for scheduling. This field is not displayed
when the <option>c</option> option is used.</para>
</entry>
</row><row><entry><para><literal>CLS</literal> </para>
</entry><entry><para>The scheduling class to which the process belongs such as real-time,
system, or timesharing. This field is included only with the <option>c</option> option.</para>
</entry>
</row><row><entry><para><literal>PRI</literal> </para>
</entry><entry><para>The kernel thread's scheduling priority. Higher numbers indicate a higher
priority.</para>
</entry>
</row><row><entry><para><literal>NI</literal> </para>
</entry><entry><para>The process's <command>nice</command> number, which contributes to its
scheduling priority. Making a process &ldquo;nicer&rdquo; means lowering its
priority.</para>
</entry>
</row><row><entry><para><literal>ADDR</literal> </para>
</entry><entry><para>The address of the <literal>proc</literal> structure.</para>
</entry>
</row><row><entry><para><literal>SZ</literal> </para>
</entry><entry><para>The virtual address size of the process.</para>
</entry>
</row><row><entry><para><literal>WCHAN</literal> </para>
</entry><entry><para>The address of an event or lock for which the process is sleeping. </para>
</entry>
</row><row><entry><para><literal>STIME</literal></para>
</entry><entry><para>The starting time of the process in hours, minutes, and seconds.</para>
</entry>
</row><row><entry><para><literal>TTY</literal> </para>
</entry><entry><para>The terminal from which the process, or its parent, was started. A question
mark indicates that there is no controlling terminal.</para>
</entry>
</row><row><entry><para><literal>TIME</literal> </para>
</entry><entry><para>The total amount of CPU time used by the process since it began.</para>
</entry>
</row><row><entry><para><literal>CMD</literal></para>
</entry><entry><para>The command that generated the process. </para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="spprocess-48"><title>Using the <filename>/proc</filename> File
System and Commands</title><para>You can display detailed information
about the processes that are listed in the <filename>/proc</filename> directory
by using process commands. The following table lists the <filename>/proc</filename> process
commands. The <filename>/proc</filename> directory is also known as the process
file system (PROCFS). Images of active processes are stored here by their
process ID number.</para><table frame="topbot" id="spprocess-84452"><title>Process Commands (<filename>/proc</filename>)</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="column1" colwidth="144*"/><colspec colname="column2" colwidth="215*"/><thead><row rowsep="1"><entry><para>Process Command</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>pcred</command> </para>
</entry><entry><para>Displays process credential information</para>
</entry>
</row><row><entry><para><command>pfiles</command> </para>
</entry><entry><para>Reports <literal>fstat</literal> and <literal>fcntl</literal> information
for open files in a process</para>
</entry>
</row><row><entry><para><command>pflags</command> </para>
</entry><entry><para>Prints <filename>/proc</filename> tracing flags, pending signals and
held signals, and other status information</para>
</entry>
</row><row><entry><para><command>pldd</command> </para>
</entry><entry><para>Lists the dynamic libraries that are linked into a process</para>
</entry>
</row><row><entry><para><command>pmap</command> </para>
</entry><entry><para>Prints the address space map of each process</para>
</entry>
</row><row><entry><para><command>psig</command> </para>
</entry><entry><para>Lists the signal actions and handlers of each process</para>
</entry>
</row><row><entry><para><command>prun</command></para>
</entry><entry><para>Starts each process</para>
</entry>
</row><row><entry><para><command>pstack</command>  </para>
</entry><entry><para>Prints a hex+symbolic stack trace for each lwp in each process</para>
</entry>
</row><row><entry><para><command>pstop</command></para>
</entry><entry><para>Stops each process</para>
</entry>
</row><row><entry><para><command>ptime</command> </para>
</entry><entry><para>Times a process by using microstate accounting</para>
</entry>
</row><row><entry><para><command>ptree</command> </para>
</entry><entry><para>Displays the process trees that contain the process</para>
</entry>
</row><row><entry><para><command>pwait</command> </para>
</entry><entry><para>Displays status information after a process terminates</para>
</entry>
</row><row><entry><para><command>pwdx</command> </para>
</entry><entry><para>Displays the current working directory for a process</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>For more information, see <olink targetdoc="refman" targetptr="proc-1" remap="external"><citerefentry><refentrytitle>proc</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para><para>The process tools are similar to some options of the <command>ps</command> command,
except that the output that is provided by these commands is more detailed. </para><itemizedlist><para>In general, the process commands do the following:</para><listitem><para>Display more information about processes, such as <literal>fstat</literal> and <literal>fcntl</literal>, working directories, and trees of parent and child processes</para>
</listitem><listitem><para>Provide control over processes by allowing users to stop or resume
them</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="spprocess-30645"><title>Managing Processes With Process Commands
(<filename>/proc</filename>)</title><para>You can display detailed, technical
information about processes or control active processes by using some of the
process commands. <olink targetptr="spprocess-84452" remap="internal">Table&nbsp;12&ndash;3</olink> lists
some of the <filename>/proc</filename> commands.</para><para>If a process becomes trapped in an endless loop, or if the process
takes too long to execute, you might want to stop (kill) the process. For
more information about stopping processes using the <command>kill</command> or
the <command>pkill</command> command, see <olink targetptr="spprocess-59633" remap="internal">Chapter&nbsp;12,
Managing System Processes (Tasks)</olink>.   </para><para>The <filename>/proc</filename> file system is a directory hierarchy
that contains additional subdirectories for state information and control
functions.</para><para>The <filename>/proc</filename> file system also provides an xwatchpoint
facility that is used to remap read-and-write permissions on the individual
pages of a process's address space. This facility has no restrictions and
is MT-safe.</para><para>Debugging tools have been modified to use <filename>/proc</filename>'s
xwatchpoint facility, which means that the entire xwatchpoint process is faster.</para><itemizedlist><para>The following restrictions have been removed when you set xwatchpoints
by using the <command>dbx</command> debugging tool:</para><listitem><para>Setting xwatchpoints on local variables on the stack due to
SPARC based system register windows</para>
</listitem><listitem><para>Setting xwatchpoints on multithreaded processes</para>
</listitem>
</itemizedlist><para>For more information, see the <olink targetdoc="refman" targetptr="proc-4" remap="external"><citerefentry><refentrytitle>proc</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>,
and <olink targetdoc="refman" targetptr="mdb-1" remap="external"><citerefentry><refentrytitle>mdb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para>
</sect2><task id="eobor"><title>How to List Processes</title><procedure remap="single-step"><step><para>Use the <command>ps</command> command to list all the processes
on a system. </para><screen>$ <userinput>ps</userinput> [-<userinput>efc</userinput>]</screen><variablelist><varlistentry><term><command>ps</command></term><listitem><para>Displays only the processes that are associated with your
login session.</para>
</listitem>
</varlistentry><varlistentry><term><option>ef</option></term><listitem><para>Displays full information about all the processes that are
being executed on the system.</para>
</listitem>
</varlistentry><varlistentry><term><option>c</option></term><listitem><para>Displays process scheduler information.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="spprocess-2"><title>Listing Processes</title><para>The following example shows output from the <command>ps</command> command
when no options are used. </para><screen>$ <userinput>ps</userinput>
   PID TTY      TIME COMD
  1664 pts/4    0:06 csh
  2081 pts/4    0:00 ps</screen><para>The following example shows output from the <command>ps</command> <option>ef</option> command. This output shows that the first process that is executed
when the system boots is <literal>sched</literal> (the swapper) followed by
the <literal>init</literal> process, <literal>pageout</literal>, and so on.
   </para><screen>$ <userinput>ps -ef</userinput>
     UID   PID  PPID  C    STIME TTY      TIME CMD
    root     0     0  0   Dec 20 ?        0:17 sched
    root     1     0  0   Dec 20 ?        0:00 /etc/init -
    root     2     0  0   Dec 20 ?        0:00 pageout
    root     3     0  0   Dec 20 ?        4:20 fsflush
    root   374   367  0   Dec 20 ?        0:00 /usr/lib/saf/ttymon
    root   367     1  0   Dec 20 ?        0:00 /usr/lib/saf/sac -t 300
    root   126     1  0   Dec 20 ?        0:00 /usr/sbin/rpcbind
    root    54     1  0   Dec 20 ?        0:00 /usr/lib/sysevent/syseventd
    root    59     1  0   Dec 20 ?        0:00 /usr/lib/picl/picld
    root   178     1  0   Dec 20 ?        0:03 /usr/lib/autofs/automountd
    root   129     1  0   Dec 20 ?        0:00 /usr/sbin/keyserv
    root   213     1  0   Dec 20 ?        0:00 /usr/lib/lpsched
    root   154     1  0   Dec 20 ?        0:00 /usr/sbin/inetd -s
    root   139     1  0   Dec 20 ?        0:00 /usr/lib/netsvc/yp/ypbind ...
    root   191     1  0   Dec 20 ?        0:00 /usr/sbin/syslogd
    root   208     1  0   Dec 20 ?        0:02 /usr/sbin/nscd
    root   193     1  0   Dec 20 ?        0:00 /usr/sbin/cron
    root   174     1  0   Dec 20 ?        0:00 /usr/lib/nfs/lockd
  daemon   175     1  0   Dec 20 ?        0:00 /usr/lib/nfs/statd
    root   376     1  0   Dec 20 ?        0:00 /usr/lib/ssh/sshd
    root   226     1  0   Dec 20 ?        0:00 /usr/lib/power/powerd
    root   315     1  0   Dec 20 ?        0:00 /usr/lib/nfs/mountd
    root   237     1  0   Dec 20 ?        0:00 /usr/lib/utmpd
    .
    .
    .    </screen>
</example>
</task><task id="spprocess-29852"><title>How to Display Information About Processes</title><procedure><step id="spprocess-step-4"><para>Obtain the process ID of the process that
you want to display more information about. </para><screen># <userinput>pgrep</userinput> <replaceable>process</replaceable></screen><para>where <replaceable>process</replaceable> is the name of the process
you want to display more information about.</para><para>The process ID is
displayed in the first column of the output. </para>
</step><step id="spprocess-step-5"><para>Display the process information that you
need.  </para><screen># <userinput>/usr/bin/</userinput><replaceable>pcommand</replaceable> <replaceable>pid</replaceable></screen><variablelist><varlistentry><term><replaceable>pcommand</replaceable></term><listitem><para>Is the (<filename>/proc</filename>) command that you want
to run. <olink targetptr="spprocess-84452" remap="internal">Table&nbsp;12&ndash;3</olink> lists
and describes these commands.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>pid</replaceable></term><listitem><para>Identifies the process ID.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="emjeh"><title>Displaying Information About Processes</title><para>The following example shows how to use
process commands to display more information about a <literal>cron</literal> process. </para><screen># <userinput>pgrep cron</userinput> <lineannotation>1</lineannotation>
4780
# <userinput>pwdx 4780</userinput> <lineannotation>2</lineannotation>
4780:   /var/spool/cron/atjobs
# <userinput>ptree 4780</userinput> <lineannotation>3</lineannotation>
4780  /usr/sbin/cron
# <userinput>pfiles 4780</userinput> <lineannotation>4</lineannotation>
4780:   /usr/sbin/cron
  Current rlimit: 256 file descriptors
   0: S_IFCHR mode:0666 dev:290,0 ino:6815752 uid:0 gid:3 rdev:13,2
      O_RDONLY|O_LARGEFILE
      /devices/pseudo/mm@0:null
   1: S_IFREG mode:0600 dev:32,128 ino:42054 uid:0 gid:0 size:9771
      O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
      /var/cron/log
   2: S_IFREG mode:0600 dev:32,128 ino:42054 uid:0 gid:0 size:9771
      O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
      /var/cron/log
   3: S_IFIFO mode:0600 dev:32,128 ino:42049 uid:0 gid:0 size:0
      O_RDWR|O_LARGEFILE
      /etc/cron.d/FIFO
   4: S_IFIFO mode:0000 dev:293,0 ino:4630 uid:0 gid:0 size:0
      O_RDWR|O_NONBLOCK
   5: S_IFIFO mode:0000 dev:293,0 ino:4630 uid:0 gid:0 size:0
      O_RDWR</screen><orderedlist><listitem><para>Obtains the process ID for the <literal>cron</literal> process</para>
</listitem><listitem><para>Displays the current working directory for the <literal>cron</literal> process</para>
</listitem><listitem><para>Displays the process tree that contains the <literal>cron</literal> process</para>
</listitem><listitem><para>Displays <literal>fstat</literal> and <literal>fcntl</literal> information</para>
</listitem>
</orderedlist>
</example>
</task><task id="spprocess-94781"><title>How to Control Processes</title><procedure><step id="spprocess-step-9"><para>Obtain the process ID of the process that
you want to control.</para><screen># <userinput>pgrep</userinput> <replaceable>process</replaceable></screen><para>where <replaceable>process</replaceable> is the name of the process
you want to control.</para><para>The process ID displayed in the first column
of the output.</para>
</step><step id="spprocess-step-10"><para>Use the appropriate process command to
control the process.</para><screen># <userinput>/usr/bin/</userinput><replaceable>pcommand</replaceable> <replaceable>pid</replaceable></screen><variablelist><varlistentry><term><replaceable>pcommand</replaceable></term><listitem><para>Is the process (<filename>/proc</filename>) command that you
want to run. <olink targetptr="spprocess-84452" remap="internal">Table&nbsp;12&ndash;3</olink> lists
and describes these commands.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>pid</replaceable></term><listitem><para>Identifies the process ID.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="spprocess-step-32"><para>Verify the process status.</para><screen># <userinput>ps -ef | grep</userinput> <replaceable>pid</replaceable></screen>
</step>
</procedure><example id="emjed"><title>Controlling Processes</title><para>The following example shows how to use process command to stop and restart
the <command>dtpad</command> process.</para><screen># <userinput>pgrep dtpad</userinput> <lineannotation>1</lineannotation>
2921
# <userinput>pstop 2921</userinput><lineannotation>2</lineannotation> 
# <userinput>prun 2921</userinput> <lineannotation>3</lineannotation></screen><orderedlist><listitem><para>Obtains the process ID for the <command>dtpad</command> process</para>
</listitem><listitem><para>Stops the <command>dtpad</command> process</para>
</listitem><listitem><para>Restarts the <command>dtpad</command> process</para>
</listitem>
</orderedlist>
</example>
</task><sect2 id="spprocess-12"><title>Terminating a Process (<command>pkill, kill</command>)</title><para>Sometimes, you might need to
stop (kill) a process. The process might be in an endless loop. Or, you might
have started a large job that you want to stop before it is completed. You
can kill any process that you own. Superuser can kill any process in the system
except for those processes with process IDs of <literal>0</literal>, <literal>1</literal>, <literal>2</literal>, <literal>3</literal>, and <literal>4</literal>. Killing these
processes most likely will crash the system. </para><para>For more information, see the <olink targetdoc="refman" targetptr="pgrep-1" remap="external"><citerefentry><refentrytitle>pgrep</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="pkill-1" remap="external"><citerefentry><refentrytitle>pkill</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="kill-1" remap="external"><citerefentry><refentrytitle>kill</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para>
</sect2><task id="spprocess-95930"><title>How to Terminate a Process (<command>pkill</command>)</title><procedure><step performance="optional"><para>Become superuser or assume an equivalent
role to terminate the process of another user.</para>
</step><step id="spprocess-step-15"><para>Obtain the process ID for the process that
you want to terminate.</para><screen>$ <userinput>pgrep</userinput> <replaceable>process</replaceable></screen><para>where <replaceable>process</replaceable> is the name of the process
that you want to terminate.</para><para>For example:</para><screen>$ <userinput>pgrep netscape</userinput>
587
566</screen><para>The process ID is displayed in the output.</para><note><para>To obtain process information on a Sun <trademark>Ray</trademark>,
use the following commands:</para><screen># <userinput>ps -fu <replaceable>user</replaceable></userinput></screen><para>This command lists all user processes.</para><screen># <userinput>ps -fu <replaceable>user</replaceable> | grep <replaceable>process</replaceable></userinput></screen><para>This command locates a specific process for a user.</para>
</note>
</step><step id="spprocess-step-33"><para>Terminate the process.</para><screen>$ <userinput>pkill</userinput> [<userinput><replaceable>signal</replaceable></userinput>] <replaceable>process</replaceable></screen><variablelist><varlistentry><term><replaceable>signal</replaceable></term><listitem><para>When no signal is included in the <command>pkill</command> command-line
syntax, the default signal that is used is &ndash;15 (<literal>SIGTERM</literal>).
Using the &ndash;9 signal (<literal>SIGKILL</literal>) with the <command>pkill</command> command
ensures that the process terminates promptly. However, the &ndash;9 signal
should not be used to kill certain processes, such as a database process,
or an LDAP server process. The result is that data might be lost.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>process</replaceable></term><listitem><para>Is the name of the process to stop.</para>
</listitem>
</varlistentry>
</variablelist><tip><para>When using the <command>pkill</command> command to terminate a
process, first try using the command by itself, without including a signal
option. Wait a few minutes to see if the process terminates before using the <command>pkill</command> command with the -9 signal.</para>
</tip>
</step><step id="spprocess-step-34"><para>Verify that the process has been terminated.</para><screen>$ <userinput>pgrep</userinput> <replaceable>process</replaceable></screen><para>The process you terminated should no longer be listed in the output
of the <command>pgrep</command> command.</para>
</step>
</procedure>
</task><task id="eoizf"><title>How to Terminate a Process (<command>kill</command>)</title><procedure><step performance="optional"><para>Become superuser or assume an equivalent
role to terminate the process of another user.</para>
</step><step><para>Obtain the process ID of the process that you want to terminate.</para><screen>$ <userinput>ps -fu <replaceable>user</replaceable></userinput></screen><para>where <replaceable>user</replaceable> is the user that you want to display
processes for.</para><para>For example:</para><screen width="100">$ <userinput>ps -fu <replaceable>userabc</replaceable></userinput>
userabc   328   323   2   Mar 12 ?         10:18 /usr/openwin/bin/Xsun
:0 -nobanner -auth /var/dt/A:0-WmayOa
userabc   366   349   0   Mar 12 ?         0:00 /usr/openwin/bin/fbconsole
userabc   496   485   0   Mar 12 ?         0:09 /usr/dt/bin/sdtperfmeter
 -f -H -t cpu -t disk -s 1 -name fpperfmeter
userabc   349   332   0   Mar 12 ?         0:00 /bin/ksh /usr/dt/bin/Xsession
userabc   440   438   0   Mar 12 pts/3     0:00 -csh -c unsetenv _ PWD;
unsetenv DT;     setenv DISPLAY :0;      
userabc   372     1   0   Mar 12 ?         0:00 /usr/openwin/bin/speckeysd
userabc   438   349   0   Mar 12 pts/3     0:00 /usr/dt/bin/sdt_shell -c
unset
.
.
.</screen><para>The process ID is displayed in the first column of the output.</para>
</step><step><para>Terminate the process.</para><screen>$ <userinput>kill</userinput> [<userinput><replaceable>signal-number</replaceable></userinput>] <replaceable>pid</replaceable></screen><variablelist><varlistentry><term><replaceable>signal</replaceable></term><listitem><para>When no signal is included in the <command>kill</command> command-line
syntax, the default signal that is used is &ndash;15 (<literal>SIGKILL</literal>).
Using the &ndash;9 signal (<literal>SIGTERM</literal>) with the <command>kill</command> command
ensures that the process terminates promptly. However, the &ndash;9 signal
should not be used to kill certain processes, such as a database process,
or an LDAP server process. The result is that data might be lost.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>pid</replaceable></term><listitem><para>Is the process ID of the process that you want to terminate.</para>
</listitem>
</varlistentry>
</variablelist><tip><para>When using the <command>kill</command> command to stop a process,
first try using the command by itself, without including a signal option.
Wait a few minutes to see if the process terminates before using the <command>kill</command> command with the -9 signal.</para>
</tip>
</step><step><para>Verify that the process has been terminated.</para><screen>$ <userinput>pgrep</userinput> <replaceable>pid</replaceable></screen><para>The process you terminated should no longer be listed in the output
of the <command>pgrep</command> command.</para>
</step>
</procedure>
</task><sect2 id="eekmk"><title>Debugging a Process (<command>pargs</command>, <command>preap</command>)</title><para>The <command>pargs</command> command and the <command>preap</command> command
improve process debugging. The <command>pargs</command> command prints the
arguments and environment variables associated with a live process or core
file. The <command>preap</command> command removes defunct (zombie) processes.
A zombie process has not yet had its exit status claimed by its parent. These
processes are generally harmless but can consume system resources if they
are numerous. You can use the <command>pargs</command> and <command>preap</command> commands
to examine any process that you have the privileges to examine. As superuser,
you can examine any process.</para><para>For information on using the <command>preap</command> command, see the <olink targetdoc="refman" targetptr="preap-1" remap="external"><citerefentry><refentrytitle>preap</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. For information
on the using the <command>pargs</command> command, see the <olink targetdoc="refman" targetptr="pargs-1" remap="external"><citerefentry><refentrytitle>pargs</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page. See also, the <olink targetdoc="refman" targetptr="proc-1" remap="external"><citerefentry><refentrytitle>proc</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para><example id="eeklf"><title>Debugging a Process (<command>pargs</command>)</title><para>The <command>pargs</command> command solves a long-standing problem
of being unable to display with the <command>ps</command> command all the
arguments that are passed to a process. The following example shows how to
use the <command>pargs</command> command in combination with the <command>pgrep</command> command
to display the arguments that are passed to a process.</para><screen># <userinput>pargs `pgrep ttymon`</userinput>
579:	/usr/lib/saf/ttymon -g -h -p <replaceable>system-name</replaceable> console login:  
-T sun -d /dev/console -l 
argv[0]: /usr/lib/saf/ttymon
argv[1]: -g
argv[2]: -h
argv[3]: -p
argv[4]: <replaceable>system-name</replaceable> console login: 
argv[5]: -T
argv[6]: sun
argv[7]: -d
argv[8]: /dev/console
argv[9]: -l
argv[10]: console
argv[11]: -m
argv[12]: ldterm,ttcompat
548:	/usr/lib/saf/ttymon
argv[0]: /usr/lib/saf/ttymon</screen><para>The following example shows how to use the <command>pargs</command> <option>e</option> command to display the environment variables that are associated
with a process.</para><screen>$ <userinput>pargs -e 6763</userinput>
6763: tcsh
envp[0]: DISPLAY=:0.0</screen>
</example>
</sect2>
</sect1><sect1 id="enudn"><title>Managing Process Class Information (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display basic information about process classes.</para>
</entry><entry><para>Use the <command>priocntl -l</command> command. to Display process scheduling
classes and priority ranges.</para>
</entry><entry><para><olink targetptr="eobpu" remap="internal">How to Display Basic Information About Process
Classes (priocntl)</olink></para>
</entry>
</row><row><entry><para>Display the global priority of a process.</para>
</entry><entry><para>Use the <command>ps <option>ecl</option></command> command to display
the global priority of a process.</para>
</entry><entry><para><olink targetptr="eobpr" remap="internal">How to Display the Global Priority of a Process</olink></para>
</entry>
</row><row><entry><para>Designate a process priority.</para>
</entry><entry><para>Start a process with a designated priority by using the <command>priocntl <option>e</option> <option>c</option> command.</command></para>
</entry><entry><para><olink targetptr="spprocess-92593" remap="internal">How to Designate a Process Priority
(priocntl)</olink></para>
</entry>
</row><row><entry><para>Change scheduling parameters of a timesharing process.</para>
</entry><entry><para>Use the <command>priocntl <option>s</option> <option>m</option></command> command
to change scheduling parameters in a timesharing process.</para>
</entry><entry><para><olink targetptr="spprocess-89655" remap="internal">How to Change Scheduling Parameters
of a Timesharing Process (priocntl)</olink></para>
</entry>
</row><row><entry><para>Change the class of a process.</para>
</entry><entry><para>Use the <command>priocntl <option>s</option> <option>c</option></command> command
to change the class of a process.</para>
</entry><entry><para><olink targetptr="spprocess-18033" remap="internal">How to Change the Class of a Process
(priocntl)</olink></para>
</entry>
</row><row><entry><para>Change the priority of a process.</para>
</entry><entry><para>Use the <command>/usr/bin/nice</command> command with the appropriate
options to lower or raise the priority of a process.</para>
</entry><entry><para><olink targetptr="spprocess-52112" remap="internal">How to Change the Priority of a Process
(nice)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="spprocess-18"><title>Managing Process Class Information</title><para>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. </para><itemizedlist><para>The possible process scheduling classes are as follows:</para><listitem><para>Fair share (<literal>FSS</literal>) </para>
</listitem><listitem><para>Fixed (<literal>FX</literal>)</para>
</listitem><listitem><para>System (<literal>SYS</literal>)</para>
</listitem><listitem><para>Interactive (<literal>IA</literal>)</para>
</listitem><listitem><para>Real-time (<literal>RT</literal>)</para>
</listitem><listitem><para>Timesharing (<literal>TS</literal>)</para><itemizedlist><listitem><para>The user-supplied priority ranges
from -60 to +60. </para>
</listitem><listitem><para>The priority of a process
is inherited from the parent process. This priority is referred to as the <emphasis>user-mode priority</emphasis>. </para>
</listitem><listitem><para>The system looks up the user-mode priority in the timesharing
dispatch parameter table. Then, the system adds in any <command>nice</command> or <command>priocntl</command> (user-supplied) priority and ensures a 0&ndash;59 range
to create a <emphasis>global priority</emphasis>.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist><sect2 id="spprocess-32"><title>Changing the Scheduling Priority of Processes
(<command>priocntl</command>)</title><para>The scheduling priority
of a process is the priority assigned by the process scheduler, according
to scheduling policies. The <command>dispadmin</command> command lists the
default scheduling policies. For more information, see the <olink targetdoc="refman" targetptr="dispadmin-1m" remap="external"><citerefentry><refentrytitle>dispadmin</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para><para>You can use the <command>priocntl</command> command to assign processes to a priority class and to manage process
priorities. For instructions on using the <command>priocntl</command> command
to manage processes, see <olink targetptr="spprocess-92593" remap="internal">How to Designate
a Process Priority (priocntl)</olink>. </para>
</sect2><task id="eobpu"><title>How to Display Basic Information About Process Classes
(<command>priocntl</command>)</title><procedure remap="single-step"><step><para>Display
process scheduling classes and priority ranges with the <command>priocntl
-l</command> command.     </para><screen>$ <userinput>priocntl -l</userinput></screen>
</step>
</procedure><example id="spprocess-19"><title>Displaying Basic Information About Process Classes (<command>priocntl</command>)</title><para>The following example shows
output from the <command>priocntl -l</command> command. </para><screen># <userinput>priocntl -l</userinput>
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</screen>
</example>
</task><task id="eobpr"><title>How to Display the Global Priority of a Process</title><procedure remap="single-step"><step><para>Display the global priority of a
process by using the <command>ps</command> command.        </para><screen>$ <userinput>ps -ecl</userinput></screen><para>The global priority is listed under the <literal>PRI</literal> column. </para>
</step>
</procedure><example id="spprocess-20"><title>Displaying the Global Priority of a Process</title><para>The following example shows <command>ps -ecl</command> command
output. The values in the <literal>PRI</literal> column show that the <command>pageout</command> process has the highest priority, while the <command>sh</command> process
has the lowest priority.</para><screen width="100">$ <userinput>ps -ecl</userinput>
 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</screen>
</example>
</task><task id="spprocess-92593"><title>How to Designate a Process Priority (<command>priocntl</command>)</title><procedure>&rolePAstepOpt.sgm;<step id="spprocess-step-23"><para>Start a process with a designated priority.</para><screen># <userinput>priocntl -e -c</userinput> <replaceable>class</replaceable> <userinput>-m</userinput> <replaceable>user-limit</replaceable> <userinput>-p</userinput> <replaceable>pri command-name</replaceable></screen><variablelist><varlistentry><term><option>e</option></term><listitem><para>Executes the command.</para>
</listitem>
</varlistentry><varlistentry><term><option>c</option> <replaceable>class</replaceable></term><listitem><para>Specifies the class within which to run the process. The valid
classes are <filename>TS</filename> (timesharing), <filename>RT</filename> (real
time), IA (interactive), FSS (fair share), and FX (fixed priority). </para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>user-limit</replaceable></term><listitem><para>When you use the <option>p</option> option, specifies the
maximum amount you can raise or lower your priority, </para>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>pri command-name</replaceable></term><listitem><para>Lets you specify the relative priority in the RT class for
a real-time thread. For a timesharing process, the <option>p</option> option
lets you specify the user-supplied priority, which ranges from -60 to +60. </para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="spprocess-step-35"><para>Verify the process status.</para><screen># <userinput>ps -ecl | grep</userinput> <replaceable>command-name</replaceable></screen>
</step>
</procedure><example id="emjeb"><title>Designating a Process Priority (<command>priocntl</command>)</title><para>The following example shows
how to start the <command>find</command> command with the highest possible
user-supplied priority.    </para><screen># <userinput>priocntl -e -c TS -m 60 -p 60 find . -name core -print</userinput>
# <userinput>ps -ecl | grep find</userinput></screen>
</example>
</task><task id="spprocess-89655"><title>How to Change Scheduling Parameters of a
Timesharing Process (<command>priocntl</command>)</title><procedure>&rolePAstepOpt.sgm;<step id="spprocess-step-26"><para>Change
the scheduling parameters of a running timesharing process.               </para><screen># <userinput>priocntl -s -m</userinput> <replaceable>user-limit</replaceable> [-<userinput>p</userinput> <replaceable>user-priority</replaceable>] <userinput>-i</userinput> <replaceable>idtype</replaceable> <replaceable>idlist</replaceable></screen><variablelist><varlistentry><term><option>s</option></term><listitem><para>Lets you set the upper limit on the user priority range and
change the current priority.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>user-limit</replaceable></term><listitem><para>When you use the <option>p</option> option, specifies the
maximum amount you can raise or lower the priority.</para>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>user-priority</replaceable></term><listitem><para>Allows you to designate a priority.</para>
</listitem>
</varlistentry><varlistentry><term><option>i</option> <replaceable>xidtype</replaceable> <replaceable>xidlist</replaceable></term><listitem><para>Uses a combination of <emphasis>xidtype</emphasis> and <emphasis>xidlist</emphasis> to identify the process or processes. The <emphasis>xidtype</emphasis> specifies
the type of ID, such as the process ID or the user ID. Use <emphasis>xidlist</emphasis> to
identify a list of process IDs or user IDs.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="spprocess-step-36"><para>Verify the process status. </para><screen># <userinput>ps -ecl | grep</userinput> <replaceable>idlist</replaceable></screen>
</step>
</procedure><example id="emjek"><title>Changing Scheduling Parameters of a Timesharing Process (<command>priocntl</command>)</title><para>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.</para><screen># <userinput>priocntl -e -c RT -m 500 -p 20 myprog</userinput>
# <userinput>ps -ecl | grep myprog</userinput></screen>
</example>
</task><task id="spprocess-18033"><title>How to Change the Class of a Process (<command>priocntl</command>)</title><procedure><step performance="optional" id="spprocess-step-29"><para>Become superuser or assume an equivalent role. </para>
</step><step id="spprocess-step-30"><para>Change the class of a process.</para><screen># <userinput>priocntl -s -c</userinput> <replaceable>class</replaceable> <userinput>-i</userinput> <replaceable>idtype</replaceable> <replaceable>idlist</replaceable></screen><variablelist><varlistentry><term><option>s</option></term><listitem><para>Lets you set the upper limit on the user priority range and
change the current priority.</para>
</listitem>
</varlistentry><varlistentry><term><option>c</option> <replaceable>class</replaceable></term><listitem><para>Specifies the class, <literal>TS</literal> for time-sharing
or <literal>RT for real-time</literal>, to which you are changing the process.</para>
</listitem>
</varlistentry><varlistentry><term><option>i</option> <replaceable>idtype</replaceable> <replaceable>idlist</replaceable></term><listitem><para>Uses a combination of <emphasis>xidtype</emphasis> and <emphasis>xidlist</emphasis> to identify the process or processes. The <emphasis>xidtype</emphasis> specifies
the type of ID, such as the process ID or user ID. Use <emphasis>xidlist</emphasis> to
identify a list of process IDs or user IDs.</para>
</listitem>
</varlistentry>
</variablelist><note><para>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 <command>priocntl -s</command> command.</para>
</note>
</step><step id="spprocess-step-37"><para>Verify the process status.</para><screen># <userinput>ps -ecl | grep</userinput> <replaceable>idlist</replaceable></screen>
</step>
</procedure><example id="emjei"><title>Changing the Class of a Process (<command>priocntl</command>)</title><para>The following example shows how to change all the processes that belong
to user <literal>15249</literal> to real-time processes.</para><screen># <userinput>priocntl -s -c RT -i uid 15249</userinput>
# <userinput>ps -ecl | grep 15249</userinput></screen>
</example>
</task><sect2 id="spprocess-33"><title>Changing the Priority of a Timesharing Process
(<command>nice</command>)</title><para>The <command>nice</command> command is only
supported for backward compatibility to previous Solaris releases. The <command>priocntl</command> command provides more flexibility in managing processes.      </para><para>The priority of a process is determined by the policies of its scheduling
class and by its <replaceable>nice number</replaceable>. Each timesharing
process has a global priority. The global priority is calculated by adding
the user-supplied priority, which can be influenced by the <command>nice</command> or <command>priocntl</command> commands, and the system-calculated priority. </para><para>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 <command>nice</command> number. </para><para>Each timesharing process starts with a default <command>nice</command> number,
which it inherits from its parent process. The <command>nice</command> number
is shown in the <literal>NI</literal> column of the <command>ps</command> report.</para><para>A user can lower the priority of a process by increasing its user-supplied
priority. However, only superuser can lower a <command>nice</command> 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.</para><para>The <command>nice</command> numbers range from 0 to +39, with 0 representing the highest
priority. The default <command>nice</command> value for each timesharing process
is 20. Two versions of the command are available: the standard version, <command>/usr/bin/nice</command>, and the C shell built-in command.               
    </para>
</sect2><task id="spprocess-52112"><title>How to Change the Priority of a Process
(<command>nice</command>)</title><tasksummary><para>Using this procedure, a user can lower the priority of a process. However,
superuser can raise or lower the priority of a process.</para><note><para>This section describes the syntax of the <command>/usr/bin/nice</command> command
and not the C-shell built-in <command>nice</command>command. For information
about the C-shell <command>nice</command> command, see the <olink targetdoc="refman" targetptr="csh-1" remap="external"><citerefentry><refentrytitle>csh</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</note>
</tasksummary><procedure><step id="spprocess-step-52"><para>Determine whether you want to change the
priority of a process, either as a user or as superuser. Then, select one
of the following:</para><stepalternatives><step><para>As a user, follow the examples in Step 2 to lower the priority
of a command.</para>
</step><step><para>As a superuser, follow the examples in Step 3 to raise or lower
priorities of a command.</para>
</step>
</stepalternatives>
</step><step id="spprocess-step-51"><para>As a user, lower the priority of a command
by increasing the <command>nice</command> number.</para><para>The following <command>nice</command> command executes <replaceable>command-name</replaceable> with
a lower priority by raising the nice number by 5 units.</para><screen>$ <userinput>/usr/bin/nice -5</userinput> <replaceable>command-name</replaceable></screen><para>In the preceding command, the minus sign designates that what follows
is an option. This command could also be specified as follows:</para><screen>% <userinput>/usr/bin/nice -n 5</userinput> <replaceable>command-name</replaceable></screen><para>The following <command>nice</command> command lowers the priority of <replaceable>command-name</replaceable> by raising the nice number by the default increment
of 10 units, but not beyond the maximum value of 39.</para><screen>% <userinput>/usr/bin/nice</userinput> <replaceable>command-name</replaceable></screen>
</step><step><para>As superuser or assuming an equivalent role, raise or lower the
priority of a command by changing the <command>nice</command> number.</para><para>The following <command>nice</command> command raises the priority of <replaceable>command-name</replaceable> by lowering the nice number by 10 units, but not
below the minimum value of 0.</para><screen># <userinput>/usr/bin/nice --10</userinput> <replaceable>command-name</replaceable></screen><para>In the preceding command, the first minus sign designates that what
follows is an option. The second minus sign indicates a negative number.</para><para>The following <command>nice</command> command lowers the priority of <replaceable>command-name</replaceable> by raising the nice number by 5 units, but not
beyond the maximum value of 39.</para><screen># <userinput>/usr/bin/nice -5</userinput> <replaceable>command-name</replaceable></screen>
</step>
</procedure><taskrelated role="see-also"><para>For more information, see the <olink targetdoc="refman" targetptr="nice-1" remap="external"><citerefentry><refentrytitle>nice</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para>
</taskrelated>
</task>
</sect1><sect1 id="spconcepts-6"><title>Troubleshooting Problems With System Processes</title><itemizedlist><para>Here
are some tips on obvious problems you might encounter:</para><listitem><para>Look for several identical jobs that are owned
by the same user. This problem might occur because of a running script that
starts a lot of background jobs without waiting for any of the jobs to finish. </para>
</listitem><listitem><para>Look for a process that has accumulated a large
amount of CPU time. You can identify this problem by checking the <literal>TIME</literal> field
in the <command>ps</command> output. Possibly, the process is in an endless
loop.    </para>
</listitem><listitem><para>Look for a process that is running with a priority that is too
high. Use the <command>ps -c</command> command to check the <literal>CLS</literal> field,
which displays the scheduling class of each process. A process executing as
a real-time (<literal>RT</literal>) process can monopolize the CPU. Or, look
for a timesharing (<literal>TS</literal>) process with a high <command>nice</command> number.
A user with superuser privileges might have increased the priority of a process.
The system administrator can lower the priority by using the <command>nice</command> command.
 </para>
</listitem><listitem><para>Look for a runaway process. A runaway process progressively uses
more and more CPU time. You can identify this problem by looking at the time
when the process started (<literal>STIME</literal>) and by watching the cumulation
of CPU time (<literal>TIME</literal>) for a while.</para>
</listitem>
</itemizedlist>
</sect1>
</chapter>