As a fun exercise, what is the best way to maximize the unix CPU load average without actually consuming lots of resources (CPU cycles or memory)?
Asked
Active
Viewed 100 times
0
-
Via OS-specific mechanisms. – Ignacio Vazquez-Abrams May 18 '13 at 02:58
-
Let's suppose this is on modern day Linux. – Victor Liu May 18 '13 at 03:00
-
Why don't you patch the kernel so that it lies about the CPU load average? – Dan D. May 18 '13 at 03:37
2 Answers
0
Last week I wanted to create a backup from my HDD. I mounted it to my old Linux machine and then ran the tar cvjf command to create and compress my HDD. My system has a Celeron CPU which I think is older than 6 years. It's done after 48 hours and the CPU works 99%, but my memory didn't use very much, maybe 50 MB.
Now there are many solutions to your question. Another one is to calculate the factorial of one number (big number).
I've written a simple C program:
#include <stdio.h>
void main() {
for ( int i = 0; i < 10000000000000; i++);
}
Then I compiled it with the GCC command, opened 5 terminals and executed them.
This image shows my load average, which is 5. Notice: My program depends on your CPU. I tested it with Pentium M.

Jamal
- 455
- 1
- 6
- 17
Sepahrad Salour
- 968
- 6
- 14
-
What I meant was that I didn't want to perform computationally intensive tasks. These examples all peg the CPU. – Victor Liu May 18 '13 at 03:16
-
-
Well, I can't think of one that doesn't peg the CPU but increases the cpu load average. Hence the question. – Victor Liu May 18 '13 at 03:27
-