Multi-unit polling method and device, computer equipment and storage medium

By adopting a multi-unit polling method and interrupt mechanism in complex electronic systems, the problem of excessive burden on the central processing unit during the polling process is solved, and faster response speed and higher system performance and reliability are achieved.

CN119248449APending Publication Date: 2025-01-03SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411370588.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing polling methods lead to response time delays and performance losses in complex electronic systems, especially in embedded systems and multi-core processor architectures, where central processing units have difficulty allocating resources efficiently, resulting in overloading of the system.

Method used

Using the multi-unit polling method, parallel processing is performed by allocating to multiple independent polling units. Each polling unit independently performs state query according to preset parameters, and uses the interrupt mechanism to reduce the burden on the central processing unit, improve the response speed and system. performance.

Benefits of technology

It significantly reduces response time, improves the real-time and reliability of the system, optimizes resource utilization, and enhances the convenience of design and debugging of complex systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248449A_ABST
    Figure CN119248449A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-unit polling method and device, computer equipment and a storage medium. The method comprises the steps that each polling unit polls according to pre-configured parameters and reads target address data, and the parameters of the polling units comprise at least one of the following items: expected data, polling intervals and the maximum number of polling times; each polling unit compares the target address data with expected data to obtain a polling result; the polling unit records the polling result to a completion register and submits a report request to a total engine; in response to the received report request, the total engine adds the report request into a request queue; in response to the fact that the request queue is not empty and the central processing unit starts interrupt enabling, the total engine sends a polling completion notification to the central processing unit in an interrupt mode; and the central processing unit reads the polling result from the completion register according to the polling completion notification. By adopting the method, the polling burden of the central processing unit can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of polling technology, and in particular to a multi-unit polling method, apparatus, computer equipment and storage medium. Background Art

[0002] As the complexity of modern electronic systems continues to increase, especially in embedded systems and multi-core processor architectures, the demand for real-time monitoring and data acquisition has increased significantly. These systems need to process a large number of concurrent data streams and respond within milliseconds to meet the requirements of applications such as smart homes, autonomous driving, industrial control, etc. The polling method of the prior art usually relies on the central processing unit to query multiple data sources in sequence, which not only causes a significant delay in response time, but the polling of each data source may be blocked due to network delays or processing bottlenecks, thereby increasing the overall waiting time and making the processing inefficient. It will also increase performance loss and system energy consumption. The design of a single processing unit is difficult to effectively allocate resources when faced with a large number of concurrent requests, causing the system to be overloaded. Summary of the invention

[0003] Based on this, it is necessary to provide a multi-unit polling method, device, computer equipment and storage medium that can reduce the polling burden of the central processing unit and improve system performance and response speed in response to the above technical problems.

[0004] In one aspect, a multi-unit polling method is provided, the method comprising:

[0005] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0006] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0007] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0008] In response to receiving the report request, the general engine adds the report request to a request queue;

[0009] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0010] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0011] In one embodiment, the polling unit reads the target address data according to the parameters of the polling unit, including:

[0012] The polling unit reads a first target address according to a parameter of the polling unit,

[0013] Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address;

[0014] The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

[0015] In one embodiment, each polling unit compares the target address data with the expected data to obtain a polling result, including:

[0016] If the target address data is the same as the expected data, the polling result is recorded as successful.

[0017] If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number;

[0018] If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number.

[0019] If the polling number is greater than the maximum polling number, the polling result is recorded as failure;

[0020] Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

[0021] In one embodiment, the method further includes: the general engine sending a polling completion notification to the central processing unit via an interruption mode, including obtaining a polling unit identifier:

[0022] After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register;

[0023] The polling unit identifier that submits the report request is obtained according to the report register.

[0024] In one embodiment, the interruption mode includes a single interruption.

[0025] In response to each time a new report request is added to the request queue, the general engine triggers an interruption.

[0026] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption;

[0027] The interruption mode also includes batch interruption,

[0028] In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold,

