I have been conducting systems administration interviews for a while now, and I used to ask that one question in every interview, which is better “Linux” or “Windows”. I used to settle for a simple answer like “Depending on the environment”, this answer could get the guy into our payroll on the spot. This was in the old days when I was still young and foolish. In these old days, I used to forgive my Windows when it hangs like forever, trying to do something I don’t know about, or when my server bails out of me for no good reason or with no trace, but you know people do grow up.
Lets imagine your process getting into the OS and praying that it reaches the CPU before it starves. according to this article, In Windows, the Kernel scheduler has two queues, a foreground queue with Round and Robin algorithm and a background Queue with First in First out algorithm, and the scheduler uses many priority algorithms along with other algorithms to decide to get your poor process into which queue. The problem here that Windows scheduler works with a multilevel queue technique, meaning once you are in the queue you are stuck there until your time come to get into the CPU or starve to death.. its simple.. but a retarded one too. So, what happens when many background processes get into the background queue? These processes are not time sliced as the ones in the foreground queue, so once they get in, they will never get out until they finish.. and to make things even better the scheduler chooses between the two queues with a probability of 80% for the background queue to 20% for the foreground queues, so if odds are against you, which seems to be always this way with me, your process has to wait a long time until it get served, and so all what you get is the freezing screen and the busy Hard disk signal.
So what does Linux do, Linux scheduler is a bit smarter, it uses a technique called multilevel queue with feedback. Hmmmm.. Feedback gives the impression that the process is able to discuss its state with the scheduler, and not like windows accept its fate to be doomed in the never lands. Yes, Linux has more than two queues with different algorithms and priority, and processes can move from one queue to another according to its state, so if a process was stuck for a long time in a queue and didn’t get served, its priority increase and it get moved to another VIP queue where processes get served at once.
Some say all this complexity in the Linux scheduler will create an overhead and slow things down when you have a large number of processes. But Linux uses O(1) scheduling algorithms, so as Windows to give it credit, which means its not subject to the number of processes, and its smart, and it really respect your requests and doesn’t give you the sense that the computer is doing a much more important thing than your pathetic request.
So where do you want to go today? I know where I am going.