The Linux kernel is interrupting the lower half of the

Source: Internet
Author: User

Let's start by explaining why the kernel divides interrupts into the upper and lower parts


Because the interrupt itself interrupts normal program execution, task scheduling cannot be performed in the interrupt, so the interrupt needs to be returned quickly, but some operations must be performed in the interrupt.


If the kernel needs to perform a hardware-related, time-sensitive, cannot be interrupted operation, then these operations should be placed in the top half, the other can postpone the operation should be placed in the lower part, so that the interruption must be completed in the operation, but also good scheduling.

Look at the kernel's support for the bottom half.

First say the following how to add your own soft interrupt program

First add your own soft break type, the lower the value the higher the priority

Using OPEN_SOFTIRQ to increase the corresponding interrupt processing function

Use RAISE_SOFTIRQ to interrupt your software effectively

The kernel will then be able to invoke the software interrupt in DO_SOFTIRQ.


And look at Tasklet.

Use the above 3 methods to declare your Tasklet

Of course to write your own execution function void func (unsigned long arg);


Add your own tasklet to the schedule with the above two functions

Of course there are corresponding functions to cancel their own tasklet, here does not introduce


Next look at the work queue Workqueue



The above method can be used to declare a work

Of course you have to write your own execution function


Use the above method to add work to the system Workquene


Of course, you can create your own work queue, and then join the work in your own working queue



The Linux kernel is interrupting the lower half of the

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.