[
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: | -- (:) |
| From: | Brian Hurt <bhurt@s...> |
| Subject: | Re: [Caml-list] STM support in OCaml |
On Thu, 9 Mar 2006, skaller wrote: > The problem with two threads is that 'some data' has to > be invalidated too. Otherwise there > is no way existing Posix software would work on a > multi-processor. > > I couldn't believe it! That's why we tried the experiment: > did the OS really invalidate the 'whole' caches, or did our > trivial increment program fail, because the memory being > incremented wasn't coherent? Generally both the lock get and lock remove need to do a memory barrier, and force all writes to complete to cache. Once in cache, the cache's do cache coherency. The caches snoop the memory traffic- and if someone is reading memory that the cache knows is more up to date in that cache than in memory, the read is satisified from that cache and not from memory- and the cache updates memory as well at the same time. I'm simplifying enormously here, but the end result is that no, you don't need to flush the entire cache on lock release. Google "cache coherency" or "MESI" for more information. Brian