|
|
|
|
|
by userbinator
4241 days ago
|
|
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. 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. |
|