Function call
Look at this piece of code:
int main () {printf ("hello,world!"); return 0;}
The printf function is used, and the function is called from the standard C library and is actually going into the kernel state calling the write () function.
System calls
The application enters the kernel through the system call interface, first through the interrupt vector table to the system call table, each system call has the corresponding number, according to the number to implement the corresponding operation and return.
The difference between a system call and a function call
System invoke: Instruction int and iret stack switch (kernel and user state use different stacks), privilege level conversion
Function calls: Call and RET regular calls do not have a stack switch
System calls are more expensive because there is a user-to-kernel switchover, specifically:
Toggle boot (Hardware complete)
Kernel stack creation
Validation of validity of parameters
Kernel-state mapping to user-state address space
System calls and function calls