Concepts of interrupts and exceptions __ operating system

Source: Internet
Author: User

Interrupt Interruption Exception exception

With the introduction of both the kernel mentality and the user state in the operating system, you need to consider how the two states are switched. The operating system kernel works in a nuclear mindset, while the user program works in User state . However, the system does not allow the user program to implement the kernel mentality of the function, and they must use these features. Therefore, it is necessary to establish some "gates" in the nuclear mentality to realize the nuclear mentality from the user state. In the actual operating system, the only way to access these "doors" when the CPU is running the upper layer is through interrupts or anomalies .

When interrupts or anomalies occur, the CPU running the user state will immediately enter the kernel mentality, which is implemented through hardware (for example, a special register to represent the CPU's working state, 0 for nuclear mentality, 1 for user state.) To enter the nuclear mindset, simply place the position at 0.

Interrupts are a very important concept in the operating system, and the lack of an interrupt mechanism for a practical operating system running on a computer would be unthinkable. interrupt (Interruption)

interrupt (Interruption), also known as an external interrupt , is the occurrence of an event from outside the CPU execution instruction, such as an I/O end interrupt from the device, indicating that the device input/output processing has been completed, It is hoped that the processor will be able to send the next input/output request to the device, while the program that completes the input/output continues to run. The clock interrupts , indicating a fixed time slice has arrived, let the processor handle timing, start the task of timed running.

This class of interrupts is typically an event unrelated to the current program's operation, which is unrelated to the program that the current processor runs. exception (Exception)

An exception (Exception), also known as an internal interrupt, exception, or plunge (Trap), refers to an event originating from within the CPU execution instruction, such as:

The illegal operation code of the program, the address crossing, arithmetic overflow, the missing page of the virtual storage System and the special event caused by falling into instructions.

The handling of exceptions is generally dependent on the current program's running site, and the exception cannot be masked , and should be dealt with immediately upon occurrence. The links and differences between internal and external interrupts are shown in Figure 1-2.

Fig. 1-2 The relation and difference between interrupt and external interruption

wu_being Blog Statement : I blog welcome reprint, please indicate the original blog and the original link. Thank you.
The concept of interruptions and anomalies:
http://blog.csdn.net/u014134180/article/details/78418428

If you read this post and feel that it is helpful and willing to pay the sponsorship fee, I will be more motivated to write.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.