[interprocess] support for private mappings?

Does this library support private, read-write file mappings? Such mapping is copy on write, and modifications to the mapped region remain private to the process that created the mapping. (POSIX: MAP_PRIVATE flag for mmap(), Windows: FILE_MAP_COPY flag to MapViewOfFile and PAGE_WRITECOPY flag to CreateFileMapping)

Zeljko Vrba wrote:
Does this library support private, read-write file mappings? Such mapping is copy on write, and modifications to the mapped region remain private to the process that created the mapping.
Yes, see http://tinyurl.com/8odxjg or longer http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess/managed_memory_se... You can also use lower level mapped_region for copy-on-write file mappings using mode_t = copy_on_write. Regards, Ion

On Sat, Jan 03, 2009 at 12:52:49AM +0100, Ion Gaztañaga wrote:
You can also use lower level mapped_region for copy-on-write file mappings using mode_t = copy_on_write.
Cool, thank you! So the following should work (I'm not using managed SHM)? file_mapping fm_("myfile", read_only); mapped_region mr_(fm_, copy_on_write); Some suggestions for documentation improvements (IMHO): This page in the reference documentation http://www.boost.org/doc/libs/1_37_0/doc/html/boost/interprocess/mapped_regi... does not mention the copy_on_write mode; it would be very helpful if that mode were mentioned there. I also feel that it would be more natural if the section you quoted were moved to the "Sharing memory between processes" chapter because that mode is an inherent property of mapped files (generic OS mechanism), not of managed shared memory (particular framework implemented by your library).

Zeljko Vrba wrote:
On Sat, Jan 03, 2009 at 12:52:49AM +0100, Ion Gaztañaga wrote:
You can also use lower level mapped_region for copy-on-write file mappings using mode_t = copy_on_write.
Cool, thank you!
So the following should work (I'm not using managed SHM)?
file_mapping fm_("myfile", read_only); mapped_region mr_(fm_, copy_on_write);
It should, because that's the way open_copy_on_write managed_shared_memory is implemented ;-)
Some suggestions for documentation improvements (IMHO):
This page in the reference documentation
http://www.boost.org/doc/libs/1_37_0/doc/html/boost/interprocess/mapped_regi...
does not mention the copy_on_write mode; it would be very helpful if that mode were mentioned there.
Yes, copy_on_write should also appear here, because it's an lower-level but useful OS wrapper. Added to my to-do list.
I also feel that it would be more natural if the section you quoted were moved to the "Sharing memory between processes" chapter because that mode is an inherent property of mapped files (generic OS mechanism), not of managed shared memory (particular framework implemented by your library).
Ok, I'll see if it fits better there. Regards, Ion
participants (2)
-
Ion Gaztañaga
-
Zeljko Vrba