[squeak-dev] The Trunk: Files-tpr.156.mcz

Tom Rushworth tom.b.rushworth at gmail.com
Fri May 27 00:19:17 UTC 2016


flush makes sure the information has gone from application memory to OS
RAM cache.  It can still be lost if the power is abruptly shut off, but
is safe from application crashes.

sync makes sure the information has gone to disk.  It takes longer, and
may involve writing stuff from other apps to disk as well.  Your info is
usually safe, but the disk may have an internal cache of its own :(.

If you want it on disk and can afford the time delay, use sync.

On 16-05-24 13:49 , Chris Muller wrote:
> A little research suggests #sync is a blocking operation, whereas
> #flush is non-blocking.
> 
> So I should probably change Magma's atomic-writing to use #sync..
> 
> 
> On Tue, May 24, 2016 at 2:45 PM, tim Rowledge <tim at rowledge.org> wrote:
>>
>>> On 24-05-2016, at 12:32 PM, Chris Muller <asqueaker at gmail.com> wrote:
>>>
>>> Since I'm not a systems programmer, I wasn't really following the
>>> other discussion.  But this does interest me since Magma employs a
>>> complex logging / playback mechanism which does depend on the idea
>>> that returning from #flush assures all my puts on that Filestreams are
>>> truly written to the disk.
>>>
>>> Should I be using #sync, instead of #flush?  Could you succinctly
>>> summarize the difference between the two for a lay-person like myself?
>>
>> My level of understanding of this is roughly that flush is spelt f-l-u-s-h and sync is spelt s-y-n-c. I don’t understand why a system would ever let things get so out of sync that you would ever need to think of it. When you close a file it seems to me that everything should be cleaned up.
>>
>>
>> tim
>> --
>> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
>> Useful random insult:- Hypnotized as a child and couldn't be woken.
>>
>>
>>
> 
> 


-- 
Tom Rushworth


More information about the Squeak-dev mailing list