Jump to content

Prefetch versus Task Scheduler


Borec

Recommended Posts

Hi,

how is it possible - in the setting of nlite, if i choose DON'T remove prefetch - nevertheless I can see the option: remove the task scheduler !!

- So, if you do it, you have no prefetch funktion. (Prefetch needs task scheduler).

What does it mean ?

Link to comment
Share on other sites


@Borec:

Could you please describe your proceeding how did you reach that? Maybe it's an "object.enabled" bug or anything like that.

@albator:

Yes, prefetching depends on the Task Scheduler, but weird is that it could be removed. If I keep Prefetch functionality, the component is definitely hidden for me (except the Task Scheduler service (which can be only disabled)).

Link to comment
Share on other sites

Prefetch 1

Prefetch 2

Prefetch 3

Prefetch 4

Ryan Myers - Prefetch

See also XP Myths - Optimization

Task Scheduler Service - "Disabling the Task Scheduler completely cripples Windows XP's Boot and Application Load times by preventing Prefetch (.PF) trace files and the Layout.ini file from being created or updated." - Source

Prefetch

All versions of Windows except real-mode Windows 3x are demand-paged operating systems, where file data and code is faulted into memory from disk as an application attempts to access it. Data and code is faulted in page-granular chunks where a page's size is dictated by the CPU's memory management hardware. A page is 4KB on the x86. Prefetching is the process of bringing data and code pages into memory from disk before it's demanded.

In order to know what it should prefetch, the Windows XP Cache Manager monitors the page faults, both those that require that data be read from disk (hard faults) and those that simply require that data already in memory be added to a process's working set (soft faults), that occur during the boot process and application startup. By default it traces through the first two minutes of the boot process, 60 seconds following the time when all Win32 services have finished initializing, or 30 seconds following the start of the user's shell (typically Microsoft Internet Explorer), whichever of these three events occurs first. The Cache Manager also monitors the first 10 seconds of application startup. After collecting a trace that's organized into faults taken on the NTFS Master File Table (MFT) metadata file (if the application accesses files or directories on NTFS volumes), the files referenced, and the directories referenced, it notifies the prefetch component of the Task Scheduler by signaling a named event object.

The Task Scheduler then performs a call to the internal NtQuerySystemInformation system call requesting the trace data. After performing post-processing on the trace data, the Task Scheduler writes it out to a file in the \Windows\Prefetch folder. The file's name is the name of the application to which the trace applies followed by a dash and the hexadecimal representation of a hash of the file's path. The file has a .pf extension, so an example would be NOTEPAD.EXE-AF43252301.PF.

An exception to the file name rule is the file that stores the boot's trace, which is always named NTOSBOOT-B00DFAAD.PF (a convolution of the hexadecimal-compatible word BAADF00D, which programmers often use to represent uninitialized data). Only after the Cache Manager has finished the boot trace (the time of which was defined earlier) does it collect page fault information for specific applications.

When the system boots or an application starts, the Cache Manager is called to give it an opportunity to perform prefetching. The Cache Manager looks in the prefetch directory to see if a trace file exists for the prefetch scenario in question. If it does, the Cache Manager calls NTFS to prefetch any MFT metadata file references, reads in the contents of each of the directories referenced, and finally opens each file referenced. It then calls the Memory Manager to read in any data and code specified in the trace that's not already in memory. The Memory Manager initiates all of the reads asynchronously and then waits for them to complete before letting an application's startup continue.

How does this scheme provide a performance benefit? The answer lies in the fact that during typical system boot or application startup, the order of faults is such that some pages are brought in from one part of a file, then from another part of the same file, then pages are read from a different file, then perhaps from a directory, and so on. This jumping around results in moving the heads around on the disk. Microsoft has learned through analysis that this slows boot and application startup times. By prefetching data from a file or directory all at once before accessing another one, this scattered seeking for data on the disk is greatly reduced or eliminated, thus improving the overall time for system and application startup.

Figure 1 Prefetch Directory

To minimize seeking even further, every three days or so, during system idle periods, the Task Scheduler organizes a list of files and directories in the order that they are referenced during a boot or application start, and stores the list in a file named \Windows\Prefetch\Layout.ini. Figure 1 shows the contents of a prefetch directory, highlighting the layout file. Then it launches the system defragmenter with a command-line option that tells the defragmenter to defragment based on the contents of the file instead of performing a full defrag. The defragmenter finds a contiguous area on each volume large enough to hold all the listed files and directories that reside on that volume and then moves them in their entirety into that area so that they are stored one after the other. Thus, future prefetch operations will even be more efficient because all the data to be read in is now stored physically on the disk in the order it will be read. Since the number of files defragmented for prefetching is usually only in the hundreds, this defragmentation is much faster than full defragmentations.

Link to comment
Share on other sites

I'm talking about windows xp - yeah, the service "task scheduler" is offered to remove it - but that's it - when i disable this service, then no prefetching and no bootvis and no defragmentation improved just by the prefetch function. So I'm surprised, that this option - to stop, OR even to remove task scheduler is accessible, if I choose the option - keep the prefetch function ???

Link to comment
Share on other sites

Tarun, wow

Borec, I see so you're actually trying to say that Prefect compatibility isn't working for you, isn't hiding the protected components. I must say that it never happened to me before, can you explain to me how to see that? thx

Link to comment
Share on other sites

..."task scheduler" is offered to remove it - but that's it - when i disable this service,...

...that this option - to stop, OR even to remove task scheduler is accessible...

:huh:

I'm kinda confused now. Are you actually talking about Task Scheduler service on the Components/Services page (i.e. remove = bug) or about Task Scheduler service on the Tweaks/Services page (i.e. disable only = normal)?

Link to comment
Share on other sites

Oh, my misunderstanding - it's mean, that when I set to hide the prefetch removal, I can constantly see the option to stop the service Task Scheduler.

I think, my problems with bootvis can be caused by the setting - disabled Last Access Update (NTFS). Is it possible? Is there any reason to let this function enabled? I suppose that the defragmentation fuction, and perhaps the prefetching can be partly depending on the Last Access Update too.

Link to comment
Share on other sites

Oh, my misunderstanding - it's mean, that when I set to hide the prefetch removal, I can constantly see the option to stop the service Task Scheduler.

Well, if you mean ability to disable service on the Tweaks/Services page, it's ok, because it can be enabled back later. ;)

It's not the only service u could "disable" some compatibility with, other is e.g. Printers compatibility vs. Printer Spooler.

I think, my problems with bootvis can be caused by the setting - disabled Last Access Update (NTFS). Is it possible?

I don't think so. Anyway, if you think you need to enable Last Access Update, use this REG tweak:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"NtfsDisableLastAccessUpdate"=dword:00000000

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...