execution time of a CPU bound task on kernels with different HZ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks...

recently I did a simple experiment, that was running a CPU bound program 
on Linux kernels with different HZ setting. I pick three, HZ=100, 
HZ=250 and HZ=250. Here is the result:

		HZ=100		HZ=250		HZ=1000
Real	319.326		317.786		319.072
User	319.33		317.801		319.094
System        0			     0.001		    0

The result was taken by simply running the program with "time" command. 
The programs were ran 4 time each and the average was calculate for all 
real, user and system time.

If you look closely, perhaps you will be shocked with the number. On 
HZ=250, the program seems running faster than the other two. I almost 
can believe it, as I suspected that it should run slower due to more 
work on taking care the interrupts. Anybody can kindly explain what 
happened here?


Here is the program I used for the test:
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char *argv[])
{
        int i, j;
        long int l, m;
        unsigned long int k,loop_max;
        float hasil;

        if (argc >= 2) {
                loop_max = labs(strtoul(argv[1], (char **) NULL, 10));
        } else
                loop_max = 1000;
        printf("loop_max is %lu\n", loop_max);

        for (i = 0; i <= 3000; i++)
                for (j = 0; j <= 1000; j++)
                        for (k = 0; k <= loop_max; k++) {
                                l = random();
				do {
                                        m = random();
                                } while (m == 0);
                                hasil = l / m;

                        }

        return (0);
}

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux