1. Overview

In this tutorial, we’ll discuss system calls and system interrupts in detail.

We’ll also present the core differences between them.

2. Background

Every operating system provides several ways for users and processes to interact with it. We can divide the interactions between the operating system and users into two categories: system call and system interrupt. Depending on the operating system, it implements either a system call or a system interrupt for communication with processes and users.

Both system calls and system interrupts are ways for user processes to communicate with the OS kernel directly. In computer science, a call is a request by a program to an operating system either for a service or to execute an operation.

An interrupt is an alert triggered by events such as the completion of an instruction, hardware or software signaling for an event, and timers reaching their final countdown value. Additionally, we can initiate interrupts from software to implement concurrency control mechanisms. Furthermore, it can arise in response to some asynchronous event.

Let’s talk about system calls and system interrupts in more detail.

3. System Call

A system call is a method that enables a user process to interact with the kernel of the operating system. A system call is a call from user mode to kernel mode. In other words, it’s the way that a program running on a computer requests a service from the kernel.

We can use system calls to read information from files, get time, manage the computer’s memory, or control the data flow between computers. Furthermore, a user program initiates a system call by executing an instruction that transfers control from the user program to the operating system kernel. A system call is a request by a program to the kernel for the execution of an operation:

System Call

Now let’s talk about various system calls that can occur in an operating system. We can divide system calls into five categories based on their use:

  • process control
  • maintenance of information
  • management of participating devices
  • handling communication
  • file management

A system call in process control manages several operations, such as creating, terminating, and allocating memory to processes. Furthermore, we can use system calls in file management for creating, opening, closing, deleting, and reading files.

Some of the vital services provided by the system calls are networking, protection, main memory management, and process management.

4. System Interrupt

System interrupts are a way for a process to alert the kernel that an event has occurred. Once interrupted, the kernel can process the event and return to the process where it left off. System interrupts are also used to suspend the execution of a program temporarily.

A system interrupt occurs when an operating system might want to stop the program from performing a task in the kernel. Interrupts are common ways for hardware and software signals to alert the computer to events such as the completion of an instruction and the arrival of data from a network:

System Interrupt

It can happen that two or more devices simultaneously raise an interrupt. In such a condition, we need additional information from the devices in order to determine the order of the execution of devices. There’re three popular methods that can decide the order of the execution: vector interrupt, interrupt nesting, and pooling.

In the vector interrupt method, the device raising interrupts sends a unique code to the CPU in order to confirm its identity. The interrupt nesting method uses a priority structure in order to determine the order. Finally, in pooling, first, we consider the device with an IRQ bit set for the execution.

5. Differences

Now we know the definitions of system call and system interrupt. A system call is a method that enables a user process to interact with the kernel of the operating system. A system call is a call from user mode to kernel mode. In other words, it’s the way that a program running on a computer requests a service from the kernel.

On the other hand, interrupts don’t require the kernel’s attention. We don’t need to notify the kernel that an interruption has occurred.

Let’s talk about the core differences between system call and system interrupt:

Rendered by QuickLaTeX.com

6. Conclusion

In this tutorial, we discussed system calls and system interrupts in detail. We also presented the core differences between them.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.