[dmd-concurrency] shared arrays
Sean Kelly
sean at invisibleduck.org
Fri Jan 15 05:37:03 PST 2010
Darnit, you're right. I dunno what I was thinking.
On Jan 14, 2010, at 1:21 PM, Kevin Bealer wrote:
> I'd suggest setting the high bit of the length instead. If I have this scenario:
>
> char[] foo = "abcd".dup;
> char[] bar = foo[1..2];
> Then bar is an array with an odd address.
>
> Kevin
> On Thu, Jan 14, 2010 at 10:16 AM, Sean Kelly <sean at invisibleduck.org> wrote:
> On Jan 14, 2010, at 4:10 AM, Steve Schveighoffer wrote:
>
> > Having implemented the array append patch to fix stomping, and reading the dmd-concurrency debate, I realized that what I implemented is no good for shared arrays.
> >
> > In fact, I wonder how shared arrays can support any array operations
>
> I sent an email about this a while back. In short, if we're going to allow array ops on shared arrays at all I think they'll have to use atomic ops to "lock" the array for the length of the update. Basically, set the 1 bit of the ptr field to indicate the array is locked. This gets tricky when more than one shared array is involved because the lock has to be acquired on each, and because different ops may try to lock arrays in different orders, if a spinlock acquire times out the code will have to release all the locks it's acquired, wait some random interval, and try again. Pretty complicated stuff if the goal is just to support shared array ops.
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
>
> _______________________________________________
> dmd-concurrency mailing list
> dmd-concurrency at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-concurrency
More information about the dmd-concurrency
mailing list