[0029] If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt.

[0030] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption;

[0031] If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

[0032] In one embodiment, the request queue includes a main queue and a priority queue.

[0033] In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue,

[0034] The central processing unit preferentially processes requests in the priority queue;

[0035] In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue,

[0036] The central processing unit processes the requests in the main queue in the order in which they are placed.

[0037] In one embodiment, the method further includes: the central processing unit reading the polling result from the completion register, including:

[0038] The central processing unit locates the polling unit that has completed polling according to the polling unit identifier;

[0039] Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result;

[0040] The completion register information is automatically cleared after being read by the central processing unit;

[0041] The completion register information includes a polling unit identifier, a polling result, a polling number, whether the waiting timeout occurs, and target address data.

[0042] In another aspect, a multi-unit polling device is provided, the device comprising:

[0043] A polling module, configured for each polling unit to perform polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0044] A comparison module, used for each polling unit to compare the target address data with the expected data to obtain a polling result;

[0045] A reporting module, used for the polling unit to record the polling result into a completion register and submit a reporting request to the general engine;

[0046] An interrupt notification module, configured to, in response to receiving the report request, the general engine adds the report request to a request queue; in response to the request queue being not empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0047] A reading module is used for the central processing unit to read the polling result from the completion register according to the polling completion notification.

[0048] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0049] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0050] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0051] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0052] In response to receiving the report request, the general engine adds the report request to a request queue;

[0053] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0054] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0055] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0056] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0057] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0058] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0059] In response to receiving the report request, the general engine adds the report request to a request queue;

[0060] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0061] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0062] In the above multi-unit polling method, parallel processing is achieved by assigning polling tasks to multiple independent polling units. This design enables each polling unit to independently perform status queries according to preset parameters (such as expected data, polling interval, and maximum number of polling times), thereby improving the speed and efficiency of data acquisition. After obtaining the target address data, the polling unit compares it with the expected data, quickly obtains the polling result, and records it in the completion register. Once the polling result is generated, the polling unit immediately submits a report request to the general engine. After receiving these requests, the general engine promptly adds them to the request queue. When the request queue is not empty, the system notifies the central processing unit by turning on the interrupt enable, ensuring that the central processing unit can process these polling results immediately without having to wait before the polling task is completed, significantly reducing the response time. This mechanism effectively reduces the burden on the central processing unit during the polling process, allowing it to focus on other tasks, thereby improving the overall performance and stability of the system. Through the above method, the real-time performance of the system is improved, and it can respond to state changes more quickly, providing higher reliability and flexibility for applications. Through precise configuration and efficient workflow, this method not only optimizes resource utilization, but also facilitates the design and debugging of complex systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 is an application environment diagram of a multi-unit polling method in one embodiment;

[0064] Figure 2 is a schematic diagram of a flow chart of a multi-unit polling method in one embodiment;

[0065] Figure 3 A schematic diagram of a system architecture applicable to a multi-unit polling method in one embodiment;

[0066] Figure 4 A schematic diagram of a process for obtaining a polling result in one embodiment;

[0067] Figure 5 is a structural block diagram of a multi-unit polling device in one embodiment;

[0068] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] The multi-unit polling method provided by the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0071] In one embodiment, Figure 2 As shown, a multi-unit polling method is provided, which is suitable for Figure 3 The computer system shown in the figure comprises a general engine and a plurality of polling units, and the method is applied to Figure 3 The system in is taken as an example to illustrate, including the following steps:

[0072] Step S201: Each polling unit performs polling according to pre-configured parameters to read target address data.

[0073] The parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times.

[0074] The target address is the address to be polled, which is usually a memory address or a register address that stores the status data to be queried. The polling unit needs to ensure the legitimacy and accessibility of the target address to avoid errors and invalid access caused by invalid addresses.

[0075] Expected data refers to the expected value or range of the polled data. Expected data is used to specify the target of the polling operation, that is, the conditions that the query status results are expected to meet. Expected data can be of various types, including:

