process-sharable pthread synchronous objects

From: David Xu <davidxu_at_freebsd.org>
Date: Wed, 06 Jan 2010 09:11:52 +0800
I want to go further to make some pthread synchronous objects
process-sharable, do you guy think it is worthy ?
except mutex and condition variable, others like rwlock and spinlock
are relative simple.

The pthread mutex is complex, especially they introduced robust mutex
type in new specification, I don't know if we need change code a lot
or a little.

The current mutex implementation is not fork-friendly, because we use
global thread ID as mutex owner, if a process is forked, the
process-local mutex is unusable by thread in child process, current we
fixed the mutex ownership for child process in fork() by libthr.

The thread ID(global or local) is needed because I want make
priority-inherited mutex as fast as normal mutex in non-contention case,
only when the thread is blocked it will enter kernel and find the owner
of the mutex, and boost the owner's priority. to find the owner, it need
to use thread ID. Otherwise, I can not find a way to make priority-mutex
as fast as normal mutex.

For process-shared mutex we really need to use global thread ID, for
process-local mutex, if we have process local thread ID, then we only
need to change code slightly.

Still don't know how a mutex can be robust in shared-memory model. ;-)

Regards,
David Xu
Received on Wed Jan 06 2010 - 00:11:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:59 UTC