Messages in this thread | | | Subject | Re: [PATCH] Lightweight userspace semaphores... | Date | Mon, 25 Feb 2002 13:14:41 +0000 (GMT) | From | Alan Cox <> |
| |
> fd = sem_initialize(); > mmap(fd, ...) > .. > munmap(..) > > which gives you a handle for the semaphore.
fd = open("/dev/shm/sem...."); mmap(fd, ...)
munmap(..)
That lets the kernel decide what it wants to do and provide as the back end. It allows you to think about things like mremap and growing/shrinking the object. And finally /dev/sem looks suspiciously like a quick tweak to /dev/shm..
> And make the initial mmap() only do a limited number of pages, so that > people don't start trying to allocate tons of memory this way.-
If it uses the /dev/shm world then anyone running a kernel with the new patches for resource accounting is still safe, and anyone else is still simply going to find their shm areas hitting swap under extreme load (which is ideal)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |