[ Team LiB ] |
Monitoring ProcessesThe programs that are running on a system at any one time are called processes. You can monitor the status of processes, control how much CPU time a process gets, find or signal processes, and suspend or halt the execution of a process. Commands for Monitoring ProcessesThe ps (process status) command is your main tool for obtaining information about processes. You can use the ps command in combination with the grep command to focus your search for specific information. You can also use the dispadmin, priocntl, nice, renice, pgrep, and pkill commands to manage processes. Table 9 lists the commands for managing processes.
Refer to the ps(1), dispadmin(1M), priocntl(1), nice(1), renice(1), pgrep(1), and pkill(1) manual pages for complete information about these commands. In addition, the /usr/proc/bin directory contains process tools that you can use to display highly detailed information about the processes listed in /proc. The /proc directory is also known as the process file system (procfs). ProcFS maps process information into the file system, enabling you to manipulate process attributes with a file-access paradigm. For more information about the /proc file system, see "Types of File Systems" on page 182. The process tools are similar to some options of the ps command, except that the output provided by the tools is more detailed. In general, the process tools do the following.
Table 10 summarizes the /usr/proc/bin commands.
For a complete description of the process tools, refer to the proc(1) manual page. For information about how to use the process tools commands to display details about processes and how to start and stop them, see "Using the /usr/proc/bin Commands" on page 55. Using the ps CommandYou can use the ps command to determine which processes are running (or not running) and to get the following detailed information about an individual process.
The ps command takes a snapshot of system activity at the time you type the command. If you are monitoring system activity by time, be aware that the results are already slightly out-of-date by the time you read them. Table 11 shows the most frequently used options for the ps command. See the ps(1) manual page for a complete list of options.
What the ps Command ReportsWhen you type ps -e and press Return, you get a report that looks like the following example.
mopoke% ps -e
PID TTY TIME CMD
0 ? 0:16 sched
1 ? 0:00 init
2 ? 0:00 pageout
3 ? 0:00 fsflush
411 ? 0:00 sac
237 ? 0:00 utmpd
208 ? 0:00 nscd
49 ? 0:00 sysevent
56 ? 0:00 picld
115 ? 0:00 in.route
179 ? 0:00 automoun
133 ? 0:00 rpcbind
189 ? 0:00 syslogd
155 ? 0:00 inetd
213 ? 0:00 lpsched
170 ? 0:00 lockd
176 ? 0:00 statd
511 ? 0:00 dtfile
193 ? 0:00 cron
226 ? 0:00 powerd
440 ? 0:00 Xsession
414 ? 0:00 ttymon
261 ? 0:02 vold
249 ? 0:00 smcboot
248 ? 0:00 smcboot
250 ? 0:00 smcboot
266 ? 0:00 htt
268 ? 0:00 htt_serv
401 ? 0:00 dmispd
372 ? 0:00 auditd
283 ? 0:00 dwhttpd
284 ? 0:23 dwhttpd
416 ? 0:00 sshd
434 ? 0:00 sendmail
454 ? 0:00 speckeys
432 ? 0:00 sendmail
439 ? 0:00 dtlogin
450 ? 0:00 fbconsol
487 pts/3 0:00 csh
503 pts/3 0:00 dtsessio
484 pts/3 0:00 sdt_shel
485 ? 0:00 dsdm
584 pts/6 0:00 ftp
419 ? 0:00 mibiisa
418 ?? 0:00 fbconsol
402 ? 0:00 snmpXdmi
415 ? 0:04 Xsun
395 ? 0:00 dtlogin
392 ? 0:00 snmpdx
412 console 0:00 ttymon
417 ? 0:00 dtlogin
504 ? 0:00 rpc.ttdb
502 pts/3 0:00 ttsessio
510 ? 0:01 dtwm
537 ? 0:00 rpc.rsta
513 ?? 0:01 dtterm
514 ? 0:00 sdtperfm
515 pts/3 0:00 sh
516 pts/3 0:00 dtpad
548 ? 0:00 cat
518 ? 0:00 sdtvolch
535 pts/7 0:00 csh
522 pts/4 0:00 csh
525 pts/5 0:00 csh
529 pts/6 0:00 csh
638 pts/4 0:00 ps
569 ? 0:04 .netscape
568 ? 0:00 netscape
570 ? 0:00 netscape
571 ? 0:00 .netscape
mopoke%
The columns are described in Table 12.
When you type ps -el and press Return, you get a listing that looks like the following example. mopoke% ps -el F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 19 T 0 0 0 0 0 SY ? 0 ? 0:16 sched 8 S 0 1 0 0 40 20 ? 150 ? ? 0:00 init 19 S 0 2 0 0 0 SY ? 0 ? ? 0:00 pageout 19 S 0 3 0 0 0 SY ? 0 ? ? 0:00 fsflush 8 S 0 411 1 0 40 20 ? 216 ? ? 0:00 sac 8 S 0 237 1 0 40 20 ? 130 ? ? 0:00 utmpd 8 S 0 208 1 0 40 20 ? 349 ? ? 0:00 nscd 8 S 0 49 1 0 40 20 ? 268 ? ? 0:00 sysevent 8 S 0 56 1 0 40 20 ? 367 ? ? 0:00 picld 8 S 0 115 1 0 40 20 ? 207 ? ? 0:00 in.route 8 S 0 179 1 0 40 20 ? 475 ? ? 0:00 automoun 8 S 0 133 1 0 40 20 ? 272 ? ? 0:00 rpcbind 8 S 0 189 1 0 40 20 ? 414 ? ? 0:00 syslogd 8 S 0 155 1 0 40 20 ? 297 ? ? 0:00 inetd 8 S 0 213 1 0 40 20 ? 391 ? ? 0:00 lpsched 8 S 0 170 1 0 40 20 ? 266 ? ? 0:00 lockd 8 S 1 176 1 0 40 20 ? 306 ? ? 0:00 statd 8 S 1001 511 503 0 50 20 ? 1097 ? ? 0:00 dtfile 8 S 0 193 1 0 40 20 ? 253 ? ? 0:00 cron 8 S 0 226 1 0 40 20 ? 174 ? ? 0:00 powerd 8 S 1001 440 439 0 40 20 ? 240 ? ? 0:00 Xsession 8 S 0 414 411 0 40 20 ? 217 ? ? 0:00 ttymon 8 S 0 261 1 0 40 20 ? 363 ? ? 0:02 vold 8 S 0 249 248 0 40 20 ? 215 ? ? 0:00 smcboot (Additional lines deleted from this example) Table 13 describes the fields in the long listing report.
Uses for the ps ReportWhen you need to check on which processes or daemons are running, use the ps -e option. If you need more detailed information about a process, use the ps -el options. See the ps(1) manual page for a complete list of options. With experience, you will know how the report should look and be able to judge what is out of the ordinary. The following guidelines can help you spot potential problems.
Signalling a ProcessThe Solaris Operating Environment provides a way to signal processes. A signal is an asynchronous notification of an event. With signals, you can interrupt a process or a thread within a process as the result of a specific event. Asynchronous signals can result from the current instruction stream. Such signals originate as hardware trap conditions for conditions such as illegal address references (segmentation violation) and illegal math operations (floating-point exceptions). The system also implements asynchronous signals that result from an external event that may not be related to the current instruction stream. Examples of such signals are job control signals, one process or thread sending a signal to another, or a kill signal sent to terminate a process. For example, the SIGHUP signal hangs up a process, SIGINT interrupts a process, and SIGKILL kills a process. Refer to signal(3HEAD) for a complete list of signals. Most signals can be ignored, a signal can be caught and a process-specific signal handler invoked, or a process can permit the default action to be taken. Every signal has a predefined default action. Killing ProcessesYou can use the kill command to deliver different signal types to programs. Many of those signals instruct a program to perform some predetermined and normal action. The following section describes how to use the kill command to terminate a process. You can use the kill command to eliminate a process entirely. The syntax of the kill command is kill -signal PID, where signal is a number or a name and PID is the process ID of the process to which you send the signal. The usual way to kill a process is to send it a certain signal. The TERM (-15) signal generally cleanly shuts down a process. If TERM (or some other signal you know the process is prepared to accept and act on) doesn't work, then you can send the KILL (-9) signal as a last resort. The KILL (-9) signal may result in loss of data, so you should not use it indiscriminately. Sometimes processes do not die when you use the kill command. The three most common cases are listed below.
Use the following steps to kill a process.
In the following example, OpenWindows is frozen on the system oak. You must log in remotely from another system and kill the process. elm% rlogin oak Password: oak% ps -e | grep openwin PID TTY TIME COMD 2212 pts/0 0:00 openwin 2213 pts/1 0:00 grep openwin oak% su Password: oak# kill 2212 oak# exit oak% logout elm% Using the /usr/proc/bin CommandsStarting with the Solaris 2.6 release, you can use a set of commands to display detailed, technical information about active processes. These commands are summarized in Table 14.
NOTE. If you use the /usr/proc/bin commands frequently, add the process tool directory to your PATH variable to make the commands more easily accessible. All of the /usr/bin/proc commands use the process ID (PID) as the argument to the command. You can obtain the PID by using the ps -e and the grep commands to search for the name of the process you want more information about. The following example displays the PID for the openwin process in the first column.
oak% ps -e | grep openwin
PID TTY TIME COMD
2212 pts/0 0:00 openwin
2213 pts/1 0:00 grep openwin
oak%
Displaying and Controlling Information About ProcessesUse the following steps to display and control information about a process.
The following examples show the output for each of the /usr/proc/bin commands for the dtlogin PID of 283. castle% ps -e | grep dtlogin 283 ? 0:00 dtlogin 270 ? 0:01 dtlogin castle% # /usr/proc/bin/pcred 283 283: e/r/suid=0 e/r/sgid=0 groups: 1 0 2 3 4 5 6 7 8 9 12 # exit castle% /usr/proc/bin/ptime 283 real 0.016 user 0.000 sys 0.016 castle% # /usr/proc/bin/pfiles 283 283: /usr/dt/bin/dtlogin -daemon Current rlimit: 64 file descriptors 0: S_IFDIR mode:0755 dev:32,24 ino:2 uid:0 gid:0 size:1024 O_RDONLY|O_LARGEFILE 1: S_IFDIR mode:0755 dev:32,24 ino:2 uid:0 gid:0 size:1024 O_RDONLY|O_LARGEFILE 2: S_IFREG mode:0644 dev:32,24 ino:326220 uid:0 gid:0 size:49 O_WRONLY|O_APPEND|O_LARGEFILE 3: S_IFCHR mode:0666 dev:32,24 ino:406038 uid:0 gid:3 rdev:13,12 O_RDWR 4: S_IFIFO mode:0666 dev:171,0 ino:4124779288 uid:0 gid:0 size:0 O_RDWR|O_NONBLOCK 5: S_IFREG mode:0644 dev:32,24 ino:326221 uid:0 gid:0 size:4 O_WRONLY|O_LARGEFILE advisory write lock set by process 270 7: S_IFSOCK mode:0666 dev:166,0 ino:32032 uid:0 gid:0 size:0 O_RDWR 8: S_IFDOOR mode:0444 dev:171,0 ino:4124780632 uid:0 gid:0 size:0 O_RDONLY|O_LARGEFILE FD_CLOEXEC door to nscd[174] # # /usr/proc/bin/pflags 283 283: /usr/dt/bin/dtlogin -daemon /1: flags = PR_PCINVAL|PR_ORPHAN|PR_ASLEEP [ wait() ] # # /usr/proc/bin/pldd 283 283: /usr/dt/bin/dtlogin -daemon /usr/openwin/lib/libXmu.so.4 /usr/openwin/lib/libX11.so.4 /usr/dt/lib/libDtSvc.so.1 /usr/lib/libresolv.so.2 /usr/lib/libdl.so.1 /usr/lib/libbsm.so.1 /usr/lib/libauth.so.1 /usr/lib/libsocket.so.1 /usr/lib/libnsl.so.1 /usr/dt/lib/libSDtFwa.so.1 /usr/lib/libc.so.1 /usr/openwin/lib/libXt.so.4 /usr/openwin/lib/libSM.so.6 /usr/openwin/lib/libICE.so.6 /usr/openwin/lib/libXext.so.0 /usr/lib/libm.so.1 /usr/openwin/lib/libtt.so.2 /usr/dt/lib/libXm.so.3 /usr/lib/libmp.so.2 /usr/lib/nss_files.so.1 /usr/lib/libpam.so.1 # # /usr/proc/bin/pmap 283 283: /usr/dt/bin/dtlogin -daemon 00010000 108K read/exec /usr/dt/bin/dtlogin 0003A000 32K read/write/exec /usr/dt/bin/dtlogin 00042000 80K read/write/exec [ heap ] EEE90000 12K read/shared dev:32,24 ino:196384 EEEA0000 12K read/shared dev:32,24 ino:196384 EEEB0000 12K read/shared dev:32,24 ino:196384 EEEC0000 8K read/write [ anon ] EEF11000 4K read/write [ anon ] EEF89000 4K read/write [ anon ] EF001000 4K read/write [ anon ] EF060000 24K read/exec /usr/lib/libpam.so.1 EF075000 4K read/write/exec /usr/lib/libpam.so.1 (More information, not shown here) EF7C0000 4K read/exec/shared /usr/lib/libdl.so.1 EF7D0000 112K read/exec /usr/lib/ld.so.1 EF7FB000 8K read/write/exec /usr/lib/ld.so.1 EF7FD000 4K read/write/exec [ anon ] EFFF9000 28K read/write/exec [ stack ] total 5480K # # /usr/proc/bin/psig 283 283: /usr/dt/bin/dtlogin -daemon HUP ignored INT caught RESETHAND,NODEFER QUIT ignored ILL default TRAP default ABRT default EMT default FPE default KILL default BUS default SEGV default SYS default PIPE ignored ALRM default TERM caught RESETHAND,NODEFER USR1 caught RESETHAND,NODEFER USR2 default CLD default NOCLDSTOP PWR default WINCH default URG default POLL default STOP default TSTP default CONT default TTIN ignored TTOU default VTALRM default PROF default XCPU ignored XFSZ ignored WAITING default LWP default FREEZE default THAW default CANCEL default LOST default RTMIN default RTMIN+1 default RTMIN+2 default RTMIN+3 default RTMAX-3 default RTMAX-2 default RTMAX-1 default RTMAX default # # /usr/proc/bin/pstack 283 283: /usr/dt/bin/dtlogin -daemon ef479154 wait () ef479154 _libc_wait (0, 3ec4c, 3b000, 12d, ef4e227c, 1e340) + 8 0001e340 ManageSession (43000, 43000, 482f8, ef001230, 81010100, c) + 454 00019348 StartDisplay (482f8, 3c954, 43000, 3b224, ef001240, ff00) + 7bc 0001a324 ForEachDisplay (189a8, 0, 2400, 41800, 42e48, 17ca8) + 1c 00017d54 main (0, effffefc, efffff08, 3b000, 0, 0) + 228 0001541c _start (0, 0, 0, 0, 0, 0) + dc # # /usr/proc/bin/pwdx 283 283: / # castle% /usr/proc/ptime 283 real 0.066 user 0.000 sys 0.032 castle% castle% ptree 283 270 /usr/dt/bin/dtlogin -daemon 283 /usr/dt/bin/dtlogin -daemon 301 /bin/ksh /usr/dt/bin/Xsession 311 /usr/openwin/bin/fbconsole 346 /usr/dt/bin/sdt_shell -c unsetenv _ PWD; unsetenv DT; 349 -csh -c unsetenv _ PWD; unsetenv DT; setenv DISP 366 /usr/dt/bin/dtsession 373 dtwm 374 dtterm -session dt0vPI0t -sdtserver 387 /bin/csh 407 ./textedit 528 sh 390 /bin/csh 393 /bin/csh 417 /usr/openwin/bin/cmdtool 420 /bin/csh 531 /bin/csh 553 ptree 283 375 dtfile -session dtbfiQD_ 405 dtfile -session dtbfiQD_ 376 snapshot -Wp 781 588 -Ws 326 201 -WP 6 6 +Wi -f snapshot.rs castle% The Priority Control Command (priocntl)You can use the priocntl command to display or set scheduling parameters of specified processes. You can also use it to display the current configuration information for the process scheduler of a system or to execute a command with specified scheduling parameters. Solaris provides several scheduling classes, each with its own scheduling policy. A process can be assigned to one of these classes; the process priority can then be adjusted within the boundaries allowed by that particular scheduling class.
For the timesharing class, the user-supplied priority ranges from –20 to +20. The priority of a timeshare process, referred to as the user-mode priority, is inherited from the parent process. The system looks up the user-mode priority in its timesharing dispatch parameter table, adds in any nice or priocntl (user-supplied) priority, and ensures a 0–59 range to create a global priority. In the default configuration, a runnable real-time process runs before any other process. Inappropriate use of real-time processes can have a dramatic, negative impact on system performance. Creating and Administering Resource Management Pools
Once you have created a pool configuration file, activate it with the pooladm(1M) command, which is also automatically run at boot time if the /etc/pooladm.conf file is present. You can bind processes, tasks, or projects to a pool with the poolbind(1M) command or query the binding for a process, if you have the appropriate authorizations. You can also specify the binding of a project to a pool with an attribute in the project(4) database. This binding is used when you are logging in or when you use the newtask(1) command. Solaris 9 also introduces the concept of a task, which is a collection of processes. Tasks remove the limitations of current process aggregates such as process groups and sessions. Tasks are bound to projects whose membership and attributes are described in the project(4) database. The SMC Projects tool is a GUI front end that you can use to administer projects and tasks in addition to the commands. Refer to Sun's System Administration Guide: Resource Management and Network Services and the relevant manual pages for more information about creating and administering resource management pools. Displaying Basic Information About Process ClassesUse the following procedure to display basic information about process classes.
In the following example, all classes except RT are loaded at the moment.
paperbark% priocntl -l
CONFIGURED CLASSES
==================
SYS (System Class)
TS (Time Sharing)
Configured TS User Priority Range: -60 through 60
IA (Interactive)
Configured IA User Priority Range: -60 through 60
paperbark%
Displaying the Global Priority of a ProcessYou can use the ps command to display the global priority of a process. The global priority is listed under the PRI column.
mopoke% ps -ecl
F S UID PID PPID CLS PRI ADDR SZ WCHAN TTY TIME CMD
19 T 0 0 0 SYS 96 ? 0 ? 0:13 sched
8 S 0 1 0 TS 59 ? 150 ? ? 0:00 init
19 S 0 2 0 SYS 98 ? 0 ? ? 0:00 pageout
19 S 0 3 0 SYS 60 ? 0 ? ? 0:00 fsflush
8 S 0 411 1 TS 59 ? 216 ? ? 0:00 sac
8 S 0 237 1 TS 59 ? 130 ? ? 0:00 utmpd
8 S 0 208 1 TS 59 ? 347 ? ? 0:00 nscd
8 S 0 49 1 TS 59 ? 268 ? ? 0:00 sysevent
8 S 0 56 1 TS 59 ? 367 ? ? 0:00 picld
8 S 0 115 1 TS 59 ? 207 ? ? 0:00 in.route
8 S 0 179 1 TS 59 ? 475 ? ? 0:00 automoun
8 S 0 133 1 TS 59 ? 272 ? ? 0:00 rpcbind
8 S 0 170 1 TS 59 ? 266 ? ? 0:00 lockd
8 S 0 155 1 TS 59 ? 297 ? ? 0:00 inetd
8 S 0 189 1 TS 59 ? 414 ? ? 0:00 syslogd
8 S 0 213 1 TS 59 ? 391 ? ? 0:00 lpsched
8 S 1 176 1 TS 59 ? 306 ? ? 0:00 statd
8 S 0 193 1 TS 59 ? 253 ? ? 0:00 cron
8 S 0 226 1 TS 59 ? 174 ? ? 0:00 powerd
8 S 0 414 411 TS 59 ? 217 ? ? 0:00 ttymon
8 S 0 261 1 TS 59 ? 363 ? ? 0:02 vold
8 S 0 249 248 TS 59 ? 215 ? ? 0:00 smcboot
8 S 0 248 1 TS 59 ? 215 ? ? 0:00 smcboot
8 S 0 250 248 TS 59 ? 215 ? ? 0:00 smcboot
8 S 0 266 1 TS 59 ? 121 ? ? 0:00 htt
8 S 0 268 266 TS 59 ? 378 ? ? 0:00 htt_serv
8 S 1001 416 395 IA 59 ? 3568 ? ? 0:07 Xsun
8 S 0 372 1 TS 59 ? 227 ? ? 0:00 auditd
8 S 1 283 1 TS 59 ? 1178 ? ? 0:00 dwhttpd
8 S 1 284 283 TS 59 ? 1277 ? ? 0:00 dwhttpd
8 S 0 417 395 IA 59 ? 662 ? ? 0:00 dtlogin
8 S 1001 483 480 IA 59 ? 184 ? pts/3 0:00 csh
8 S 1001 446 436 IA 59 ? 292 ? ? 0:00 fbconsol
8 S 1001 436 435 IA 59 ? 240 ? ? 0:00 Xsession
8 S 0 435 417 IA 59 ? 662 ? ? 0:00 dtlogin
8 S 1001 450 1 IA 59 ? 639 ? ? 0:00 speckeys
8 S 1001 499 483 IA 49 ? 999 ? pts/3 0:00 dtsessio
8 S 1001 507 499 IA 49 ? 1097 ? ? 0:00 dtfile
8 S 1001 480 436 IA 59 ? 496 ? pts/3 0:00 sdt_shel
8 S 1001 481 1 IA 59 ? 295 ? ? 0:00 dsdm
8 O 1001 555 522 IA 59 ? 138 pts/4 0:00 ps
8 S 0 419 391 TS 59 ? 288 ? ? 0:00 mibiisa
8 S 0 401 1 TS 59 ? 384 ? ? 0:00 dmispd
8 S 0 415 1 TS 59 ? 331 ? ? 0:00 sshd
8 S 0 402 1 TS 59 ? 439 ? ? 0:00 snmpXdmi
8 S 0 395 1 TS 59 ? 621 ? ? 0:00 dtlogin
8 S 0 418 395 IA 59 ? 292 ? ?? 0:00 fbconsol
8 S 0 391 1 TS 59 ? 268 ? ? 0:00 snmpdx
8 S 0 412 1 TS 59 ? 217 ? console 0:00 ttymon
8 S 1001 498 1 IA 59 ? 574 ? pts/3 0:00 ttsessio
8 S 0 500 155 TS 59 ? 427 ? ? 0:00 rpc.ttdb
8 S 1001 506 499 IA 59 ? 1158 ? ? 0:02 dtwm
8 S 1001 528 509 IA 59 ? 180 ? pts/6 0:00 csh
8 R 1001 509 499 IA 59 ? 1004 ? ? 0:00 dtterm
8 S 1001 510 499 IA 59 ? 921 ? ? 0:00 sdtperfm
8 S 1001 518 498 IA 59 ? 137 ? pts/3 0:00 sh
8 S 1001 512 1 IA 59 ? 239 ? ? 0:00 sdtvolch
8 S 1001 519 518 IA 49 ? 907 ? pts/3 0:00 dtpad
8 S 1001 545 507 IA 49 ? 1097 ? ? 0:00 dtfile
8 S 0 520 155 TS 59 ? 230 ? ? 0:00 rpc.rsta
8 S 1001 522 509 IA 59 ? 180 ? pts/4 0:00 csh
8 S 1001 525 509 IA 59 ? 180 ? pts/5 0:00 csh
8 S 1001 531 509 IA 59 ? 180 ? pts/7 0:00 csh
8 S 1001 544 512 IA 59 ? 122 ? ? 0:00 cat
8 S 0 546 1 TS 59 ? 565 ? ? 0:00 sendmail
8 S 25 547 1 TS 59 ? 561 ? ? 0:00 sendmail
mopoke%
You can also use the /usr/sbin/dispadmin -l command to display process scheduler information. The following example shows the output from the dispadmin -l command.
castle% /usr/sbin/dispadmin -l
CONFIGURED CLASSES
==================
SYS (System Class)
TS (Time Sharing)
IA (Interactive)
castle%
For complete information, refer to the dispadmin(1M) manual page. Designating a Process PriorityUse the following steps to designate a process priority.
The following example starts the find command with the highest possible user-supplied priority. # priocntl -e-c TS -m 60 -p 60 find . -name core -print mopoke% mopoke% ps -ecl | grep find 8 S 0 686 682 TS 60 ? 133 ? pts/7 0:00 find mopoke% Changing the Class of a ProcessUse the following steps to change the class of a process.
NOTE. You must be superuser or working in a real-time shell to change the class of a process from or to realtime.
# priocntl -s -c TS -i uid 1001 # ps -ecl | grep 1001 8 S 1001 496 481 TS 59 ? 137 ? pts/4 0:00 sh 8 S 1001 497 496 TS 59 ? 152 ? pts/4 0:00 more 8 S 1001 329 308 TS 59 ? 3801 ? ? 0:35 Xsun 8 S 1001 350 332 TS 59 ? 241 ? ? 0:00 Xsession 8 S 1001 408 1 TS 59 ? 590 ? pts/3 0:00 ttsessio 8 S 1001 360 350 TS 59 ? 297 ? ? 0:00 fbconsol 8 S 1001 417 409 TS 59 ? 1105 ? ? 0:00 dtfile 8 S 1001 364 1 TS 59 ? 326 ? ? 0:00 speckeys 8 S 1001 394 391 TS 59 ? 182 ? pts/3 0:00 csh 8 S 1001 391 350 TS 59 ? 501 ? pts/3 0:00 sdt_shel 8 S 1001 392 1 TS 59 ? 300 ? ? 0:00 dsdm 8 S 1001 409 394 TS 59 ? 1015 ? pts/3 0:00 dtsessio 8 S 1001 416 409 TS 59 ? 1176 ? ? 0:03 dtwm 8 S 1001 418 409 TS 59 ? 977 ? ?? 0:01 dtterm 8 S 1001 430 418 TS 59 ? 180 ? pts/4 0:00 csh 8 S 1001 420 409 TS 59 ? 929 ? ? 0:00 sdtperfm 8 S 1001 450 417 TS 59 ? 1105 ? ? 0:00 dtfile 8 S 1001 422 408 TS 59 ? 137 ? pts/3 0:00 sh 8 S 1001 423 422 TS 59 ? 913 ? pts/3 0:00 dtpad 8 S 1001 424 1 TS 59 ? 240 ? ? 0:00 sdtvolch 8 S 1001 455 424 TS 59 ? 122 ? ? 0:00 cat 8 S 1001 435 418 TS 59 ? 180 ? pts/5 0:00 csh 8 S 1001 439 418 TS 59 ? 180 ? pts/6 0:00 csh 8 S 1001 442 418 TS 59 ? 182 ? pts/7 0:00 csh 8 S 1001 481 430 TS 59 ? 131 ? pts/4 0:00 man 8 S 1001 545 442 TS 59 ? 517 ? pts/7 0:03 spider.e 8 S 1001 690 439 TS 59 ? 235 ? pts/6 0:00 ftp 8 S 1001 610 608 TS 59 ? 2574 ? ? 0:00 .netscap 8 S 1001 607 1 TS 59 ? 630 ? ? 0:00 netscape 8 S 1001 609 607 TS 59 ? 653 ? ? 0:00 netscape 8 S 1001 608 607 TS 59 ? 3165 ? ? 0:20 .netscap # Setting Fair-Share ParametersThe valid class-specific options for setting fair-share parameters—new in the Solaris 9 release—are shown in Table 15.
Setting Fixed-Priority ParametersThe valid class-specific options for setting fixed-priority parameters—new in the Solaris 9 release—are shown in Table 16.
Use the following steps to assign a fixed priority to a command.
The following example executes a command in the fixed-priority class with a user-priority limit of 20, a user priority of 10, and a time quantum of 250 milliseconds. mopoke% su Password: # priocntl -e -c FX -m 20 -p 10 -t 250 ps -ef | grep priocntl root 701 674 0 01:01:52 pts/4 0:00 grep priocntl # Setting the Priority of a Process (nice)
You can use the priocntl command (preferred) or the nice command to raise or lower the priority of a command or a process. When you use the nice command without an argument, the default is to increase the nice number by four units, thus lowering the priority of the process.
NOTE. You must be superuser to raise the priority of a process with the nice command. Users can lower their own process priorities. Use the following command to lower the priority of a command by four units (the default).
/usr/bin/nice command-name
Use the following command to lower the priority of a command by increasing the nice number by ten units.
/usr/bin/nice -n +10 command-name
NOTE. The plus sign (+) is optional for positive numbers. The minus sign (–) is required for negative numbers. Use the following command to raise the priority of a command by lowering the nice number by ten units.
/usr/bin/nice -10 command-name
Use the following command to raise the priority of a command by lowering the nice number by ten units. The minus sign indicates a negative number.
/usr/bin/nice -10 command-name
Changing the Priority of a Running Process (renice)If you want to alter the scheduling priority of one or more running processes, you can use the renice command. Specify the process IDs of the processes to be affected. If the first operand is a number within the range of priorities (–20 to 20), renice treats it as a priority. Otherwise, renice treats it as an ID. Users other than superuser can alter the priority only of processes they own and can increase their nice value only within the range 0 to 19. The following example adjusts the system scheduling priority so that process IDs 987 and 32 have a lower scheduling priority.
paperbark% renice -n 5 -p 987 32
paperbark%
The -n option specifies the system scheduling priority, and the -p option specifies the process ID numbers to adjust. Finding or Signalling Processes (pgrep, pkill)You can use the pgrep command to examine the active processes on the system and report the process IDs of the processes whose attributes match the command-line argument. The simplest way to use pgrep is to type the command with the name of the process as the argument.
pgrep process-name
Refer to the pgrep(1) manual page for a complete listing of options and arguments. The following example uses pgrep to find the process ID of the sendmail command.
paperbark% pgrep sendmail
2830
paperbark%
The pkill command works in the same way as pgrep except that it signals each matching process as would kill(1) instead of displaying the process ID. You can specify a signal name or number as the first command-line option to pkill. Refer to the pgrep(1) manual page for a complete listing of options and arguments for pkill. The following example terminates the most recently created xterm.
paperbark% pkill -n xterm
paperbark%
|
[ Team LiB ] |