[0076] Determine the value, that is, expect the data to be equal to a specific value;

[0077] Greater than a certain value, that is, the expected data is greater than a specific value;

[0078] Less than a certain value, that is, the expected data is less than a specific value;

[0079] Range value, that is, the data is expected to be between a certain range.

[0080] Specifically, the register of a certain module stores a 32-bit status code, and the polling unit needs to know whether the target address data is 0x01 or between 0x10 and 0x20. The configured expected data can be 0x01 and the range [0x10, 0x20], respectively.

[0081] The polling interval refers to the time interval of the polling operation. This parameter is used to control the frequency of the polling operation to avoid excessive consumption of system resources due to frequent polling. The polling interval can be flexibly configured according to specific application scenarios and requirements. Generally speaking, the polling interval can range from a few milliseconds to a few seconds. In scenarios with high real-time requirements, the polling interval is usually set shorter (nanoseconds or microseconds) to ensure that the system can respond to state changes in a timely manner. In some scenarios with lower real-time requirements, the polling interval can be set longer to reduce the consumption of system resources.

[0082] The maximum polling times refers to the maximum number of polling times allowed by the polling unit during the polling task process. This parameter is used to prevent the polling task from falling into an infinite loop. After the polling times exceed the maximum polling times, if the task is still not completed, the polling unit considers the polling task failed and takes corresponding measures.

[0083] The polling unit increments the polling counter each time it performs a polling operation. If the polling counter reaches the maximum number of times, the polling unit stops polling and reports task failure to the central processing unit.

[0084] Step S203: Each polling unit compares the target address data with expected data to obtain a polling result.

[0085] The expected data helps the polling unit determine whether the polling result meets expectations. The data read from the target address is compared with the expected data to determine whether the task is completed or meets the preset conditions.

[0086] Step S205: the polling unit records the polling result into a completion register and submits a report request to the main engine.

[0087] Specifically, the polling result at least includes the polling success or polling failure status, the number of success or failure, and the timestamp record. The polling unit constructs a report request and packages the above polling results into a data structure.

[0088] The completed register data structure can be referred to:

[0089] [31:N] indicates the polling unit identifier;

[0090] [N-1:M] indicates the polling result;

[0091] [M-1:P] indicates the number of polling consumptions;

[0092] [P-1:Q] indicates whether the timeout has failed;

[0093] [Q-1:0] indicates the destination address.

[0094] Step S207: in response to receiving the report request, the general engine adds the report request to a request queue.

[0095] Specifically, before adding a request to the queue, the main engine performs a legality check on the request content to confirm that the request format is correct and the data is valid and non-duplicate.

[0096] Step S209, in response to the request queue being not empty and the central processing unit turning on the interrupt enable, the main engine sends a polling completion notification to the central processing unit via an interrupt.

[0097] Specifically, the overall engine includes an interrupt register, and the central processing unit can select whether to allow the overall engine to send an interrupt notification to the central processing unit by pre-configuring the interrupt register.

[0098] Step S211: According to the polling completion notification, the central processing unit reads the polling result.

[0099] In the above multi-unit polling method, parallel processing is achieved by assigning polling tasks to multiple independent polling units. This design enables each polling unit to independently perform status queries according to preset parameters (such as expected data, polling interval, and maximum number of polling times), thereby improving the speed and efficiency of data acquisition. After obtaining the target address data, the polling unit compares it with the expected data, quickly obtains the polling result, and records it in the completion register. Once the polling result is generated, the polling unit immediately submits a report request to the general engine. After receiving these requests, the general engine promptly adds them to the request queue. When the request queue is not empty, the central processing unit is notified by interruption, ensuring that the central processing unit can choose to process these polling results at a preset time without having to monitor the status of many devices all the time, significantly reducing the response time. This mechanism effectively reduces the burden on the central processing unit during the polling process, allowing it to focus on other tasks, thereby improving the overall performance and stability of the system. Through the above method, the real-time performance of the system is improved, and it can respond to state changes more quickly, providing higher reliability and flexibility for applications. Through precise configuration and efficient workflow, this method not only optimizes resource utilization, but also facilitates the design and debugging of complex systems.

