Are indivisible operations still indivisible on multiprocessor and multicore systems?

Posted by Steve314 on Stack Overflow See other posts from Stack Overflow or by Steve314
Published on 2010-03-04T22:41:51Z Indexed on 2010/03/08 8:51 UTC
Read the original article Hit count: 274

As per the title, plus what are the limitations and gotchas.

For example, on x86 processors, alignment for most data types is optional - an optimisation rather than a requirement. That means that a pointer may be stored at an unaligned address, which in turn means that pointer might be split over a cache page boundary.

Obviously this could be done if you work hard enough on any processor (picking out particular bytes etc), but not in a way where you'd still expect the write operation to be indivisible.

I seriously doubt that a multicore processor can ensure that other cores can guarantee a consistent all-before or all-after view of a written pointer in this unaligned-write-crossing-a-page-boundary situation.

Am I right? And are there any similar gotchas I haven't thought of?

© Stack Overflow or respective owner

Related posts about multicore

Related posts about multiprocessing