process-sharable pthread synchronous objects
David Xu
davidxu at freebsd.org
Wed Jan 6 01:11:54 UTC 2010
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
More information about the freebsd-current
mailing list