[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-03-08 (21:38) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] STM support in OCaml |
On Wed, 2006-03-08 at 14:45 -0600, Brian Hurt wrote: > One comment I will make is that a mutex is expensive, but not *that* > expensive. I just wrote a quick program (available if anyone cares) in > GNU C that measures the cost, in clocks, of locking and unlocking a posix > mutex. On my desktop box (AMD Athlon XP 2200+ 1.8GHz), I'm getting a cost > of like 44 clock cycles. Which makes it less expensive than an L2 cache > miss. Ahem. Now try that on an AMDx2 (dual core). The cost goes through the roof if one process has a thread on each core. Because each core has its own cache and both caches have to be flushed/ synchronised. And those caches are BIG! I had hoped to compare dual CPU with dual core by buying a two CPU box (i.e. with two dual cores on it) but they're 2-3 times more expensive because it seems there's no board that supports Athlons (you need Opterons which cost a lot more). I have no idea if Linux, for example, running SMP kernel, is smart enough to know if a mutex is shared between two processing units or not: AFAIK Linux doesn't support interprocess mutex. Windows does. Be interesting to compare. As mentioned before the only data I have at the moment is a two thread counter increment experiment on a dual CPU G5 box, where the speed up from 2 CPUs vs 1 was a factor of 15 .. times SLOWER. -- John Skaller <skaller at users dot sourceforge dot net> Async PL, Realtime software consultants Checkout Felix: http://felix.sourceforge.net