Add to Google Reader or Homepage |
~ pjvenda / blog
$home . blog . photography

08 October 2007

Priority to Windows Media Player in Vista, over Network and I/O operations

Hardly recent news, but this one of those issues where marketing decisions seem to win over good architecture design. Trouble often awaits at the end of a shortcut...

People found out first through occasional events and then through more focused and scientific experiments that the Windows Vista scheduler deliberately (and grossly) gives CPU priority to its Media Player, against all other processes - even network and I/O operations!

But let's go for a little walk around the scheduler architecture theory park before going back to windows vista...
All of today's operating systems are multi tasking, simulating an ideal environment where each process has its own CPU. Inside every operating system's kernel there is a scheduler which job is to allocate bits of CPU time to all processes. Schedulers employ very complex algorithms to distribute an average CPU time as evenly and/or fairly as possible while keeping maximum response times for sake of interactivity and avoiding resource starvation issues (where a small group of processes keeps an unfair amount of CPU and I/O resources for themselves, leaving other processes waiting forever or, in OS jargon "starving".

I am not a scheduler guru, but I know enough to understand that they are damn hard to get right. Tuning a scheduler is an exhausting iterative task that requires great technical knowledge and creativity to come up with clever optimisations. The unsolved problem with schedulers is that nobody ever found a perfect algorithm for all kinds of usage scenarios and load patterns. Probably because such scheduler does not exist!
Playing games, browsing the web, editing audio and/or video and accessing compressed media (generic media players) are perfect examples of very different usage scenarios that happen often on the same hosts. Each has a unique set of requirements and needs a different amount of system resources to itself.
Multiple mechanisms and techniques were invented to handle this broad range of patterns as fairly as possible. In some cases schedulers categorise and tune their settings individually to each process by learning its patterns and inferring its specific category. Some other cases though are affected by users where given processes are explicitly marked as having higher priority or otherwise. With these techniques, the scheduler tries to tune itself globally to the actual usage scenario that it needs to handle. Computer scientists are working on it and slowly coming closer to the goal of the perfect scheduler that handles well every usage scenario thrown at it.

This, in general and qualitative terms, is what is involved with every scheduler in every multi tasking operating system. The source code for some schedulers is open and can be accessed, changed, tuned, made better and contributed back to the project. It is not an easy task though! As I mentioned before, schedulers are made of several elaborated algorithms that take time to locate, contain, read, understand and finally understand (this is not a typo).

Other operating system vendors, however, CHEAT!
Microsoft decided to give a higher priority specifically to its media player software, to improve interactivity and responsiveness, hopefully regardless system load. This is obviously the wrong kind of scheduler tuning probably derived from marketing and "strategy" personnel, who clearly don't know much about schedulers.
How is this wrong? Recalling that the scheduler tries to make a single CPU host behave like it runs multiple processes at the same time, increasing priority on one process is only made at the cost of performance on all other processes. This is wrong because Microsoft is giving an unfair advantage to their media player software, perpetuating their locking techniques.

The technique seems simple to me: hard code priority boosts to their own software to make all others run worse. People obviously prefer those that run well and will eventually stick with Microsoft technology. Today it's their media player... What about tomorrow? Internet Explorer?? Imagine Firefox taking 2 minutes to start or 30 seconds to load a flash based page? I would surely not use it in such conditions.

This case is serious because one of the processes that suffers a priority decrease and a notable performance decrease is related to the system's network I/O handlers. Network traffic is seriously slowed when using Microsoft media player on Windows Vista.
... but believe me, music and videos play ultra-smoothly!


Now let me explain that I am yet to install windows Vista on any of my hosts due to several different reasons:
  1. As happens with anyone else, my time is limited. I use it to research my own fields of interest and to enjoy my life as much as I can. The vast majority of Microsoft's products do not fit into any of the mentioned categories (a notable exception is Flight Simulator);
  2. My every day operating system is Linux, so testing windows Vista would be for experimental purposes only. However, there are other operating systems in queue for me to experiment with before Vista;
  3. I refuse to pay directly for a copy of windows Vista, therefore, unless there is some other legal way for me to get a licensed copy I am keeping XP. Maybe when I buy a laptop or a workstation that is only sold with a Vista pre-installation... maybe I'll give it a good long-run test;
  4. Flight Simulator X seems to run decently on XP;
  5. Oh, haven't you noticed? Vista's scheduler is broken.
Cheers, PJ.


Rui Covelo said...

Very nice post (or should I say "brilliant"). Sometimes marketing really gets in the way of engineering. I'm sure Microsoft is full of excellent engineers. It's hard to imagine a big company like Microsoft without big brains behind it's products. Microsoft really has excellent products but it also has some of the crappiest software I have ever worked with.

On the other hand, sometimes engineering need a little help not to focus so much in geek stuff that most users wouldn't use or even notice. Or simple users would prefer something else to be improved.

It's probably is a little hard (not much hard I think) to keep the perfect balance but Microsoft keeps tilting the plates too much towards marketing in my opinion.

I know a company needs to make money but I don't think Microsoft is so popular or has been making money by giving it's _home_ users what they really need. If most home users used an operating system that does what they really need, I think they would all be using Mac OS X! :D

Unknown said...

Sorry for the delay in the reply ;)

I agree that engineering sometimes needs a little short cut here and there to attach better with more specific realities. These short cuts, however, should be elegant and clever optimisations. They should be "fair" towards other elements.

Since you mention Mac OS X, there is a clear example of such an elegant engineering short cut toward reality: the BootCache (read about it here:

Anyway, thanks for your comment, it is always welcome.

Cheers, PJ.