Unit 7 Solaris Process Control - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Unit 7 Solaris Process Control

Description:

Cpu sort by cpu usage. Time sort by process execution time. Size ... This could cause corruption of data if the process is I/O intensive. Killing a Process ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 13
Provided by: randy176
Category:

less

Transcript and Presenter's Notes

Title: Unit 7 Solaris Process Control


1
Unit 7 Solaris Process Control
  • Randy Marchany
  • VA Tech Computing Center

2
ps
  • The ps command lists processes running on the
    system.
  • Without arguments, the command only shows the
    processes run by the current user.
  • Solaris has 2 versions of the ps command.
    /usr/ucb/ps and /usr/bin/ps. /usr/ucb/ps is the
    BSD version of the command.

3
ps
  • ps ef will list all of the processes running on
    the system.
  • Every process is assigned a unique number (PID).
  • The CMD field of the output lists the actual
    command running on the system.
  • There are a lot of other fields

4
ps
  • ps el will list the process states as well.
  • O the process is currently running. Note, this
    will almost always be the ps command itself.
  • S the process is sleeping, waiting for
    resources or input.
  • R the process is runnable and in the run queue.
  • Z the process is in a Zombie state and can only
    be cleared by a reboot. This occurs when a child
    process dies ant the parent fails to clean up
    after it.
  • T process is stopped by job control. A ctl-Z
    will put a process in this state.

5
prstat
  • prstat command shows the running processes at a
    configured interval (5 seconds).
  • Can sort the output by key values supplied by the
    s option
  • Cpu sort by cpu usage
  • Time sort by process execution time
  • Size sort by process image size
  • Rss sort by process resident set size
  • Pri sort by process priority

6
Killing a Process
  • Sometimes you have to kill a runaway process.
  • The kill command will do this but you must
    specify a signal value. This signal tells the
    process to do something.
  • Solaris has 42 different signals that can be sent
    to a process. Well only look at 3 of them 1, 3,
    9.

7
Killing a Process
  • Trapping Signals
  • A process can do 3 things when it receives a
    signal
  • Ignore the signal
  • Do something like close all open files and
    exiting
  • Do what the signal tells it to do
  • If the process has a signal handler, then it
    can intercept the signal and do what the handler
    wants with it.

8
Killing a Process
  • The psig command (new to Solaris 8) will print a
    list showing what the process response will be
    to each of the 47 different signals.
  • There are 2 signals which cant be ignored.
  • 9 aka SIGKILL forces a process to release its
    resources and die. This could cause corruption of
    data if the process is I/O intensive.

9
Killing a Process
  • The second signal that cant be ignored
  • 23 aka SIGSTOP. This is used in shell-based job
    control and is invoked when you hit a Z. Solaris
    8 provides a pstop command which does the same
    thing.
  • To resume the process, use the prun command to
    restart the process from its suspended state.

10
Setting Process Priority
  • The nice command allows the administrator to
    change the priority of a running process.
  • Default nice value is 20. Do a ps elf and look
    at the NI field.
  • Nice values range from 0-39. But they are the
    number to be added to the default value of 20.
    Example nice n 10 PID will set the nice value
    to 30. You can use negative numbers to lower the
    priority. The renice command works on running
    processes.

11
Common Signals
12
Killing a Process
  • To see all the values for the kill command,
    enter kill l
  • To send a signal, enter kill s signal pid OR
    kill signal pid
  • Example
  • Kill 3 pid
  • pgrep command retrieves the PID of a process.
Write a Comment
User Comments (0)
About PowerShow.com