Why windows takes so long to start up.

by Steve Wiseman on September 7, 2006 · 3 comments

in Windows

Most of us have had a brand new computer at one time. It’s a great feeling. You boot up windows and within 30 seconds you are surfing the net, checking your email, or playing your favorite game. 10 months down the road things aren’t so nice anymore. You power up your computer and it seems to take forever to load.

Even when you are careful about what you install it seems that each day it takes longer for it to boot. It’s not your imagination – and there are a couple of good tips to keep your boot time short and sweet.

As always – backup your system before you start any of this. If you make a mistake you might need to restore from backup

Update (09/08/2006) – There has been some controversy about the prefetch folder. I think this issue needs to be looked into. I did have a reputable source for this information: It was the “Windows XP Annoyances” book by O’Reilly. Page 210. Titled “Keeping an eye on prefetch”

1. The prefetch cache

The first tip I want to talk about is the windows prefetch. Windows XP has this feature that loads commonly used programs – at boot time.

Here is how it works: Yesterday you used MS Word, and Duke Nukem 3D. Today you boot your system to check e-mail. It sees parts of these two programs in the prefetch folder and loads them into memory before windows completes the boot process. The benefit is faster application launch times. If you really wanted to use MS Word, it would pop up really quick when you double clicked on it.

The problem is most people have been running windows for years, and the prefetch gets clogged with stuff that you almost never use. Windows takes forever to boot because it is prefetching a 1.0 copy of Napster, and you just want to check your email before you have to go to work.

What can be done about it? Well there are a few things we can do to tweak the prefetch cache. One method is to disable it partially, and this can be done quite easily.

Simply browse to the windows folder (Ex: C:\Windows) and under there you should see the prefetch folder. Go into the prefetch folder and delete all the files (Careful! It should look like this c:\windows\prefetch) And here is a screenshot of one if you still have questions

The first thing to note is the next reboot will be slow. This is because windows needs to relearn the prefetch for system files. Subsequent boots will run much faster since the sludge of programs has been removed, and only new ones are in the cache.

The trouble is that it will only help you for a while – until the prefetch gets clogged up again. We need to edit a registry key to tweak it. Open regedit and browse to this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters

Under this key you should see a value named: EnablePrefetcher

It has 4 possible values:

0 – Disabled : The prefetch system is turned off.

1 – Application : The prefetch only caches applications.

2 – Boot : The prefetch only caches boot system files.

3 – All : The prefetch caches boot, and application files.

We don’t want to disable it entirely. This would actually make boot times *longer*. This is because this feature is also used to speed up the loading of boot files. That is why we are going to pick the number 2 option. It allows us to keep the advantage of caching system files, without continually clogging the system up with applications.

Set the value to 2 and reboot.

The 2nd time you boot it should boot much faster. Remember that the side effect is that launching individual applications once windows has loaded will now be slightly slower.

2. Hard drive fragmentation

Over time your hard drive will become fragmented. An over simplified explanation of fragmentation is when your files and folders are not all stored in the same spot. For example lets say you had a large movie file. If it were fragmented the first 5 megabytes are at the beginning of the hard drive, and then next 5 are at the end. It takes longer for windows to read the file than it would if it were all in the same spot. The point is that if each file is stored in a linear fashion, and the drive does not have to move all over the place to read it – it will load faster. XP has a built-in defrag tool, and it is simple to run. Open “My Computer” right click on the boot drive, and go to properties. Now click on the tools tab.

Click “Defragment Now” and the following window should appear:

Before you click on the “Defragment” button you want to close all applications and be aware that it might take hours to complete. If you leave something running it might keep windows from completing the defragment operation.

Click on the defragment button and you can walk away. Or you can watch it defrag your hard drive:

3. Disconnected network drives

