[squeak-dev] Re: Adding fsync() call to the primitiveFileFlush prim ?

David T. Lewis lewis at mail.msen.com
Sun May 22 04:45:58 UTC 2016


On Sat, May 21, 2016 at 09:47:07AM -0700, marcel.taeumel wrote:
> Hi Tim,
> 
> in Windows, this is called FlushFileBuffers, I guess:
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa364439%28v=vs.85%29.aspx

Slightly off topic, but worth mentioning: The implementation of FilePlugin
for Windows operates on HANDLE references to files, which I believe are roughly
equivalent to file descriptors on Unix. Thus the Unix VMs are written to the
higher level stdio interface, and the Windows VM uses a more direct lower level
IO strategy. I have always wondered which of the two approaches (low level
HANDLE/descriptor versus higher level buffered stdio) produces better overall
performance for Squeak.

One way to answer the question would be to implement a FilePlugin for Unix
VMs with all of the IO done at the descriptor level. Specifically, a
SQFile->file would be a reference to an integer file descriptor (similar to
a Windows HANDLE), and the platform support code would operate against
file descriptors rather than (FILE *) references.

Doing a reimplementation of FilePlugin for Unix is probably not a huge
project, but I have never gotten around to trying it.

Has anyone else wondered about this? Which is better, the Windows VM file
strategy, or the Unix VM file strategy?

Dave

> 
> MSDN also suggests to use unbuffered I/O instead of calling such a flush
> function too often. What are our options to control buffered vs. unbuffered
> from Squeak land?
> 
> https://support.microsoft.com/en-us/kb/99794
> https://msdn.microsoft.com/en-us/library/windows/desktop/cc644950%28v=vs.85%29.aspx
> 
> On what media is the data stored? I think that you cannot be 100% sure to
> have all data written after some function call returns because some details
> are out of reach for user applications. Think of some USB driver that needs
> just two more cycles to finish writing... I am no expert there but it seems
> tricky to find the correct point in time to turn the power off. Regular OS
> shutdown seems more appropriate...
> 
> Best,
> Marcel
> 
> 
> 
> --
> View this message in context: http://forum.world.st/Adding-fsync-call-to-the-primitiveFileFlush-prim-tp4896538p4896545.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list