Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
23.  Managing System Processes (Tasks) Commands for Managing System Processes (Overview) How to Display Information About Processes Example--Displaying Information About Processes  Previous   Contents   Next 
   
 
  1. Adds the /usr/proc/bin directory to the PATH variable

  2. Obtains the process identification number for lpsched

  3. Displays the current working directory for lpsched

  4. Displays the process tree that containslpsched

  5. Displays fstat and fcntl information

How 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 /usr/proc/bin command to control the process.

    # /usr/proc/bin/pcommand pid

    pcommand

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

    pid

    Identifies the process ID.

  3. Verify the process status.

    # pgrep PID

Example--Controlling Processes

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

# PATH=$PATH:/usr/proc/bin
# export PATH 1
# pgrep dtpad 2
2921
# pstop 2921 3
# prun 2921 4
  1. Adds the /usr/proc/bin directory to the PATH variable

  2. Obtains the process identification number for dtpad

  3. Stops the dtpad process

  4. Restarts the dtpad process

Killing a Process (pkill)

Sometimes, it is necessary 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).

How 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 pid

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.

 
 
 
  Previous   Contents   Next