[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Locks and threads
From: |
Neil Jerram |
Subject: |
Re: Locks and threads |
Date: |
Wed, 25 Mar 2009 22:13:55 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Linas Vepstas <address@hidden> writes:
> Well, once you identify the section that needs locking,
> you'll want to use an rwlock instead of a mutex. The
> rwlock (pthread_rwlock_rdlock) allows multiple
> simultaneous readers. The writers, however, get
> exclusive access. (pthread_rwlock_wrlock)
I forgot to comment on this before...
In my view the important case to optimize is the one with only a
single thread - i.e. I don't want to add any significant performance
penalty in that case. And for that case, IIUC, there is no difference
between a mutex and an rwlock.
Also I would guess that we would hit more portability issues in future
with a rwlock than with a mutex. Of course, we could look at
configure time for rwlock support, and fall back to a mutex - but that
has a cost too, in code complexity.
On balance, therefore, I don't think using a rwlock rather than a
mutex is worthwhile.
Regards,
Neil
- Re: Locks and threads, (continued)
Re: Locks and threads, Ludovic Courtès, 2009/03/05
Re: Locks and threads, Neil Jerram, 2009/03/10
Re: Locks and threads, Andy Wingo, 2009/03/12
Re: Locks and threads, Neil Jerram, 2009/03/13
Re: Locks and threads, Neil Jerram, 2009/03/25
Re: Locks and threads, Linas Vepstas, 2009/03/25
Re: Locks and threads, Neil Jerram, 2009/03/26
Re: Locks and threads, Linas Vepstas, 2009/03/26
Re: Locks and threads, Ludovic Courtès, 2009/03/26
Re: Locks and threads, Neil Jerram, 2009/03/26
Re: Locks and threads, Ludovic Courtès, 2009/03/26