Partager via


Disabling Background Flushing to Improve Performance (Windows Embedded CE 6.0)

1/6/2010

If you have a hive-based registry, you can disable background registry flushing to improve performance. When background flushing is disabled, the registry flushes only when you explicitly call RegFlushKey.

The following registry key example shows how to disable background flushing:

[HKEY_LOCAL_MACHINE\init\BootVars]
   "RegistryFlags"=dword:2

The RegistryFlags value determines how registry changes are committed to persistent storage. The hive-based registry uses memory-mapped files to store registry data; when you add the RegistryFlags value that disables background flushing, it disables background flushing normally performed by the kernel. The RegistryFlags value applies only to the hive-based registry, and has no effect on RAM-based registry.

The RegistryFlags value is read only once during startup and is not read again until the system restarts. Therefore, you cannot toggle flushing functionality. To avoid adversely affecting the time required for startup, the semantics do not start until all processes in the initialization sequence have started. This assumes that registry settings written during startup are likely to apply only to the current device state, and therefore do not require the same level of permanence as most registry settings.

The following table shows the defined values for the RegistryFlags value.

DWORD value Description

none or 0

Default setting. Flushes the registry nondeterministically.

1

Enables aggressive flushing

2

Disables background flushing

If the flush fails, for example, due to an out-of-disk error, the key is still closed. In that case, RegCloseKey returns the error resulting from the failed flush.

See Also

Concepts

Registry Flushing
Flush-On-Close Registry Flushing
Options for Registry Flushing