Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Jan 2005 22:26:34 +0800
From:      David Xu <davidxu@freebsd.org>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: higher speed mutexes
Message-ID:  <41DFED9A.8070202@freebsd.org>
In-Reply-To: <41DD01CE.70004@he.iki.fi>
References:  <41DCEA91.6040402@he.iki.fi> <41DCFD2F.2040207@freebsd.org> <41DD01CE.70004@he.iki.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
Petri Helenius wrote:

> David Xu wrote:
>
>> I will have low overhead pthread library available soon, for
>> simple mutex, it is only an atomic_cmpset_long() plus a function
>> call (pthread_mutex_lock) overhead.
>>
> Sounds great. Will this change the performance of rwlocks or is simple 
> mutex preferred for performance sensitive applications?
> Is this something that I could drop on top of RELENG_5 or RELENG_5_3 
> or is CURRENT required?
> Do you have this in some public depository already?
>
I have put it there:
http://people.freebsd.org/~davidxu/libthread.tgz
It can only run on newest -CURRENT kernel.

It is a simplified version of libpthread plus some ideas from libthr.
It is different with libpthread, it uses thr + umtx interfaces and does
not have signal wrapper, it is in very simple shape.
I have rewritten simple mutex code to use umtx cmpset atomic instruction.
Condition variable code is also rewritten, now simple mutex and condition
variable both can be shared between processes once pthread.h is changed
to define mutex and other synchronization objects in C structure style
(current it was typedefed as a structure pointer, which prevents them from
being shared between processes via mmap() ), also I believe semaphore
and rwlock can also be shared between processes  once pthread.h is updated.
In detail, I don't use thr_suspend and thr_wakeup, I use more reliable way:
umtx_wait + umtx_wake, I have added them into kernel sometimes ago.

So I would like to see this library in tree, and let me start to work on
process sharable synchronization objects in near future.

David Xu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41DFED9A.8070202>