Multi-interrupt quick response asynchronous processing method and device for Linux system, electronic equipment and medium
By binding a processing function for each interrupt in the Linux system and using tasklet scheduling to process multiple interrupts, the deadlock and crash problems caused by improper multi-interruption processing in complex systems are solved, and fast response and high concurrency processing capabilities are achieved.
Patent Information
- Application Number
- CN202411671324.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
AI Technical Summary
In complex airborne avionics systems, improper handling of multiple interrupts may lead to kernel deadlocks and system crashes, and user-state programs need to actively query the kernel-state interrupt processing results, resulting in insufficient interrupt processing capabilities.
The interrupt handling function is bound to each preset interrupt in the kernel state, including the upper and lower half of the interrupt, and create tasklet and tasklet handling functions based on the lower half of the interrupt. In response to multiple interrupt requests, the first interrupt is executed using the upper half of the interrupt and triggers the tasklet scheduling, and a second interrupt is processed based on the tasklet scheduling, and an asynchronous notification signal is sent to the user-state program after its execution is completed.
It realizes the system's rapid response and asynchronous processing of multiple interrupts, improves the system's concurrent processing capabilities, and reduces the need for user-state programs to actively query the execution results of kernel-state interrupts, thereby ensuring rapid response to critical tasks and saving time.
Smart Images

