Address Alignment
Date: Jul 2012
Level: Basic


INTERVIEW QUESTIONS

Company: Cisco Systems
Question Title: Address Alignment
QUESTION DETAILS:

What is address alignment?


Alignment refers to the arrangement of data in memory, and specifically deals with the issue of accessing data as proper units of information from main memory.

1. First we must conceptualize main memory as a contiguous block of consecutive memory locations.
2. Each location contains a fixed number of bits.
3. The data which these fixed number of bits represents can be accessed by the location's address.
4. Thus addresses denote the smallest unit of memory which can be manipulated.
Example: A 32bit memory that is byte addressable.

Issues of alignment come into play when the objects which need to be accessed are larger than the smallest addressable unit (usually some integer number of the size of the basic unit). In some machines, accesses to objects larger than a byte must be aligned . An access to an object of size s bytes at byte address A is aligned if A mod s = 0.

Misalignment causes hardware complications, since the memory is typically aligned on a word boundary. A misaligned memory access will, therefore, take multiple aligned memory references.
All Questions