tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Posix shared memory and mmap()
> Am I correct in my thinking that on system that do not support Posix
> shared memory, the alternative way to have shared memory between
> unrelated processes is to create a temporary file and then call
> mmap(... MAP_SHARED).
Well, _an_ alternative way, not _the_ alternative way, but yes.
> So why bother implementing Posix shared memory functions (shm_open
> and shm_unlink), if the same can be achieved with mmap()?
(1) Because existing code tries to use the POSIX calls.
(2) Because the semantics are slightly different (eg, exactly when
memory segments are destroyed and the like).
(3) Because the POSIX way is a completely separate namespace and thus,
for exmaple, works just fine between processes chrooted into separate
areas (under which circumstances there are no filesystem objects
accessible to both processes).
(4) Because the POSIX way does not require a writable filesystem.
(5) Probably others I haven't thought of offhand.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index