Friday 24 July 2009

Windows CE: Boot Time Considerations

Hi folks,

I’ve often been ask the question “How can I improve the boot time of my Windows CE device?” Well the first thing to notice here is that Windows CE allows you to implement your own boot concept which should be customized to the needs of your specific device! But that of course requires some knowledge about the specific device so let’s focus on all the things that effect your boot time.
  • Well as you might have guessed, every component that loads during boot has an impact on the boot time. So it is crucial to understand where each component fits in. By that you see that bringing down the boot time is really a team effort that everyone in your team has to think about. The first thing to do would be to remove unnecessary components and registry keys. To learn more about the impact of each component you should profile your system for instance with CeLog.

  • The next step would be to optimize your boot order. Therefore you need to know your boot phases as well as the dependencies of each component.

  • The debug print function NKDbgPrintfW is the source of numerous trivial but impactful bugs! By using the appropriate RetailZones your performance gain can be up to 30%.

  • To cut down your boot time even further you should de-serialize your file system mountings by disabling AutoMount and controlling the load order.

  • Drivers and services can also have a huge impact on your boot time as they are loaded on a single serialized thread. Therefore you should not poll, loop, stall, sleep, block, WaitForSingleObject, etc. during the XXX_Init function. File and registry I/O should also be minimized during boot. Use DisableThreadLibraryCalls in DllMain to disable notifying every Dll of the creation of a new thread. You should also keep in mind that User-Mode drivers (only relevant for Windows Embedded CE 6.0 and up) have a longer boot time due to the additional overhead of the udvice.exe host process. As User-Mode drivers are also loaded serialized, having only one udevice.exe host process increases your boot time even further. Having only Kernel-Mode driver would result in a faster boot time. As you see, again it is important to know your dependencies to reduce the boot time.

Well you see there is a lot you can do to improve your boot time but in order to do so you really need to know your system in and out.

Have fun!

No comments: