Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File Write Caching and HD Write Caching
Message
From
10/02/2003 10:54:57
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
File Write Caching and HD Write Caching
Miscellaneous
Thread ID:
00751418
Message ID:
00751418
Views:
107
There may be some confusion out there as regards this subject, so I thought that I'd try to clarify things at least a bit.

File Write Caching
This is automatic in any Windows system and cannot be turned off by the PC user using some system setting. The MSDN article at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/file_caching.asp describes this type of caching in some detail.
Note, too, that this is applicable whether the file in question resides on the local PC or on a network HD. However, in the case of a networked file WRITE it appears (documentation is unclear) that the content of the cache on the local machine is governed by the Cache Manager of the machine where the file is actually stored.
Windows does have some mechanisms to provide some programmatic control over file write caching, as mentioned in the article cited. These operate on a (specific) file basis and two variations affect every WRITE done under that 'open' of the file while the other ("FlushFileBuffers") is a function that operates on the file's cached data at the time that it is executed. As VFP developers we have no access to these control mechanisms except as may be implemented within the VFP language itself. The "FLUSH" command is an example (though it seems to need improvement in the more current versions of the Windows operating systems in order to operate as documented).

HD Write Caching
Most modern hard disks include "on-board cache" in the order of 2 megabytes to 8 megabytes and its content is governed exclusively by the HD controller's logic. There is no interaction whatsoever between the PC's operating system and the HD controller except for the capability of (most) Windows OS versions to be able to disable WRITE caching.
When write caching is enabled then the HD controller will return a "completed successfully" indication to the OS as soon as it has captured (in its cache) the last byte of the data to be written but before the data has actually been written to the disk. The HD logic will later (very soon) physically write the data to the disk.
There is one critical reliability issue with this (enabled) WRITE caching operation - should the physical write actually fail then data will certainly be lost! While these conditions may be rare, they will be catastrophic to data integrity should they occur and the vast majority of available disk adapters and disk controllers are not engineered to accommodate these rare conditions (there is apparently at least one disk adapter on the market that will handle sudden power loss situations correctly on re-boot).
Because of this it is recommended to DISABLE WRITE CACHING on every HD on every PC unless you know you have one of those capable adapter/drive combinations.
Windows 2000 and Windows XP have this capability (disabling) for sure (I don't have other Wondows OS' to verify them).

Summary
We have no direct control, as VFP developers, over file write caching but we do have basic control over HD write caching and it is highly recommended that HD write caching be disabled on all HDs.
Reply
Map
View

Click here to load this message in the networking platform