[0100] In one embodiment, the polling unit reads the target address data according to the parameters of the polling unit, including:

[0101] The polling unit reads a first target address according to a parameter of the polling unit,

[0102] Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address;

[0103] The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

[0104] The polling unit is provided with a corresponding mask register, and the state bit of the first target address read is set to 1, and the bit position irrelevant to the state bit is set to 0, so as to filter the bits irrelevant to the state and obtain the second target address. The second target address and the value of the mask register are subjected to a bitwise AND operation, and the final result obtained is the target address data read by the polling unit.

[0105] Specifically, the second target address is 0x1a, the value of the mask register is 0x0f, and the two values ​​are different only in the lower 4 bits. The result after the bitwise AND operation is 0x0a, which is the target address data. The target address data is compared with the expected data to determine whether the polling result is successful, and the polling counter is incremented by 1.

[0106] In the above embodiment, the polling unit can accurately obtain the target address data by filtering the bits, thereby improving the accuracy and efficiency of data reading. At the same time, the combination of bitwise AND operation and the use of mask registers enhances the reliability of the system and reduces the risk of misreading.

[0107] In one embodiment, each polling unit compares the target address data with the expected data to obtain a polling result, including:

[0108] If the target address data is the same as the expected data, the polling result is recorded as successful.

[0109] If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number;

[0110] If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number.

[0111] If the polling number is greater than the maximum polling number, the polling result is recorded as failure;

[0112] Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

[0113] Specifically, Figure 4 As shown, if the polling result is the same as the expected result, the polling is successful. When the polling is successful, the polling unit jumps out of the polling task.

[0114] When polling fails, the polling unit assigns a specific error code to each error. Error types include polling timeout error, data mismatch error, resource unavailable error, etc., so that the central processor can identify different errors and make different treatments. For example, temporary errors can be retried, and permanent errors can be handled differently. Typing errors helps the central processing unit automatically trigger the corresponding response mechanism, thereby improving the overall response efficiency of the system.

[0115] In the above embodiment, by allowing multiple polling, the success probability of acquiring target data is improved, and the clear success and failure polling status simplifies subsequent error processing and retry decisions, thereby enhancing the reliability and monitorability of the system.

[0116] In one embodiment, the overall engine sends a polling completion notification to the central processing unit via an interrupt, including obtaining a polling unit identifier:

[0117] After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register;

[0118] The polling unit identifier that submits the report request is obtained according to the report register.

[0119] Among them, the polling unit identifier is a specific identifier for each polling unit, which is used to specify and configure a specific polling unit to perform a specific polling task during system initialization or task assignment. The polling unit identifier indicates that the polling unit is unique. When the system starts, specific polling tasks can be assigned to the polling unit with the corresponding identifier according to the priority and requirements of the task. High-priority tasks are assigned to polling units with higher performance, while low-priority tasks can be assigned to general polling units. The polling unit identifier can help the system accurately locate and read the status information of a specific polling unit during status reporting and result reporting.

[0120] The preset time refers to when the central processing unit receives the interrupt signal, or it may be a time in a preset period after the central processing unit receives the interrupt signal, which is not limited in the present application. The preset time period is obtained by presetting, for example, 5 seconds, 10 seconds.

[0121] In the above embodiment, by obtaining the polling unit identifier, accurately locating and processing the corresponding polling result, the polling burden of the central processing unit is reduced and the response speed of the system is improved.

[0122] In one embodiment, the interruption mode includes a single interruption,

[0123] In response to each time a new report request is added to the request queue, the general engine triggers an interruption.

[0124] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption;

[0125] The interruption mode also includes batch interruption,

[0126] In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold,

[0127] If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt.

[0128] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption;

[0129] If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

