Linux kernel design and implementation--7 interrupt and interrupt processing (4) __linux

Source: Internet
Author: User
4. Upper half and lower part

1 Why should be divided into the lower half of

Game of speed and function. As mentioned above, interrupt handlers are interrupted by other people's operations, so run as fast as you can. But I want to try to do a great function. This is one of two conflicting goals. The solution is to divide the interrupt handler into the following two parts

2)

Top half: There are strict time constraints, do some work that must be done immediately, such as the response to interrupts and hardware reset

Lower half: Allow to finish later, do some less urgent work, such as data processing

In this way, the interrupt handler handles the upper half, and the lower part is then performed at a later idle time to achieve a balance between speed and function.

3) Example: Interrupt handling of network card

The network card has data arrives, sends an interrupt to the kernel

The kernel call interrupt handler handles the following tasks: notifying hardware, copying data to memory. These tasks are urgent, that the network card is usually relatively small cache, if not in time to copy out, the cache will cause loss of packets. And you must have the NIC reset and ready to receive new data immediately.

The lower half of the work: in-memory data processing, and sent to the corresponding process. This is less urgent work that can be done later.

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.