Operating system note One: interrupts, exceptions, and sink mechanisms

Source: Internet
Author: User

The interrupt/anomaly/sink mechanism is the only way for the operating system to switch from user state to kernel state, which is the driving force of the operating system.

Interrupts and exception mechanisms have the following characteristics:

    1. Randomly occurring
    2. Automatic processing (Hardware completion)
    3. Can be restored

The difference between interrupts and exceptions:

    • Interrupts are external events that are not expected by the running program
    • Exception is thrown by an executing instruction

What are the roles of software and hardware during interrupts and exceptions:

    • Hardware--Interrupt/exception response
    • Software-Interrupt/exception handling program

Purpose of Interrupt/exception Introduction:

    • Interrupts are introduced for parallel operation between the CPU and the device
    • The introduction of the exception is to indicate that the CPU executes the instruction itself when the problem occurs

A story: Xiao Ming in Reading, suddenly came to a telephone, pick up the phone to continue reading, this is interrupted; Xiao Ming is reading, feeling thirsty, drinking water and then reading, this is abnormal.

Category Reason Synchronous/Asynchronous return behavior
Interrupt Interrupt (interrupt) From an I/O device or other hardware part Asynchronous Always return to the next instruction
Abnormal

Caught (Trap)

Consciously arranged. Synchronous Return to next instruction
Fault (fault) Recoverable errors Synchronous Return to current instruction
Terminate (Abort) Unrecoverable error Synchronous does not return

Failure and fall into:

    • Page fault, because it is fault, so when the page exception processing is completed, it will also try to re-execute the command that triggered the exception (most of the time is no longer a page fault)
    • Breakpoint processing, used in debugging, encountered a breakpoint will stop to wait for your processing, wait until you let it re-execute, directly execute the next instruction

Finish

Operating system note One: interrupts, exceptions, and sink mechanisms

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.