|
Boost : |
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-09-14 19:46:25
Sebastian Redl wrote:
> Phil Endecott wrote:
>> Does anyone have any ideas about the behaviour of memory-mapped files
>> on network filesystems, i.e. NFS and/or Windows shares? Is there any
>> chance that Boost.Interprocess could use mmaped files on such
>> filesystems, with instances of the program running on different
>> machines sharing data?
>>
> MSDN has this to say for CreateFileMapping:
>> Although *CreateFileMapping* works with remote files, it does not keep
>> them coherent. For example, if two computers both map a file as
>> writable, and both change the same page, each computer only sees its
>> own writes to the page. When the data gets updated on the disk, it is
>> not merged.
Any ideas when the write-back occurs? When the file is closed /
unmapped? Can you call flush to force write back? (Does interprocess
support any of this?)
> Although I couldn't find concrete information in the man pages, some
> Google results on "mmap consistent" suggest that mmap behaves the same.
I have had a look at the NFS spec and it says a lot about what
implementations "may" do, and it's similar.
A simpler case than the example that you quote above is one writer and
multiple readers. The main requirement is that when the writer's
changes become visible to a reader they do so atomically, or at least
in-order. I.e. if I have a large interprocess::list which spans
multiple blocks, and the writer inserts something, then the readers
must see either no changed blocks or all changed blocks. Or, if I have
some sort of lock-free structure like a journal, and the writer appends
data and then updates an end-of-journal pointer to make it visible,
then the page containing the pointer must not become visible to the
readers until after the pages containing the data.
Anyway, I think the answer is that this is either hard or impossible;
but I thought I'd ask just in case someone has already investigated.
Regards,
Phil.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk