4.6. ¥×¥í¥»¥¹

FreeBSD ¤Ï¥Þ¥ë¥Á¥¿¥¹¥¯¤Î¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¤Ç¤¹¡£ ¤Ä¤Þ¤ê¡¢1¤Ä°Ê¾å¤Î¥×¥í¥°¥é¥à¤¬¤¢¤¿¤«¤âƱ»þ¤ËÆ°¤¤¤Æ¤¤¤ë¤«¤Î¤è¤¦¤Ë¸«¤¨¤ë¡¢ ¤È¤¤¤¦¤³¤È¤Ç¤¹¡£Æ°ºîÃæ¤Î¥×¥í¥°¥é¥à¤Ï¤½¤ì¤¾¤ì ¥×¥í¥»¥¹ ¤È¸Æ¤Ð¤ì¤Þ¤¹¡£ ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤È¡¢ºÇÄã¤Ç¤â1¤Ä¤Î¿·¤·¤¤¥×¥í¥»¥¹¤¬¥¹¥¿¡¼¥È¤·¤Þ¤¹¡£ ¥·¥¹¥Æ¥à¤òÀµ¾ï¤Ëµ¡Ç½¤µ¤»¤ë¤¿¤á¤Ë¾ï¤ËÆ°ºî¤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¥×¥í¥»¥¹¤â¤¿¤¯¤µ¤ó¤¢¤ê¤Þ¤¹¡£

³Æ¥×¥í¥»¥¹¤Ï¥×¥í¥»¥¹ ID¡¢¤â¤·¤¯¤Ï PID ¤È¸Æ¤Ð¤ì¤ë¿ô»ú¤Ç¤¿¤À°ì¤Ä¤Ë¼±Ê̤µ¤ì¤Þ¤¹¡£ ¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¤Î¤è¤¦¤Ë³Æ¥×¥í¥»¥¹¤Ë¤Ï½êÍ­¼Ô¤È¥°¥ë¡¼¥×¤¬¤¢¤ê¤Þ¤¹¡£ ½êÍ­¼Ô¤È¥°¥ë¡¼¥×¤Î¾ðÊó¤Ï¡¢ ¤³¤ì¤Þ¤Ç¤Ë¸«¤¿¥Õ¥¡¥¤¥ëµö²Ä°À­¤òÍѤ¤¡¢ ¤½¤Î¥×¥í¥»¥¹¤¬³«¤±¤ë¥Õ¥¡¥¤¥ë¤ä¥Ç¥Ð¥¤¥¹¤ò·èÄꤹ¤ë¤¿¤á¤Ë»È¤ï¤ì¤Þ¤¹¡£ ¿¤¯¤Î¥×¥í¥»¥¹¤Ë¤Ï¿Æ¥×¥í¥»¥¹¤â¤¢¤ê¤Þ¤¹¡£ ¿Æ¥×¥í¥»¥¹¤È¤Ï¡¢¤½¤Î¥×¥í¥»¥¹¤ò¥¹¥¿¡¼¥È¤µ¤»¤¿¥×¥í¥»¥¹¤Î¤³¤È¤Ç¤¹¡£ Î㤨¤Ð¡¢¥·¥§¥ë¤Ë¥³¥Þ¥ó¥É¤òÂǤÁ¹þ¤ó¤Ç¤¤¤ë¤È¤­¤Ï¥·¥§¥ë¤¬¥×¥í¥»¥¹¤Ç¡¢ Æ°¤«¤¹¥³¥Þ¥ó¥É¤â¤Þ¤¿¤É¤ì¤â¥×¥í¥»¥¹¤Ç¤¹¡£ ¤³¤Î¤è¤¦¤Ë¤·¤Æµ¯Æ°¤¹¤ë¥×¥í¥»¥¹¤Ï¤½¤ì¤¾¤ì¥·¥§¥ë¤¬¿Æ¥×¥í¥»¥¹¤Ë¤Ê¤ê¤Þ¤¹¡£ ¤³¤ì¤ÎÎã³°¤Ï init ¤È¤¤¤¦ÆÃÊÌ¤Ê¥×¥í¥»¥¹¤Ç¤¹¡£ init ¤Ï¾ï¤ËºÇ½é¤Î¥×¥í¥»¥¹¤Ê¤Î¤Ç¡¢ PID ¤Ïɬ¤º 1 ¤Ë¤Ê¤ê¤Þ¤¹¡£ init ¤Ï FreeBSD ¤¬¥¹¥¿¡¼¥È¤¹¤ë¤È¤­¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤Æ¼«Æ°Åª¤Ëµ¯Æ°¤µ¤ì¤Þ¤¹¡£

