[dmd-concurrency] shared arrays
Sean Kelly
sean at invisibleduck.org
Thu Jan 14 07:42:23 PST 2010
On Jan 14, 2010, at 7:33 AM, Sean Kelly wrote:
> On Jan 14, 2010, at 7:27 AM, Steve Schveighoffer wrote:
>
>> You'd need to lock the array data itself. But in any case, I think it may be too ideal to think we can support atomic array operations without manual synchronization. I.e., a SynchronizedArray type similar to UniqueArray type may be required for this.
>>
>> I was thinking more in the case, how to write the runtime so it handles atomic updates of the actual array data, meaning at least word-sized data isn't messed up. I have no idea if things like this should be possible on shared arrays:
>>
>> a[] = b[] + 5 + c[];
>
> I don't know that they can be, sadly.
Regarding my earlier comment, I think I misspoke. An operation on shared array data could get the base pointer for the block from the GC and use that to obtain a lock. The compiler could theoretically optimize where locks are acquired for loop operations too, at least in simple cases. This all smells like a hack though.
More information about the dmd-concurrency
mailing list