Prefetcher

Last updated

The Prefetcher is a component of Microsoft Windows which was introduced in Windows XP. [1] It is a component of the Memory Manager that can speed up the Windows boot process and shorten the amount of time it takes to start up programs. It accomplishes this by caching files that are needed by an application to RAM as the application is launched, thus consolidating disk reads and reducing disk seeks. This feature was covered by US patent 6,633,968. [2] [3]

Contents

Since Windows Vista, the Prefetcher has been extended by SuperFetch and ReadyBoost. SuperFetch attempts to accelerate application launch times by monitoring and adapting to application usage patterns over periods of time, and caching the majority of the files and data needed by them into memory in advance so that they can be accessed very quickly when needed. ReadyBoost (when enabled) uses external memory like a USB flash drive to extend the system cache beyond the amount of RAM installed in the computer. ReadyBoost also has a component called ReadyBoot that replaces the Prefetcher for the boot process if the system has 700 MB or more of RAM. [4]

Overview

When a Windows system boots, components of many files need to be read into memory and processed. Often different parts of the same file (e.g. Registry hives) are loaded at different times. As a result, a significant amount of time is spent 'jumping' from file to file and back again multiple times, even though a single access would be more efficient. The prefetcher works by watching what data is accessed during the boot process (including data read from the NTFS Master File Table), and recording a trace file of this activity. The boot fetcher will continue to watch for such activity until 30 seconds after the user's shell has started, or until 60 seconds after all services have finished initializing, or until 120 seconds after the system has booted, whichever elapses first.

Future boots can then use the information recorded in this trace file to load code and data in a more efficient fashion (i.e. by re-ordering disk reads to minimise or eliminate the need to access the same file multiple times thus minimising disk head movements).

Application prefetching works in a similar fashion, but is instead localized to a single application's startup. Only the first 10 seconds of activity are monitored. [1] :458

The prefetcher stores its trace files in the "Prefetch" folder inside the Windows folder (typically C:\Windows\Prefetch). The name of the boot trace file is always NTOSBOOT-B00DFAAD.PF, and application trace files are a concatenation of the application's executable name, a hyphen, a hexadecimal representation of the hash of the path the file resides in, and a ".pf" extension. Applications that host other components (i.e. Microsoft Management Console or Dllhost) have the name of the loaded component included in the computed hash as well; this results in different trace files being created for each component.

Note that the Task Scheduler is the process responsible for parsing the trace data collected by the prefetcher and writing files to the prefetcher directory. As a result, the prefetcher will not operate correctly if the Task Scheduler service is not started.

To further improve access times, the Task Scheduler calls Windows Disk Defragmenter every three days. When the machine is idle, the lists of files and directories that were referenced during the boot process and application startups is processed. [1] :461–462 The processed result is stored in Layout.ini in the Prefetch directory, and is subsequently passed to the Disk Defragmenter, instructing it to re-order those files into sequential positions on the physical hard drive.

This will further improve performance by minimising the distance that the hard drive's heads have to be moved from one file to the next.

It is possible to trigger this re-ordering (by running "Defrag.exe %systemdrive% -b" from the command line) without running a full defragmentation.[ citation needed ]

If the system is installed on a solid-state drive, ReadyBoost is disabled.

Configuration

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: [5]

The recommended value is 3. [5] Values higher than 3 do not increase performance, and changing the value to 2 will not make Windows boot faster. [5]

Incorrect tweaking of the prefetcher

Often found on the Internet [7] is the "/prefetch:1" application tweak, [8] which is a valid but misunderstood switch. It is used to distinguish between different operating modes of an executable in case those different modes would have significantly different prefetch traces. [9]

A second myth is that the user should delete the prefetch folder contents to speed up the computer. If this is done, Windows will need to re-create all the prefetch files again, thereby slowing down Windows during boot and program starts until the prefetch files are created—unless the prefetcher is disabled. [10] [11] [12] Windows maintains prefetch files in the Prefetch folder for up to the 128 most recently launched programs. [13]

See also

Related Research Articles