[0130] The preset time refers to when the central processing unit receives the polling completion notification, or it can be a time within a preset period of time after the central processing unit receives the polling completion notification, and this application does not impose any restrictions on this.

[0131] Specifically, when the interrupt mode is batch interrupt, assuming that the set threshold value of the number of pending report requests is 5, when the main engine determines that the current number of pending report requests in the request queue is 7, the main engine triggers an interrupt, and the central processing unit immediately stops executing the current task, and reads and processes the 7 pending report requests, and continues to return to the previously stopped task after processing is completed. It can also stop executing the current task 8 seconds after receiving the polling completion notification, and read and process the 7 pending report requests, and continue to return to the previously stopped task after processing is completed.

[0132] In the above embodiment, by introducing the mechanism of single interruption and batch interruption, the flexibility and efficiency of polling result processing are improved. In the single interruption mode, whenever a new report request is added to the request queue, the main engine can quickly trigger an interrupt to ensure that the central processing unit responds in time, thereby quickly processing the polling results. This mechanism reduces information delay, enables the system to respond to data changes more quickly, and improves the real-time nature of data monitoring.

[0133] In batch interrupt mode, when the number of pending report requests exceeds the set threshold, the system can merge and process multiple requests, reducing the performance overhead caused by frequent interrupts. This method effectively reduces the frequency of interrupt context switching and improves the overall efficiency of the system. By centrally processing multiple requests, the central processing unit can manage resources more efficiently and avoid wasting resources when processing low-frequency events.

[0134] In one embodiment, the request queue includes a main queue and a priority queue.

[0135] In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue,

[0136] The central processing unit preferentially processes requests in the priority queue;

[0137] In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue,

[0138] The central processing unit processes the requests in the main queue in the order in which they are placed.

[0139] Specifically, assume that there are three polling units in the system: polling units A, B, and C. Polling units A and B are marked as high priority, while polling unit C is of normal priority. When polling unit A makes a request, the main engine puts its request into the priority queue because it has a high priority identifier. Then, polling unit B also makes a request. Since it is also a high priority, the main engine puts its request into the priority queue again. When polling unit C makes a request, since it does not have a high priority identifier, the request is placed in the main queue. When processing requests, the central processing unit first checks the priority queue and processes the requests of polling units A and B in turn. Only after the priority queue is processed, the central processing unit will turn to the main queue to process the request of polling unit C.

[0140] The priority classification can include the following:

[0141] Task importance: Tasks are classified according to their functions or the degree of impact on the system. For example, safety-related tasks usually have a higher priority.

[0142] Time sensitivity: Some tasks need to be completed within a specific time, such as real-time data processing, and such tasks are usually given high priority.

[0143] Resource requirements: Tasks that use more resources may be given a lower priority to avoid blocking other parts of the system.

[0144] Dependencies: Some tasks depend on the completion of other tasks, in which case the predecessor tasks should be given higher priority.

[0145] In the above embodiment, by introducing the request management mechanism of the main queue and the priority queue, the flexibility and efficiency of the system in processing polling results are significantly improved. When the polling unit has a high priority identifier, the main engine can put its request into the priority queue in time to ensure that the central processing unit gives priority to these important requests. This priority management not only improves the response speed of key tasks, but also effectively reduces the potential risk of data delays and information loss. Relatively speaking, for requests that do not have a high priority identifier, they are placed in the main queue in turn, and the central processing unit responds one by one according to the processing order, ensuring the fairness and stability of the system as a whole. This design optimizes resource allocation, so that the system can meet the requirements of real-time and stability when processing complex scenarios, and improves the overall performance of data monitoring.

[0146] In one embodiment, the central processing unit reads the polling result from the completion register, including:

[0147] The central processing unit locates the polling unit that has completed polling according to the polling unit identifier;

[0148] Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result;

[0149] The completion register information is automatically cleared after being read by the central processing unit.

