|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. Managing Terminals and Modems (Overview) 2. Setting Up Terminals and Modems (Tasks) 3. Managing Serial Ports With the Service Access Facility (Tasks) 4. Managing System Resources (Overview) 5. Displaying and Changing System Information (Tasks) 8. Scheduling System Tasks (Tasks) 9. Managing System Accounting (Tasks) 10. System Accounting (Reference) 11. Managing System Performance (Overview) 12. Managing System Processes (Tasks) Managing System Processes (Task Map) Commands for Managing System Processes How to Display Information About Processes Managing Process Class Information (Task Map) Managing Process Class Information How to Display Basic Information About Process Classes (priocntl) How to Display the Global Priority of a Process How to Designate a Process Priority (priocntl) How to Change Scheduling Parameters of a Timesharing Process (priocntl) How to Change the Class of a Process (priocntl) How to Change the Priority of a Process (nice) Troubleshooting Problems With System Processes 13. Monitoring System Performance (Tasks) 14. Troubleshooting Software Problems (Overview) 16. Managing Core Files (Tasks) 17. Managing System Crash Information (Tasks) 18. Troubleshooting Miscellaneous Software Problems (Tasks) 19. Troubleshooting File Access Problems (Tasks) 20. Resolving UFS File System Inconsistencies (Tasks) |
Commands for Managing System ProcessesThe following table describes the commands for managing system processes. Table 12-1 Commands for Managing Processes
The Solaris Management Console's Processes tool enables you to manage processes with a user-friendly interface. For information on using and starting the Solaris Management Console, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration. Using the ps CommandThe ps command enables you to check the status of active processes on a system, as well as display technical information about the processes. This data is useful for administrative tasks such as determining how to set process priorities. Depending on which options you use, the ps command reports the following information:
The following table describes some fields that are reported by the ps command. Which fields are displayed depend on which option you choose. For a description of all available options, see the ps(1) man page. Table 12-2 Summary of Fields in ps Reports
Using the /proc File System and CommandsYou can display detailed information about the processes that are listed in the /proc directory by using process commands. The following table lists the /proc process commands. The /proc directory is also known as the process file system (PROCFS). Images of active processes are stored here by their process ID number. Table 12-3 Process Commands (/proc)
For more information, see proc(1). The process tools are similar to some options of the ps command, except that the output that is provided by these commands is more detailed. In general, the process commands do the following:
Managing Processes With Process Commands (/proc)You can display detailed, technical information about processes or control active processes by using some of the process commands. Table 12-3 lists some of the /proc commands. If a process becomes trapped in an endless loop, or if the process takes too long to execute, you might want to stop (kill) the process. For more information about stopping processes using the kill or the pkill command, see Chapter 12, Managing System Processes (Tasks). The /proc file system is a directory hierarchy that contains additional subdirectories for state information and control functions. The /proc file system also provides an xwatchpoint facility that is used to remap read-and-write permissions on the individual pages of a process's address space. This facility has no restrictions and is MT-safe. Debugging tools have been modified to use /proc's xwatchpoint facility, which means that the entire xwatchpoint process is faster. The following restrictions have been removed when you set xwatchpoints by using the dbx debugging tool:
For more information, see the proc(4), and mdb(1) man pages. How to List Processes
The following example shows output from the ps command when no options are used. $ ps PID TTY TIME COMD 1664 pts/4 0:06 csh 2081 pts/4 0:00 ps The following example shows output from the ps -ef command. This output shows that the first process that is executed when the system boots is sched (the swapper) followed by the init process, pageout, and so on. $ ps -ef UID PID PPID C STIME TTY TIME CMD root 0 0 0 Dec 20 ? 0:17 sched root 1 0 0 Dec 20 ? 0:00 /etc/init - root 2 0 0 Dec 20 ? 0:00 pageout root 3 0 0 Dec 20 ? 4:20 fsflush root 374 367 0 Dec 20 ? 0:00 /usr/lib/saf/ttymon root 367 1 0 Dec 20 ? 0:00 /usr/lib/saf/sac -t 300 root 126 1 0 Dec 20 ? 0:00 /usr/sbin/rpcbind root 54 1 0 Dec 20 ? 0:00 /usr/lib/sysevent/syseventd root 59 1 0 Dec 20 ? 0:00 /usr/lib/picl/picld root 178 1 0 Dec 20 ? 0:03 /usr/lib/autofs/automountd root 129 1 0 Dec 20 ? 0:00 /usr/sbin/keyserv root 213 1 0 Dec 20 ? 0:00 /usr/lib/lpsched root 154 1 0 Dec 20 ? 0:00 /usr/sbin/inetd -s root 139 1 0 Dec 20 ? 0:00 /usr/lib/netsvc/yp/ypbind ... root 191 1 0 Dec 20 ? 0:00 /usr/sbin/syslogd root 208 1 0 Dec 20 ? 0:02 /usr/sbin/nscd root 193 1 0 Dec 20 ? 0:00 /usr/sbin/cron root 174 1 0 Dec 20 ? 0:00 /usr/lib/nfs/lockd daemon 175 1 0 Dec 20 ? 0:00 /usr/lib/nfs/statd root 376 1 0 Dec 20 ? 0:00 /usr/lib/ssh/sshd root 226 1 0 Dec 20 ? 0:00 /usr/lib/power/powerd root 315 1 0 Dec 20 ? 0:00 /usr/lib/nfs/mountd root 237 1 0 Dec 20 ? 0:00 /usr/lib/utmpd . . . How to Display Information About Processes
The following example shows how to use process commands to display more information about a cron process. # pgrep cron 1 4780 # pwdx 4780 2 4780: /var/spool/cron/atjobs # ptree 4780 3 4780 /usr/sbin/cron # pfiles 4780 4 4780: /usr/sbin/cron Current rlimit: 256 file descriptors 0: S_IFCHR mode:0666 dev:290,0 ino:6815752 uid:0 gid:3 rdev:13,2 O_RDONLY|O_LARGEFILE /devices/pseudo/mm@0:null 1: S_IFREG mode:0600 dev:32,128 ino:42054 uid:0 gid:0 size:9771 O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE /var/cron/log 2: S_IFREG mode:0600 dev:32,128 ino:42054 uid:0 gid:0 size:9771 O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE /var/cron/log 3: S_IFIFO mode:0600 dev:32,128 ino:42049 uid:0 gid:0 size:0 O_RDWR|O_LARGEFILE /etc/cron.d/FIFO 4: S_IFIFO mode:0000 dev:293,0 ino:4630 uid:0 gid:0 size:0 O_RDWR|O_NONBLOCK 5: S_IFIFO mode:0000 dev:293,0 ino:4630 uid:0 gid:0 size:0 O_RDWR
How to Control Processes
The following example shows how to use process command to stop and restart the dtpad process. # pgrep dtpad 1 2921 # pstop 29212 # prun 2921 3
Terminating a Process (pkill, kill)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. 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 most likely will crash the system. For more information, see the pgrep(1) and pkill(1) and kill(1) man pages. How to Terminate a Process (pkill)
How to Terminate a Process (kill)
Debugging a Process (pargs, preap)The pargs command and the preap command improve process debugging. The pargs command prints the arguments and environment variables associated with a live process or core file. The preap command removes defunct (zombie) processes. A zombie process has not yet had its exit status claimed by its parent. These processes are generally harmless but can consume system resources if they are numerous. You can use the pargs and preap commands to examine any process that you have the privileges to examine. As superuser, you can examine any process. For information on using the preap command, see the preap(1) man page. For information on the using the pargs command, see the pargs(1) man page. See also, the proc(1) man page. Example 12-4 Debugging a Process (pargs)The pargs command solves a long-standing problem of being unable to display with the ps command all the arguments that are passed to a process. The following example shows how to use the pargs command in combination with the pgrep command to display the arguments that are passed to a process. # pargs `pgrep ttymon` 579: /usr/lib/saf/ttymon -g -h -p system-name console login: -T sun -d /dev/console -l argv[0]: /usr/lib/saf/ttymon argv[1]: -g argv[2]: -h argv[3]: -p argv[4]: system-name console login: argv[5]: -T argv[6]: sun argv[7]: -d argv[8]: /dev/console argv[9]: -l argv[10]: console argv[11]: -m argv[12]: ldterm,ttcompat 548: /usr/lib/saf/ttymon argv[0]: /usr/lib/saf/ttymon The following example shows how to use the pargs -e command to display the environment variables that are associated with a process. $ pargs -e 6763 6763: tcsh envp[0]: DISPLAY=:0.0 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|