Data structure alignment: Difference between revisions

Content deleted Content added
Wiarthurhu (talk | contribs)
restore examples of doomed architecture due to alignment problems.
Wiarthurhu (talk | contribs)
restore porting examples
Line 17:
==Compatibility==
 
The advantage to supporting unaligned access is that is is easier to write compilers that
Because the main (only?) advantage to supporting unaligned access is that some memory can be used which would otherwise be lost as padding, and because the cost of supporting it is so high, many modern [[computer architecture]] designs don't support it at all. Most (all?) of the ones that do, require the [[operating system|OS]] to do most of the work. Older designs (notably [[x68]]) do not implement full support in hardware.
do not need to align memory, at the expense of the cost of slower access.
 
One way to increase performance in [[RISC]] processors which
Some programs which were written for an architecture that did not enforce aligmnent may use unaligned memory access (either intentionally or not). This can be a problem when porting said programs.
 
One way to increase in [[RISC]] processors which
are designed to maximize raw performance is to require data to loaded or
stored on a word boundary. So though memory is commonly addressed by
Line 27 ⟶ 25:
would be required to be start at every 64 bits on a 64 bit machine.
The processor could flag a fault if it were asked to load a number
which was not on such a boundary, but this would result in a slower call to a routine which would effectivelyneed to figure out which word or words contained the data and extract the equivalent
figure out which word or words contained the data and extract the equivalent
value.
 
This caused difficulty when the team from [[Mosaic Software]] ported
their [[Twin Spreadsheet]] to the [[68000]] based [[Atari ST]]. The Intel [[8086]]
architecture had no such restrictions.
 
Line 41 ⟶ 38:
However since this bit was masked with other flags, it was impossible to
keep the O/S from faulting on non-aligned data. Both platforms ulimately
failed as platforms for hosting Windows applications. This small detail may be
one reason for the continued dominance of the x86 architecture over rivals.