From owner-svn-doc-all@FreeBSD.ORG Tue Oct 22 18:58:13 2013 Return-Path: Delivered-To: svn-doc-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 79420A6B; Tue, 22 Oct 2013 18:58:13 +0000 (UTC) (envelope-from dru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B0F52FA3; Tue, 22 Oct 2013 18:58:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MIwD0j089517; Tue, 22 Oct 2013 18:58:13 GMT (envelope-from dru@svn.freebsd.org) Received: (from dru@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MIwDNd089516; Tue, 22 Oct 2013 18:58:13 GMT (envelope-from dru@svn.freebsd.org) Message-Id: <201310221858.r9MIwDNd089516@svn.freebsd.org> From: Dru Lavigne Date: Tue, 22 Oct 2013 18:58:13 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r43021 - head/en_US.ISO8859-1/books/handbook/basics X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire doc trees \(except for " user" , " projects" , and " translations" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 18:58:13 -0000 Author: dru Date: Tue Oct 22 18:58:12 2013 New Revision: 43021 URL: http://svnweb.freebsd.org/changeset/doc/43021 Log: Combine "Processes" and "Daemons, Signals, and Killing Processes" into one section entitled "Processes and Daemons" - introduce daemons and processes in same introductory section - add headings for viewing processes and for killing processes - update listings To be followed by a white space fix. Modified: head/en_US.ISO8859-1/books/handbook/basics/chapter.xml Modified: head/en_US.ISO8859-1/books/handbook/basics/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/handbook/basics/chapter.xml Tue Oct 22 10:04:16 2013 (r43020) +++ head/en_US.ISO8859-1/books/handbook/basics/chapter.xml Tue Oct 22 18:58:12 2013 (r43021) @@ -2859,7 +2859,7 @@ root 5211 0.0 0.2 3620 1724 2 - Processes + Processes and Daemons &os; is a multi-tasking operating system. Each program running at any one time is called a @@ -2877,9 +2877,33 @@ root 5211 0.0 0.2 3620 1724 2 process which has the shell as its parent process. The exception is a special process called &man.init.8; which is always the first process to start at boot time and which always - has a PID of 1. + has a PID of 1. - To see the processes on the system, use &man.ps.1; and + Some programs are not designed + to be run with continuous user input and disconnect from the + terminal at the first opportunity. For example, a web server + responds to web requests, rather than user input. Mail servers + are another example of this type of application. These types of + programs are known as daemons. + The term daemon comes from Greek mythology and represents an + entity that is neither good nor evil, and which invisibly + performs useful tasks. This is why the BSD mascot is the + cheerful-looking daemon with sneakers and a pitchfork. + + There is a convention to name programs that normally run as + daemons with a trailing d. For example, + BIND is the Berkeley Internet Name + Domain, but the actual program that executes is named. + The Apache web server program is + httpd and the line printer spooling daemon + is lpd. This is only a naming convention. For example, + the main mail daemon for the Sendmail + application is sendmail, and not + maild. + + Viewing Processes + + To see the processes running on the system, use &man.ps.1; or &man.top.1;. To display a static list of the currently running processes, their PIDs, how much memory they are using, and the command they were started with, use @@ -2891,21 +2915,9 @@ root 5211 0.0 0.2 3620 1724 2 running and owned by the user. For example: &prompt.user; ps - PID TT STAT TIME COMMAND - 298 p0 Ss 0:01.10 tcsh - 7078 p0 S 2:40.88 xemacs mdoc.xsl (xemacs-21.1.14) -37393 p0 I 0:03.11 xemacs freebsd.dsl (xemacs-21.1.14) -72210 p0 R+ 0:00.00 ps - 390 p1 Is 0:01.14 tcsh - 7059 p2 Is+ 1:36.18 /usr/local/bin/mutt -y - 6688 p3 IWs 0:00.00 tcsh -10735 p4 IWs 0:00.00 tcsh -20256 p5 IWs 0:00.00 tcsh - 262 v0 IWs 0:00.00 -tcsh (tcsh) - 270 v0 IW+ 0:00.00 /bin/sh /usr/X11R6/bin/startx -- -bpp 16 - 280 v0 IW+ 0:00.00 xinit /home/nik/.xinitrc -- -bpp 16 - 284 v0 IW 0:00.00 /bin/sh /home/nik/.xinitrc - 285 v0 S 0:38.45 /usr/X11R6/bin/sawfish + PID TT STAT TIME COMMAND +8203 0 Ss 0:00.59 /bin/csh +8895 0 R+ 0:00.00 ps The output from &man.ps.1; is organized into a number of columns. The PID column displays the process @@ -2922,19 +2934,18 @@ root 5211 0.0 0.2 3620 1724 2 COMMAND is the command that was used to start the program. - &man.ps.1; supports a number of different options to change + A number of different options are available to change the information that is displayed. One of the most useful sets - is auxww. displays - information about all the running processes of all users. - displays the username of the process' owner, - as well as memory usage. displays + is auxww, where displays + information about all the running processes of all users, + displays the username and memory usage of the process' owner, + displays information about daemon processes, and causes &man.ps.1; to display the full command line for each process, rather than truncating it once it gets too long to fit on the screen. - The output from &man.top.1; is similar. A sample session - looks like this: + The output from &man.top.1; is similar: &prompt.user; top last pid: 72257; load averages: 0.13, 0.09, 0.03 up 0+13:38:33 22:39:10 @@ -2943,23 +2954,38 @@ CPU states: 12.6% user, 0.0% nice, 7.8 Mem: 36M Active, 5256K Inact, 13M Wired, 6312K Cache, 15M Buf, 408K Free Swap: 256M Total, 38M Used, 217M Free, 15% Inuse - PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND -72257 nik 28 0 1960K 1044K RUN 0:00 14.86% 1.42% top - 7078 nik 2 0 15280K 10960K select 2:54 0.88% 0.88% xemacs-21.1.14 - 281 nik 2 0 18636K 7112K select 5:36 0.73% 0.73% XF86_SVGA - 296 nik 2 0 3240K 1644K select 0:12 0.05% 0.05% xterm - 175 root 2 0 924K 252K select 1:41 0.00% 0.00% syslogd - 7059 nik 2 0 7260K 4644K poll 1:38 0.00% 0.00% mutt -... +last pid: 9609; load averages: 0.56, 0.45, 0.36 up 0+00:20:03 10:21:46 +107 processes: 2 running, 104 sleeping, 1 zombie +CPU: 6.2% user, 0.1% nice, 8.2% system, 0.4% interrupt, 85.1% idle +Mem: 541M Active, 450M Inact, 1333M Wired, 4064K Cache, 1498M Free +ARC: 992M Total, 377M MFU, 589M MRU, 250K Anon, 5280K Header, 21M Other +Swap: 2048M Total, 2048M Free + + PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND + 557 root 1 -21 r31 136M 42296K select 0 2:20 9.96% Xorg + 8198 dru 2 52 0 449M 82736K select 3 0:08 5.96% kdeinit4 + 8311 dru 27 30 0 1150M 187M uwait 1 1:37 0.98% firefox + 431 root 1 20 0 14268K 1728K select 0 0:06 0.98% moused + 9551 dru 1 21 0 16600K 2660K CPU3 3 0:01 0.98% top + 2357 dru 4 37 0 718M 141M select 0 0:21 0.00% kdeinit4 + 8705 dru 4 35 0 480M 98M select 2 0:20 0.00% kdeinit4 + 8076 dru 6 20 0 552M 113M uwait 0 0:12 0.00% soffice.bin + 2623 root 1 30 10 12088K 1636K select 3 0:09 0.00% powerd + 2338 dru 1 20 0 440M 84532K select 1 0:06 0.00% kwin + 1427 dru 5 22 0 605M 86412K select 1 0:05 0.00% kdeinit4 The output is split into two sections. The header (the - first five lines) shows the PID of the last + first five or six lines) shows the PID of the last process to run, the system load averages (which are a measure of how busy the system is), the system uptime (time since the last reboot) and the current time. The other figures in the - header relate to how many processes are running (47 in this - case), how much memory and swap space has been used, and how - much time the system is spending in different CPU states. + header relate to how many processes are running, + how much memory and swap space has been used, and how + much time the system is spending in different CPU states. If + the system has been formatted with the ZFS + file system, the ARC line provides an + indication of how much data was read from the memory cache + instead of from disk. Below the header is a series of columns containing similar information to the output from &man.ps.1;, such as the @@ -2969,46 +2995,18 @@ Swap: 256M Total, 38M Used, 217M Free, 1 This is split into two columns: one for total size and one for resident size. Total size is how much memory the application has needed and the resident size is how much it is actually - using at the moment. In this example, - mutt has required almost 8 MB - of RAM, but is currently only using 5 MB. + using now. &man.top.1; automatically updates the display every two seconds. A different interval can be specified with . - + - - Daemons, Signals, and Killing Processes - - When using an editor, it is easy to control the editor and - load files because the editor provides facilities to do so, and - because the editor is attached to a - terminal. Some programs are not designed - to be run with continuous user input and disconnect from the - terminal at the first opportunity. For example, a web server - responds to web requests, rather than user input. Mail servers - are another example of this type of application. - - These programs are known as daemons. - The term daemon comes from Greek mythology and represents an - entity that is neither good or evil, and which invisibly - performs useful tasks. This is why the BSD mascot is the - cheerful-looking daemon with sneakers and a pitchfork. - - There is a convention to name programs that normally run as - daemons with a trailing d. - BIND is the Berkeley Internet Name - Domain, but the actual program that executes is &man.named.8;. - The Apache web server program is - httpd and the line printer spooling daemon - is &man.lpd.8;. This is only a naming convention. For example, - the main mail daemon for the Sendmail - application is &man.sendmail.8;, and not - maild. + + Killing Processes - One way to communicate with a daemon, or any running - process, is to send a signal using + One way to communicate with any running + process or daemon is to send a signal using &man.kill.1;. There are a number of different signals; some have a specific meaning while others are described in the application's documentation. A user can only send a signal to a @@ -3017,13 +3015,13 @@ Swap: 256M Total, 38M Used, 217M Free, 1 root user, who can send signals to anyone's processes. - &os; can also send a signal to a process. If an application + The operating system can also send a signal to a process. If an application is badly written and tries to access memory that it is not supposed to, &os; will send the process the - Segmentation Violation signal - (SIGSEGV). If an application has used the + Segmentation Violation signal + (SIGSEGV). If an application has been written to use the &man.alarm.3; system call to be alerted after a period of time - has elapsed, it will be sent the Alarm signal + has elapsed, it will be sent the Alarm signal (SIGALRM). Two signals can be used to stop a process: @@ -3036,8 +3034,7 @@ Swap: 256M Total, 38M Used, 217M Free, 1 that can not be interrupted. SIGKILL can not be ignored by a process. - This is the I do not care what you are doing, stop right - now signal. Sending a SIGKILL to a + Sending a SIGKILL to a process will usually stop that process there and then. There are a few tasks that can not be interrupted. For example, if the process is trying to read from a file that @@ -3050,7 +3047,7 @@ Swap: 256M Total, 38M Used, 217M Free, 1 Other commonly used signals are SIGHUP, SIGUSR1, and SIGUSR2. - These are general purpose signals and different applications + Since these are general purpose signals, different applications will respond differently. For example, after changing a web server's configuration @@ -3112,19 +3109,17 @@ Swap: 256M Total, 38M Used, 217M Free, 1 /bin/kill. Be aware that different shells have a different syntax for specifying the name of the signal to send. Rather than try to learn all of them, - it can be simpler to use /bin/kill - ... - directly. + it can be simpler to specify /bin/kill. When sending other signals, substitute - TERM or KILL in the - command line as necessary. + TERM or KILL with the name + of the signal. - Killing a random process on the system can be a bad idea. + Killing a random process on the system is a bad idea. In particular, &man.init.8;, PID 1, is special. Running /bin/kill -s KILL 1 is a quick, and unrecommended, way to shutdown the system. @@ -3132,6 +3127,7 @@ Swap: 256M Total, 38M Used, 217M Free, 1 &man.kill.1; before pressing Return. +