Figure CN119621268A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of embedded operating system applications, and in particular to a method, device, electronic device and medium for rapid response asynchronous processing of multiple interrupts in a Linux system. Background Art
[0002] With the development of technology, airborne avionics systems are becoming more and more complex. There are more and more bus types used on a CPU module, and based on the real-time considerations of user software, interrupt reception is often used as the bus receiving method. Complex systems with multiple interrupts may cause kernel deadlock or even system crash if the interrupts are not handled properly. When an interrupt is processed, other interrupts cannot be processed. If the processing time of the interrupt is long, the Linux thread will not be executed, and it will also affect the response of interrupts with the same priority and low priority, causing interrupt loss. When multiple interrupts arrive at the same time, improper interrupt handling will cause system conflicts or even crashes. User-mode programs will query whether the kernel-mode interrupts have been processed, which will also cause the system's interrupt processing capability to fail to meet the situation where multiple interrupts arrive. Summary of the invention
[0003] In view of this, the embodiments of the present application propose a Linux system multi-interrupt rapid response asynchronous processing method, device, electronic device and medium, aiming to ensure that critical tasks can be responded to quickly and improve the system's concurrent processing capabilities.
[0004] To achieve the above-mentioned purpose, an embodiment of the present application provides a Linux system multi-interrupt rapid response asynchronous processing method, comprising: binding an interrupt processing function to each preset interrupt in the kernel state, the interrupt comprising an interrupt upper half and an interrupt lower half, and creating a tasklet and a tasklet processing function corresponding to the tasklet based on the interrupt lower half; in response to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute a first interrupt and trigger a preset tasklet scheduling; based on the tasklet scheduling, using the tasklet processing function to process a second interrupt, and after the second interrupt is executed, using the tasklet processing function to send the asynchronous notification signal to the user state program.
[0005] Optionally, before binding an interrupt processing function to each preset interrupt, the method includes: initializing the interrupt processing function; allocating an interrupt signal to each preset interrupt in the user state, and binding the interrupt signal to the signal capture function.
[0006] Optionally, after using the tasklet processing function to send the asynchronous notification signal to the user-state program, the method includes: in response to the received asynchronous notification signal, using the user-state program to automatically execute the signal capture function to complete subsequent interrupt legacy tasks.
[0007] To achieve the above-mentioned purpose, an embodiment of the present application also provides a Linux system multi-interrupt rapid response asynchronous processing device, including: a binding module, used to bind an interrupt processing function to each preset interrupt in the kernel state, the interrupt includes an interrupt upper half and an interrupt lower half, and a tasklet and a tasklet processing function corresponding to the tasklet are created based on the interrupt lower half; a scheduling module, used to respond to multiple interrupt requests arriving at the same time, use the interrupt upper half to execute a first interrupt and trigger a preset tasklet scheduling; an asynchronous notification module, used to use the tasklet processing function to process a second interrupt based on the tasklet scheduling, and after the second interrupt is executed, use the tasklet processing function to send the asynchronous notification signal to the user state program.
[0008] Optionally, the Linux system multi-interrupt rapid response asynchronous processing device also includes: an initialization module for initializing the interrupt processing function; a signal allocation module for allocating an interrupt signal to each preset interrupt in the user state, and the interrupt signal is bound to the signal capture function.
[0009] Optionally, the Linux system multi-interrupt rapid response asynchronous processing device also includes: a signal capture module, which is used to respond to the received asynchronous notification signal, automatically execute the signal capture function using a user state program, and complete subsequent interrupt legacy tasks.
[0010] To achieve the above-mentioned purpose, an embodiment of the present application also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Linux system multi-interrupt rapid response asynchronous processing method provided in any one of the above-mentioned embodiments.
[0011] To achieve the above objectives, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the Linux system multi-interrupt rapid response asynchronous processing method provided in any of the above embodiments.
[0012] The embodiments of the present application propose a Linux system multi-interrupt rapid response asynchronous processing method, device, electronic device and medium, by binding an interrupt processing function to each preset interrupt in the kernel state, the interrupt includes an interrupt upper half and an interrupt lower half, and creating a tasklet and a tasklet processing function corresponding to the tasklet based on the interrupt lower half; in response to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute a first interrupt and trigger a preset tasklet scheduling; based on the tasklet scheduling, using the tasklet processing function to process a second interrupt, and after the second interrupt is executed, using the tasklet processing function to send the asynchronous notification signal to the user state program, in response to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute the first interrupt to achieve the improvement of the concurrent processing capability of the system, using the asynchronous notification signal to notify the user state program to execute the corresponding interrupt processing, reducing the user state actively querying the kernel state program interrupt execution results, thereby ensuring that critical tasks can be responded to quickly and saving time. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is the process of the Linux system multi-interrupt rapid response asynchronous processing method provided in an embodiment of the present application Figure 1 ;
[0014] Figure 2 This is the process of the Linux system multi-interrupt rapid response asynchronous processing method provided in an embodiment of the present application Figure 2 ;
[0015] Figure 3 The structure frame of the Linux system multi-interrupt rapid response asynchronous processing device provided in one embodiment of the present application Figure 3 ;
[0016] Figure 4 It is a structural block diagram of a Linux system multi-interrupt rapid response asynchronous processing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0017] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not be construed as any limitation, and the various embodiments can be combined and referenced with each other under the premise of no contradiction.
[0018] In common operating systems such as Linux, user-mode programs generally cannot directly receive kernel-mode interrupt signals, but instead learn about interrupt-related events and respond indirectly. The following is a specific implementation mechanism and related instructions:
[0019] User-mode programs mainly interact with kernel mode through system calls. When an interrupt occurs and kernel mode completes the corresponding interrupt processing, if there is a situation that needs to be known by user mode, the kernel will pass relevant information by updating some data structures or status identifiers accessible to user-mode programs. Then user-mode programs can initiate system calls in a timely manner to query these status information, thereby indirectly knowing whether there is an interrupt-related situation.
[0020] For example, in a network communication scenario, when a network card receives a network data packet, an interrupt is triggered (this is an interrupt event handled by the kernel state). The kernel state interrupt handler receives the data packet, performs preliminary processing, and stores it in the kernel buffer. At the same time, it updates the corresponding network socket status information (for example, marking that the socket has new data to read). User-state network applications (such as browsers, etc.) check the socket status by calling system call functions such as recv. If a mark indicating that new data is readable is found, it knows that a new data packet has arrived, which is equivalent to indirectly obtaining information related to the network reception event triggered by the interrupt.
[0021] For interrupts generated by some hardware devices, if the user-mode program needs to obtain relevant information, it often uses the interfaces provided by the device driver and the file system to achieve this. After the device driver handles the interrupt-related operations in the kernel state, it will work with the file system to update the corresponding device file status or leave information in the buffer corresponding to the device-related file descriptor and other locations that can be read by the user-mode program.
[0022] For example, for a disk device, when the disk completes a read or write operation and triggers an interrupt, the kernel-state disk driver completes the relevant processing and updates some metadata information of the device file corresponding to the disk device (such as the file's read or write pointer position, etc.). User-state applications (such as programs related to file reading and writing) can open the corresponding disk device file (through device file paths such as / dev / sda) and use conventional file read and write system calls (such as read, write, etc.) to obtain or operate related information, thereby indirectly understanding the interrupt processing status corresponding to the disk read and write operation.
[0023] Kernel state and user state can pass interrupt-related information by sharing the same memory area. When kernel state handles interrupts, some key results, status and other data can be written to the shared memory area, and then the user state program can read the content in the shared memory area in a timely manner to know the interrupt-related situation. However, this method requires a reasonable synchronization mechanism to ensure data consistency and integrity, such as using semaphores to avoid read-write conflicts.
[0024] Through the memory mapping mechanism, user-state programs can map certain data structures or memory areas in the kernel space to the user space, so that the user state can access these mapped contents in the same way as accessing its own memory. For example, in some high-performance network application scenarios, after the kernel state processes the network card interrupt to receive the data packet, it may provide the memory area related to the data packet to the user-state network processing program through memory mapping, so that it can quickly obtain the data packet content and perform subsequent processing. The user-state program can know whether there is a new interrupt to receive the data packet by checking the status of the mapped area.
[0025] It can be seen from the above content that in the prior art, user-mode programs need to actively obtain interrupt notification signals from kernel-mode programs, which will undoubtedly lead to problems such as long execution time of interrupt handlers and interrupt loss. This application proposes a Linux system multi-interrupt rapid response asynchronous processing method to solve the above technical problems.
[0026] The following first explains the terms used in this application:
[0027] Kernel state program, the Linux operating system adopts a dual-state design mode of kernel state and user state. Kernel state is the privileged level where the operating system kernel runs. In this state, programs can access the system's hardware resources, execute protected instructions, and directly operate key parts such as memory. Kernel state programs exist in the kernel and are a collection of codes that constitute the core functions of the operating system. It controls the key operating mechanisms of the entire system. Basic and important functions such as process scheduling, memory management, device driver management, and file system management are all implemented by kernel state programs.
[0028] User-mode programs correspond to kernel-mode programs and have their own unique characteristics and important functions. User-mode programs run in user mode, which is a non-privileged execution level. They are various applications written by users based on the application development interface provided by the operating system. For example, common text editors (such as Vim, gedit, etc.), office software, browsers and other daily software are all user-mode programs. These programs run in the user space divided by the operating system, which is isolated from the kernel space where kernel-mode programs are located, so as to ensure the security and stability of the system.
[0029] Tasklet scheduling, during the operation of the Linux system, when a hardware device generates an interrupt (hard interrupt), in order to respond and process the key part as quickly as possible, the interrupt handler will first execute urgent operations that must be completed immediately, which is called the upper half. However, some relatively less urgent operations that may take a little longer to process in the upper half will affect the system's ability to respond quickly to other interrupts, so such operations are postponed to a later stage, which is the so-called soft interrupt lower half. Tasklet is a mechanism for implementing the soft interrupt lower half, which can effectively schedule and execute these subsequent tasks. For tasklets of the same type, that is, tasklets created by the same tasklet structure, they are serial when executed, that is, only one tasklet of the same type can be running at a time, which can avoid complex concurrent synchronization problems and ensure the predictability of the execution order of specific types of tasks. However, tasklets of different types can be executed concurrently to improve the efficiency of the system in processing multiple asynchronous tasks.
[0030] An interrupt is when the CPU pauses the currently executing task and executes a specific processing program during the operation of the computer due to input from external devices (such as keyboard, mouse, network card, etc.) or internal abnormal conditions (such as division by zero, page fault, etc.). This processing program is the interrupt processing function (also often called interrupt service program). The interrupt program is the source of the interrupt request. Different interrupt sources correspond to specific interrupt processing functions. The pre-binding between them means that the system has established this one-to-one relationship during the initialization phase or earlier, so that the correct processing function can be quickly called to deal with the interrupt when it occurs.
[0031] An embodiment of the present application proposes a Linux system multi-interrupt rapid response asynchronous processing method, which is applied to an electronic device, wherein the electronic device can be a terminal or a server. This embodiment and the following embodiments are all described by taking the server as an example. The implementation details of the Linux system multi-interrupt rapid response asynchronous processing method proposed in this embodiment are specifically described below. The following content is only for the convenience of understanding the implementation details provided, and is not necessary for the implementation of this solution.
[0032] The specific process of the Linux system multi-interrupt rapid response asynchronous processing method proposed in this embodiment can be as follows: Figure 1 to Figure 2 As shown, including:
[0033] S10, binding an interrupt processing function to each preset interrupt in the kernel state, the interrupt includes an interrupt upper half and an interrupt lower half, and creating a tasklet and a tasklet processing function corresponding to the tasklet based on the interrupt lower half;
[0034] Specifically, when the system starts, it automatically binds the corresponding interrupt processing function to each interrupt and sets the interrupt triggering mode. In Linux, interrupts are divided into the upper half and the lower half. The lower half of the interrupt includes the processing function associated with the tasklet scheduling, namely the tasklet processing function.
[0035] refer to Figure 3 In an embodiment of the present application, before step S10, the Linux system multi-interrupt rapid response asynchronous processing method further includes:
[0036] Initialize the interrupt handling function;
[0037] Assign an interrupt signal to each preset interrupt in the user state, and bind the interrupt signal to the signal capture function.
[0038] Exemplarily, when the user state program is started, a corresponding interrupt signal, that is, an asynchronous notification signal such as SIGIO and SIGUSR1, is assigned to each interrupt. The user state program also binds a corresponding capture function to each asynchronous notification signal, and the bound capture function is automatically executed when the asynchronous notification signal occurs.
[0039] refer to Figure 1 and Figure 2 , S20, in response to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute the first interrupt and trigger the preset tasklet scheduling;
[0040] It should be pointed out that tasklet is a common mechanism for implementing the lower half of the interrupt processing. First, you need to create a tasklet structure and write the corresponding tasklet processing function, then associate them through tasklet_init and other methods, and then use the tasklet_schedule function to schedule the tasklet at the right time (usually when the upper half of the interrupt is processed and returns), so that it enters the execution queue and waits for the system to execute its corresponding tasklet processing function to complete the task of the lower half of the interrupt. The responsibilities of the upper half of the interrupt are mainly focused on the emergency key operations mentioned above. Under normal circumstances, it will not execute the preset tasklet scheduling related operations. Tasklet scheduling is a link in the startup of the lower half of the interrupt processing mechanism. After the upper half of the interrupt has processed the relevant emergency affairs, the system (through the corresponding kernel code logic) calls tasklet_schedule and other functions to trigger tasklet scheduling, and then executes the tasklet processing function to start the task processing flow of the lower half of the interrupt.
[0041] It should be noted that the hardware device in the present application is a special device, and the architecture of this special device supports processing multiple interrupt requests arriving at the same time.
[0042] Among them, after the hardware device is interrupted, it sends an interrupt request to the interrupt controller of the CPU. The interrupt controller of the CPU suspends the currently executed program according to the interrupt request, finds the entry address of the corresponding interrupt handler according to the interrupt number corresponding to the interrupt request, and starts to execute the interrupt task processing from the entry address. Specifically, after the electronic device finds the entry address of the interrupt handler and executes the necessary upper half of the interrupt processing, it uses the tasklet mechanism to schedule the subsequent tasks to be executed.
[0043] Exemplarily, the interrupt handler quickly processes the interrupt in the upper half of the interrupt, and temporarily turns off other interrupt requests, turns on the interrupt request after completing the tasklet scheduling, and enters the lower half of the interrupt.
[0044] S30, based on tasklet scheduling, using the tasklet processing function to process the second interrupt, and after the second interrupt is executed, using the tasklet processing function to send an asynchronous notification signal to the user state program;
[0045] It should be noted that when an interrupt occurs, the interrupt processing is divided into the upper half (processing urgent and critical operations that must be completed immediately) and the lower half (processing relatively less urgent and slightly longer tasks). Tasklet is a way to implement the lower half processing. Electronic devices can create multiple tasklets and bind different tasklet processing functions to them. In these processing functions, corresponding asynchronous notification signals are generated according to the specific interrupt task logic and sent to the corresponding user-mode process, so as to achieve asynchronous communication and effective processing of subsequent tasks of the interrupt.
[0046] It should be noted that the tasklet processing function can be interrupted. After being interrupted, it can recover itself and continue running from the breakpoint.
[0047] It is worth mentioning that this step is an important invention point of the present invention. In the present application, the user-mode program does not need to query the status of the device. After receiving the asynchronous notification signal transmitted by the kernel layer, the user-mode program will automatically execute the capture function bound to the asynchronous notification signal to complete the interrupt processing of the user-mode program. The Linux system multi-interrupt rapid response asynchronous processing method provided by the embodiment of the present application is that after the interrupt is triggered, the kernel-mode program executes the interrupt processing and actively sends the asynchronous notification signal to the user-mode program. The user-mode program completes the processing after obtaining the asynchronous notification signal. The user-mode program does not need to wait for the arrival of the signal through any operation, thereby reducing the interrupt processing time and improving the system operation speed.
[0048] The present invention designs a fast response asynchronous notification method for multiple interrupts, so that the kernel returns immediately after sending a signal to the user, and the user does not need to query whether the kernel device is accessible, thereby avoiding the program occupying CPU resources for a long time, and the asynchronous operation improves the concurrent processing capability of the system; at the same time, the present invention puts the less urgent tasks in the interrupt processing into the lower half for execution, and allows the interrupt processing program to return as soon as possible, avoiding the interrupt time being too long and causing the interrupt to be lost.
[0049] Continue to refer Figure 3 In an embodiment of the present application, after step S30, the Linux system multi-interrupt rapid response asynchronous processing method further includes:
[0050] In response to the received asynchronous notification signal, the signal capture function is automatically executed by the user mode program to complete the subsequent interrupt legacy tasks.
[0051] That is to say, after receiving the signal sent by the kernel state, the user state program will automatically execute the signal capture function to complete the interrupt processing in the user state.
[0052] In summary, an embodiment of the present application proposes a Linux system multi-interrupt rapid response asynchronous processing method, which binds an interrupt processing function to each preset interrupt in the kernel state, wherein the interrupt includes an upper half and a lower half of an interrupt, and creates a tasklet and a tasklet processing function corresponding to the tasklet based on the lower half of the interrupt; in response to multiple interrupt requests arriving at the same time, the upper half of the interrupt is used to execute the first interrupt and trigger the preset tasklet scheduling; based on the tasklet scheduling, the tasklet processing function is used to process the second interrupt, and after the second interrupt is executed, the tasklet processing function is used to send an asynchronous notification signal to the user state program; in response to multiple interrupt requests arriving at the same time, the upper half of the interrupt is used to execute the first interrupt, thereby improving the concurrent processing capability of the system; the asynchronous notification signal is used to notify the user state program to execute the corresponding interrupt processing, thereby reducing the user state's active query of the kernel state program interrupt execution results, thereby ensuring that critical tasks can be responded to quickly and saving time.
[0053] It should be noted that the step division of the above methods is only for clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this application.
[0054] Based on the above embodiments, the present application also provides a Linux system multi-interrupt fast response asynchronous processing device, which is used to solve the technical problem that the key tasks caused by the user-mode program needing to actively query the execution status of multiple interrupt requests arriving at the same time cannot be responded to quickly, and the concurrent processing capability of the system is poor. Figure 4 The Linux system multi-interrupt rapid response asynchronous processing device 100 may include a binding module 1001, a scheduling module 1002 and an asynchronous notification module 1003, wherein the binding module 1001 is used to bind an interrupt processing function to each preset interrupt in the kernel state, the interrupt includes an interrupt upper half and an interrupt lower half, and a tasklet and a tasklet processing function corresponding to the tasklet are created based on the interrupt lower half; the scheduling module 1002 is used to respond to multiple interrupt requests that arrive at the same time, use the interrupt upper half to execute the first interrupt and trigger the preset tasklet scheduling; the asynchronous notification module 1003 is used to use the tasklet processing function to process the second interrupt based on the tasklet scheduling, and after the second interrupt is executed, use the tasklet processing function to send an asynchronous notification signal to the user state program.
[0055] In an embodiment of the present application, the Linux system multi-interrupt rapid response asynchronous processing device 100 may also include an initialization module 1004 and a signal allocation module initialization module 1005, wherein the initialization module 1004 is used to initialize the interrupt processing function; the signal allocation module 1005 is used to allocate an interrupt signal to each preset interrupt in the user state, and the interrupt signal is bound to a signal capture function.
[0056] In an embodiment of the present application, the Linux system multi-interrupt rapid response asynchronous processing device 100 may also include a signal capture module 1006, which is used to respond to the received asynchronous notification signal, use the user state program to automatically execute the signal capture function, and complete subsequent interrupt legacy tasks.
[0057] It is not difficult to find that this embodiment is a system embodiment corresponding to the above method embodiment, and this embodiment can be implemented in conjunction with the above method embodiment. The relevant technical details and technical effects mentioned in the above embodiments are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above embodiments.
[0058] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.
[0059] Another embodiment of the present application proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Linux system multi-interrupt rapid response asynchronous processing method in the above-mentioned method embodiments.
[0060] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripheral devices, voltage regulators and power management circuits together, which are all well known in the art, so this article will not describe them further. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on the wireless medium through the antenna, and further, the antenna also receives the data and transmits the data to the processor.
[0061] The processor is responsible for managing the bus and general processing, and may also provide various functions, including timing, peripheral interfacing, voltage regulation, power management, and other control functions. Magnetic storage may be used to store data used by the processor when performing operations.
[0062] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.
[0063] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM (Read-Only Memory), RAM (Random Access Memory), disk or optical disk and other media that can store program codes.
[0064] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. A Linux system multi-interrupt rapid response asynchronous processing method, characterized in that: include: Binding an interrupt processing function to each preset interrupt in the kernel state program, the interrupt comprising an interrupt upper half and an interrupt lower half, and creating a tasklet and a tasklet processing function corresponding to the tasklet based on the interrupt lower half; In response to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute a first interrupt and trigger a preset tasklet scheduling; Based on the tasklet scheduling, the tasklet processing function is used to process the second interrupt, and after the second interrupt is executed, the tasklet processing function is used to send the asynchronous notification signal to the user mode program.
2. The Linux system multi-interrupt rapid response asynchronous processing method according to claim 1, characterized in that: Before binding an interrupt processing function to each preset interrupt, the method includes: Initialize the interrupt processing function; An interrupt signal is allocated to each preset interrupt in the user state, and the interrupt signal is bound to a signal capture function.
3. The Linux system multi-interrupt rapid response asynchronous processing method according to claim 2, characterized in that: After sending the asynchronous notification signal to the user state program using the tasklet processing function, the method includes: The user state program is utilized to automatically execute the signal capture function to complete subsequent interrupt legacy tasks.
4. A Linux system multi-interrupt rapid response asynchronous processing device, characterized in that: include: A binding module, used to bind an interrupt processing function to each preset interrupt in the kernel state program, wherein the interrupt includes an interrupt upper half and an interrupt lower half, and to create a tasklet and a tasklet processing function corresponding to the tasklet based on the interrupt lower half; A scheduling module, for responding to multiple interrupt requests arriving at the same time, using the interrupt upper half to execute a first interrupt and trigger a preset tasklet scheduling; An asynchronous notification module is used to process the second interrupt based on the tasklet scheduling using the tasklet processing function, and after the second interrupt is executed, send the asynchronous notification signal to the user state program using the tasklet processing function.
5. The Linux system multi-interrupt rapid response asynchronous processing device according to claim 4, characterized in that: The Linux system multi-interrupt rapid response asynchronous processing device also includes: An initialization module, used for initializing the interrupt processing function; A signal distribution module is used to distribute an interrupt signal to each preset interrupt in the user state, and the interrupt signal is bound to a signal capture function.
6. The Linux system multi-interrupt rapid response asynchronous processing device according to claim 5, characterized in that: The Linux system multi-interrupt rapid response asynchronous processing device also includes: The signal capture module is used to respond to the received asynchronous notification signal and automatically execute the signal capture function using the user state program to complete subsequent interrupt legacy tasks.
7. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Linux system multi-interrupt rapid response asynchronous processing method as described in any one of claims 1 to 3.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the Linux system multi-interrupt rapid response asynchronous processing method according to any one of claims 1 to 3 can be implemented.