<span class="mw-page-title-main">Windows 2000</span> Fifth major release of Windows NT

Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It is the direct successor to Windows NT 4.0, and was released to manufacturing on December 15, 1999, officially released to retail on February 17, 2000 for all versions, and on September 26, 2000 for Windows 2000 Datacenter Server. It was Microsoft's primary business-oriented operating system until the introduction of Windows XP Professional in 2001.

NT File System (NTFS) is a proprietary journaling file system developed by Microsoft in the 1990s.

<span class="mw-page-title-main">Windows 98</span> Microsoft personal computer operating system released in 1998

Windows 98 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. It was the second operating system in the 9x line, as the successor to Windows 95. It was released to manufacturing on May 15, 1998, and generally to retail on June 25, 1998. Like its predecessor, it is a hybrid 16-bit and 32-bit monolithic product with the boot stage based on MS-DOS.

The Encrypting File System (EFS) on Microsoft Windows is a feature introduced in version 3.0 of NTFS that provides filesystem-level encryption. The technology enables files to be transparently encrypted to protect confidential data from attackers with physical access to the computer.

<span class="mw-page-title-main">Shadow Copy</span> Microsoft technology for storage snapshots

Shadow Copy is a technology included in Microsoft Windows that can create backup copies or snapshots of computer files or volumes, even when they are in use. It is implemented as a Windows service called the Volume Shadow Copy service. A software VSS provider service is also included as part of Windows to be used by Windows applications. Shadow Copy technology requires either the Windows NTFS or ReFS filesystems in order to create and store shadow copies. Shadow Copies can be created on local and external volumes by any Windows component that uses this technology, such as when creating a scheduled Windows Backup or automatic System Restore point.

<span class="mw-page-title-main">System Restore</span> System recovery feature in Microsoft Windows

System Restore is a feature in Microsoft Windows that allows the user to revert their computer's state to that of a previous point in time, which can be used to recover from system malfunctions or other problems. First included in Windows Me, it has been included in all following desktop versions of Windows released since, excluding Windows Server. In Windows 10, System Restore is turned off by default and must be enabled by users in order to function. This does not affect personal files such as documents, music, pictures, and videos.

<span class="mw-page-title-main">Windows Vista</span> Seventh major release of Windows NT

Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft Windows. It was released to manufacturing on November 8, 2006, and over the following two months, it was released in stages to business customers, original equipment manufacturers (OEMs), and retail channels. On January 30, 2007, it was released internationally and was made available for purchase and download from the Windows Marketplace; it is the first release of Windows to be made available through a digital distribution platform.

As the next version of Windows NT after Windows 2000, as well as the successor to Windows Me, Windows XP introduced many new features but it also removed some others.

Compared with previous versions of Microsoft Windows, features new to Windows Vista are numerous, covering most aspects of the operating system, including additional management features, new aspects of security and safety, new I/O technologies, new networking features, and new technical features. Windows Vista also removed some others.

<span class="mw-page-title-main">Microsoft Management Console</span> Component of Microsoft Windows

Microsoft Management Console (MMC) is a component of Microsoft Windows that provides system administrators and advanced users an interface for configuring and monitoring the system. It was first introduced in 1998 with the Option Pack for Windows NT 4.0 and later came pre-bundled with Windows 2000 and its successors.

<span class="mw-page-title-main">ReadyBoost</span> Disk caching component of Microsoft Windows

ReadyBoost is a disk caching software component developed by Microsoft for Windows Vista and included in later versions of Windows. ReadyBoost enables NAND memory mass storage CompactFlash, SD card, and USB flash drive devices to be used as a cache between the hard drive and random access memory in an effort to increase computing performance. ReadyBoost relies on the SuperFetch and also adjusts its cache based on user activity. ReadyDrive for hybrid drives is implemented in a manner similar to ReadyBoost.

Windows Vista introduced a number of new I/O functions to the Microsoft Windows line of operating systems. They are intended to shorten the time taken to boot the system, improve the responsiveness of the system, and improve the reliability of data storage.

<span class="mw-page-title-main">Microsoft Drive Optimizer</span> Windows utility which defragments a hard drive

