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

Linux/UnixÖеÄload averageÔ­À´Ò»µãÒ²²»¼òµ¥

·¢²¼Ê±¼ä:2007-06-09 22:11:57À´Ô´:ºìÁª×÷Õß:Winterh
¡¡¡¡ÎҵŤ×÷ÄÚÈÝÊÇÊØ»úÆ÷£¬ÓÚÊDZȽÏÏУ¬ÓÐʱ¼ä¾ÍÕÛÌÚЩ×Ô¼º¸ÐÐËȤµÄ¶«Î÷¡£¾­³£ÐèÒªÓÃtop²é¿´ÏµÍ³ÐÔÄÜ£¬¶ÔÓÚÊä³ö½á¹ûÖÐÓÒÉϽǵÄÄǼ¸¸öÊý¾Ýµ½µ×ÊÇʲôº¬Ò壬һֱûÓÐÈ¥Á˽⡣×òÌìÐÄѪÀ´³±£¬ÓÚÊÇËÄ´¦²éÕÒload averageµ½µ×ÊÇʲô¡£

¡¡¡¡googleÁËÒ»·¬£¬·¢ÏÖһƪ½²load averageµÄÎÄÕ£¬¿´À´load averageÕæµÄ²»¼òµ¥£¡

¡¡¡¡load averageÊÇʲô£¿
¡¡¡¡Í¨¹ýtopÃüÁî¿ÉÒԲ鿴ϵͳµÄload average£¬ËüÏÔʾµÄÊÇϵͳÔÚ1·ÖÖÓ£¬5·ÖÖÓ£¬15·ÖÖÓÖ®ÄÚµÄloadÇé¿ö¡£

¡¡¡¡Í¨Ë×µÄ˵£¬loadÊÇÖ¸run-queue length (i.e., the sum of the number ofprocesses waiting in the run-queue plus the number currentlyexecuting).

¡¡¡¡×¨ÒµÒ»µã˵£¬A exponentially-damped time-dependent average

¡¡¡¡load averageÔõô¼ÆË㣿
¡¡¡¡ÕâÆäÖÐÉæ¼°µ½²»ÉÙÊýѧ֪ʶ£¬·¢ÁËÎÒÒ»¸öÍíÉϲÅÁ˽â¸ö´ó¸Å¡£°¦£¬Êýѧ²î°¡

¡¡¡¡ÎªÁËʹÄں˿ÉÒÔ¸ßЧ¼ÆËãload average£¬²ÉÓÃÁËfixed-point arithmetic¡£fixed-point arithmeticÊÇÒ»Öַdz£¿ìËÙµÄÄ£Ä⸡µãÔËËãµÄ·½·¨£¬ÌرðÊÇÔÚûÓÐFPU£¨float point unit£©²¿¼þµÄ´¦ÀíÆ÷ÉÏ£¬·Ç³£ÓÐÓá£

¡¡¡¡¼ÆË㹫ʽ£ºload(t) = load(t-1) e^(-5/60) + n (1 - e^(-5/60))£¬µü´ú¼ÆË㣬ÆäÖÐnΪrun-queue length¡£

¡¡¡¡ÎªÊ²Ã´²ÉÓÃÕâ¸ö¼ÆË㹫ʽÄØ£¿
¡¡¡¡ÓÉExponential Smoothing·½³ÌÓУ¬Y(t)£½ Y(t-1) + a*[X(t) - Y(t-1)],whereX(t) is the input raw data, Y(t - 1) is the value due to the previoussmoothing iteration and Y(t) is the new smoothed value.Õâ¸ö¹«Ê½¾Íµ±×÷¹«Àí°É£¬²»ÒªÎÊÎÒΪʲô£¬ÎÒÒ²²»ÖªµÀ¡£

¡¡¡¡Áîa£½1-b£¬bΪe^(-5/60)£¬¾Í¿ÉÒԵõ½load averageµÄ¼ÆË㹫ʽ

¡¡¡¡²ÉÓô˹«Ê½µÄºÃ´¦£º¾Ö²¿µÄload¶¶¶¯²»»á¶Ôload averageÔì³ÉÖØ´óÓ°Ï죬ʹÆäƽ»¬¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