Windows XP Prefetch Files

Prefetch Files

Part 1. Prefetcher Guide:

Part 2. Defragging the Prefetch File:

Part 3. Cleaning out the Prefetch Files:

Part 4. Repairing the Prefetch Folder:

Prefetch Parameters

The Prefetcher's configuration is stored in the Windows Registry at

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

The EnablePrefetcher value can set to be one of the following:

  • 0 = Disabled
  • 1 = Application launch prefetching enabled
  • 2 = Boot prefetching enabled
  • 3 = Applaunch and Boot enabled (Optimal and Default)

The recommended value is 3.

"EnablePrefetcher"=dword:00000003

Note: Ignore the option for Hexadecimal or Decimal under "Base" when choosing to input 1, 2 or 3.

  1. The Windows Prefetcher Guide:

Windows XP Prefetching by default is already optimized. There are no tweaks that do anything but hurt performance. Anyone making any claims otherwise does not understand how Windows Prefetching works. They also do not provide documented and accurate reproducible testing to prove that some "tweak" does work. This nonsense has been copied off one site to another.

It is completely impossible for unused entries in the Prefetch folder to slow a system down.

Prefetch files are trace files that simply include a list of files and their locations that are used by an application when it loads. Nothing is preloaded or cached in memory before you attempt to load an application.

Prefetching is the reason Windows XP Boots faster.

The Prefetch folder and the “layout.ini” file will Defragment itself every 72 hours, and will self clean older Prefetch files from your system. You will hardly ever see more then 130 Prefetch Files in your Prefetch Folder.

Prefetch Description

One of the hidden features in Windows XP (only) is the prefetcher. It, quite simply, works to speed up the launch of applications by loading them before you access them. It primarily works by loading startup programs during the time windows is still booting so that when you enter your password, everything

loads quickly. It also keeps a record of all programs launched and how much they are used to aid in allocating how much prefetching to which program.

When a Windows XP system is booted, data is saved about all logical disk read operations. On later boots, this information is used to prefetch these files in parallel with other boot operations. During boot and application launch, a Windows system demands and pages a sizable amount of data in small chunks (4 KB to 64 KB), seeking between files, directories, and metadata. The Logical Prefetcher, which is new for Windows XP, brings much of this data into the system cache with efficient asynchronous disk I/Os that minimize seeks. During boot, the Logical Prefetcher finishes most of the disk I/Os that need to be done for starting the system in parallel to device initialization delays, providing faster boot and logon performance

Prefetching is a process in which the operating system loads key pieces of data and code from disk into memory before it's actually needed. A general look at how prefetching works.

In order for this Prefetching operation to actually improve performance, the Windows XP Cache Manager monitors the data being moved between the disk and RAM and between RAM and virtual memory when the system is booting up as well as when various applications are loaded.

As the Cache Manager monitors these occurrences, it constructs maps of the directories and all of the files that were referenced for each application or process. These maps are then saved to files with a .pf extension in the \Windows\Prefetch folder.

Once these map files have been created, the Cache Manager will use them to improve efficiency when the system boots up as well as when loading applications. More specifically, the Cache Manager will intercept every process or application that is about to be loaded and will check the \Windows\Prefetch folder to see if there is a corresponding map. If there is, the Cache Manager will call on the file system to immediately access the directory and files referenced in the map. The Cache Manager will then alert the Memory Manager and tell it to use the information in the map file to load data and code into memory. Once this prefetch operation is complete, the Cache Manager will allow the application or process to continue loading. As the application or process does so, it will find the majority of the files and data that it needs already available in memory, thus reducing the amount of disk access and allowing the application or process to load or respond faster.

In order to further improve the efficiency of this prefetching operation, Windows XP will regularly analyze the contents of the map files, compile a list of the directories and files, organize them in the order in which they are loaded, and save this information in a file called Layout.ini in the \Windows\Prefetch folder. It will then schedule disk defragmenter to run on a regular basis and use the information in the Layout.ini file to relocate all of the directories and files listed to a contiguous area of the disk. The prefetcher works to take all the loading to the windows boot logo stage to make everything else that requires your interaction faster. The prefetcher has a file for each program that you run that, in part, it records the amount of use. Logically, programs that are loaded often are prefetched more than programs that are not. The prefetch files are located in %windir%\prefetch. That's C:\windows\prefetch for those who don't know. If you opened it now you would see a whole bunch of .pf files and one layout.ini file. All the .pf files are individual records of each program. The layout.ini file is a consolidation of all those programs and what they typically access, in order of priority. The prefetcher requires scheduled tasks to work. If you have the service disabled or off, the prefetcher will not function.

Prefetching is the reason Windows XP Boots faster.

Note: If your prefetcher is not working. Check in windows services to see if “Task Scheduler” is running.

This service must be running for the prefetcher to work.

2. Defragging the Prefetch File:

Go to run, and then type in “cmd”, (without the quotes). And a black window will pop up with the c:\ prompt. On that line just type in “defrag c: -b” (without the quotes) and it will defrag the prefetch file for you. When it is done just type exit and the window will close and you are done.

If the file was really fragmented you will notice a difference in the time it takes to boot up Windows, usually faster.

3. Cleaning out the Prefetch Files:

Remember:

It is totally unnecessary to clean out the PF files in your prefetch folder.

It is just a myth that it helps speed things up.

The Prefetch folder and the “layout.ini” file will Defragment itself every 72 hours, and will self clean older Prefetch files from your system. You will hardly ever see more then 130 Prefetch Files in your Prefetch Folder.

I would strongly advise to just leave the prefetch and it’s files alone. It does no harm and will keep your system in better running condition.

But if you must, please use caution and be advised that your system could see a slowdown in boot time.

NOTE: Do Not Delete the “Prefetch Folder”

NOTE: Do Not Remove Or Delete The “layout.ini” File Which Resides In XP'S Prefetch Folder Or You Could Slow Down Your PC At Start Up And When You Open Windows Programs.

The “layout.ini” file is a consolidating of all the files in your prefetch folder. And sets the parameters for Prefetching boot priorities.

Once it is gone, it can stay gone on some PC'S forever, and your Prefetch Folder will never work again no matter what you do in the registry to try to rectify the problem.

See Below for help in repairing the prefetch folder:

To delete everything in the prefetch folder:

Go to Start > run, type in "prefetch" (without the quotes).

Click on "Edit" on the top toolbar, select "Select All", and then delete everything except the “layout.ini” File. If you do, Then open up your “recycle bin”. Find the “layout.ini” file. Then restore it to place it back into the prefetch folder.

NOT E: After deleting everything in your “Prefetch File”. XP will startup slower the first couple of times as it searches for, and finds your required and allowed startup files and programs. As to start rebuilding the Prefetch List.

4. Repairing the Prefetch Folder:

4 easy steps how you can rebuild the “layout.ini” file again.

1. Make sure that the task scheduler is enabled. If you are un-sure, go to Start/Control Panel/Administrative Tools/ Click on Services/ Then in the list of services make sure the Task Scheduler is enabled & restart the service by clicking on Start. Close the Services Folder & go back to desktop. 2. Then go to START/RUN/ and TYPE IN ”cmd” (without the quotes) CLICK OK. This will bring up the DOS Command screen. 3. You will need to copy and paste this entry in at the flashing cursor ” rundll32.exe advapi32.dll,ProcessIdleTasks “(without quotes) and press ENTER. 4. Now reboot three times and your Prefetch folder will be rebuilt. (It takes 3 reboots for the prefetch folder to work out what it needs)