ps(1) ¤È top(1) ¤È¤¤¤¦2¤Ä¤Î¥³¥Þ¥ó¥É¤¬ ¥·¥¹¥Æ¥à¾å¤Î¥×¥í¥»¥¹¤ò³Îǧ¤¹¤ë¤¿¤á¤ËÆäËÊØÍø¤Ç¤¹¡£ ps(1) ¥³¥Þ¥ó¥É¤Ï¸½ºßÆ°ºîÃæ¤Î¥×¥í¥»¥¹¤Î¥ê¥¹¥È¤ò¸«¤ë¤¿¤á¤Ë»È¤¤¡¢ PID ¤ä¥×¥í¥»¥¹¤¬»È¤Ã¤Æ¤¤¤ë¥á¥â¥ê¤ÎÎÌ¡¢ ¤É¤¦¤¤¤¦¥³¥Þ¥ó¥É¥é¥¤¥ó¤Çµ¯Æ°¤µ¤ì¤¿¤Î¤«¡¢ ¤Ê¤É¤òɽ¼¨¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ top(1) ¥³¥Þ¥ó¥É¤ÏÆ°ºîÃæ¤ÎÁ´¤Æ¤Î¥×¥í¥»¥¹¤òɽ¼¨¤·¡¢ ¿ôÉ䴤ȤËɽ¼¨¤ò¹¹¿·¤¹¤ë¤Î¤Ç¡¢ ·×»»µ¡¤¬¤Ê¤Ë¤ò¤·¤Æ¤¤¤ë¤Î¤«¥¤¥ó¥¿¥é¥¯¥Æ¥£¥Ö¤ËÃΤ뤳¤È¤¬¤Ç¤­¤Þ¤¹¡£

¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢ps(1) ¤ÏÆ°ºîÃ椫¤Ä½êÍ­¼Ô¤¬¼«Ê¬¤Î¥³¥Þ¥ó¥É¤Î¤ß¤òɽ¼¨¤·¤Þ¤¹¡£ Î㤨¤Ð:

% 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)
48630  p0  S      2:50.89 /usr/local/lib/netscape-linux/navigator-linux-4.77.bi
48730  p0  IW     0:00.00 (dns helper) (navigator-linux-)
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

¤³¤ÎÎã¤Çʬ¤«¤ë¤È¤ª¤ê¡¢ ps(1) ¤Î½ÐÎϤϤ¤¤¯¤Ä¤«¤Î¹Ô¤ËÀ°·Á¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ PID ¤ÏÀè¤Û¤É¸«¤¿¥×¥í¥»¥¹ ID ¤Ç¤¹¡£ PID ¤Ï 1 ¤«¤é½ç¤Ë 99999 ¤Þ¤Ç³ä¤êÅö¤Æ¤é¤ì¡¢ ­¤ê¤Ê¤¯¤Ê¤ë¤ÈºÇ½é¤ËÌá¤Ã¤Æ»È¤¤²ó¤µ¤ì¤Þ¤¹¡£ TT ¤Ï¥×¥í¥°¥é¥à¤¬Æ°¤¤¤Æ¤¤¤ë tty ¤ò¼¨¤·¤Þ¤¹¡£ º¹¤·Åö¤¿¤Ã¤Æ̵»ë¤·¤Æ¤â¤«¤Þ¤ï¤Ê¤¤¤Ç¤·¤ç¤¦¡£ STAT ¤Ï¥×¥í¥°¥é¥à¤Î¾õÂÖ¤ò¼¨¤·¤Þ¤¹¤¬¡¢ ¤³¤ì¤â¤Þ¤¿Ìµ»ë¤·¤Æ¤è¤¤¤Ç¤·¤ç¤¦¡£ TIME ¤Ï¥×¥í¥°¥é¥à¤¬¤½¤Î CPU ¾å¤ÇÆ°¤¤¤Æ¤¤¤ë»þ´Ö¤ÎŤµ¤Ç¤¹—¤³¤ì¤Ï¥×¥í¥°¥é¥à¤ò¥¹¥¿¡¼¥È¤µ¤»¤¿¤È¤­ ¤«¤é¤Î·Ð²á»þ´Ö¤Ç¤¢¤ë¤È¤Ï¤«¤®¤ê¤Þ¤»¤ó¡£ CPU ¾å¤Ç»þ´Ö¤ò»È¤¦É¬Íפ¬¤¢¤ë¤Þ¤Ç¤«¤Ê¤ê¤Î»þ´Ö¤òÈñ¤¹¤è¤¦¤Ê¥×¥í¥°¥é¥à¤â¤¢¤ë¤«¤é¤Ç¤¹¡£ ºÇ¸å¤Ë¡¢COMMAND ¤Ï¤½¤Î¥×¥í¥°¥é¥à¤òµ¯Æ°¤¹¤ë¤Î¤Ë»È¤ï¤ì¤¿¥³¥Þ¥ó¥É¥é¥¤¥ó¤È¤Ê¤ê¤Þ¤¹¡£