[0150] In the above embodiment, the completion register information of the polling unit is read by the central processing unit to obtain the polling result, thereby ensuring the timeliness and accuracy of the result. This process not only improves the system's response speed to the polling result, but also avoids repeated reading and data redundancy by automatically clearing the completion register information, thereby maintaining the neatness and efficiency of the system. This design enables the central processing unit to process the results of multiple polling units with higher efficiency, providing stronger support for real-time applications.

[0151] It should be understood that although Figure 2-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0152] In one embodiment, Figure 5 As shown, a multi-unit polling device is provided, including: a polling module, a comparison module, a reporting module, an interrupt notification module and a reading module, wherein:

[0153] A polling module 21, configured for each polling unit to perform polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0154] A comparison module 22, configured for each polling unit to compare the target address data with the expected data to obtain a polling result;

[0155] A reporting module 23, configured for the polling unit to record the polling result to a completion register and submit a reporting request to the general engine;

[0156] The interrupt notification module 24 is used for, in response to receiving the report request, the general engine adds the report request to the request queue; in response to the request queue being not empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit through an interrupt;

[0157] The reading module 25 is used for the central processing unit to read the polling result from the completion register according to the polling completion notification.

[0158] In one embodiment, the device polling module 21 is used for each polling unit to poll according to pre-configured parameters to read the target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0159] The polling unit reads the target address data according to the parameters of the polling unit, including:

[0160] The polling unit reads a first target address according to a parameter of the polling unit,

[0161] Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address;

[0162] The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

[0163] In one embodiment, the device comparison module 22 is used for each polling unit to compare the target address data with the expected data to obtain a polling result.

[0164] Compare the target address data with the expected data and record the polling results, including:

[0165] If the target address data is the same as the expected data, the polling result is recorded as successful.

[0166] If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number;

[0167] If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number.

[0168] If the polling number is greater than the maximum polling number, the polling result is recorded as failure;

[0169] Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

[0170] In one embodiment, the device interrupt notification module 24 is used for, in response to receiving the report request, the general engine adding the report request to the request queue; in response to the request queue being not empty and the central processing unit turning on the interrupt enable, the general engine sending a polling completion notification to the central processing unit through an interrupt;

[0171] The general engine sends a polling completion notification to the central processing unit via an interrupt, including obtaining a polling unit identifier:

[0172] After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register;

[0173] Acquire, according to the report register, an identifier of a polling unit that submits a report request;

[0174] The interruption mode includes a single interruption,

[0175] In response to each time a new report request is added to the request queue, the general engine triggers an interruption.

[0176] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption;

[0177] The interruption mode also includes batch interruption,

[0178] In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold,

[0179] If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt.

[0180] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption;

[0181] If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

[0182] The request queue includes a main queue and a priority queue.

[0183] In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue,

[0184] The central processing unit preferentially processes requests in the priority queue;

[0185] In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue,

[0186] The central processing unit processes the requests in the main queue in the order in which they are placed.

[0187] In one embodiment, the device reading module 25 is used for the central processing unit to read the polling result from the completion register according to the polling completion notification.

[0188] The central processing unit reads the polling result, including:

[0189] The central processing unit locates the polling unit that has completed polling according to the polling unit identifier;

[0190] Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result;

[0191] The completion register information is automatically cleared after being read by the central processing unit;

[0192] The completion register information includes a polling unit identifier, a polling result, a polling number, whether the waiting timeout occurs, and target address data.

[0193] For the specific definition of the multi-unit polling device, please refer to the definition of the multi-unit polling method above, which will not be repeated here. Each module in the above-mentioned multi-unit polling device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0194] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a multi-unit polling method is implemented.

[0195] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0196] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0197] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0198] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0199] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0200] In response to receiving the report request, the general engine adds the report request to a request queue;

[0201] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0202] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0203] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0204] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0205] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0206] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0207] In response to receiving the report request, the general engine adds the report request to a request queue;

[0208] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0209] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0210] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0211] The polling unit reads the target address data according to the parameters of the polling unit, including:

