ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxÄÚ´æ¼ÆÊýÏê½â

·¢²¼Ê±¼ä:2008-05-18 00:53:13À´Ô´:ºìÁª×÷Õß:emerald
¶ÁдÎļþʱµÄ»º´æ»úÖÆÓëwindows²»Í¬£¬ÒÔÖÂÓÚ¶Áд´óÎļþʱcachedÖµ·Ç³£´óÇҾӸ߲»Ï¡£

½ü¼¸ÌìÓÃoracle£¬·¢ÏÖoracle¿ñÓÃÄڴ棬¾­³£ÄÚ´æСµ½10MµÄ¹æÄ£¡£º¹Ò»¸ö£¬¸Ï¿ìÈþ­ÀíÂòÁËеÄ1GÄÚ´æÀ´×°£¬ÉÏÈ¥ºó·¢ÏÖ¸ù±¾Èϲ»³öÀ´¡£¼Ó°àÒ»¶àСʱ²Å·¢ÏÖ386Äں˸ù±¾²»Èϸ߶ËÄÚ´æ(HIGHMEM)£¬ËùÒÔÄڴ漫ÏÞÒ»Ö±ÊÇ896M¡£ÒÔÇ°ÊÇ1GÄڴ棬ËùÒÔ¿´²»³öÀ´£¬ÏÖÔÚ»»ÁË1.5G£¬¿´³öÀ´ÁË¡£

¸Ï¿ìÉÏÁËÒ»¸ö2.6.12-1-686µÄÄںˣ¬È»ºóÖØÆô£¬ÈϳöÀ´ÁË¡£²»¹ýfree»¹ÊÇÖ»ÓÐ32M×óÓÒ£¬ÎÒÃÇ´ó¾ªÐ¡¹ÖµÄ´òµç»°µ½oracleÄÇÀïÈ¥×Éѯ£¬µÃµ½µÄ´ð¸´ÊÇÒª°²×°ÍêÕûµÄ²¹¶¡£¬²¢ÇÒÒªÓÃoracleÈÏÖ¤¹ýµÄ·þÎñÆ÷¡£oracleÈÏÖ¤ÁËɶ·þÎñÆ÷£¿RedHatEnterpriseAS3/4,ÄǸö¶«Î÷ÒªÊշѵģ¬¶øÇÒ¾ø¶Ô²»±ãÒË¡£×îºóÎÞÄΣ¬×öÁËÒ»´Î²»Æô¶¯oracleµÄ²âÊÔ¡£³öºõÎÒÃÇÒâÁϵģ¬mysql³ÔÁ˶àÊýµÄÄÚ´æ¡£¾ßÌåÔì³ÉÕâÖÖ×´¿öµÄÔ­ÒòÊÇɶÄØ£¿

ż²éÔÄÁËlinuxÄÚ´æ¹ÜÀí×ÊÁÏ£¬·¢ÏÖlinuxµÄÄÚ´æ¹ÜÀí¼ÆÊýÉϽ²µÄ¶«Î÷ºÍwindows½²µÄÓкܴó²îÒì¡£ÏÂÃæ¾ßÌåÁоÙϼ¸ÖÖ¼ÆÊý¡¢²é¿´·½Ê½ºÍº¬Òå¡£

total mem£¬¿ÉÒÔÓÃtop free²é¿´³öÀ´¡£
free mem£¬¿ÉÒÔÓÃtop free vmstat²é¿´³öÀ´¡£
used mem£¬¿ÉÒÔÓÃtop free²é¿´³öÀ´.
buffer mem£¬¿ÉÒÔÓÃtop free vmstat²é¿´³öÀ´¡£
shared mem£¬¿ÉÒÔÓÃfree²é¿´³öÀ´¡£
swap mem£¬¿ÉÒÔÓÃtop²é¿´³öÀ´¡£
swap used£¬¿ÉÒÔÓÃtop vmstat²é¿´³öÀ´¡£
cached mem£¬¿ÉÒÔÓÃtop free vmstat²é¿´³öÀ´¡£
active mem£¬¿ÉÒÔÓÃfree vmstat -a²é¿´³öÀ´£¬¼´cached used¡£
inactive mem£¬¿ÉÒÔÓÃfree vmstat -a²é¿´³öÀ´£¬¼´cached free¡£

ÆäÖÐtotal memÊdzýȥϵͳÍâµÄ¿ÉÓÃÄڴ棬ϵͳ´óÔ¼Õ¼1M¶à¡£È»ºó·ÖÅä¸øfree memºÍused mem¡£used memÓÖ°üÀ¨ÁËÄں˱íʹÓã¨ÀýÈçGDT£©£¬³ÌÐòʹÓã¬buffer£¬cached¡£ËùÒÔ

cached mem=active mem+inactive mem
total mem=free mem+used mem
used mem=Äں˱íʹÓÃ+³ÌÐòʹÓÃÎïÀíÄÚ´æ+buffer mem+cached mem

ÂÔÈ¥Äں˱íʹÓã¬Õâ¸öʽ×Ó¿ÉÒÔ±äÐγÉÕâÑù£º

³ÌÐòʹÓÃ×ÜÄÚ´æ=swap used+³ÌÐòʹÓÃÎïÀíÄÚ´æ
=swap used+used mem-buffer mem-cached mem
=total mem-free mem+swap used-buffer mem-cached mem

¸ù¾ÝËùÓÐϵͳÄÚ´æ¹ÜÀíµÄºãµÈʽ£º
³ÌÐòʹÓÃ×ÜÄÚ´æ+Ò»´Î¿ÉÉêÇëÄÚ´æ=total mem+swap used

