What is the status of thread process-shared synchronization?
John Baldwin
jhb at freebsd.org
Thu Sep 23 14:25:58 UTC 2010
On Thursday, September 23, 2010 8:19:26 am Alexander Churanov wrote:
> Hi folks!
>
> The FreeBSD 8.1 manual pages state that pthread process-shared
> synchronization option is not supported, at least for some primitives.
>
> 1) Are there any plans to implement this option?
> 2) Is anybody working on that?
> 3) What are the main obstacles which prevent us from having the option
> implemented?
>
> I am teaching students UNIX-like systems in general and FreeBSD in
> particular. I've set them a task on synchronizing processes reading
> and writing from a shared-memory cache. But then found that in spite
> of PTHREAD_PROCESS_SHARED being available, it is not supported. I've
> endeavored to fix POSIX rwlocks by making pthread_rwlock_t a
> structure, but then found that POSIX semaphores do not support
> process-shared attribute either.
I believe POSIX semaphores in 9 do now support PTHREAD_PROCESS_SHARED. David
Xu implemented it. He may be able to MFC this to 8-stable.
> 4) Do we have any synchronization primitive capable of synchronizing
> threads in different processes in FreeBSD?
Unfortunately the various POSIX/SYSV primitives do not currently support it in
8. You could implement a shared mutex on top of umtx fairly easily I believe.
umtx itself is address-space agnostic (so a umtx object can be shared among
processes), and the existing pthread_mutex code can probably be borrowed
directly to implement a mutex. I think the biggest obstacle for FreeBSD is
changing the definition of pthread_mutex_t, etc. to be structures instead of
pointers to dynamically allocated structures.
--
John Baldwin
More information about the freebsd-threads
mailing list