Linux ½ø³Ì¹ÜÀíÆÊÎö
ÎÄÕÂÀ´Ô´£ºhttp://www.ibm.com/developerworks/cn/linux/l-linux-process-management/
¼¶±ð£º Öм¶
M. Tim Jones, ¹ËÎʹ¤³Ìʦ, Emulex Corp.
2009 Äê 1 ÔÂ 20 ÈÕ
Linux® µÄÓû§¿Õ¼ä½ø³ÌµÄ´´½¨ºÍ¹ÜÀíËùÉæ¼°µÄÔÀíÓë UNIX® Óкܶ๲ͬµã£¬µ«Ò²ÓÐһЩÌض¨ÓÚ Linux µÄ¶ÀÌØÖ®´¦¡£ÔÚ±¾ÎÄÖУ¬Á˽â Linux ½ø³ÌµÄÉúÃüÖÜÆÚ£¬Ì½Ë÷Óû§½ø³Ì´´½¨¡¢ÄÚ´æ¹ÜÀí¡¢µ÷¶ÈºÍÏú»ÙµÄÄÚºËÄÚÄ»¡£
Linux ÊÇÒ»ÖÖ¶¯Ì¬ÏµÍ³£¬Äܹ»ÊÊÓ¦²»¶Ï±ä»¯µÄ¼ÆËãÐèÇó¡£Linux ¼ÆËãÐèÇóµÄ±íÏÖÊÇÒÔ½ø³Ì µÄͨÓóéÏóΪÖÐÐĵġ£½ø³Ì¿ÉÒÔÊǶÌÆڵģ¨´ÓÃüÁîÐÐÖ´ÐеÄÒ»¸öÃüÁ£¬Ò²¿ÉÒÔÊdz¤Æڵģ¨Ò»ÖÖÍøÂç·þÎñ£©¡£Òò´Ë£¬¶Ô½ø³Ì¼°Æäµ÷¶È½øÐÐÒ»°ã¹ÜÀí¾ÍÏԵü«ÎªÖØÒª¡£
ÔÚÓû§¿Õ¼ä£¬½ø³ÌÊÇÓɽø³Ì±êʶ·û£¨PID£©±íʾµÄ¡£´ÓÓû§µÄ½Ç¶ÈÀ´¿´£¬Ò»¸ö PID ÊÇÒ»¸öÊý×ÖÖµ£¬¿ÉΩһ±êʶһ¸ö½ø³Ì¡£Ò»¸ö PID ÔÚ½ø³ÌµÄÕû¸öÉúÃüÆڼ䲻»á¸ü¸Ä£¬µ« PID ¿ÉÒÔÔÚ½ø³ÌÏú»Ùºó±»ÖØÐÂʹÓã¬ËùÒÔ¶ÔËüÃǽøÐлº´æ²¢²»¼ûµÃ×ÜÊÇÀíÏëµÄ¡£
ÔÚÓû§¿Õ¼ä£¬´´½¨½ø³Ì¿ÉÒÔ²ÉÓü¸ÖÖ·½Ê½¡£¿ÉÒÔÖ´ÐÐÒ»¸ö³ÌÐò£¨Õâ»áµ¼ÖÂнø³ÌµÄ´´½¨£©£¬Ò²¿ÉÒÔÔÚ³ÌÐòÄÚ£¬µ÷ÓÃÒ»¸ö fork »ò exec ϵͳµ÷Óá£fork µ÷ÓûᵼÖ´´½¨Ò»¸ö×Ó½ø³Ì£¬¶ø exec µ÷ÓÃÔò»áÓÃгÌÐò´úÌ浱ǰ½ø³ÌÉÏÏÂÎÄ¡£½ÓÏÂÀ´£¬ÎÒ½«¶ÔÕ⼸ÖÖ·½·¨½øÐÐÌÖÂÛÒÔ±ãÄúÄܺܺõØÀí½âËüÃǵŤ×÷ÔÀí¡£
ÔÚ±¾ÎÄÖУ¬ÎÒ½«°´ÕÕÏÂÃæµÄ˳ÐòÕ¹¿ª¶Ô½ø³ÌµÄ½éÉÜ£¬Ê×ÏÈչʾ½ø³ÌµÄÄں˱íʾÒÔ¼°ËüÃÇÊÇÈçºÎÔÚÄÚºËÄÚ±»¹ÜÀíµÄ£¬È»ºóÀ´¿´¿´½ø³Ì´´½¨ºÍµ÷¶ÈµÄ¸÷ÖÖ·½Ê½£¨ÔÚÒ»¸ö»ò¶à¸ö´¦ÀíÆ÷ÉÏ£©£¬×îºó½éÉܽø³ÌµÄÏú»Ù¡£
½ø³Ì±íʾ
ÔĶÁ developerWorks ÉÏ Tim Jones Ëù׫дµÄ¸ü¶àÎÄÕÂ
Tim µÄÆÊÎö…… ϵÁÐÎÄÕÂ
ÔÚ Linux ÄÚºËÄÚ£¬½ø³ÌÊÇÓÉÏ൱´óµÄÒ»¸ö³ÆΪ task_struct µÄ½á¹¹±íʾµÄ¡£´Ë½á¹¹°üº¬ËùÓбíʾ´Ë½ø³ÌËù±ØÐèµÄÊý¾Ý£¬´ËÍ⣬»¹°üº¬ÁË´óÁ¿µÄÆäËûÊý¾ÝÓÃÀ´Í³¼Æ£¨accounting£©ºÍά»¤ÓëÆäËû½ø³ÌµÄ¹Øϵ£¨¸¸ºÍ×Ó£©¡£¶Ô task_struct µÄÍêÕû½éÉܳ¬³öÁ˱¾Îĵķ¶Î§£¬Çåµ¥ 1 ¸ø³öÁË task_struct µÄһС²¿·Ö¡£ÕâЩ´úÂë°üº¬Á˱¾ÎÄËùҪ̽Ë÷µÄÕâЩÌض¨ÔªËØ¡£task_struct λÓÚ ./linux/include/linux/sched.h¡£
Çåµ¥ 1. task_struct µÄһС²¿·Ö
struct task_struct {
volatile long state;
void *stack;
unsigned int flags;
int prio, static_prio;
struct list_head tasks;
struct mm_struct *mm, *active_mm;
pid_t pid;
pid_t tgid;
struct task_struct *real_parent;
char comm[TASK_
Ïà¹ØÎĵµ£º
µ±ÎÒµÄubuntu½øÐÐÈç³£µÄ¸üÐÂʱ£¬Í»È»¸æËßÎÒDynamic MMap ran out of room.È»ºógoogleµÃ½â·¨£¬¼Ç¼ÈçÏ£º
sudo gedit /etc/apt/apt.conf.d/70debconf
ÔöÌíÒÔÏÂÁ½ÐУºAPT::Cache-Limit "200000000";
&nbs ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
½üÆÚÒÔÀ´£¬¾²¹ÛÊÀ½ç
Linux
Òµ½çµÄ¸÷ÖÖ¶¯Ïò£¬ÁîÈËÐÄÈç³±Ó¿£¬²»µÃ°²Äþ¡£´Ë»°Ôõô½²£¿
Ê®¼¸ÄêÀ´£¬
Linux
ÒѾÐγÉÒ»¹ÉÊÀ½çÐԵķ¢Õ¹³±Á÷£¬ÈκÎÊÆÁ¦Ò²×èµ²²»ÁË¡£Ðí¶àÊÀ½ç¼¶µÄ´ó¹ ......
ÌáÒª£ºLinux ´ÅÅÌ·ÖÇø±í¡¢ÎļþϵͳµÄ²é¿´¡¢Í³¼ÆµÄ¹¤¾ßºÜ¶à£¬ÓÐЩ¹¤¾ßÊǶ๦Äܵģ¬²»½ö½öÊDz鿴´ÅÅ̵ķÖÇø±í£¬¶øÇÒÒ²ÄܽøÐдÅÅÌ·ÖÇøµÄ²Ù×÷£»µ«ÔÚ±¾ÎÄ£¬ÎÒÃÇÖ»½²´ÅÅÌ·ÖÇøµÄ²é¿´£¬ÒÔ¼°·ÖÇøµÄʹÓÃÇé¿öµÄ²é¿´£»±¾ÎÄÖ»ÊǸøÐÂÊÖÉÏ·֮Ó㻹ØÓÚ·ÖÇø¹¤¾ßµÄ²Ù×÷£¬ÎÒ½«ÔÚÒÔºó×öרÃŽéÉÜ£»´ËÎÄÄ¿µÄ:Ö÷ÒªÊÇÏò³õѧÕß½éÉÜÒ»ÏÂÈëÃűر¸µÄÒ»µ ......
½âѹ¹¤¾ß£¨ÎÞ´ò°ü¹¦ÄÜ£©£º
-------------------------------
j——bzip2¡¢bunzip2
z——gzip¡¢gunzip
Z——compress¡¢uncompress
½âѹ¹¤¾ß£¨Óдò°üÄÜÁ¦£©£º
-------------------------------
zip¡¢unzip
rar¡¢unrar
ѹËõ°ü*.tar.gz»òÕß*.tgzµÄ½âѹ
----------------------- ......
³É¹¦µØ¹ÜÀíÈκÎϵͳµÄ¹Ø¼üÖ®Ò»£¬ÊÇÒªÖªµÀϵͳÖÐÕýÔÚ·¢ÉúʲôÊ¡£Linux ÖÐÌṩÁËÒì³£ÈÕÖ¾£¬²¢ÇÒÈÕÖ¾µÄϸ½ÚÊÇ¿ÉÅäÖõġ£Linux ÈÕÖ¾¶¼ÒÔÃ÷ÎÄÐÎʽ ´æ´¢£¬ËùÒÔÓû§²»ÐèÒªÌØÊâµÄ¹¤¾ß¾Í¿ÉÒÔËÑË÷ºÍÔĶÁËüÃÇ¡£»¹¿ÉÒÔ±àд½Å±¾£¬À´É¨ÃèÕâЩÈÕÖ¾£¬²¢»ùÓÚËüÃǵÄÄÚÈÝÈ¥×Ô¶¯Ö´ÐÐijЩ¹¦ÄÜ¡£Linux ÈÕÖ¾´æ´¢ÔÚ /var/log Ŀ¼ÖС£ÕâÀïÓм¸¸öÓ ......