DEV Community

More About File Operations in C Including File Descriptors

Rita Kairu on February 12, 2024

Comprehensive Guide to File Operations and System Calls in C File operations and system calls are fundamental aspects of programming in C, essenti...
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.