ps(1) ¤Ïɽ¼¨¤¹¤ë¾ðÊó¤òÊѤ¨¤ë¤¿¤á¤Î¥ª¥×¥·¥ç¥ó¤ò¤¿¤¯¤µ¤ó¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£ ¤¤¤Á¤Ð¤óÊØÍø¤Ê¤Î¤Ï auxww ¤Ç¤·¤ç¤¦¡£ a ¤Ï¼«Ê¬¤Î¥×¥í¥»¥¹¤À¤±¤Ç¤Ï¤Ê¤¯¡¢ Æ°ºîÃæ¤Î¥×¥í¥»¥¹Á´Éô¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤òɽ¼¨¤·¤Þ¤¹¡£ u ¤Ï¥×¥í¥»¥¹¤Î½êÍ­¼Ô¤Î̾Á°¤ò¥á¥â¥ê»ÈÍÑÎ̤ÈƱÍͤËɽ¼¨¤·¤Þ¤¹¡£ x ¤Ï¥Ç¡¼¥â¥ó¥×¥í¥»¥¹¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤òɽ¼¨¤·¡¢ ww ¤Ç¡¢¥¹¥¯¥ê¡¼¥ó¤ËÆþ¤ê¤­¤é¤Ê¤¤¤Û¤ÉŤ¯¤Ê¤Ã¤¿¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ç¤â¾Êά¤»¤º¡¢ ps(1) ¤ËÁ´¥³¥Þ¥ó¥É¥é¥¤¥ó¤òɽ¼¨¤µ¤»¤Þ¤¹¡£

top(1) ¤Î½ÐÎϤâƱÍͤǤ¹¡£ Îã¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£

% top
last pid: 72257;  load averages:  0.13,  0.09,  0.03    up 0+13:38:33  22:39:10
47 processes:  1 running, 46 sleeping
CPU states: 12.6% user,  0.0% nice,  7.8% system,  0.0% interrupt, 79.7% idle
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
48630 nik        2   0 29816K  9148K select   3:18  0.00%  0.00% navigator-linu
  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
...

½ÐÎϤÏ2¤Ä¤Î¥»¥¯¥·¥ç¥ó¤Ëʬ¤«¤ì¤Æ¤¤¤Þ¤¹¡£ ¥Ø¥Ã¥À (ºÇ½é¤Î 5 ¹Ô¤Ç¤¹) ¤ÏÆ°ºî¤·¤Æ¤¤¤ëºÇ¿·¤Î¥×¥í¥»¥¹¤Î PID¡¢ ¥·¥¹¥Æ¥à¤ÎÊ¿¶ÑÉé²Ù (¥·¥¹¥Æ¥à¤¬¤É¤ì¤¯¤é¤¤Ë»¤·¤¤¤«¤Î»Øɸ)¡¢ ¥·¥¹¥Æ¥à¤Î²ÔƯ»þ´Ö (ºÇ¸å¤ÎºÆµ¯Æ°¤«¤é¤Î»þ´Ö) ¤È¸½ºß¤Î»þ¹ï¤ò¼¨¤·¤Þ¤¹¡£ ¥Ø¥Ã¥À¤ÎÃæ¤Î¾¤Î¿ô»ú¤ÏÆ°ºîÃæ¤Î¥×¥í¥»¥¹¤Î¿ô (¤³¤Î¾ì¹ç 47 ¤Ç¤¹¤Í)¡¢ »È¤ï¤ì¤Æ¤¤¤ë¥á¥â¥ê¤È¥¹¥ï¥Ã¥×Îΰè¤ÎÎÌ¡¢ ¤½¤·¤Æ¥·¥¹¥Æ¥à¤¬°Û¤Ê¤ë CPU ¾õÂ֤˾ÃÈñ¤·¤¿»þ´Ö¤È´Ø·¸¤·¤Þ¤¹¡£