Microsoft Drive Optimizer is a utility in Microsoft Windows designed to increase data access speed by rearranging files stored on a disk to occupy contiguous storage locations, a technique called defragmentation. Microsoft Drive Optimizer was first officially shipped with Windows XP.

There are a number of security and safety features new to Windows Vista, most of which are not available in any prior Microsoft Windows operating system release.

Windows Vista has many significant new features compared with previous Microsoft Windows versions, covering most aspects of the operating system.

Windows Vista contains a range of new technologies and features that are intended to help network administrators and power users better manage their systems. Notable changes include a complete replacement of both the Windows Setup and the Windows startup processes, completely rewritten deployment mechanisms, new diagnostic and health monitoring tools such as random access memory diagnostic program, support for per-application Remote Desktop sessions, a completely new Task Scheduler, and a range of new Group Policy settings covering many of the features new to Windows Vista. Subsystem for UNIX Applications, which provides a POSIX-compatible environment is also introduced.

<span class="mw-page-title-main">Vopt</span> Windows defragmentation utility

Vopt is a Windows defragmentation utility sold by Golden Bow Systems. It is one of the oldest defragmentation products, and has supported MS-DOS and all versions of Microsoft Windows. The convenience of quick processing time is offset by less optimal performance, but when used in conjunction with the built-in optimization of the Windows prefetch folder, system performance is maintained without major reorganization of all the files on the drive.

<span class="mw-page-title-main">Windows Search</span> Desktop search platform by Microsoft

Windows Search is a content index and desktop search platform by Microsoft introduced in Windows Vista as a replacement for the previous Indexing Service of Windows 2000, Windows XP, and Windows Server 2003, designed to facilitate local and remote queries for files and non-file items in the Windows Shell and in compatible applications. It was developed after the postponement of WinFS and introduced to Windows several benefits of that platform.

Some of the new features included in Windows 7 are advancements in touch, speech and handwriting recognition, support for virtual hard disks, support for additional file formats, improved performance on multi-core processors, improved boot performance, and kernel improvements.

References

  1. 1 2 3 Russinovich, Mark; David Solomon (2005). "Memory Management". Microsoft Windows Internals (4th ed.). Microsoft Press. pp.  458–462. ISBN   0-7356-1917-4.
  2. "Pre-fetching of pages prior to a hard page fault sequence", US patent 6,633,968, retrieved 2023-11-16
  3. "MSDN Magazine Homepage". Archived from the original on 2008-05-16. Retrieved 2008-02-23.
  4. "Inside the Windows Vista kernel". Microsoft .
  5. 1 2 3 4 "XP Myths". Archived from the original on 2009-04-08. Retrieved 2009-03-17.
  6. "Windows Hardware Dev Center". Microsoft .
  7. "Misinformation and the Prefetch Flag". Microsoft. 25 May 2005. Retrieved 2008-12-09.
  8. "Misinformation and the Prefetch Flag". Funny, It Worked Last Time. MSDN Blogs. 25 May 2005. Retrieved 2008-12-09. Secondly, one can specify a /prefetch:#flag when launching an app. [...] Some sites have guessed that this switch turns on prefetching, and suggest that you add that to every executable you care about [...]
  9. "Misinformation and the Prefetch Flag". Funny, It Worked Last Time. MSDN Blogs. 25 May 2005. Retrieved 2008-12-09. Both guesses are incorrect. The /prefetch:# flag is looked at by the OS when we create the process -- however, it has one (and only one) purpose. We add the passed number to the hash. Why? [~snip~]
  10. Gralla, Preston (2007). Big Book of Windows Hacks. "O'Reilly Media, Inc.". ISBN   978-0-596-52835-5.
  11. "Beware of Bogus XP Advice".
  12. "Windows XP: Kernel Improvements Create a More Robust, Powerful, and Scalable OS". Archived from the original on 2008-05-16. Retrieved 2008-02-23.
  13. "Misinformation and the Prefetch Flag". Funny, It Worked Last Time. MSDN Blogs. 25 May 2005. Retrieved 2008-12-09. For one thing, XP will just re-create that data anyway; secondly, it trims the files anyway if there's ever more than 128 of them so that it doesn't needlessly consume space.