« SUN sets at 4:30PM ! | Main | Bedouins are back in bay area ! »

Can you spare a quater ...?

I meant to say quater of an hour...

Recently I was bumped into two discussions . One was about windows operating systems context switching, another one was about 64bit machine.

For the context switching, someone was thinking that as soon as a user request comes to the kernel land, there is a context switch. There were few things that I started thinking about. What does the person mean by context switching. If I could recall, in a process based os when a processor is switched ( assigned ) to another process for execution we call it a context switch. In windows schedulable enitities are threads, so it might be that the person was talking about thread switching.

 Whatever that switchable entity is, it does not make sense... Remember that user space data can be accessed directly from top level kernel mode component. If there were a process context switch as soon as the process goes to kernel mode, there is a security and protection problem. So it means the context was not switched as soon as it gets to the kernel mode. Then the next question is when there could be a context switch while we are in the caller process context and in kernel mode. Some obvious ones are if the time quantum for the process is used up, or if the process goes to kernel mode wait. Since windows is, as far as I know, is thread based, the switching is supposed to be light-weight, and it could still be in the same process context, only the threads were switched. But if none of the current process's threads are ready to be scheduled, a process context switch has to happen. One fine point I missed here in my assumption. If you happen to know the meaning of topLevel kernel component in windows terminology, quite often we think about kernel mode driver that is a top level component. Which usually implies a file system or file system filter driver. But in most cases  there are a lot of processing goes on in the kernel mode before even hitting top level driver ( kernel component that we are thinking here ), and during that processing if there is no outside influence to change context, would there still be a context switch. Or specifically if nothing extraneous influence changes process or thread context, is the kernel mode execution path before toplevel component would change contex?.  I don't see why it would do that ...  I don't see any need for it.

So it's not necessary that the context would be different as soon as it enters kernel mode. Then what exactly happens when the process goes to kernel mode. From a very high level point of view, the processor has to be in privilage mode. And for stack space sanity, arguments, flags, and other stuff gets copied to kernel stack, and execution continues in the kernel mode. This is at a concept level. For detail, look at available lituratures on windows internals and / or start digging deep with debugger.

At this point I would like ask  - What is an operating system?

 It is a program that allows other programs to share computer resources. How does it do, how fair it is, how efficient it is, how general purpose it is ...  are basically the questions whose answer belong to the policy enforcement algorithms.

Second discussion I was invoved with was about 64bit systems, and its performance is going to be better than 32bit machine. The question came from an experienced software engineer with proper computer science back ground. My answer was at first purely based on intuition. And I said sure it is going to be faster, graphics would be snappier, blah, blah. His answer was that he can only see it is faster when massive numerical processing is done. Other than that it was beyond him. Is it a neive or logical thought?

That got me to a point of thinking that if one has to show that 64bit is better performing machine ( wiht 64 bit windows), what that person need to do?.  Perhaps there are bench marks that do not try to compare apple and orange. But how could you go about doing it? Remember you need to convince a bonafied computer engineer that 64bit systems are better performing !. Also you might have to prove if someone needs it or not.

For a moment, I was also stumbled by the question. Is it really just futuristic? Can I really show that it is better performing? This needs a no or hardly any perturbation on two systems: One 32 bit, and another 64bit. And eliminating as much of baggages as possible. For example networking, since it can have non determistic delays...

Frankly, it is an interesting question, and I don't have answer to it. I can probably point at lot of technical discussion that would show how larger address space is going to help. Perhaps the system cache sizes are larger, and perhaps the block level i/o gets to fetch or write with a larger chunks etc., etc. But the basic question is - User perception. Lets take vista 32bit and vista 64bit, make sure apple and oranges are not compared, so the system should be as identical as possible from users perspective ( same amount of RAM, same type and capacity of Hard disk etc...).

Posted on Monday, March 12, 2007 at 08:22PM by Registered CommenterProkash Sinha | CommentsPost a Comment

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.