¤½¤Î²¼¤Ë¤Ï ps(1) ¤Î½ÐÎϤÈƱ¤¸¤è¤¦¤Ê¾ðÊó¤ò»ý¤Ã¤¿¹Ô¤¬Â³¤­¤Þ¤¹¡£ Á°¤ÈƱÍÍ PID ¤Ë¥æ¡¼¥¶Ì¾¡¢¾ÃÈñ CPU »þ´Ö¤È¼Â¹ÔÃæ¤Î¥³¥Þ¥ó¥É¤òÃΤ뤳¤È¤¬¤Ç¤­¤Þ¤¹¡£ top(1) ¤ò»È¤¦¤È¥Ç¥Õ¥©¥ë¥È¤Ç¥×¥í¥»¥¹¤¬»È¤Ã¤Æ¤¤¤ë¥á¥â¥êÍÆÎ̤âʬ¤«¤ê¤Þ¤¹¡£ ¥á¥â¥ê»ÈÍÑÎ̤ÎÍó¤Ï2¹àÌܤËʬ¤«¤ì¤Æ¤ª¤ê¡¢ °ìÊý¤Ï¹ç·×»ÈÍÑÎÌ¡¢ ¤½¤·¤Æ¤â¤¦°ìÊý¤Ï¼Â»ÈÍÑÎ̤Ǥ¹—¹ç·×»ÈÍÑÎ̤ϥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬É¬ÍפȤ·¤Æ¤¤¤ë¥á¥â¥êÎ̤ǡ¢ ¼Â»ÈÍÑÎ̤Ϥ½¤Î»þÅÀ¤Ç¼ÂºÝ¤Ë»È¤ï¤ì¤Æ¤¤¤ë¥á¥â¥êÎ̤Ǥ¹¡£ ¤³¤ÎÎã¤Ç¤Ï¡¢Netscape ¤¬¤À¤¤¤¿¤¤ 30 MB ¤Î RAM ¤òɬÍפȤ·¤Æ¤¤¤Þ¤¹¤¬¡¢ ¤¤¤Þ¤Î¤È¤³¤í 9 MB ¤·¤«»È¤Ã¤Æ¤¤¤Ê¤¤¤³¤È¤¬Ê¬¤«¤ê¤Þ¤¹¡£

top(1) ¤Ï¼«Æ°Åª¤Ë2É䴤Ȥ˲èÌ̤ò¹¹¿·¤·¤Þ¤¹¡£ s ¥ª¥×¥·¥ç¥ó¤ò»È¤¨¤Ð¹¹¿·´Ö³Ö¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

ËÜʸ½ñ¡¢¤ª¤è¤Ó¾¤Îʸ½ñ¤Ï ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/ ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£

FreeBSD ¤Ë´Ø¤¹¤ë¼ÁÌ䤬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¥É¥­¥å¥á¥ó¥È ¤òÆɤó¤À¾å¤Ç <questions@FreeBSD.org> ¤Þ¤Ç (±Ñ¸ì¤Ç) Ï¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£
ËÜʸ½ñ¤Ë´Ø¤¹¤ë¼ÁÌä¤Ë¤Ä¤¤¤Æ¤Ï¡¢<doc@FreeBSD.org> ¤Þ¤ÇÅŻҥ᡼¥ë¤ò (±Ñ¸ì¤Ç) Á÷¤Ã¤Æ¤¯¤À¤µ¤¤¡£