0% found this document useful (0 votes)
6 views1 page

Understanding Data Alignment in Memory

Data alignment increases system performance by placing data at memory offsets that are multiples of the word size, allowing the CPU to efficiently fetch or write instructions and data from memory in whole machine words. Compilers add unused padding bytes to data structures to efficiently align them in memory and enable the CPU to access multiple bytes in a single memory operation.

Uploaded by

Samra Wahid Ali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Understanding Data Alignment in Memory

Data alignment increases system performance by placing data at memory offsets that are multiples of the word size, allowing the CPU to efficiently fetch or write instructions and data from memory in whole machine words. Compilers add unused padding bytes to data structures to efficiently align them in memory and enable the CPU to access multiple bytes in a single memory operation.

Uploaded by

Samra Wahid Ali
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Data alignment 

means putting the data at a memory offset equal to some multiple of


the word size, which increases the system's performance due to the way
the CPU handles memory.

In long words, the instruction can be fetched/written one machine word at a time. This machine word
differs depends on h/w. In a typical 32-bit machines, in one memory attempt, 4 bytes can be either read
or written. Thus for the efficient access of memory, our compilers does padding by barring the unused
memory.

You might also like