Sun Microsystems Logo
Products and Services
 
Support and Training
 
 

Previous Previous     Contents     Index     Next Next

ProcedureHow to Control Processes

  1. Obtain the process ID of the process you want to control.

    # pgrep process

    process is the name of the process you want to control.

    The process identification number is in the first column of the output.

  2. Use the appropriate process command to control the process.

    # /usr/bin/pcommand pid

    pcommand

    Process command you want to run. Table 23-3 lists these commands.

    pid

    Identifies the process ID.

  3. Verify the process status.

    # ps -ef | grep PID

Example--Controlling Processes

The following example shows how to use process tools to stop and restart dtpad.

# pgrep dtpad 1
2921
# pstop 2921 2
# prun 2921 3

  1. Obtains the process identification number for dtpad

  2. Stops the dtpad process

  3. Restarts the dtpad process

Killing a Process (pkill)

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, and superuser can kill any process in the system except for those processes with process IDs of 0, 1, 2, 3, and 4. Killing these processes might crash the system.

For more information, see pgrep(1).

ProcedureHow to Kill a Process

  1. (Optional) To kill a process that belongs to another user, become superuser.

  2. Obtain the of the process ID of the process you want to stop.

    $ pgrep process

    process is the name of the process you want to display more information about.

    The process identification number is displayed in the first column of the output.

  3. Stop the process.

    $ pkill [-9] pid 

    -9

    Ensures that the process terminates promptly.

    pid

    Process ID to stop.

  4. Verify that the process has been stopped.

    $ pgrep process

Managing Process Class Information

The following list identifies the process scheduling classes that can be configured on your system, and 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 and 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.

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)

You can display process scheduling classes and priority ranges with the priocntl -l command.

$ priocntl -l

Example--Getting 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

Previous Previous     Contents     Index     Next Next