Presentation is loading. Please wait.

Presentation is loading. Please wait.

Va-scanCopyright 2002, Marchany Unit 7 – Solaris Process Control Randy Marchany VA Tech Computing Center.

Similar presentations


Presentation on theme: "Va-scanCopyright 2002, Marchany Unit 7 – Solaris Process Control Randy Marchany VA Tech Computing Center."— Presentation transcript:

1 va-scanCopyright 2002, Marchany Unit 7 – Solaris Process Control Randy Marchany VA Tech Computing Center

2 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany 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. We’ll only look at 3 of them: 1, 3, 9.

7 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany 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 can’t 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 va-scanCopyright 2002, Marchany Killing a Process  The second signal that can’t 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 va-scanCopyright 2002, Marchany 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 va-scanCopyright 2002, Marchany Common Signals You want to gracefully kill a process Send SIGTERM (15) to the process (kill –15 pid) You want to suspend a process not kill it Hit ^Z or kill –23 pid Process refuses to respond to a 1, 2 or 15 Kill –9 pid Suspended process needs to be restarted Send SIGCONT(25)

12 va-scanCopyright 2002, Marchany 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.


Download ppt "Va-scanCopyright 2002, Marchany Unit 7 – Solaris Process Control Randy Marchany VA Tech Computing Center."

Similar presentations


Ads by Google