|
Threads-Devel : |
Subject: Re: [Threads-devel] pthreads_rwlock vs shared_mutex
From: Nathan Rosenblum (flander_at_[hidden])
Date: 2014-02-03 18:55:53
>
> Apologies if this is a question that gets asked ad nauseum on this list,
> but why is the shared_mutex implementation not a wrapper for pthread_rwlock
> on pthreads-based systems? I observe significantly better performance under
> concurrent reader access when using the pthreads implementation compared to
> acquiring a reader lock on shared_mutex, particularly on OSX where the cost
> of a contended pthread_mutex is extremely high (a short-hold,
> high-utilization, mostly-read shared_mutex on that platform effectively
> serializes access).
>
>
Answering my own question: presumably because absent platform-specific
extensions like Linux's PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
pthread_rwlock is write-starving. Is there interest in implementing
platform-specific optimization that uses these locks when doing so does not
change the semantics (e.g. on Linux w/ NPTL)?
Best,
--nate