Awasihba’s Log

December 23, 2008

What is load average ?

Filed under: sysadmin, unix — Tags: , — abhisawa @ 5:43 pm

Always question what exactly those three numbers indicates when you give any unix command like top, uptime. From where those numbers came in existance.

Few people said that its load on system but never told which part of system is loaded.

After reading three part series about load average triplets by Dr. Neil Gunther came to know the exact formula for load avarage calulation

Its relationship between active unix processes to process run queue length of the system.

q(t) = A q(t-1) + ( 1 – A ) n(t)

over here at time ‘t’ system took reading of process’s run queue length q(t) and number of active process on system n(t), which got arranged with previous reading of process’s run queue length q(t-1)

In above equation constant A = exp(-5/60R)

where R is 5, 10 and 15 which creates desired triplet of load average for respective minutes. Above equation is applicable for linux kernel.

Whole equation is nicely explained by Dr. Neil Gunther in above article.

 

 

December 18, 2008

My own bashrc quickhelp

Filed under: programming — Tags: — abhisawa @ 3:58 pm

Many times I write so many functions in my bashrc for quick administration task; but after a while I forget about them and over long run I stop using them because I hardly remember that I did write something like that. Here is function in bashrc which gives you quick overview of all the functions with help of comments.

$HOME/myfunctions

function myhelp {
#This prints help over here
FILE="$HOME/myfunctions"
grep -A 1 ^function $FILE | sed -e '  /^--/d ; /^function/ { s/^function//g; s/{//g;   N;   s/n#(.*)/ - 1/; } '
}

function py {
#Ping yahoo.com
  ping www.yahoo.com
}

function debugAE {
#Start debugging apple events on console
        if [ "$1" == "on" ]
        then
                export AEDebugSends=1
                export AEDebugReceives=1
        else
                export AEDebugSends=0
                export AEDebugReceives=0
        fi
}

In above code , you can modify FILE variable in myhelp() to specify your function file ( over here it is $HOME/myfunctions ). Source the same function file in ~/.bashrc or ~/.profile .

For quick help you type myhelp on prompt , you should get output as follows.



Output

myhelp – This prints help over here
py – Ping yahoo.com
debugAE – Start debugging apple events on console

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.