>> Does anyone know whether there are implementations of mmap that
>> do transparent file sharing? It seems to me that should be possible by
>> making the buffer cache share pages with mmapping processes.
> These days they all do. The POSIX rationale says:
> ... When multiple processes map the same memory object, they can
> share access to the underlying data.
Notice the weasel word "can". It is not guaranteed that they will do so
automatically without delay. Apparently each process may have a physically
distinct copy of the data, not shared access to a single location.
Hmmm — how did that make it through the IEEE editing process? However, that is not part of the standard if it's in the Rationale - just an explanation of the standard - which I want want look at more carefully to see what it says about what is required of mmap(2).
That said, as Heinz and the rest of us who worked on the original version of what would come to POSIX can tell you, the word "can" was always a no-no. The word "SHALL" is the the official IEEE word, and if you use "SHOULD," even in the rationale and it was very much frowned upon. I'll have try dig up the troff sources to an early draft of the original and do a "grep -i should * | wc -l" through it. I bet the number is very small and "can" is zero.
That said, it has been a few years since I have read a current draft, but less the rationale section (which is not the standard itself).
Clem
Clem