I’ve been reading through the Windows 7 Developer Guide. I like this document; it is tilted more towards information than hype, and is readable even for non-developers. There are things mentioned which I had not spotted before.
One example is triggers in the service control manager. There was actually a PDC session which covered this, among other things, under the unexciting title Designing Efficient Background Processes (PowerPoint). If you check out the slides, you’ll see that this is actually something significant for Windows users. It is an attempt to reduce all that stuff that runs whether or not you need it, increasing boot time and slowing performance. Apparently some people are so upset with the time it takes Windows to boot that they are threatening to sue; so yes, this does matter.
Services are applications that run in the background, usually without any visible interface. They consume system resources, so it makes sense to run them only when needed. Unfortunately, many services run on a “just in case” basis. For example, if I check the services on this machine I see I have one running called Apple Mobile Device, just in case I might connect one. It is using 4MB of RAM. However, I never connect an Apple device to this machine. I’m sure it was installed by iTunes, which I rarely use, though I like to keep up-to-date with what Apple is doing. So every time I start Windows this thing also starts, running uselessly in the background.
According to Vikram Singh, who took the PDC session, adding 10 typical 3rd party services to a clean Vista install has a dramatic effect on performance:
- Boot time: up by 87% (24.7 to 46.1 seconds)
- CPU time when idle: up by six times (to 6.04%)
- Disk Read Count: up by three times (from 10,192 to 31,401 in 15 seconds)
Service triggers are an attempt to address this, by making it possible to install services that start in response to specific events, instead of always running “just in case”. Four trigger types are mentioned:
- On connection of a certain class of device
- On connection to a Windows domain
- On group policy refresh
- On connection to a network (based on IP address change)
In theory then, Apple can rewrite iTunes for Windows 7, so that the Apple Mobile Device service only starts when an Apple device is connected. A good plan.
Now, I can think of three reasons why this might not happen. First, inertia. Second, compatibility. This means coding specifically for Windows 7, whereas it will be easier just to do it the old, compatible way. Third, I imagine this would mean faster boot, but slower response when connecting the device. Apple (or any third party) might think: the user will just blame Windows for slow boot, but a slow response when connecting the device will impact the perceived performance of our product. So the service will still run at start-up, just in case.
Still, I’m encouraged that Microsoft is at least thinking about the problem and providing a possible solution. We may also benefit if Microsoft tweaks some of its own Windows services to start on-demand.
What they need to do is have an additional service startup type that means “at boot, but it’s not required for the system to operate”. In fact, perhaps Windows 7 should automatically do this for all application services BY DEFAULT, forcing people to explicitly change it when they build their code for Windows 7. The advantage of this is that you can use your system immediately, but while your desktop is loading, and you’re opening your browser and your outlook email client, the system is still in the background on a low priority thread loading your services. If and when you attempt to connect to one of the services, if it still is not finished loading, then the application blocks. But probably not for too long, because it’s already been trying to load for a bit.
The problem is that if you specify a service to start at boot time, the system automatically assumes that core OS functionality doesn’t work without the service started.
This would be a win/win for everyone. Only a small compromise for apple, because unless the user is opening itunes within 20 seconds of their system booting, there’s no slowdown at all because by the time they do go to start itunes, the service already finished.
Third party manufacturers here can help in another way. Even after logging-in it takes an age for my workstation to become responsive thanks to all the rubbish that gets installed in the System Tray. Yes, I do use RealPlayer but no, I do not want the latest gossip on celebrities. Same goes for Quicktime, Windows Messenger etc., much of which admittedly has a ‘run automatically on startup’ switch but which also seems to come with a lot of utter crap of no real use whatsoever. Less is very definitely more.
Why would we care what apple does, this is something we could hack together without help from apple, its just the service config, just use sc.exe
Zach: Vista already added a auto start with delay mode.
Ah! xinetd comes to Windows! And as for auto start with delay, do you know how annoying it is to think your machine is booted and then when you start doing something all these delayed services start and you need to wait more… If Linux and OS X can start in a quick fashion, why can’t Windows!
Gary