# System calls and library calls

I have wondered for sometime what the difference is between system calls (found in section 2 of the man pages) and library calls (in section 3). Its simple...

- system calls are provided by the system and are executed in the system kernel. They are entry points into the kernel and are therefore NOT linked into your program. These are not portable calls.
- Library calls include the ANSI C standard library and are therefore portable. These functions are linked into your program.

It is worth noting that, because system calls are part of the O/S. The program has to make a context switch to the kernel when they are called and because of this, they have a high startup overhead. The upside is that the time executing these routines is assigned to the OS and not the user program.

Top | Master Index | Keywords | Functions