Software Interrupt Definition

A software interrupt, also called an exception, is an interrupt that is caused by software, usually by a program in user mode.

An interrupt is a signal to the kernel (i.e., the core of the operating system) that an event has occurred, and this results in changes in the sequence of instructions that is executed by the CPU (central processing unit). One of the two main types of interrupts, a hardware interrupt, is a signal to the system from an event that has originated in hardware, such as the pressing of a key on the keyboard, a movement of the mouse or a progression in the system clock.

Software interrupts were introduced into Linux with the 2.4 kernel. Examples of events that cause them are requests by an application program for certain services from the operating system or the termination of such programs. When it receives a software interrupt signal, the CPU may temporarily switch control to an interrupt handler routine, and the process (i.e., a running instance of a program) in the kernel that was suspended by the interrupt will be resumed after the interrupt has been accommodated. Each type of software interrupt is associated with an interrupt handler, which is a software routine that takes control when the interrupt occurs.

User mode is one of two distinct execution modes for the CPU in Linux. It is a non-privileged mode in which each process begins. Non-privileged means that processes in this mode are prohibited from accessing those portions of memory that have been allocated to other programs or to the kernel.

Another way in which software interrupts differ from hardware interrupts is that they are not started immediately, but, rather, only at certain times; that is, they begin only after a hardware interrupt or a system call has occurred. As is the case with hardware interrupts, the number of types of software interrupts is limited.

A system call is a request in a Unix-like operating system made via a software interrupt by an active process for a service performed by the kernel, such as input/output (i.e., any movement of information to or from the combination of the CPU and main memory) or process creation (i.e., creation of a new process). An active process is a process that is currently progressing in the CPU, as opposed to processes that are waiting for their next turns in the CPU.

Created April 25, 2006.
Copyright © 2006 The Linux Information Project. All Rights Reserved.