Loader

Overview

The operating system provides a function called the loader that copies the code and data of the executable object file into memory, and then transfers control to the beginning of the program. The process of copying a program into memory and running it is called loading.

The program's first instruction is called the entry point. On x86-64 Linux machines, this always corresponds to the address of the _start function typically found in crt1.o. This object file is silently linked by the compiler driver.

Virtual Memory

Using virtual memory, the loader does not actually copy any data from disk into memory. Instead, virtual pages are allocated for the code/data segments and then marked as uncached. The VM system then pages them in on demand.

Powered by Forestry.md