Interrupts

From FriendOS Wiki
Jump to navigation Jump to search

Interrupts are used in operating system design in order to allow things such as input, or timing, and often used with system calls to allow for an easy interface with the operating system. Interrupts can typically be split into several categories. External interrupts, Exceptions, and Software interrupts are some.

External Interrupts

External interrupts are used by external devices, such as keyboards, to tell the CPU that there has been an update in their state. The way of handling these external interrupts differs from platform to platform, but on RISC-V its handled with the PLIC.

Exceptions

Exceptions are errors that occur on a hardware level, sometimes from issues with the software, such as illegally storing to memory. Exceptions typically have specific error codes, and specific ways of getting details on why they occurred, often stored in specific registers.

Software Interrupts

Software interrupts are generated, as the name implies, by software, these are used to time things, interact with the operating system, through syscalls, or to handle something important within the operating system.