Basic knowledge about Linux: interruptions and exceptions

Source: Internet
Author: User
Q1. what is interruption? What is an exception? What is the difference between the two? A: 1) interrupt control is generated to overcome the low processor efficiency caused by using the program query control service for I/O interfaces, its main advantage is that the processor response can be obtained only when I/O interfaces require services, without the need... information

Q1. what is interruption? What is an exception? What is the difference between the two?
A:

1) interrupt control is generated to overcome the low processor efficiency caused by the use of the program query control service for I/O interfaces, its main advantage is that the processor response can be obtained only when the I/O interface requires service, without the need for the processor to continuously query. therefore, the initial interruptions are all for external devices, known as external interruptions (or hardware interruptions );

2) An exception is also called an internal interrupt. it is used to solve some random events that occur during machine running and facilitate programming;

3) 256 types of interruptions are divided into external shielded interruptions (INTR) and external unshielded interruptions (NMI). all I/O device interrupt requests (IRQ) cause shielded interruptions, faults caused by emergencies (such as hardware faults) produce unshielded interruptions;

4) exceptions are classified into faults and traps. they share the same characteristics that they do not use interrupt controllers, and cannot be blocked (The exception is actually the terminal signal sent by the CPU ).

 

Q2. what is an interrupt vector? In Linux, how does one allocate an interrupt vector?

A:

1) to enable the processor to easily identify each type of Interrupt source, number the 256 vector interruptions from 0 to 255, that is, assign an interrupt type code n, call this 8-bit unsigned integer a vector, that is, the interrupt vector;

2) Linux allocates 256 interrupt vectors as follows:

A. No. is 0 ~ The vectors of 31 correspond to abnormal and unshielded interruptions;

B. The serial number is 32 ~ The 47 vector (that is, the interrupt caused by the I/O device) is allocated to the shielded interrupt;

C. The remaining number is 48 ~ The 255 vector is used to identify soft interruptions. Linux uses only one of them (namely, the 128 or 0x80 vector) for system calling.

 

Q3. what is an interrupt descriptor table? What is a gate descriptor?

A:

1) in real address mode, the CPU uses the 1 KB space starting from 0 in the memory as an interrupt vector table. each table entry occupies 4 bytes. However, in protection mode, the interrupt vector table composed of four bytes cannot meet the requirements. Therefore, in the protection mode, the table items in the interrupt vector table are composed of eight bytes, the interrupt vector table is also called the interrupt descriptor table (IDT );

2) each table item in IDT is called a gate descriptor ).

 

Q4. what types of gate descriptors are there? What are their differences?

A: The type code in the door descriptor occupies three places, indicating the type of the door descriptor, which is mainly divided into the following categories:

1) interrupt gate (interrupt gate): the type code is 110, which contains the separator and intra-segment offset of the segment where an interrupt or exception handling program is located;

2) trap gate: the type code is 111;

3) system gate: it is specially set in the Linux kernel to allow user-mode process access to the trap gate.

From: Column of zhouzxi

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.