by April 10, 2002 0 comments



Microsoft OSs have always had the dubious distinction of becoming slower with every new version. However, Win XP bucks this trend by booting faster than its predecessors–Win NT/2000 on the same hardware. Here’s how they did it.

The boot process has three parts. The first happens when a computer is powered on–the system BIOS goes through a Power On Self Test (POST) like RAM check, floppy, hard drive and CD-ROM drive detection. Next, the BIOS loads the boot loader in the MBR (Master Boot Record) of the active partition. Finally, once the boot loader is initialized, the OS starts to boot. This typically takes the longest as the OS does a lot of different tasks. It loads the core OS, mounts disks, loads device drivers, reads the registry, looks for new devices, initializes the display and shows the user shell. It also makes network connections and other custom settings like security at this time. Win XP works with the hardware such that this is faster. 

Filenames in the PREFETCH folder

Every application (including the XP boot system) has an associated prefetch file that describes the order in which modules are loaded when it starts up. These filenames are based on the name of the application executable, a hexadecimal representation of the hash to the full path of the executable and the file extension.PF. Depending on the physical path on your machine, the hex code differs.
However, the XP boot prefetch file is always named the same on all systems–NTOSBOOT-B00DFAAD.PF. Interestingly, the hex part is a parody of BAADF00D–something I guess, the Microsoft programmers must have been complaining about!

If you’re buying a new system and installing XP on it, look for a motherboard that supports the Simple Boot Flag Specification in its BIOS. This allows the BIOS and OS to work together and optimize speed. It minimizes BIOS memory tests and video ROMs, doesn’t initialize devices for a PnP OS, starts disk spin-ups earlier and disable boot logos and floppy drive.

Win XP also has a new and improved boot loader (NTLDR). The Boot Loader is responsible for reading and loading the core OS and its system files. In Win XP, the boot loader caches files and directory information and reads system files in a single I/O pass, thereby leading to a significant boost in loading of the OS kernel. The kernel also contains improvements to optimize boot time. It now overlaps disk I/O with device initialization, wherein devices are detected and drivers loaded into memory as they’re being read from the disk. Also device drivers for XP are written such that only the device to be used is initialized. The network is also initialized during system boot and not after. 

Win XP also uses ‘pre-fetching’ to load drivers, services and the shell into memory before they are actually needed. This is done by studying previous boots and optimizing the load pattern for the necessary files. This process is also applied to applications on the system. Every application is analyzed by the system when it starts up the first few times. It then creates a virtual ‘memory-map’ of what the application requires during different times of running and saves this information into the WINDOWS\PREFETCH folder. Once the mapping is done, the application loads much faster. The prefetch data is stored for the previous eight boots or application launches. 

To see the effect of not having prefetch data, simply delete the files for a corresponding application, and start it to see the difference. For instance, if you have Microsoft Word, first run it a few times if you haven’t already done so and use it normally. Then record the time that Word takes to start up from the moment you click its icon. Now delete the files WINWORD.EXE.*.PF (see box on what these filename formats are) from WINDOWS\PREFETCH. Start Word again using its icon and measure the startup time. You’ll see a major difference in the two. But no problem, Win XP will start collecting prefetch data for the application again and a few launches later you’ll get the quick start again. There is also a file for the boot loader that works in the similar way. However, deleting it for testing is not really recommended.

The prefetch data is also used in the Win XP defrag application. The most optimal prefetch order data is written to the Layout.ini file in the WINDOWS\PRE FETCH directory. You can open this file in Notepad to see the order in which XP thinks the files should be arranged physically on the disk for the fastest boot. Defrag also reads this data and arranges the files accordingly. In fact Win XP automatically runs defrag when it detects an idle computer and tries to change the layout of the files. 

The next thing that Win XP does is cache network connections and settings, which will give you a faster connection to a network than in previous Windows. Win XP by default uses cached network views rather than real-time ones. So when you actually initiate a view, it shows you the cached version, and tries to make the actual connection in the background. This reduces the number of network interruptions, and won’t slow down your work even when there’s an unavailable domain, DHCP or DNS server error, or even a disconnected network cable. If there’s a problem, it will inform you in an appropriate manner such as a balloon tip. 

Let’s now look at how to optimize your system if your motherboard doesn’t support the Simple Boot Flag Specification. Since BIOS menus from different vendors are different, we’ll only name the options you need to change. It may be called something else in your BIOS. 

  • Enable Quick POST. This disables processes like detailed memory checks and boot
    logos
  • Disable boot up floppy seek, as it significantly increases the boot time otherwise
  • Boot up device order. Set the boot device order to “C only”. In some BIOSs, you’ll need to move the IDE-0 device to the top of the list. This not only speeds up the boot, as the first boot device is the one that you need to load, but also prevents floppies from booting the
    system
  • Enable PnP-OS. This option stops the BIOS from detecting devices and lets the OS handle them. Since it’s the OS
    that finally enumerates the devices on the system anyway, this option reduces time significantly
  • Remove unnecessary apps and services from starting up automatically. Win XP comes with a tool that easily allows you to do this. Type ‘msconfig’ in Start>Run and uncheck the apps and services that you do not wish to startup
    automatically

Finally, we‘ll walk you through the new tool that analyses, displays and can optimize the system’s boot process. It’s called BootVis and is available at
http://download.microsoft.com/download/whistler/BVT/1.0/WXP/EN-US
as a file called BootVis_ file.exe. Download and extract the files to a folder on your disk and run the BootVis.EXE program. Close all other applications and once the program loads up, select File>New>Next Boot+ Drivers Trace. Your system will reboot in 15 secs. Once back from reboot, wait for certain files to get written to the drive–you’ll see a message stating that. After this finishes, the program loads up again and displays a number of graphs. Detailed help about each graph is available in the program, so I’ll not go into them. Suffice to say that these graphs represent the time required to load the different components mentioned as part of the boot process in this article. 

To optimize the system, you should run the above step 4-5 times. Then, select Trace>Optimize system from the menu and wait for another reboot. This one may take a slightly longer time than earlier ones. Defrag the system immediately after you’ve logged back in and subsequent bootups will see a much more improved boot time. 

Vinod Unny is a Technology Consultant at iSquare Technologies

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

<