Re: light weight user level semaphores

Ulrich Drepper
2001-04-18T19:37:00Z

Linus Torvalds <torvalds@transmeta.com> writes:

Sounds good so far. Some comments.

> - FS_create is responsible for allocating a shared memory region
> at "FS_create()" time.

This is not so great. The POSIX shared semaphores require that an
pthread_mutex_t object placed in a shared memory region can be
initialized to work across process boundaries. I.e., the FS_create
function would actually be FS_init. There is no problem with the
kernel or the helper code at user level allocating more storage (for
the waitlist of whatever) but it must not be necessary for the user to
know about them and place them in share memory themselves.

The situation for non-shared (i.e. intra-process) semaphores are
easier. What I didn't understand is your remark about fork. The
semaphores should be cloned. Unless the shared flag is set there
should be no sharing among processes.

The rest seems OK. Thanks,

--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------