Shared - Another Thread

Patrick Schluter Patrick.Schluter at bbox.fr
Thu Oct 18 19:11:56 UTC 2018


On Thursday, 18 October 2018 at 17:01:46 UTC, Stanislav Blinov 
wrote:
> On Thursday, 18 October 2018 at 16:31:33 UTC, Vijay Nayar wrote:
>
>> Imagine a simple algorithm that does logic on very long 
>> numbers, split into bytes.  One multi-threaded implementation 
>> may use 4 threads.  The first operating on bytes 0, 4, 8, etc.
>>  The second operating on bytes 1, 5, 9, etc.
>>
>> In this case, a mutex or lock isn't actually needed, because 
>> the algorithm itself assures that threads don't collide.
>
> Yes, they do collide. You just turned your cache into a giant 
> clusterf**k. Keyword: MESIF.

In that case partitioning in cache line sizes is the least that 
has to be done.


More information about the Digitalmars-d mailing list