½ñÌì¶ÁÁ˱¾ÊéµÄµÚÒ»ÕÂ.ÕâÒ»Õ³õ²½½éÉÜÁËLinuxÄں˵Ä×ÜÌå²¼¾Ö,Ò²¾ÍÊÇ×ÜÌåÉÏÀ´¿´ÓÐÄÄЩģ¿é×é³É.´ÓÉϵ½ÏÂÖ÷ÒªÊÇ:glidc->ϵͳµ÷ÓÃ->(VFS,Schedular,Soft ISR,ISR,FILE Sytem,Task Manager,Memory Manager,IP Stack)À¨ºÅÀïÃæµÄ¸÷¸öÄ£¿é¶¼ÊDz¢ÁдæÔÚµÄ.Ä¿Ç°¶ÔÓÚÕâÆäÖеÄÐí¶àÃû´ÊÎÒ»¹²»ÊìϤ,²»½û¸Ðµ½²ÑÀ¢,ҪѧϰµÄ¶«Î÷ʵÔÚÓÐÐí¶à,×Ô¼ºÀË·ÑÁ˲»ÉÙʱ¼ä....°´×÷Õß˵µÄ,Õâ±¾ÊéÖ÷Òª½²µÄÊÇIP StackµÄÐÅÏ¢Á÷³Ì.¶ÁÕß¿ÉÒÔÔÚºê¹ÛÉÏÁ˽âIPÐÒé×åµÄ¸÷¸öÐÒé¼äµÄÏûÏ¢ÊÇÈçºÎÁ÷¶¯µÄ.
µÚÒ»ÕÂÒ»¿ªÊ¼¾Í½²ÁË΢Äں˺ʹóÄں˵ÄÇø±ð,²¢ÔÚ×îºóÏÖÔÚµÄOS´ó¶à²»ÊÇÒ»µ¥Ò»µÄijһÖÖ,ͨ³£¶¼ÊÇÁ½ÖÖ¶¼ÓÐÉæ¼°.ÒòΪ¸÷×ÔÓи÷×Եĺô¦:΢Äں˵ÄÄں˵ÄʵÏÖ¸ü¼Ó¸ßЧ,±ãÓÚÒÆÖµ,·½ÃæϵͳÆäËû¸÷¸öÄ£¿é¼äµÄͨÐÅ.´óÄں˵ÄÖ÷ÒªÌصã¾ÍÊÇ,ËüÔÚÖ´ÐеÄʱºòÔÚÄÚ´æÖÐÊÇÒ»¸ö´óµÄ¶þ½øÖƵÄÓ³Ïñ,¸÷¸öÄ£¿éÔÚÔËÐеÄʱºò¶¼Òª¼ÓÔص½ÄÚ´æÖÐÈ¥,Äܹ»³ä·ÖµÄÀûÓÃÓ²¼þ.
ÕâÒ»ÕÂÁíÍ⻹½²½âÁ˼¸¸öÔÚÐÒéÕ»ÖÐÓõĺܶàµÄÊý¾Ý½á¹¹,Ö÷ÒªÊÇÁ´±íºÍHashÁ´±í.¿´µ½Õⲿ·ÖµÄʱºòÎÒÉîÉîµÄ¸Ð¾õµ½Êý¾Ý½á¹¹·Ç³£µÄÖØÒª,²¢½ÓҪѧ»îÁË,²»ÄÜ×ß½ÌÌõÖ÷ÒåµÀ·!±ÈÈç˵LinuxµÄÁ´±íµÄʵÏÖ¾ÍÏ൱µÄƯÁÁ.Ëü²»ÊÇÏñ´ó¶à½Ì¿ÆÊéµÄ˵µÄÄÇÑù,ÔÚÁ´±íµÄ½ÚµãÖдæ·Ådata.¶øÊÇÈú¬ÓÐÊý¾ÝµÄ½á¹¹Öаüº¬Ò»¸öÁ´±í½Úµã.ÕâÑù¸üÁé»î.¿ÉÒÔ¿´µÄ³öÀ´LinuxÔ´´úÂëÖÐÐí¶àµØ·½¶¼ÀûÓÃÁËCÓïÑÔµÄÁé»îÐÔ,ºÍGCC±àÒëÆ÷µÄÌØÐÔ,ÈçtypeofµÈ.(^_^¿´À´CÓïÑÔÒª¼ÓÇ¿ÁËÏÂÁË,ÎÒ»¹ºÜÄÛ..)ÆäÖÐÁ´±íµÄÕâÖÖʵÏÖ»úÖƵĹؼüÊÇlist_entryºê.list_entry(ptr,type,memeber),
ptrÊÇÖ¸Ïòº¬ÓÐÕæʵÊý¾ÝµÄ½á¹¹ÖÐstrcut list head³ÉÔ±µÄÖ¸Õë.typeÊÇstruct list headµÄÀàÐÍ.memberÊǸóÉÔ±µÄ±äÁ¿Ãû.
list_entry( ptr, type , member);
#define list_entry(ptr, type, member) container_of(ptr, type, member)
#define container_of(ptr, type, member) ({\
const typeof( ((type*)0)->member) *mptr = (ptr);\
(type *)( (char *) mptr-offsetof(type,member) );})
#define offsetof(TYPE,MEMBER)( (size_t) &((TYPE *)0)\
->MEMBER)
ͨ³£ÒªÓÃһЩÌØÊâµÄ·½·¨£¬·ÀÖ¹Îóɾ³ý£¬ÆäʵÎóɾ³ýÊÇ¿ÉÒÔ·ÀÖ¹µÄ£¬ÌØÒâɾ³ýÊÇÎÞ·¨·ÀÖ¹µÄ¡£
Îóɾ³ý£¬Í¨³£ÊÇchattr +i filename
[root@imdba imdba_t2]# ls -ltr
total 116
-rw-rw—- 1 mysql mysql 61 Oct 17 16:08 db.opt
-rw-rw—- 1 mysql mysql 8556 Oct 17 16:09 imdba_t2_t.frm ......
(AIXÃüÁî)iostatÃüÁîÖ÷Ҫͨ¹ý¹Û²ìÎïÀí´ÅÅ̵ĻîԾʱ¼äÒÔ¼°ËûÃǵÄƽ¾ù´«ÊäËٶȣ¬¼à¿ØϵͳÊäÈë/Êä³öÉ豸¸ºÔØ.
iostat [¼ä¸ôʱ¼ä] [´òÓ¡´ÎÊý]
exp: iostat 5 2
psÃüÁîÊÇUNIXϵͳÖÐ×î³£¼ûµÄÃüÁËüÖ÷ÒªÏÔʾϵͳÖйØÓÚ½ø³ÌµÄͳ¼ÆºÍ״̬ÐÅÏ¢£¬Èç½ø³ÌID£¬I/OÐÐΪÒÔ¼°CPUÀûÓÃÂʵÈ.
ÏÔʾ10¸öÏûºÄCPU×î¶àµÄ½ø³Ì£º
ps aux |sort ......