[MPlayer-dev-eng] [PATCH] use pthreads for caching
Uoti Urpala
uoti.urpala at pp1.inet.fi
Sat Jan 27 22:30:17 CET 2007
On Sat, 2007-01-27 at 15:41 -0500, Rich Felker wrote:
> On Sat, Jan 27, 2007 at 05:45:20PM +0200, Uoti Urpala wrote:
> > On Sat, 2007-01-27 at 10:09 -0500, Rich Felker wrote:
> > > Yes. It's not a matter of the implementation being fast or slow. It's
> > > fundamentally impossible to make synchronization fast. Each "lock"
> > > prefix requires a couple hundred cycles on my machine, and I'm told
> > > it's even worse on machines with higher clocks.
> > takes about 3.9 seconds. That means 72 cycles per loop, and less than 36
> > cycles per call - and that's with function call overhead included.
>
> Have threads actually been initialized yet? If not, the lock is
> probably a no-op.
Yes, I had another thread which took the lock a couple of times just to
make sure it was actually working. This was on uniprocessor Athlon (but
the pthread_mutex_lock assembler still has the lock prefix so no tricks
such as special-casing the library itself for uniprocessor). Some Google
searches showed that on P4 the cost is likely higher but still below 100
cycles as opposed to "worse than a couple hundred cycles".
More information about the MPlayer-dev-eng
mailing list