[0212] The polling unit reads a first target address according to a parameter of the polling unit,

[0213] Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address;

[0214] The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

[0215] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0216] Each polling unit compares the target address data with the expected data to obtain a polling result, including:

[0217] If the target address data is the same as the expected data, the polling result is recorded as successful.

[0218] If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number;

[0219] If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number.

[0220] If the polling number is greater than the maximum polling number, the polling result is recorded as failure;

[0221] Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

[0222] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0223] The general engine sends a polling completion notification to the central processing unit via an interrupt, including obtaining a polling unit identifier:

[0224] After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register;

[0225] Acquire, according to the report register, an identifier of a polling unit that submits a report request;

[0226] The central processing unit reads the polling result, including:

[0227] The central processing unit locates the polling unit that has completed polling according to the polling unit identifier;

[0228] Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result;

[0229] The completion register information is automatically cleared after being read by the central processing unit;

[0230] The completion register information includes a polling unit identifier, a polling result, a polling number, whether the waiting timeout occurs, and target address data.

[0231] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0232] The interruption mode includes a single interruption,

[0233] In response to each time a new report request is added to the request queue, the general engine triggers an interruption.

[0234] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption;

[0235] The interruption mode also includes batch interruption,

[0236] In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold,

[0237] If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt.

[0238] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption;

[0239] If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

[0240] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0241] The request queue includes a main queue and a priority queue.

[0242] In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue,

[0243] The central processing unit preferentially processes requests in the priority queue;

[0244] In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue,

[0245] The central processing unit processes the requests in the main queue in the order in which they are placed.

[0246] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0247] Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times;

[0248] Each polling unit compares the target address data with the expected data to obtain a polling result;

[0249] The polling unit records the polling result to a completion register and submits a report request to the general engine;

[0250] In response to receiving the report request, the general engine adds the report request to a request queue;

[0251] In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt;

[0252] The central processing unit reads the polling result from the completion register according to the polling completion notification.

[0253] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0254] The polling unit reads the target address data according to the parameters of the polling unit, including:

[0255] The polling unit reads a first target address according to a parameter of the polling unit,

[0256] Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address;

[0257] The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

[0258] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0259] Each polling unit compares the target address data with the expected data to obtain a polling result, including:

[0260] If the target address data is the same as the expected data, the polling result is recorded as successful.

[0261] If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number;

[0262] If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number.

[0263] If the polling number is greater than the maximum polling number, the polling result is recorded as failure;

[0264] Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

[0265] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0266] , the general engine sends a polling completion notification to the central processing unit through an interrupt, including obtaining a polling unit identifier:

[0267] After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register;

[0268] Acquire, according to the report register, an identifier of a polling unit that submits a report request;

[0269] The central processing unit reads the polling result, including:

[0270] The central processing unit locates the polling unit that has completed polling according to the polling unit identifier;

[0271] Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result;

[0272] The completion register information is automatically cleared after being read by the central processing unit;

[0273] The completion register information includes a polling unit identifier, a polling result, a polling number, whether the waiting timeout occurs, and target address data.

[0274] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0275] The interruption mode includes a single interruption,

[0276] In response to each time a new report request is added to the request queue, the general engine triggers an interruption.

[0277] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption;

[0278] The interruption mode also includes batch interruption,

[0279] In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold,

[0280] If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt.

[0281] The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption;

[0282] If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

[0283] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0284] The request queue includes a main queue and a priority queue.

[0285] In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue,

[0286] The central processing unit preferentially processes requests in the priority queue;

[0287] In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue,

[0288] The central processing unit processes the requests in the main queue in the order in which they are placed.

[0289] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0290] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0291] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A multi-unit polling method, characterized in that: Used in a computer system, the computer system comprising a general engine and a plurality of independent polling units, the method comprising: Each polling unit performs polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times; Each polling unit compares the target address data with the expected data to obtain a polling result; The polling unit records the polling result to a completion register and submits a report request to the general engine; In response to receiving the report request, the general engine adds the report request to a request queue; In response to the request queue being non-empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt; The central processing unit reads the polling result from the completion register according to the polling completion notification.

