<div class="gmail_quote">On Wed, Jan 27, 2010 at 7:19 PM, Michel Fortin <span dir="ltr"><<a href="mailto:michel.fortin@michelf.com">michel.fortin@michelf.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Le 2010-01-27 à 18:25, Andrei Alexandrescu a écrit :<br>
<div class="im"><br>
> Consider a shared array:<br>
><br>
> shared int[] x;<br>
><br>
> What can be done with it? It's tricky; the array has two words worth of info and we can't assume 128 bits can be atomically written on a 64-bit machine.<br>
<br>
</div>Isn't that a great case for a lock pool controlled with a hash table? If you have dismissed that option, why?<br>
<font color="#888888"><br></font></blockquote><div> </div><font color="#888888">I think the larger question is, what are the common use cases for </font>shared? It seems dangerous to rely on per-field atomicity too much for ordinary tasks; clearly (int32)++ is supportable without heroic measures and (int[][]) ~= (int[]) probably is not, or is at least harder / trickier. If you don't understand modern CPU architecture it's not self-evident what the rules are, which makes this topic pretty much restricted to people with advanced skills as these things are reckoned nowadays. Is shared just to support building synchronization tools and special purpose things like rapid-access stacks, or is it a tool every developer is expected to use commonly?<br>
<br>It may be that our profile of who is supposed to be using it for what will answer a lot of questions about what we need to support, how fast it has to be, and what trade-offs are appropriate. Or at least, I will be less confused (or more likely, confused for a different reason).<br>
<br>Kevin<br><br></div>