What do we mean when we say that the control of the operating system is transferred to the main () function during program execution?

Suppose we are trying to run an arbitrary program -

int main()
{
statement 1;
statement 2;
statement 3;
}

Then he often said that during the execution of the program the OS control is transferred to the main () function, and after all the operators inside the main function are executed, the control returns to the OS again.

What do we understand under control? and if control is really transferred from the OS to the program, then how do several programs start at the same time?

+4
source share
2 answers

, , . , .

PROGRAM (, Pascal, FORTRAN) . C "main", y .

C , .

, . , . . . .

. "" ( ) , . C, , .

, "" // , .

"" , , : "" . , . , .

?

. "run".

"control".

""   ,     ,   Main, , "".

, ?

. . . . - ; .

0

"" - " ".

, (.. ).

, , main(). , , , .. .

+5

Source: https://habr.com/ru/post/1667889/


All Articles