Boundary alignment: Ken Reek responds (LONG!)
Dave Martindale
dmmartindale at watcgl.UUCP
Fri May 11 01:09:29 AEST 1984
To address your last point first, I do not see how you can agree that
UNIX was written "wrong" because parts of it assume that all pointers
will fit in an int, an then say that your sofware is right and the
hardware is wrong for not allowing non-aligned references.
If you believe that all hardware should allow non-aligned references
for the benefit of the software, why don't you also argue that all
hardware should use byte addressing, with all pointers the same length
and the pointer the same size as the int? These latter restrictions
are actually far more important to porting much code than having the
processor do unaligned fetches.
Hardware design is a series of tradeoffs. It would be nice to have
hardware that would accept data on arbitrary byte boundaries. It would
be even nicer to extend that to arbitrary bit boundaries. It would be
nice if no machine had an address shorter than 24 bits, 32 would be
much better. It would be nice if all machines had floating-point
instruction times which are comparable to their integer instruction times.
It would be nice to have virtual memory capability on all machines (this
makes a much greater difference in "size of problem that can be handled"
than the ability to pack data to eliminate wasted space).
But all "it would be nice to have" features cost something - in speed,
cost, power, size of board, or somewhere. Manufacturers will continue
to decide to include or exclude a feature based on these tradeoffs.
Computer users will continue to evaluate the machines produced in light
of their capabilities, restrictions, and the application they are intended
for. Now, if you choose to ignore all machines which will not do unaligned
fetches, that is your right. But please do not badmouth other people who
see other issues as more important to what they do.
And if you really want to call your software "portable", it should run
on machines which have different sizes of pointers, different byte
orders within the word, different native character sets, and even restrictions
on the alignment of data. You make software which is portable by making
it independent of the details of the implementations of a wide variety
of machines, not by arguing that a certain class of those machines should
not be allowed to exist.
Dave Martindale
More information about the Comp.unix.wizards
mailing list