Talk:Load (computing): Difference between revisions

Content deleted Content added
Clarify point on Linux vs world on load average calculations: Linux includes certain sleeping states.
Line 103:
 
15:38, 13 February 2007 (UTC)~~marrandy
 
Your example is flawed. Running processes do not use only a percentage of the CPU. The running process is always using 100%. When we say that a process takes 5% of the CPU we mean that, over a defined period, it is running for 5% of the time. Each of your 1 second long processes with 5% utilisation is in reality running for 1/20 of a second and waiting for something (e.g. disk I/O or sleeping) for 19/20 of a second.
 
The profile of the load depends on when those processes want their 1/20th of a second slot. If they all do something for 1/20th of a second then sleep for 19/20ths and you start them at exactly the same time the load will start at 10 (1 running, 9 waiting for the CPU), drop to 9 after 1/20th seconds (1 running 8 waiting, 1 sleeping), then 8 and so on until after 0.5 seconds all the processes are sleeping. In this case, the average of the load over a whole second is 1.1. If each process is designed to run in a different 1/20th of a second e.g. the first process runs straight away, the second waits 1/20th seconds then runs, the third waits 2/20ths of a second then runs etc, the load will be 1 while there is a process running and 0 while there isn't. Over the second, the average load will be 0.5 in this case.
 
This is why your media player example appears to be broken. Linux counts a process waiting for disk I/O towards the load average even though if a processor became available the process would not be able to run. I imagine that one media player spends alot of its time waiting for the disk to deliver blocks from the media file. A second media player probably introduces contention somewhere else where the waiting processes would not be counted towards the load. Either that, or the media files used in the second test were still in the disk cache from the first test, thus massively reducing the required IO wait time.
[[User:Jeremypnet|Jeremypnet]] 13:09, 12 March 2007 (UTC)