Wednesday, March 7, 2007

Memory management 2

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 ?

1 comment:

Scribbler said...

Obviously there is a relation between memory and performance. If 90% of the CPU time is spent on swapping/paging then your program's response time will be longer. Let us say if you run only one program which does lot of complex operations, the operating system will not allocate entire memory to that program. Depending on the availability(after allocating memory to OS, drivers, i/o, etc) it allocates some of the remaining memory to that program. If the entire program requires more space to complete, the OS will do paging inside that program and completes the operation. So the more the memory your PC has the more the memory your program gets. This means less of paging, which means more time spent in doing the real operation rather than wasting time on paging, hence higher performance. There are these Virtual memory concepts which can enhance the performace further. Also don't forget some programs like DVD decoders require Direct Memory Access(no microprocessor involvement)hence higher performance.