linuxÔõôÉó²éÀú³Ì״̬
ÃÕµ×£º ͨ¹ýʹÓà ps¡¢top¡¢pstree¡¢cat /proc/[pid]/status µÈÏÂÁ¿ÉÒÔÔÚ linux ÖÐÉó²éÀú³Ì״̬¡£ps ÏÂÁî¿ÉÏÔʾÀú³ÌµÄ»ù±¾ÐÅÏ¢£¬°üÀ¨ pid ºÍ cpu ʹÓÃÂÊ¡£top ÏÂÁîÌṩһ¸ö½»»¥Ê½½çÃ棬һÁ¬¸üÐÂÀú³ÌÐÅÏ¢£¬Èç cpu ʹÓÃÂʺÍÄÚ´æʹÓÃÂÊ¡£pstree ÏÂÁîÏÔʾÀú³ÌÊ÷£¬Õ¹Ê¾Àú³Ì¼°Æä×ÓÀú³ÌÖ®¼äµÄ¹Øϵ¡£cat /proc/[pid]/status ÏÂÁîÌṩÓйØÀú³Ì״̬µÄ¸üÏêϸµÄÐÅÏ¢¡£ÆäËûÏÂÁÈç pidof¡¢kill ºÍ renice£¬Ò²¿ÉÓÃÓÚÉó²é»òÖÎÀí½ø
ÔõÑùÔÚ Linux ÖÐÉó²éÀú³Ì״̬
Ç°ÑÔ
ÏàʶÀú³ÌµÄ״̬¹ØÓÚÕï¶ÏºÍÖÎÀí Linux ϵͳÖÁ¹ØÖ÷Òª¡£ÎÒÃÇ¿ÉÒÔʹÓÃÖÖÖÖÏÂÁîÀ´¼ì²éÀú³ÌµÄÄ¿½ñ״̬¡£
ÒªÁì
1. ps ÏÂÁî
ps ÏÂÁîÊÇ×î³£ÓõŤ¾ßÖ®Ò»£¬ÓÃÓÚÉó²éÀú³ÌµÄ״̬¡£Ëü¿ÉÒÔÏÔʾÓйØÕýÔÚÔËÐеÄÀú³ÌµÄ»ù±¾ÐÅÏ¢£¬°üÀ¨Àú³Ì ID (PID)¡¢Óû§¡¢CPU ʹÓÃÂʺÍÄÚ´æʹÓÃÂÊ¡£
ps -ef
µÇ¼ºó¸´ÖÆ
2. top ÏÂÁî
top ÏÂÁîÌṩÁËÒ»¸ö½»»¥Ê½µÄÀú³Ì״̬¼àÊÓ½çÃæ¡£ËüÒ»Á¬¸üÐÂÀú³ÌÐÅÏ¢£¬°üÀ¨ CPU ʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊ¡¢Ïß³ÌÊýºÍÏÂÁîÐвÎÊý¡£
top
µÇ¼ºó¸´ÖÆ
3. pstree ÏÂÁî
pstree ÏÂÁîÏÔʾһ¸öÀú³ÌÊ÷£¬Õ¹Ê¾Àú³Ì¼°Æä×ÓÀú³ÌÖ®¼äµÄ¹Øϵ¡£ÕâÓÐÖúÓÚ¿ÉÊÓ»¯ÏµÍ³ÖÐÕýÔÚÔËÐеÄÀú³ÌÌõÀí½á¹¹¡£
pstree
µÇ¼ºó¸´ÖÆ
4. cat /proc/[PID]/status ÏÂÁî
ÿ¸öÀú³Ì¶¼ÓÐÒ»¸ö /proc Ŀ¼ÏµÄÌõÄ¿£¬ÆäÖаüÀ¨ÓйظÃÀú³ÌµÄÏêϸÐÅÏ¢¡£ÎÒÃÇ¿ÉÒÔʹÓà cat ÏÂÁîÉó²é¸ÃÌõÄ¿ÖÐµÄ status Îļþ£¬ÒÔ»ñÈ¡ÓйØÀú³Ì״̬µÄ¸üÏêϸµÄÐÅÏ¢¡£
cat /proc/[PID]/status
µÇ¼ºó¸´ÖÆ
5. Other Commands
ÒÔÏÂÆäËûÏÂÁîÒ²¿ÉÒÔÓÃÓÚÉó²éÀú³Ì״̬£º
pidof ÏÂÁƾ֤Àú³ÌÃû³Æ²éÕÒÀú³Ì ID¡£
kill ÏÂÁÖÕÖ¹Àú³Ì¡£
renice ÏÂÁÐÞˢг̵ĵ÷ÀíÓÅÏȼ¶¡£
½áÂÛ
ͨ¹ýʹÓÃÕâЩÏÂÁÎÒÃÇ¿ÉÒÔÉîÈëÏàʶ Linux ϵͳÖÐÕýÔÚÔËÐеÄÀú³ÌµÄ״̬¡£ÕâЩÐÅÏ¢¹ØÓÚ¹ÊÕÏɨ³ý¡¢ÐÔÄÜÓÅ»¯ºÍ×ÊÔ´ÖÎÀíÖÁ¹ØÖ÷Òª¡£
ÒÔÉϾÍÊÇlinuxÔõôÉó²éÀú³Ì״̬µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