TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Murray Lesser
from: Mike Bilow
date: 1995-12-31 18:11:08
subject: Link386 /Align Option

Murray Lesser wrote in a message to All:

 ML>     Can anyone explain what the LINK386 /Align switch does
 ML> any better than what I have been able to find in the
 ML> literature?  In particular, is there an optimum value for
 ML> all (or only some) 32-bit programs, and what is it?

 ML>     For example:  In the IBM PL/I for OS/2 "Programming
 ML> Guide" the examples use switch /A:2.  In the IBM "C/C++
 ML> Tools Programming Guide" the example touts switch /A;16. 
 ML> The on-line "Developer's Toolkit (version 3) Tools
 ML> Information file for LINK386 recommends /A:2.  What does the
 ML> value signify?  Does it really make any difference?  Why? 

 ML>     Any explanatory comments would be appreciated.

Never use a value less than 4 for linker alignment on 32-bit programs, and
never use a value greater than 4096 for linker alignment on any OS/2
programs. These are the only absolute rules.

As you increase the linker alignment, you will consume memory in the hope
that you can increase your chances of objects already being paged in by
coincidence resulting from previous paging, thereby increasing speed.

The default 32-bit linker alignment is 512 bytes, which happens to be the
size of a disk sector.  The idea is that an access to the disk is expensive
and should not be wasted by throwing away most of the data being read in
anyway.

If you use a performance tuning tool such as LXOPT, which optimizes the
chances of related objects being brought in together, then it makes sense
to use a very large alignment.  OS2KRNL, for example, uses 4096-byte
alignment.

If you have no performance tuning, and objects are arranged essentially
ramdomly, then you probably should stick close to the minimum alignment
size. Particular compilers and libraries may be sufficiently well tuned on
their own to increase the alignment size a bit, as C++ recommends with 16
bytes; also, object-oriented languages such as C++ will tend to allocate
larger objects with hidden elements, taking better advantage of larger
alignment.

All things considered, using 16 bytes is probably fine for nearly all
32-bit programs built without explicit performance tuning.  It might be
worth testing 16- and 512-byte alignment with any particular program to see
if there is a performance difference.  In general, computationally
intensive programs (such as OS2KRNL) will benefit most from larger
alignment.
 
-- Mike


--- 
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 808 809 934 955 712/407 515
SEEN-BY: 712/517 628 713/888 800/1 7877/2809
@PATH: 323/107 150 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.