Linux load definition-general Linux technology-Linux programming and kernel information. The following is a detailed description. Using the uptime or top command, you can see the output of a load, such as load average: 0.00, 0.03, 0.00. What is this load? man's document is just a document, there is no specific definition of the load.
Load statistics must be completed by the kernel. Therefore, it is better to find the answer in the kernel source code. Find the kernel source code 2.6.21 and start exploring.
Load (t) = (load (t-1) * exp (I) + n (t) * (2048-exp (I)/2048
Load (t-1) is the result of the last Calculation
N (t) indicates the number of active processes at t time.
The calculation method is to accumulate the running and uninterruptible values in the running queue of each CPU and multiply them by 2048.
The calculation method is as follows:
1946 unsigned long nr_active (void)
1947 {
1948 unsigned long I, running = 0, uninterruptible = 0;
1949
1950 for_each_online_cpu (I ){
1951 running + = cpu_rq (I)-> nr_running;
1952 uninterruptible + = cpu_rq (I)-> nr_uninterruptible;
1953}
1954
1955 if (unlikely (long) uninterruptible <0 ))
1956 uninterruptible = 0;
1957
1958 return running + uninterruptible;
1959}
In essence, the load is completely determined by the number of active processes on each CPU in the past period of time. However, the load is not equivalent to the number of processes that need to be scheduled per second. is a complicated process.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service