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 ?

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.


-----------------------------------------------------------------------------------------------------------------

Monday, February 19, 2007

One Laptop Per Child >>> the device


The OLPC machine. Copied from here

The laptop does not have a hard-drive, or slots for CD/DVD/Floppy etc to essentially save power consumption.

Principle of Least Surprise

I will point you to a link on Wiki.
Basically, I think it is inherently tied to the user interfaces for various software systems and applications. As a Mac user at home, I have this habit of trying to close applications with an Alt+Q at work. This is before I realize what I am doing and then switch back to Alt+X.

But I think this principle goes further than that. Basically, it is binding the user interface for all new systems/applications to the existing conventions. This is probably why you see most operating systems run some variety of windows (though they may like to call them something else --- the concept is the same: you open a new window and then close it.) Very few new applications come up with newer paradigms .

So, the question is: is this a good principle to follow while designing user interfaces ? How do we balance convention/familiarity with giving users a vastly new experience, a paradigm shift ? What is the optimal solution ?

Welcome to my computer blog

Hi ALL:

I am hoping to use this blog as a place to post everything that I learn about computers on a daily basis.

FAQ:

Q:How will this be any different from the millions of websites that are already serving this purpose ?
A: True, there are numerous locations on the web where you can get the same (and definitely more detailed) information. But please remember: this is a personal journal. There is a thought process attached to how we go from one post to the next. There will be a flow which will be something I experience. In that sense, it will be different. This blog will not stand rooted to a specific technology platform or a specific paradigm. We will learn about all things that are even remotely related to computers.

Q: Why write a blog when I could have referred books, journals, magazines, e-zines etc ?
A: I have observed that writing about something makes you explore it a little more than if you just read about it. This is especially true if you were to write something in the public domain because then you would try to make sure that what you are writing is factually correct and not just an impression that you gained while reading about it. Furthermore, like I have stressed before, this is my blog, my opinion piece. No article or post on this blog will be complete without stating my opinion on that subject.

So, there. We have the basic ingredients in place to start learning. I am still learning. So there will be some errors/inaccuracies in some of these posts which I will try and correct as and when I come to know of them. So, please pardon those errors and keep your comments coming so I can learn more.

Thanks and keep participating !!!