Traditionally executables get mapped at their desired base address, if that's not in use yet. You can't map at 0, since the lowest part of the address space is reserved (leads to crashes on null pointer dereferencing, instead of accessing memory you didn't intend to acceess).
Since you only load a single .exe file into a process, they don't need to use a unique base address. So most .exe files keep the default value 0x400000
. They often lack a relocation table, and thus must be loaded at that address.
For dlls things are a bit more complicated, since their target address can be in use already. In that case they'll get mapped at another address, and a relocation table is used to patch parts of its code that now need to point to other addresses. This fixup costs both CPU time and memory (executables are mapped as copy-on-write, and the fixup means your application gets a unique copy of the dll). So base addresses for dlls are typically chosen to avoid overlaps and thus relocation.
Nowadays things are different. RAM is much cheaper, so the cost of relocation isn't that important anymore. On the other hand security is very important now. So we use a process called ASLR where executables are mapped at unguessable addresses. This makes the base address the executable specifies rather meaningless.
Thus executables being able to choose their own base address is a performance optimization that was useful on slow computers with little RAM but isn't useful on modern systems anymore since MS decided to trade a bit of performance for increased security.
0x100000000
(32 bit max + 1) for base, but it doesn't answer my question really...