Recently I found this in a powerpoint presentation:
When a program is compiled and linked, the linker inserts some extra code in the program. It is this code that calls the main function about the same way a user calls "lower functions".
The extra code has two functionalities:
- make sure that the C program runs in the right environment
- cleanup after succesfull termination
Prior to that I thought that cleanup was kernel's job. What is the right story?