Different load between rhel6 and rhel7

Latest response

Dear Red Hat,

I have run a little program on Rhel6 and Rhel 7.

Linux Rhel7 3.10.0-957.10.1.el7.x86_64 #1 SMP Thu Feb 7 07:12:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Linux Rhel6 2.6.32-754.9.1.el6.x86_64 #1 SMP Wed Nov 21 15:08:21 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

#include <stdio.h>
#include <time.h>
int main(void)
{
        struct timespec tt;
        struct timespec tc;
        int a;
        int q;
        tt.tv_nsec=10000;
        tt.tv_sec=0;
        for (a=0; a<100; a++)
        {
                q = fork();
                if (q == 0)
                {
                        printf("Child\n");
                        break;
                }
                else
                {
                        printf("%i\n", a);
                }
        }

        for (a=0; a<1000000; a++)
        {
                nanosleep(&tt,&tc);
        }
}

I have same results on both servers, but not load average.
server Rhel7
load average: 14,23, 8,30, 5,69
real 1m31.723s
user 0m1.544s
sys 0m10.330s
server Rhel6
load average: 0.01, 0.03, 0.00
real 1m35.845s
user 0m1.165s
sys 0m4.444s

Why load average are different when they do the same program?

Responses

Most likely you've discovered an accounting difference between kernel 2.6.32 and 3.10.

I've seen similar things happen between RHEL5's 2.6.18 and RHEL6's 2.6.32, they were also triggered by tiny syscalls like nanosleeps, especially if you fill them with incorrect parameters so the syscall fails.

It's good that RHEL7 is more accurate.