Optimize Driver Load Time (Compact 2013)
3/26/2014
This topic discusses strategies for optimizing driver load time.
Driver Loading Overview
You can set a device driver to load synchronously, which is automatically during system startup, or asynchronously, which is on demand after system startup. The method that you choose depends on when the OS requires a particular device driver.
Although the Bus Enumerator (BusEnum) driver typically loads drivers synchronously, it also supports asynchronous driver loading. Therefore, you can configure threads to load drivers asynchronously, so that the main BusEnum thread can continue loading required drivers while the new thread is delayed. To prevent the drivers from timing out while waiting for dependencies, define BusEnum to synchronize the driver loading threads to support any dependencies between drivers. To further reduce boot time, group drivers under a bus key to be loaded by another instance of BusEnum.
The following driver issues increase load time:
- Initialization functions waiting for hardware initialization or other driver dependencies
- Drivers that time out while waiting for hardware that is not present
- Large memory operations that display drivers, or other drivers loaded by Graphics, Windowing and Events (GWES), that execute during startup; for example, the drawing of complex interfaces or the loading of large DLLs.
For more information about driver loading, see Device Manager Functions. For more information about BusEnum, see BusEnum: Enabling Finer Control of Device Driver Loading on MSDN.
Reduce Driver Load Time
To reduce driver load time:
- Remove drivers that support hardware not currently connected to the device. This will prevent the start process from waiting for the driver initialization to time out.
- Remove drivers that are not required at boot time. To load drivers only when they are required, call the function ActivateDeviceEx, and use a separate instance of BusEnum.
- Eliminate redundant operations, such as those that have already finished running in the boot loader or OEM adaptation layer (OAL).
- Modify initialization functions to delay slow tasks by using the IOCTL value in registry keys to get a Post-Init callback, and then use a thread to finish initialization. For more information, see IOCTL_HAL_POSTINIT and the Remarks section of XXX_Init (Device Manager).