[Tutor] what is 'doubleword alignment'?

Alan Gauld alan.gauld at btinternet.com
Fri Jul 15 23:32:07 CEST 2011


Albert-Jan Roskam wrote:
> Got it already, I think. The word boundary of one chunk of information 
 > in my case 8 bytes) is aligned in the computer's memory
 > such that the boundary's address is a power of two.

Yes, you are right. It means that the storage of your data should always 
be aligned with addressable locations on your computer. The computers 
addressing scheme may not be linear and may not correspond to the "word" 
size in the programming environment. (eg The old Intel 8086 CPU used a 
segment:offset addressing scheme that meant any given memory location 
could be addressed in multiple ways. This was great for clever 
multi-tasking schemes but murder for normal computing because variable 
addresses could easily get messed up and accidentally overwrite other 
bits of data. Other CPUs have other schemes and running 32bit programs 
on 64bit hardware is another example where the two don't match!)


Ensuring that the programming view of memory and the hardware view 
matches up is A Very Good Thing(TM)...

HTH,

Alan G.


More information about the Tutor mailing list