Compartilhar via


Lazy-Writer Thread (Windows CE 5.0)

Send Feedback

Each cache has its own lazy-writer thread that searches for and commits dirty sectors. By default, the priority of this thread is set at idle, however, you can override this priority for a profile using the following registry setting:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<Profile Name>\FATFS]
    "LazyWriterThreadPrio256"=dword:xx

The lazy-writer thread uses the following algorithm.

if (event set indicating that there are dirty sectors to commit) {
    while (TRUE){
        Enter main critical section protecting the cache from main threads;
        if (no more dirty sectors) {
            Leave main critical section;
            break;
        }
        Find first dirty run of sectors to commit;
        Commit those dirty sectors;
        Leave main critical section;
    }
}
Reset event indicating there are no dirty sectors to commit.

A main thread will not be able to interrupt the lazy-writer thread while it is committing dirty sectors. However, since the lazy-writer thread always leaves the main critical section, a main thread will have priority in fulfilling its requests. The dirty sectors check occurs while the lazy-writer thread holds the critical section to prevent race conditions. It then checks the dirty sector count and resets the event.

See Also

Cache Manager

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.