DEV Community

Discussion on: More About File Operations in C Including File Descriptors

Collapse
 
pauljlucas profile image
Paul J. Lucas

System calls are requests made by user-space programs to the operating system kernel, whereas functions are routines provided by libraries or the standard C library. System calls involve a context switch to kernel mode, making them more expensive in terms of performance compared to library functions.

The library functions ultimately also make system calls, so the cost of library function calls are in addition to, not instead of, system calls. The library functions don’t somehow have magic access to bypass system calls.

The advantage of library functions is that they are “higher level” and have better APIs for doing most things and also offer choices in buffering.