I am using networked drives all the time. If you have ever put your machine on a network and connected to a shared drive, this can slow you down too. If you have a drive that is still mapped, but cannot be reached it will slow down windows during boot time. This is because windows will wait…wait…and wait some more for the remote server to respond. To clean these out open “My Computer” and go to the tools menu. Click on “Disconnect Network Drives” It will open a window that looks like this:

Click on the drives you no longer need, and click OK.

4. Spyware & Adware

These can have a big impact on your start times. If your PC gets loaded with spyware, it spends a large portion of its boot time making sure those pesky programs are loaded and ready to throw popup adverts at you all day. To check and clean your system of spyware there are three free programs that I highly recommend:

1. Microsoft Windows Defender

2. Ad-Aware

3. SpyBot Search And destroy

5. File and Printer Sharing

One other item that can significantly impact is the “File and Printer Sharing” feature within windows. Obviously, if you are sharing your printer, or folders you don’t want to disable this – so this tip is not for you. If you never use it, then why waste your time waiting for it to load?

Here is how to turn it off:

Go into the control panel. Click on “Network Connections”

Now right click on “Local Area Connection” and click on properties

Uncheck the “File and Printer Sharing for Microsoft Networks”

Click OK, and reboot.

That wraps up our windows startup optimization. And if you are tired of waiting for windows to shutdown, then check out our article on speeding that up too!

Stay tuned. We are about to release a new version of our Remote Reboot program. This version adds a feature suggested by David in our forum. It allows you to specify the shutdown reason that is written to the event log on Windows XP, and 2003. If you are not sure what I am talking about…this should remind you:

One final note, if you have any ideas for a free utility you would like to see, please post to our forum…or better yet check out the ones we already have

{ 3 comments… read them below or add one }

Ahmed Helmy October 5, 2009 at 8:22 am

Good Work man thnx for help

Alex November 20, 2009 at 7:22 pm

No. Wrong.
First, do not turn off EnablePrefetcher flag to 2. It want helps to boot faster. It just turns off application prefetching as this occurs after boot.

Second.
You should not only delete Prefetch folder contents. If you do so, you need at least rebuild it. Do it with command rundll32.exe advapi32.dll,ProcessIdleTasks

Third.
Optimize system performance defragmenting boot-files:
defrag c: -boot

Never turn off task scheduler. More below.
These services need to be set to Automatic and running.
System Event Notification
Task Scheduler

First, I do not know anything about PerfectDisk. PerfectDisk may have it’s
own version of Prefetch.

Disadvantages of Optimize hard disk when idle:
• Using a third party disk defragmenter. That app should take care of it.
• Running a laptop with a battery; defragmenting can use up power.

PerfectDisk should take care of optimizing the hard disk when idle.

The following info is from various sources and my own experience and relates
to XP’s native defrag utilities.

Maybe there will be a clue in the following.

[[Windows XP Professional monitors the files that are used when the computer
starts and when you start applications. By monitoring these files, Windows
XP Professional can prefetch them. Prefetching data is the process whereby
data that is expected to be requested is read ahead into the cache.
Prefetching boot files and applications decreases the time needed to start
Windows XP Professional and start applications.

Prefetching is further improved if the files are located next to each other
on the outer edge of the disk. Windows XP Professional optimizes the
location of boot files and applications when the computer is idle. The
optimization occurs in the background and lasts only a minute or two; you
might hear the hard disk being accessed when optimization occurs. After the
initial optimization takes place, subsequent optimization occurs, at most,
every three days. {Three boots.}

When you run the Disk Defragmenter tools that are included with Windows XP
Professional, they can perform any optimization updates that are scheduled
to take place during the next idle period. The Disk Defragmenter tools do
not disturb the existing layout of optimized boot files and applications.

Note
Computers running Windows XP Home Edition also prefetch and optimize boot
files and applications.]]
From…
Optimizing Startup Times by Using Defragmentation Tools
http://www.microsoft.com/resources/…kd_tro_uutk.asp

Prefetch uses DFRGNTFS.EXE and DEFRAG.EXE on NTFS formatted drives. I have
no idea about FAT32.

