Maximize cpu load average without consuming resources

0

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)?

Victor Liu

Posted 2013-05-18T02:53:25.863

Reputation: 111

Question was closed 2013-05-18T03:55:58.463

Via OS-specific mechanisms. – Ignacio Vazquez-Abrams – 2013-05-18T02:58:45.503

Let's suppose this is on modern day Linux. – Victor Liu – 2013-05-18T03:00:17.060

Why don't you patch the kernel so that it lies about the CPU load average? – Dan D. – 2013-05-18T03:37:56.103

Answers

0

This question is covered on Stackoverflow: Artificially modify server load in Ubuntu

nik

Posted 2013-05-18T02:53:25.863

Reputation: 50 788

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.

enter image description here

Sepahrad Salour

Posted 2013-05-18T02:53:25.863

Reputation: 928

What I meant was that I didn't want to perform computationally intensive tasks. These examples all peg the CPU. – Victor Liu – 2013-05-18T03:16:25.910

Can you please give me an example? – Sepahrad Salour – 2013-05-18T03:18:00.780

Well, I can't think of one that doesn't peg the CPU but increases the cpu load average. Hence the question. – Victor Liu – 2013-05-18T03:27:13.587

Please read my edited post. Hope this helps. – Sepahrad Salour – 2013-05-20T09:01:36.340