Ending Processes
Ending Processes
When a thread ends, how do you tell that its done if they dont use an exit() call? I dont see how you could end it gracefully from a return..
Re:Ending Processes
Do you mean something like following?
Well, the trick is: main() is not the start of a process - the *real* entry is a function often called start:
So the OS exits the process if it doesn't exit itself
Code: Select all
int main(void)
{
printf("I am a process :-)\n");
return 0;
}
Code: Select all
_start:
push env
push argv
push argc
call main
call exit