December 2019
Intermediate to advanced
346 pages
9h 8m
English
For a given sequence of code statements, the compiler can choose to either execute them in the same order as they are received or reorder them to gain performance if multiple threads are working on the same code. For example, take a look at the following code:
a = b;c = 1;
The preceding code can be reordered and executed in the following order for another thread:
c = 1;a = b;
Code reordering is a problem for multicore processors with weak memory models, such as Intel Itanium processors. It has no impact on single-core processors, however, due to the sequential consistency model. The code is restructured so that another thread can take advantage or store an instruction that is already in the memory. Code reordering can ...
Read now
Unlock full access