tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Posix shared memory and mmap()



On Fri, Jan 15, 2010 at 07:04:58PM +0000, Sad Clouds wrote:
> 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).

That's essentially what Linux is doing, I think. shm_* is using
/dev/shm, which is just another tmpfs instance.

> So why bother implementing Posix shared memory functions (shm_open and 
> shm_unlink), if the same can be achieved with mmap()?

Because it might be more efficient. E.g. you can dramatically cut down
on the involved locking if you know that the object is always in weired
memory etc.

Joerg


Home | Main Index | Thread Index | Old Index