These services need to be set to Automatic and running.
System Event Notification
Task Scheduler

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management\PrefetchParameters

Value Name: EnablePrefetcher
Value Type: REG_DWORD
Value Data: 0, 1, 2 or 3
Values are:
0 = disabled
1 = Application launch prefetching
2 = Boot prefetching
3 = Both Application & boot prefetching

3 seems to be the preferred option. 3 is parameters 1 and 2 ANDed.

Value Name: RootDirPath (Path to %systemroot%\Prefetch folder)
Value Type: REG_SZ
Value Data: Prefetch

This is what frodo@theshire.org was referring to.

TweakUI
[+] General
Optimize hard disk when idle
[[This allows Windows to rearrange files on the hard disk when the computer
is not in use to improve performance. This is a system wide setting which
requires a restart for changes to take effect.]]

TweakUI changes this key to 0 or 1…

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OptimalLayout
Value Name: EnableAutoLayout
Value Type: REG_DWORD
Value Data: 0 or 1
0 = disabled
1 = enabled

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OptimalLayout
Value Name: LayoutFilePath
Value Type: REG_SZ
Value Data: C:\WINDOWS\Prefetch\Layout.ini

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction
Value Name: Enable
Value Type: REG_SZ
Value Data: Y or N

[[Accepted values for this entry are Y or N. If the entry is set to Y,
Windows automatically optimizes the file location for boot optimization.
This optimization occurs automatically if the system is idle for 10 minutes.
Boot optimization improves startup time by locating startup files in
contiguous clusters on the volume, reducing the movement of the disk head
when reading the volume.]]

Value Data needs to be Y.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction

Value Name: LcnEndLocation (disk address, end location on the hard drive)
Value Type: REG_SZ
Value Data: Some number (disk address)

Value Name: LcnStartLocation (disk address, start location on the hard
drive)
Value Type: REG_SZ
Value Data: Some number (disk address)

Value Name: OptimizeComplete
Value Type: REG_SZ
Value Data: Yes or No
If Yes, boot optimization was completed.
If No there will be an entry in OptimizeError.

Value Name: OptimizeError
Value Type: REG_SZ
Value Data: Insufficient space or Insufficient Resources

The above registry Value Names refer to running defrag, defrag c: -boot or
Rundll32.exe advapi32.dll,ProcessIdleTasks.

You can delete the contents of %windir%\Prefetch\layout.ini or delete
layout.ini altogether and Rundll32.exe advapi32.dll,ProcessIdleTasks should
rebuild or recreate the layout.ini. You can do nothing to layout.ini and
Rundll32.exe advapi32.dll,ProcessIdleTasks should rebuild it.

Rundll32.exe advapi32.dll,ProcessIdleTasks will rebuild the layout.ini file,
even if it has been deleted from %windir%\Prefetch. Layout.ini is the
OptimalLayoutFile. [OptimalLayoutFile] is the first line in layout.ini.

Layout.ini is what keeps track of this…

[[XP keeps track of files used by every application. After several launches
of the same application, it has some sense of what files are required.
Thereafter, it uses an algorithm that says, basically, if a file has not
been used in the last six launches, it is marked for removal; if a file has
been used in the last two launches, it's marked for inclusion. Then based
on these notations, Windows XP determines which files need to be brought
into the block, and which ones moved out. When this move will take place
depends on several factors, such as how recently files were moved for this
application, and when the machine is available? Consistent with the idea
that disk activity should not interfere with performance, Windows XP won't
move the application files unless there has been no user-initiated I/O
activity for 13 minutes. Microsoft presumes this means the user is away
from the machine. It then begins migrating the files to the optimal place
on the disk.]]
From…
Performance Enhancements in Windows® XP
http://windowsxp.devx.com/articles/perfen/default.asp

admin November 20, 2009 at 7:25 pm

Fantastic comment. Thanks for all the tips to make things faster

Leave a Comment

Previous post:

Next post: