Parallel reads on std.container.array.Array

Arun Chandrasekaran aruncxy at gmail.com
Fri Dec 8 10:07:55 UTC 2017


On Friday, 8 December 2017 at 10:01:14 UTC, Kagamin wrote:
> On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran 
> wrote:
>> I was wondering if std.container.array.Array supports 
>> threadsafe parallel reads similar to std::vector.
>
> No, your code can also fail on a system with inconsistent cache 
> because data written by writing thread can remain in its cache 
> and not reach shared memory in time or reading threads can read 
> from their stale cache.

I'm OK with some delay between the writes and the reads. The same 
applies to the writes and reads across processes. At least 
between threads the impact/delay is minimum whereas between 
processes it's even worse as the page will have to be reflected 
in all the mapped processes.


More information about the Digitalmars-d-learn mailing list