ÎÒÃÇ¿ÉÒÔ¼ÆËã³ö£º
Ò»´Î¿ÉÉêÇëÄÚ´æ=free mem+buffer mem+cached mem£¨ÊÂʵÉÏÒªÂÔСÓÚÕâ¸öÖµ£©

³ÌÐòʹÓõIJ¿·Öswap³öÈ¥²¿·Ö£¬Õ¼ÓÃtotal²¿·Ö£¬Ê£ÏµľÍÊÇÒ»´Î¿ÉÒÔÉêÇëµÄ×î´óÖµ¡£¶à´ÎÉêÇëÔì³ÉÕâ¸öֵ̫С¾Í¼ÌÐøÏòswapÀïÃæ½»»»¡£

Ê×ÏȽâÊÍbufferºÍcachedÇø±ð¡£Í¨Ë׵Ľ²£¬bufferÖзŵÄÊǶÔÏóÊý¾Ý½á¹¹£¬¶øcachedÖзŵÄÊÇÎ޽ṹµÄ¿éÊý¾Ý¡£cached¿ÉÒÔ»º³åÈκαê×¼µÄ¿éÉ豸£¬¶ø²»ÓùÜÊÇʲô¶«Î÷¡£ÆäÖÐÉ漰дͨºÍд»ØµÄ¸ÅÄ´ó¼Ò×Ô¼º¿´È¥°É¡£

È»ºóÊdzÌÐòʹÓÃÎïÀíÄÚ´æµÄ¸ÅÄî¡£³ÌÐòµÄ×ÜÄÚ´æµÈÓÚ½»»»³öÈ¥µÄ²¿·Ö¼ÓÉϳÌÐòʹÓÃÎïÀíÄÚ´æ¡£¶ø³ÌÐòʹÓõÄ×ÜÄÚ´æºÍ¸÷¸ö³ÌÐòµÄÄÚ´æÕ¼ÓÃÊÇʲô¹ØϵÄØ£¿Õâ¸öÓÖÒªÉæ¼°¹²ÓÃÒ³ÃæµÄÎÊÌâ¡£

windowsÖÐÒ²ÓÐÀàËƸÅÄÈç¹ûÁ½¸öÒ³ÃæÄÚÈÝÏàͬ£¬ÄÇôÔÚÄÚ´æÖб£ÁôÒ»·Ý¾Í¿ÉÒÔÁË¡£Õâ¸öÊǶ¯Ì¬Á´½Ó¿â/¶¯Ì¬¹²Ïí¿âµÄÀíÂÛ»ù´¡¡£ËùÒÔËùÓнø³ÌµÄshared memÖ»ÓÐÒ»·Ýcopy¡£½ø³ÌʹÓõÄData+StackÊÇÊý¾Ý¿Õ¼ä£¬codeÊÇ´úÂë¿Õ¼ä£¬Á½ÕߺͼõÈ¥shared memÊÇ˽Óпռ䣬Ҳ¾ÍÊÇË׳ƵĽø³ÌÄÚ´æÕ¼Ó᣽«ËùÓÐÄÚ´æÕ¼ÓÃÇóºÍ¼ÓÉÏshared memµÄºÍ£¬¾ÍµÃµ½Á˳ÌÐòµÄ×ÜÄÚ´æ¡£

LinuxµÄcachedºÍwindowsµÄÒ»¸öºÜ´ó²îÒìÔÚÓÚ£¬windowsµÄ´ÅÅÌ»º´æÊǶÁд»º´æ¶ÓÁС£Ð´Èë²Ù×÷ºÍÔ¤¶ÁÈ¡²Ù×÷ÔÚ¶ÓÁÐÖÐÅÅÐò¡£ÍêÁ˾ÍÊÍ·ÅÁË£¬Ö÷ÒªÓÃÓÚƽ»º¶Áдƿ¾±¡£¶ÁÈ¡Ô¤²â»úÖƲÅÊÇÔö¼ÓÃüÖеÄÖØÍ·¡£linuxµÄcached¶ÁдÍêÁËÒ»Ö±²»ÊÍ·Å£¬Ö±µ½ÄÚ´æ²»×ãÔÙÊÍ·Å¡£ÊͷŵÄËÙ¶ÈÀ´ËµÓ¦¸ÃÊÇûÓÐÎÊÌâµÄ£¬±Ï¾¹Êý¾ÝÒѾ­Ð´ÈëÁË£¬Ö»²îÒ»¸öÊý¾Ý½á¹¹±ê־λÐ޸ĶøÒÑ¡£ÕâÖÖ»úÖÆÖ÷Òª¶ÔÓ¦¸ßÃüÖÐÂÊ£¬Èç¹ûÖظ´Ê¹ÓÃÏàͬÎļþ£¨Ó¦¸Ã˵ÊÇÏàͬ¿éÉ豸µÄÏàͬoffset£©¡£ÄÇô»º´æ»úÖÆÓÀÔ¶Ö»Òª¶ÁÒ»´Î£¬Ð´Èë´ÎÊýҲԶԶСÓÚÓ¦µ±µÄдÈë´ÎÊý¡£

¸ù¾ÝÉÏÃæÒ»´Î¿ÉÉêÇëÄÚ´æµÄ¼ÆË㹫ʽ£¬¿ÉÒÔÖªµÀÕâ´ÎżËÀÔÚÄÄÀïÁË°É¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