mmap is great for IPC. I even worked on a flavor of Unix that had a special shared-memory semaphore (that worked on any shared memory, not just mmap'd shared memory) that required no kernel involvement unless you wanted to wait for a lock to be released.
That is, w/o involving the kernel, you can use mmap'd memory to get a lock w/o race conditions and, for the very small percentage of cases (if you've designed your system well) when there is lock contention, you allocate a kernel resource that you can sleep on and mark the mmap lock area so the lock holder will wake you up when they release the lock. I believe this shared-memory locking technique required just 4 d-words of shared memory per lock.
You can also use byte-range file locks on even an empty file that doesn't even have to be related to the mmap'd memory.
- tye
In reply to Re^4: Mmap question (fud)
by tye
in thread Mmap question
by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |