The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
Every data type has alignment requirements mandated by the processor architecture. A
processor will be able to efficiently process data if the processing word size matches
processor's data bus size. For example, on a 32-bit machine, the processing word size is 4
bytes. Figure 3.1 illustrates how a correctly
aligned integer value is stored in memory. The 4 bytes of the aligned integer
A
are stored as A0
, A1
,
A2
, and A3
in memory. As this integer is stored with
correct alignment, the processor can fetch the complete word in a single 32-bit bus
cycle.
If the same processor now attempts to access an integer variable X
at an unaligned address, it cannot perform the read in a single bus cycle. Figure 3.2 illustrates an incorrectly
aligned integer value stored in memory.
The processor has to issue two fetch instructions to read the complete misaligned integer and so takes twice as long as for an aligned integer. In short, the addresses of memory chunks should be in multiples of their sizes. If an address satisfies this requirement, it is said to be properly aligned. The consequences of accessing data via an unaligned address can range from slower execution to program termination.