In: Computer Science
Give four reasons why system calls are typically implemented using interrupts instead of function calls.
Interrupt is used to break the sequence of a program instructions. System call is also a break in the normal execution that requests change in mode when there is need of certain resources. The switch is made from user mode to kernel mode to acquire those resources.
Four reasons using interrupt to implement system call and not function:
1. System call needs to call a system subroutine. Whereas functions deal with program subroutine. This means that the system call invokes a subroutine that is in the system. And function deals with subroutines that are in the program.
2. System call implementation needs control transfer to kernel space from user space. This includes dealing with architecture specific traits. This is done by using software interrupts due to the feature they have.
3. System calls make the processor go from the current address to another address. Hardware interrupts offer the same functionality.
4. System calls require the use of kernel space. Interrupts, in general, also require the use of kernel services after the current state is saved.