Mar 15, 2010 14:49
I love more and more computer program designing than coding as I know more and more. I was just going throug some design which was explaining that what *must* happen at kernel level and what *must not* and then how a user space can be written in a much much better way by clearly knowing that what kernel *provides* and what *not*
While I was thinking this one, I saw a beautiful analogy of the same.
There are 3 lifts to go to all floors here at L&T. You press one button either, one which indicates that you want to go to top or obviously the other one which tells that you want to go to down.
Now, an algorithm runs. The lift out of three which is nearest to you and !going in opposite direction will __serve__ your request.
Now, there are some special cases. During lunch time which is at 12:30 to 2. Now, everyone @ 12:30, from each floor, is going to ground floor. And at around 2, there is rush at ground floor and wants to go at their respective floor.
Let me explain an analogy now. I see the *core* algorithm as what something that kernel provides which is the best possible thing.
Now, how an user space application can make it better or worse. I see us who are using lift as user space application and thus,
1. Best case - When everyone is returning from lunch. There should be an understanding (and so algorithm in computer terms) among people (and thus among application or in application). Those who wants to go to first and second floor will take only lift-1, those who wants to go to 3rd and 4th will take only lift-2 and others will take lift-3. This will give each application less response time and utilisation would be better.
2. Worst case - It is what happens normally. No one cares. Take any lift that comes first in order to get best latency which apparently looks right but turns out to be wrong. Since now each lift is carrying people which is a combination of who want to go to first floor, 2nd, 3d, 4th, 5th and 6th. Now, lift will stop at each floor. And the time that it takes to open and again close the door at each floor (this is like serving I/O request) adds so much latency that at the end each one will take much time with compare to case wherein if they had developed understanding among themselves as explained above.
And this looks exactly true, and which says, there are few things which needs to be better handled at application in better way and there are core facilities which can be provided by kernel only.....
My just few cents and :-)
analogy,
lift,
computer,
science