2. The method according to claim 1, characterized in that The polling unit reads the target address data according to the parameters of the polling unit, including: The polling unit reads a first target address according to a parameter of the polling unit, Set the first target address status bit position to 1, and the bit position irrelevant to the status bit to 0, so as to filter the bits irrelevant to the status, and obtain the second target address; The second target address is bitwise ANDed with the value of the corresponding mask register set in the polling unit to obtain the target address data.

3. The method according to claim 2, characterized in that Each polling unit compares the target address data with the expected data to obtain a polling result, including: If the target address data is the same as the expected data, the polling result is recorded as successful. If the target address data is different from the expected data, determining whether the polling number is greater than the maximum polling number; If the polling number is less than or equal to the maximum polling number, the polling is started again until the polling result is recorded as successful and / or the polling number reaches the maximum polling number. If the polling number is greater than the maximum polling number, the polling result is recorded as failure; Wherein, each time the polling unit completes a polling, the polling times are incremented; before entering the polling again, it is necessary to wait for a polling interval.

4. The method according to claim 1, characterized in that: The general engine sends a polling completion notification to the central processing unit via an interrupt, including obtaining a polling unit identifier: After receiving the interrupt signal, the central processing unit interrupts the current task execution at a preset time and reads the reporting register; The polling unit identifier that submits the report request is obtained according to the report register.

5. The method according to claim 4, characterized in that The interruption mode includes a single interruption, In response to each time a new report request is added to the request queue, the general engine triggers an interruption. The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes a report request in the request queue according to the interruption; The interruption mode also includes batch interruption, In response to multiple pending report requests being added to the request queue, the general engine determines whether the number of the current multiple pending report requests exceeds a set threshold, If the number of pending report requests exceeds a set threshold, the general engine triggers an interrupt. The central processing unit receives the polling completion notification, interrupts the current task execution at a preset time, and reads and / or processes two or more report requests in the request queue according to the interruption; If the number of the pending report requests does not exceed the set threshold, the overall engine continues to wait for new report requests.

6. The method according to claim 5, characterized in that The request queue includes a main queue and a priority queue. In response to the polling unit having a high priority polling unit identifier, the general engine places the polling unit request having the high priority polling unit identifier into the priority queue, The central processing unit preferentially processes requests in the priority queue; In response to the polling unit not having a high priority polling unit identifier, the general engine places the polling unit request without the high priority polling unit identifier into the main queue, The central processing unit processes the requests in the main queue in the order in which they are placed.

7. The method according to claim 4, characterized in that The central processing unit reads the polling result from the completion register, comprising: The central processing unit locates the polling unit that has completed polling according to the polling unit identifier; Reading the completion register information of the polling unit where the polling is completed, to obtain the polling result; The completion register information is automatically cleared after being read by the central processing unit; The completion register information includes a polling unit identifier, a polling result, a polling number, whether the waiting timeout occurs, and target address data.

8. A multi-unit polling device, characterized in that: The device comprises: A polling module, configured for each polling unit to perform polling according to pre-configured parameters to read target address data, wherein the parameters of the polling unit include at least one of the following: expected data, polling interval, and maximum number of polling times; A comparison module, used for each polling unit to compare the target address data with the expected data to obtain a polling result; A reporting module, used for the polling unit to record the polling result into a completion register and submit a reporting request to the general engine; An interrupt notification module, configured to, in response to receiving the report request, the general engine adds the report request to a request queue; in response to the request queue being not empty and the central processing unit turning on the interrupt enable, the general engine sends a polling completion notification to the central processing unit via an interrupt; A reading module is used for the central processing unit to read the polling result from the completion register according to the polling completion notification.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Proxy method for high-frequency polling of operating system, electronic device and storage medium

    WO2026199900A1