Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have seen many times that my CPU usage is 100% and my RAM is only occupied for about 50%. What is the relationship between these two? How does one's performance affects the other?

share|improve this question

migrated from serverfault.com Dec 3 '09 at 17:09

This question came from our site for professional system and network administrators.

6 Answers 6

up vote 15 down vote accepted

The CPU processes (performs instructions on things, such as adding) stuff in memory. RAM is just part of the memory pyramid (see below). So when you are processing lots of data, that data ( or maybe large portions of it) will likely get loaded into RAM so it is ready for the cpu, this is to speed things up because RAM is faster to access than storage devices. So CPU usage and RAM can often correlate, but don't have to.

A basic example might be an image editing program. I load up my 20MB jpeg, the program reads the entire image, and the OS keeps that in RAM for you (all working memory looks the same to the program, the OS decides if it goes to the page/swap file on disk or RAM). So the image is in RAM waiting to be processed, but I go for coffee before telling the program to apply so silly filter, so the CPU isn't doing anything. I come back, apply the filter to add some bubbles to the image, and the CPU goes to 100% and even more memory gets used because it keeps the preprocessed image in memory, so I can undo the change I just made. When the program is done adding the bubbles, the CPU drops, but maybe not the memory.

Of course, it isn't quite this simple :-)

Picture of Memory Pyramid

share|improve this answer
    
+1 very good explanation –  Antoine Benkemoun Dec 3 '09 at 13:35

It's the same relationship as your brain have with a book. The faster brain = the faster your read, the bigger the book = the more pages it can contain.

share|improve this answer
1  
Oohh... nice analogy! –  MikeyB Dec 3 '09 at 14:35

RAM is used to save data. CPU time is used to process data.

There is no relationship between CPU and memory usage. A process can occupy all CPUs of a system but use only a minimal amount of memory. Also, a process can allocate all memory available on a system but only use minimal CPU time. So there is no relation between both.

share|improve this answer

They are not related. You some tasks use a lot of just one of those resources and some use a lot of both.

share|improve this answer

There's no consistent relationship between the two. CPU usage depends on how much processing or work that needs to be done by the app. RAM is how much space/memory it needs to hold the app while it's running.

More RAM = you can run more apps concurrently

More CPU = you can run more complex calculations/operations

Hope that helps.

share|improve this answer

No relationship. Think of it in terms of doing some heavy-duty number-crunching. RAM is how many of those numbers can be stored for faster retrieval, whereas CPU is how fast those numbers can have mathematical operations performed on them.

For how one affects the other, let's assume that you have a slow CPU but lots of RAM. That means that you can store quite a few of those numbers in memory - about half a billion of them on a typical 32 bit machine. But processing/computation/etc on those numbers will be slower.

On the other hand if you have a fast CPU but a small amount of RAM, processing of the numbers will be fast, but from time to time the machine will need to drag them from disk (and put them back again to make room for more), which is many times slower than taking them from RAM.

So really, each affects the other, and for best performance you need both to be good. However, this totally depends on what each application is actually doing, and there are other factors (such as disk speed, processor caches, etc) which we needn't go into too much detail about for now, but which you should be aware will complicate things.

share|improve this answer

protected by Community Sep 14 '13 at 18:33

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.