Quote:
Ultimately function calls (which do not include the user defined functions but do include the C/C++ etc standard library functions) too would be passed to kernel for some or the other work.
Correct me if I am wrong.
|
You're wrong
No offense - but Sergei's example is a great.
And if you wanted another example (an example in the Standard C library), then look no further than "strlen()"
.
I repeat what I said
above:
Q: What is the real difference between system calls and normal function calls?
A: There is a HUGE difference. By definition, a "system call" changes context from user space to system space. A function call, on the other hand, is executed from user space.
Q: Ultimately function calls too would be passed to kernel for some or the other work?
A: Not every function call ends up as a system call.
In fact, probably FEW ever do.
PS:
"return", as I'm sure you know, is a C/C++ *operator*. As such, it's outside the scope of this discussion.
If you meant "function main()", you can easily create a function that makes NO system calls (e.g. "void main () { ; }"). The PROGRAM might make system calls (in both the preamble and exit code) ... but the FUNCTION doesn't.