Could you give examples of programs that require more RAM and programs that require more CPU power?

Could you give examples of programs that require more RAM and programs that require more CPU power? by Joey Kim

Answer by Joey Kim:

More RAM:

int a[1000000000000000000000000000]; // congratulations, you're out of RAM

More CPU:

for(;;) { fork(); } // a fork bomb! run!

Browsers can use a lot of memory if you go onto “rich web applications”. If you run that above code from a JavaScript console, you’ve got yourself a program that uses a lot of CPU.

Editors such as Eclipse and Aptana Studio use a lot of memory. On the other hand, Notepad (the one that comes with Windows) uses an insanely small amount of memory.

Emulators, such as Bochs or QEMU use a lot of CPU, since you’re converting instructions from one form to another.

Google Chrome uses less memory than Firefox and Internet Explorer, but Firefox uses less CPU.

Hope this helps!

EDIT: Peter Ho said that “for(;;)” takes up only one core. He suggested a fork bomb. Edited to reflect his suggestion. Thanks, Peter!

Could you give examples of programs that require more RAM and programs that require more CPU power?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s