Date: Wed, 06 Jan 2010 09:11:52 +0800 From: David Xu <davidxu@freebsd.org> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: process-sharable pthread synchronous objects Message-ID: <4B43E358.609@freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B43E358.609>