All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Understanding Program Execution: What Happens Between execve() and main() in Linux

By

amitprasad

7mo ago· 8 min readenInsight

Summary

This technical blog post explores the complex process that occurs between when the Linux kernel is asked to execute a program via the execve system call and when the program's main() function actually begins execution. The author shares insights gained from working on a RISC-V-based userspace simulator, detailing the sequence of events including ELF file loading, dynamic linking, and program initialization that happens before main() runs.

Key quotes

· 4 pulled
taught myself a lot more than I wanted to know about what happens in-between when the Kernel is asked to run a program, and when the first line of our program's main function is actually executed
When is the OS kernel actually asked to run any program? The answer, at least on Linux, is the execve system call
Here's a summary of that rabbit hole
This is actually quite straightforward! We pass the name of the executable file, a list
Snippet from the RSS feed
A while back, I worked on a RISC-V-based userspace simulator for fun. In doing so, taught myself a lot more than I wanted to know about what happens in-between when the Kernel is asked to run a program, and when the first line of our program’s main functi

You might also wanna read