linuxÔõÑùÉó²éÀú³Ì״̬
¿ÉÒÔͨ¹ýʹÓà ps ÏÂÁî¡¢top ÏÂÁî¡¢pstree ÏÂÁî»ò proc ÎļþϵͳÀ´Éó²é linux Àú³Ì״̬¡£ÕâÓÐÖúÓÚ¼à¿ØÀú³ÌÔ˶¯ºÍÈ·±£ÏµÍ³Æ½ÎÈÔËÐС£
ÔõÑùÉó²é Linux Àú³Ì״̬
ÔÚ Linux ϵͳÖУ¬Éó²éÀú³Ì״̬ÖÁ¹ØÖ÷Òª£¬ÓÉÓÚËüÔÊÐíϵͳÖÎÀíÔ±ºÍÓû§¼à¿ØϵͳÔËÐÐÖÐÀú³ÌµÄÔ˶¯¡£¿ÉÒÔͨ¹ý¶àÖÖÒªÁìÉó²éÀú³Ì״̬¡£
1. ʹÓà ps ÏÂÁî
ps ÏÂÁîÊÇ×î³£ÓõÄÉó²éÀú³Ì״̬µÄÒªÁì¡£Ëü¿ÉÒÔÏÔʾϵͳÖÐËùÓÐÕýÔÚÔËÐеÄÀú³ÌµÄÐÅÏ¢¡£
ps -ef
µÇ¼ºó¸´ÖÆ
´ËÏÂÁÏÔʾÿ¸öÀú³ÌµÄÀú³Ì ID (PID)¡¢Óû§ ID (UID)¡¢¸¸Àú³Ì ID (PPID)¡¢Àú³Ì״̬¡¢Æô¶¯Ê±¼äºÍÏÂÁîÐвÎÊý¡£
2. ʹÓà top ÏÂÁî
top ÏÂÁîÌṩÁ˽»»¥Ê½Àú³Ì¼à¿Ø½çÃæ¡£ËüÏÔʾϵͳÖÐËùÓÐÕýÔÚÔËÐеÄÀú³Ì£¬²¢Æ¾Ö¤ CPU ºÍÄÚ´æʹÓÃÇéÐζÔËüÃǾÙÐÐÅÅÐò¡£
top
µÇ¼ºó¸´ÖÆ
3. ʹÓà pstree ÏÂÁî
pstree ÏÂÁîÒÔÊ÷×´½á¹¹ÏÔʾÀú³ÌÌõÀí½á¹¹¡£ÕâʹµÃ¿ÉÊÓ»¯Àú³ÌÖ®¼äµÄ¹Øϵ±äµÃÈÝÒס£
pstree
µÇ¼ºó¸´ÖÆ
4. ʹÓà proc Îļþϵͳ
proc Îļþϵͳ°üÀ¨ÓëϵͳÖÐÿ¸öÕýÔÚÔËÐеÄÀú³ÌÏà¹ØµÄÐÅÏ¢¡£¿ÉÒÔÉó²éÿ¸öÀú³ÌµÄ /proc/[PID] Ŀ¼¡£
ÀýÈ磬ҪÉó²éÀú³Ì PID Ϊ 12345 µÄ״̬£¬¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
cat /proc/12345/status
µÇ¼ºó¸´ÖÆ
Àú³Ì״̬
Linux Àú³Ì¿ÉÒÔ´¦ÓÚÒÔÏÂ״̬֮һ£º
R: ÔËÐÐ
S: ˯Ãß
D: ²»¿ÉÖÐֹ˯Ãß
T: ÒÑ×èÖ¹
Z: ½©Ê¬Àú³Ì
ͨ¹ýʹÓÃÉÏÊöÒªÁ죬Äú¿ÉÒÔÇáËɼà¿Ø Linux ϵͳÖÐÀú³ÌµÄ״̬£¬´Ó¶øÈ·±£ÏµÍ³Æ½ÎÈÔËÐС£
ÒÔÉϾÍÊÇlinuxÔõÑùÉó²éÀú³Ì״̬µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