question about file flushing

John M McIntosh johnmci at smalltalkconsulting.com
Fri Jun 17 23:37:26 UTC 2005


This is a vm implementation specific question:
For the unix and os-x implementations when you flush a file stream it  
at the primitive layer sends a fflush to the file handle.

      The function fflush() forces a write of all buffered data for  
the given
      output or update stream via the stream's underlying write  
function.  The
      open status of the stream is unaffected.

for os-9 I do a PBFlushFileSync, and PBFlushVolSync (which might be  
overkill)

The issue is of course does the  fflush, actually flush the bits to  
the file (it should),  then to the disk? and the volume/file meta data?
Some operating system or hardware lie about the last few parts of the  
path, mind a flush should get the bit to the host os, so an
application failure won't lose them.

The windows VM, from what I read does a FlushFileBuffers()
The FlushFileBuffers function flushes the buffers of a specified file  
and causes all buffered data to be written to a file.


I'll note both the fflush and FlushFileBuffers can flush a volume,  
but that requires passing in the volume reference something you
can't do (I believe).

True flush and sync of data to disks may require a plugin just to  
ensure the volume meta-data is flushed correctly, and or a raid system
is not lying to you.

On 17-Jun-05, at 12:32 PM, Chris Muller wrote:

> If I am writing to multiple FileStreams, sending #flush to any one  
> of them only
> flushes the contents of just that one file or all open files on  
> that same
> hard-drive?  Does anyone know for sure?
>
> thanks,
>   Chris
>
>
>

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list