System Calls

System calls are special set of functions available in several programming languages. They are used by programs to communicate directly with an operating system. The operating system communicates back to the user's program through the return value of the function.

Generally, system calls are slower than normal function calls. The reason is because when you call a system call, control is relinquished to the operating system to perform the system call. In addition, depending on the nature of the system call, your program may be blocked by the OS until the system call has finished, thus making the execution time of your program even longer.

One rule of thumb should always be followed when calling a system call: Always check the return value. The return value is the only method that the operating system has to communicate information to your program. Thus, you should always check the return value in the event that the system call failed.

List of C System Calls

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License