Continuing on the subject of memory management:
It seems that when you start applications on your machine, their code is loaded into your RAM. This occupies your RAM as long as you keep the application open (even if you are not using the application actively).
Now, that seems to me, a very inefficient way of handling memory. For two reasons:
1. It limits the number of applications that I can keep open without impacting my system performance.
2. If I load a "heavy" application (with a large memory footprint), the performance of the other applications will be impacted. For example, I use Lotus Sametime 7.5 chat client at work. This takes up around 60 MB of RAM even when it just lying there idle (it probably just keeps updating my contact list status , but that's about it). There are times through the day when I am forced to run 7-8 parallel applications. These are the times that I have to close the 7.5 client and load an older version to free up more memory.
I do understand that there are some algorithms (email 2 from beta) which use the least referenced method to manage memory better. But, really. How efficient can that be ?
This series has just begun. I am hoping to learn more about atleast one aspect of an OS through this series. So, please keep your comments coming...
I will end this post with a question so it gives me an opening for my next post in this series:
Is there a co-relation between memory and system performance ?
Wednesday, March 7, 2007
Memory management 1
Ok...so this is not really a "post" in the true sense. I am just pasting a series of mails amongst friends trying to address a memory management question that I had this morning:
-----------------------------------------------------------------------------------------------------------------
Email 1 -- Alpha
-----------------------------------------------------------------------------------------------------------------
OK...I accept that I am dumb and that I have no clue what is happening on my PC...but please help me understand this:
Below is a screenshot of my Task Manager...how can CPU usage be "00" when the process is using up 47 MB of my RAM ??? what am I missing here ??? If an app is using up memory, it must be doing something right ? why wd it need memory otherwise ? is there a way to make windows allocate memory only when I actually want the app to do something for me ?
-----------------------------------------------------------------------------------------------------------------
Email 2 -- Beta
-----------------------------------------------------------------------------------------------------------------
Ok occupying memory and doing something are totally different things. Let me explain.
Let's say you launch a program on your computer. All programs on your computer reside on your hard disk. It is very inefficient to run programs from your hard disk because it is very slow. So the computer tries to load the program into RAM, which is a quicker memory. Let's say you click a button on a window, the computer does the necessary action by executing the code that is loaded into RAM.
But let's say you have 512MB RAM and all of it is already filled up with 2 or 3 programs that got loaded into it. Now you launch a new program. What happens? Will it run from the hard disk? Actually no. It will use algorithms to figure out which part of RAM was least used (or last used based on algorithm) and swap that part of RAM (called a page) out of RAM and get a part of the new program into the RAM. So in reality, your computer is constantly swapping parts of programs in and out of RAM and executing the necessary parts from RAM.
So 47MB of RAM used up on your computer is taken up by programs that are loaded into your RAM, ready to execute. But is it necessary that they do some work when loaded into RAM? No it's not. Because, for example, you might have launched a browser, loaded a news website and reading the article. The program is not doing much at that time (except displaying the content). So the CPU usage is 0%. But the 47MB may be taken up by the browser program loaded into RAM.
In my view, in most of our home PC's, the CPU's are idle most of the time. Probably around 90% of the time. That doesn't mean that a slower CPU will do the job for you. The remaining 10% of the time when the CPU is busy, a faster CPU will do the job faster for you. So if you see the CPU usage graph, there will be small bursts of activity, with long inactive periods inbetween.
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
Email 1 -- Alpha
-----------------------------------------------------------------------------------------------------------------
OK...I accept that I am dumb and that I have no clue what is happening on my PC...but please help me understand this:
Below is a screenshot of my Task Manager...how can CPU usage be "00" when the process is using up 47 MB of my RAM ??? what am I missing here ??? If an app is using up memory, it must be doing something right ? why wd it need memory otherwise ? is there a way to make windows allocate memory only when I actually want the app to do something for me ?
-----------------------------------------------------------------------------------------------------------------
Email 2 -- Beta
-----------------------------------------------------------------------------------------------------------------
Ok occupying memory and doing something are totally different things. Let me explain.
Let's say you launch a program on your computer. All programs on your computer reside on your hard disk. It is very inefficient to run programs from your hard disk because it is very slow. So the computer tries to load the program into RAM, which is a quicker memory. Let's say you click a button on a window, the computer does the necessary action by executing the code that is loaded into RAM.
But let's say you have 512MB RAM and all of it is already filled up with 2 or 3 programs that got loaded into it. Now you launch a new program. What happens? Will it run from the hard disk? Actually no. It will use algorithms to figure out which part of RAM was least used (or last used based on algorithm) and swap that part of RAM (called a page) out of RAM and get a part of the new program into the RAM. So in reality, your computer is constantly swapping parts of programs in and out of RAM and executing the necessary parts from RAM.
So 47MB of RAM used up on your computer is taken up by programs that are loaded into your RAM, ready to execute. But is it necessary that they do some work when loaded into RAM? No it's not. Because, for example, you might have launched a browser, loaded a news website and reading the article. The program is not doing much at that time (except displaying the content). So the CPU usage is 0%. But the 47MB may be taken up by the browser program loaded into RAM.
In my view, in most of our home PC's, the CPU's are idle most of the time. Probably around 90% of the time. That doesn't mean that a slower CPU will do the job for you. The remaining 10% of the time when the CPU is busy, a faster CPU will do the job faster for you. So if you see the CPU usage graph, there will be small bursts of activity, with long inactive periods inbetween.
-----------------------------------------------------------------------------------------------------------------
Subscribe to:
Posts (Atom)