EasyManuals Logo
Home>Intel>Processor>ARCHITECTURE IA-32

Intel ARCHITECTURE IA-32 User Manual

Intel ARCHITECTURE IA-32
568 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #378 background imageLoading...
Page #378 background image
IA-32 Intel® Architecture Optimization
7-32
Objects allocated dynamically by different threads may share cache
lines. Make sure that the variables used locally by one thread are
allocated in a manner to prevent sharing the cache line with other
threads.
Another technique to enforce alignment of synchronization variables
and to avoid a cacheline being shared is to use compiler directives when
declaring data structures.
Other techniques that prevent false-sharing include:
Organize variables of different types in data structures (because the
layout that compilers give to data variables might be different than
their placement in the source code).
When each thread needs to use its own copy of a set of variables,
declare the variables with:
the directive threadprivate, when using OpenMP
the modifier __declspec (thread), when using Microsoft
compiler
Example 7-6 Placement of Synchronization and Regular Variables
int regVar;
int padding[32];
int SynVar[32*NUM_SYNC_VARS];
int AnotherVar;
Example 7-7 Declaring Synchronization Variables without Sharing a Cache
Line
__declspec(align(64)) unsigned __int64 sum;
struct sync_struct {…};
__declspec(align(64)) struct sync_struct sync_var;

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel ARCHITECTURE IA-32 and is the answer not in the manual?

Intel ARCHITECTURE IA-32 Specifications

General IconGeneral
BrandIntel
ModelARCHITECTURE IA-32
CategoryProcessor
LanguageEnglish

Related product manuals