System Calls

In traditional operating systems (OS), such as UNIX, system calls are interface between user processes and an OS kernel. A system call function could be fork(), which creates a new process, a running program. A user process could invoke fork() to request the kernel to create a new process that is a duplicate of itself on its behalf. A system call may involve data exchange. For example, a waitpid() invocation waits for child process to change state. The calling process/thread will suspend its execution until status of information for one of its terminated child processes is available, or until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process.

Some system calls could be handled at user space. But most system calls are handled in the OS kernel. At first edition UNIX, the OS has fewer than 35 documented system calls. If you are able to access a UNIX system, you can check system call numbers in system header file sys/syscall.h. Also, you can check Free BSD syscall names and IDs through this link.


A typical way to implement system calls is to use a software interrupt or trap. If a system call is handled through a trap to kernel, it involves a performance overhead to do context copying and restoring. When control is transferred to the OS kernel for a system call, some register is needed to store the system call number and then the software interrupt is executed. In some specific CISC architectures such as x86, however, faster control transfer instructions are available so as to transfer control to OS kernels more efficiently without interrupt overhead.

Comments

Popular posts from this blog

25 Google Interview Questions

Convert LaTeX to HTML

Art of Software Development