|
Page-aligning the segments makes it (much) cheaper to load pieces of the executable on demand (demand paging) which reduces the amount of physical memory required to launch the program. Note that most of that size is zeroes padding the file out. Also remember that most file allocations are quantized to 512 or 4096-byte blocks. Dynamic linking makes it possible for executables to share a single copy of system frameworks; this saves physical memory, improves performance (due to reduced cache traffic), reduces the size of downloads, etc. The UUID allows the debugger to reliably associate an executable with the dSYM bundle containing debug information. Other features not discussed in the article allow a single program to run on multiple architectures (PPC, I386, X86_64, etc), allow the system to reliably determine whether a program has changed, to decide what capabilities the program has been granted, etc. It's worth putting these size number into perspective; yes, EIGHT THOUSAND BYTES sounds big and scary next to twenty, but the overhead scales linearly with the number of executables and their functional complexity, not geometrically. Also, you have on the order of ONE TRILLION BYTES of storage for these headers, rather than three hundred and sixty thousand... |
In this case the entire executable, headers and all, can fit in 1 page, so instead of just having that one page read into memory and executed immediately, you have to read another one for a total of 2 pages. For a small executable, this overhead can result in up to twice as many pages being read in, and although for larger ones that require many tens or more pages it decreases proportionally, it still doesn't make any sense to add otherwise completely useless bytes that have to be read in; disks (and SSDs) are several orders of magnitude slower than memory, so if the block containing the header is going to be read, it might as well include some more data (like the code of the program) that would need to be read later in any case.