What Your Code Does Before main()
What Your Code Does Before main()
Your program's first instruction is not in main. Between the kernel's execve and your
entry point lies the entire boot machinery of the runtime: loading segments, relocations,
dynamic linking, and the C runtime's _start. We trace it with strace, ldd, and a
debugger.
Topics covered:
- The ELF file and its segments
- What the dynamic linker actually does
- The strange first microseconds of every process
- Why startup time is a systems problem, not a language problem
Related articles
JIT Compilation: Why Hot Loops Become Machine Code
Tiered compilation, on-stack replacement, and deoptimization — when the runtime outperforms the ahead-of-time compiler.
What Happens When You Allocate an Object
Thread-local allocators, TLABs, bump allocation, and why object allocation is nearly free until the moment it isn't.
How Garbage Collectors Decide What to Free
Mark-sweep, generational hypothesis, and GC pauses — the physics of automatic memory management and why it's never truly free.
More in Runtime & Execution
How Garbage Collection Actually Works
A visual walkthrough of mark-sweep, generational collection, and concurrent GC — the algorithms that keep your memory clean.
WatchHow Threads Actually Work
The kernel scheduler, context switches, goroutines versus threads — a visual walkthrough of what 'running on a core' really means.
WatchDepth, delivered weekly
One technical dispatch a week — articles and episode notes before they go public.
One technical dispatch per week. No noise.