CSC 382 · Computer Architecture 1
Our notes
2 min readFrom source to running program
Source → (assembler or compiler) → object modules → (linker or link editor) → executable → (loader) → in memory, running.
The linker (link editor)
- Combines several object modules (and library routines) into one program.
- Resolves external references: a CALL SQRT in one module gets the address of SQRT from the module or library that defines it (an error if no module does: "undefined reference").
- Relocates: assigns each module a place in the combined program and adds the module's starting offset to every address marked as relocatable.
Worked example: relocation
Module A is 300 words long and module B 150. The linker places A at 0 and B at 300. In B, an instruction refers to B's local address 40; after linking it must refer to 300 + 40 = 340. If A calls B's entry point at B-relative 10, the call gets 310. If the loader then puts the whole program at 5000, every relocatable address gets 5000 more: B's 40 becomes 5340.
Kinds of loader
- Absolute loader: copies code into the addresses fixed at assembly time. Simple, but the program can run only there.
- Relocating loader: adds the load address to relocatable words, so the program can run anywhere.
- Linking loader: links and loads in one step.
- Dynamic loading and linking: libraries are loaded when first needed and shared by many programs (DLLs on Windows, .so files on Linux and Android). Saves memory and allows library updates without relinking.
Bootstrap programs
When power comes on, memory holds no operating system. A small program in read-only memory runs first:
- It tests the hardware (the power-on self-test on PCs).
- It finds a boot device and loads a short boot loader from it.
- The boot loader loads the operating system kernel, which takes over.
The name comes from "pulling yourself up by your bootstraps". On early minicomputers such as the PDP-8, operators keyed in a short bootstrap loader by hand with front-panel switches; modern PCs use BIOS or UEFI firmware, and phones a boot ROM that checks signatures before loading Android.
Memory hierarchy (link to CSC 495)
Registers → cache (L1, L2, L3) → main memory (RAM) → solid-state or magnetic disk → tape or cloud archive. Each level is larger, slower and cheaper per byte than the one above; programs run fast because they reuse nearby data (locality), which caches exploit. Computer Architecture II takes this further.
Exams usually ask
- Explain the functions of a linker and a loader.
- Work out relocated addresses for modules placed at given positions.
- Describe the bootstrap process.
Common mistake
Confusing linking with loading. The linker joins modules and resolves names; the loader puts the result into memory and starts it (a linking loader does both).
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
No reading links here yet
Our team adds free books, videos and practice for each topic, and opens every link before it goes up.