Task scheduling detection method and device, electronic equipment and storage medium
By using the task scheduling detection method to monitor the scheduling status of each periodic task in real time in the controller of the AUTOSAR architecture, the problem of not being able to determine whether other periodic tasks are scheduled normally in the prior art is solved, and the task delay scheduling is realized Real-time monitoring and abnormal reporting meet the needs of controller functional safety.
Patent Information
- Application Number
- CN202411235972.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-27
AI Technical Summary
In the prior art, the controller of the AUTOSAR architecture can only confirm whether the feeding task is scheduled normally, and cannot determine whether other periodic tasks are scheduled normally, resulting in the inability to monitor the task delay scheduling problem, and the external watchdog triggers reset. Unable to report abnormal information.
Provide a task scheduling detection method, by receiving task scheduling detection instructions, scheduling detection of each task in the task set based on time intervals, obtaining the scheduling execution status and detection times, determining the detection times threshold, and generating scheduling detection results based on the status , generate a task scheduling detection report and report the above exception.
Real-time monitoring of each periodic task of the controller is realized to ensure whether the task is scheduled normally, and to report abnormal information in a timely manner to meet the controller's functional safety needs.
Smart Images

Figure CN119201382A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task scheduling detection method, device, electronic device and storage medium. Background Art
[0002] The current AUTOSAR architecture controller usually uses an external watchdog to confirm whether the system is normal. However, when using an external watchdog, it can only confirm that the periodic task of feeding the watchdog is scheduled normally, but cannot determine whether other periodic tasks are scheduled normally. Therefore, it cannot determine whether other periodic tasks have delayed scheduling problems. Summary of the invention
[0003] In order to solve the problems of the prior art, the embodiments of the present application provide a task scheduling detection method, device, electronic device and storage medium to at least solve the problem that each periodic task cannot be monitored whether it is scheduled normally in the prior art. The technical solution is as follows:
[0004] According to a first aspect of an embodiment of the present application, a task scheduling detection method is provided, the method comprising:
[0005] Receive a task scheduling detection instruction, perform task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information of each task; the task scheduling detection information represents the scheduling execution state of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set;
[0006] For each task in the task set, based on the scheduling execution cycle of the task and the time interval, determine a detection number threshold of the task;
[0007] When the current detection times of the task is greater than or equal to the detection times threshold of the task, a task scheduling detection result of the task is generated based on the scheduling execution state of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
[0008] In an exemplary embodiment, the receiving the task scheduling detection instruction and performing task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction includes:
[0009] Receiving a task scheduling detection instruction triggered by a hardware timer based on a time interval of a type of interrupt instruction; the type of interrupt instruction includes a highest priority execution identifier;
[0010] The task scheduling detection instruction is executed according to the highest priority to perform task scheduling detection on each task in the task set.
[0011] In an exemplary embodiment, determining the detection number threshold of the task based on the scheduling execution cycle of the task and the time interval includes:
[0012] Obtaining a deviation tolerance of the task; the deviation tolerance of the task represents a percentage of an allowable scheduled execution deviation time of the task relative to a scheduled execution period of the task;
[0013] Obtaining a scheduling execution deviation tolerance time of the task based on the product of the scheduling execution period of the task and the deviation tolerance of the task;
[0014] Obtaining a target scheduling execution period of the task based on the sum of the scheduling execution period of the task and the scheduling execution deviation tolerance time of the task;
[0015] Based on the ratio between the target scheduling execution period of the task and the time interval, a detection number threshold of the task is obtained.
[0016] In an exemplary embodiment, generating the task scheduling detection result of the task based on the scheduling execution state of the task includes:
[0017] Determine whether the scheduling execution state of the task detected in the last task scheduling is the same as the scheduling execution state of the task detected in the previous task scheduling;
[0018] If they are the same, generating a task scheduling exception result for the task;
[0019] If they are not the same, a normal task scheduling result of the task is generated.
[0020] In an exemplary embodiment, after generating a normal result of task scheduling of the task, the method further includes:
[0021] Reset the current detection times in the task scheduling detection information of the task.
[0022] In an exemplary embodiment, after generating the task scheduling exception result of the task, the method further includes:
[0023] Generate a task scheduling detection report for the task based on the task scheduling detection information of the task and the task scheduling abnormality result of the task;
[0024] The task scheduling detection report is sent to a service node, so that the service node performs scheduling exception processing on the task based on the task scheduling detection report.
[0025] According to a second aspect of an embodiment of the present application, a task scheduling detection device is provided, the device comprising:
[0026] A detection module, used to receive a task scheduling detection instruction, perform task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information of each task; the task scheduling detection information represents the scheduling execution state of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set;
[0027] A detection times threshold determination module is used to determine, for each task in the task set, a detection times threshold of the task based on the scheduling execution cycle of the task and the time interval;
[0028] The result determination module is used to generate a task scheduling detection result of the task based on the scheduling execution status of the task when the current detection times of the task is greater than or equal to the detection times threshold of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
[0029] In an exemplary embodiment, the detection module includes:
[0030] A receiving module, used for receiving a task scheduling detection instruction triggered by a hardware timer based on a time interval of a type of interrupt instruction; the type of interrupt instruction includes a highest priority execution identifier;
[0031] The detection execution module is used to execute the task scheduling detection instruction according to the highest priority to perform task scheduling detection on each task in the task set.
[0032] In an exemplary embodiment, the module for determining the detection number threshold includes:
[0033] A deviation tolerance acquisition module, used to acquire the deviation tolerance of the task; the deviation tolerance of the task represents the percentage of the allowed scheduled execution deviation time of the task relative to the scheduled execution period of the task;
[0034] A scheduling execution deviation tolerance time calculation module, used to obtain the scheduling execution deviation tolerance time of the task based on the product between the scheduling execution period of the task and the deviation tolerance of the task;
[0035] A target scheduling execution period calculation module, used to obtain the target scheduling execution period of the task based on the sum of the scheduling execution period of the task and the scheduling execution deviation tolerance time of the task;
[0036] The detection times threshold calculation module is used to obtain the detection times threshold of the task based on the ratio between the target scheduling execution period of the task and the time interval.
[0037] In an exemplary embodiment, the determination result module includes:
[0038] A judgment module, used to judge whether the scheduling execution state of the task detected in the last task scheduling is the same as the scheduling execution state of the task detected in the previous task scheduling;
[0039] The result generation module is used to generate a task scheduling abnormal result for the task if they are the same; if they are not the same, generate a task scheduling normal result for the task.
[0040] In an exemplary embodiment, the apparatus further comprises:
[0041] The reset module is used to reset the current detection times in the task scheduling detection information of the task.
[0042] In an exemplary embodiment, the apparatus further comprises:
[0043] A task scheduling detection report generation module is used to generate a task scheduling detection report for the task based on the task scheduling detection information of the task and the task scheduling abnormality result of the task;
[0044] The task scheduling detection report sending module is used to send the task scheduling detection report to the service node, so that the service node performs scheduling exception processing on the task based on the task scheduling detection report.
[0045] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the task scheduling detection method of any one of the above aspects.
[0046] According to the fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded and executed by a processor to implement a task scheduling detection method as described in any of the above aspects.
[0047] According to a fifth aspect of the embodiments of the present disclosure, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the task scheduling detection method of any one of the above aspects.
[0048] The embodiment of the present application receives a task scheduling detection instruction, performs a task scheduling detection on each task in a task set based on the time interval of receiving the task scheduling detection instruction, and obtains task scheduling detection information of each task, wherein the task scheduling detection information represents the scheduling execution status of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set; for each task in the task set, based on the scheduling execution cycle and time interval of the task, a detection number threshold of the task is determined; when the current detection number of the task is greater than or equal to the detection number threshold of the task, a task scheduling detection result of the task is generated based on the scheduling execution status of the task; the task scheduling detection result represents whether the scheduling of the task is normal, thereby achieving the purpose of real-time monitoring of whether the scheduling of each periodic task of the controller is normal. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 It is a flowchart of a task scheduling detection method provided in an embodiment of the present application;
[0051] Figure 2 It is a structural block diagram of a task scheduling detection device provided in an embodiment of the present application;
[0052] Figure 3 It is a hardware structure block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0054] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0055] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0056] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0057] The embodiment of the present application relates to a task scheduling detection technology for a controller of automotive electronics of the AUTOSAR architecture. With the rapid development of automotive electronics technology, the iterative upgrade of the electronic and electrical architecture of automotive electronics, and the increasing intelligence of automotive electronics, the functions carried by the controller are more abundant. Correspondingly, the complexity of the controller system design is also increasing, and the system design is related to the realization of functional safety in the automotive field, so there are also higher requirements for the functional safety of the controller. The functional safety of the controller can be guaranteed by security mechanisms in four dimensions: memory, time, execution, and information exchange. The rich functions of the controller require that the controller has high real-time performance in issuing and processing data, instructions, etc. When periodic tasks are delayed or not scheduled for a long time, it will affect the controller's real-time processing and transmission of data, instructions, etc., which will affect the continuity of the data, have a negative impact on the business process or function of the controller, destroy the continuity and effectiveness of the controller's business, and then affect the stability, reliability and safety of the overall controller system. Therefore, it is very necessary and necessary to monitor whether the periodic tasks of the controller are delayed or not scheduled for a long time and whether this result can be reported. In the prior art, current controllers usually use an external watchdog to confirm whether the system is normal. However, the defect of this method is that when using an external watchdog, it can only confirm that the periodic task of feeding the dog is scheduled normally, and it cannot determine whether other periodic tasks are scheduled normally, so it cannot determine whether other periodic tasks have delayed scheduling problems; and when using an external watchdog, once the dog is fed too late, it will generally directly trigger a controller reset, and it cannot report this problem to the business layer, allowing the business layer to make decisions based on the current runtime environment, so it cannot fully meet the functional safety requirements of the controller.
[0058] In order to solve the problem in the prior art that it is impossible to monitor whether each periodic task in a controller is scheduled normally, an embodiment of the present application provides a task scheduling detection method. The method is based on receiving a task scheduling detection instruction, and performs a task scheduling detection on each task in a task set based on the time interval of receiving the task scheduling detection instruction, to obtain task scheduling detection information for each task, wherein the task scheduling detection information represents the scheduling execution status of the corresponding task and the current number of detections of the corresponding task, and for each task in the task set, a detection number threshold of the task is obtained based on the scheduling execution cycle and time interval of the task, and when the detection number threshold condition is met, a task scheduling detection result of the task is generated based on the scheduling execution status of the task.
[0059] The following is a specific embodiment of a task scheduling detection method provided by the present application. Figure 1, which shows a flow chart of a task scheduling detection method provided by an embodiment of the present application. It should be noted that this specification provides method operation steps as described in the embodiment or flow chart, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the system or product is executed in practice, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, a parallel processor or a multi-threaded processing environment). Specifically, the method may include the following steps:
[0060] Step S1: Receive a task scheduling detection instruction, perform task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information for each task; the task scheduling detection information represents the scheduling execution status of the corresponding task and the current detection times of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set.
[0061] Specifically, the scheduling execution status of a task refers to whether the scheduling execution of the task is completed, or refers to the number of scheduling executions of the task; the time interval is less than the shortest scheduling execution cycle in the task set, and the scheduling execution cycle of each task in the task set is an integer multiple of the time interval.
[0062] In some exemplary embodiments, receiving a task scheduling detection instruction, and performing a task scheduling detection on each task in the task set based on a time interval of receiving the task scheduling detection instruction includes:
[0063] Receiving a task scheduling detection instruction triggered by a hardware timer based on a time interval of a type of interrupt instruction; the type of interrupt instruction includes a highest priority execution flag;
[0064] The task scheduling detection instruction is executed according to the highest priority to perform task scheduling detection on each task in the task set.
[0065] By receiving the task scheduling detection instruction triggered by the hardware timer of each controller based on the time interval of a type of interrupt instruction, task scheduling detection is performed on each task in the task set. The hardware timer of each controller is used for precise timing, and a type of interrupt instruction includes the highest priority execution mark. During task scheduling detection, the interference of the controller's own operating system operation can be shielded, ensuring the real-time and efficiency of task scheduling detection. In addition, each controller has its own hardware timer, so that in a multi-core architecture, it can also ensure that the monitoring and reporting of each core are independent and non-interfering.
[0066] Step S2: for each task in the task set, based on the task scheduling execution cycle and time interval, determine the detection number threshold of the task;
[0067] Specifically, the task set refers to the task set of each controller, each task has its own scheduling execution cycle, and the time interval is unified in the same controller, that is, in the same controller, the frequency of task scheduling detection for each task in the task set is the same, and the time intervals between different controllers can be the same or different, depending on the specific needs.
[0068] In some exemplary embodiments, determining the detection number threshold of a task based on the scheduling execution cycle and time interval of the task includes:
[0069] Obtaining the deviation tolerance of the task; the deviation tolerance of the task represents the percentage of the allowed scheduling execution deviation time of the task relative to the scheduling execution period of the task;
[0070] Based on the product of the task's scheduling execution period and the task's deviation tolerance, the task's scheduling execution deviation tolerance time is obtained;
[0071] Based on the sum of the task's scheduling execution period and the task's scheduling execution deviation tolerance time, the target scheduling execution period of the task is obtained;
[0072] Based on the ratio between the target scheduling execution period and the time interval of the task, the detection number threshold of the task is obtained.
[0073] Specifically, the deviation tolerance of the task can be a negative value, a positive value, or zero; it is set according to actual needs. By obtaining the deviation tolerance of the task, based on the deviation tolerance of the task, the scheduling execution cycle and time interval of the task, the detection number threshold within the allowable error range is calculated. By increasing the deviation tolerance, the detection number threshold corresponding to each periodic task can be adjusted according to actual conditions, and the tolerance range of delayed scheduling of periodic tasks can be dynamically controlled, so as to better formulate security strategies and improve the flexibility of the detection method.
[0074] Step S3: When the current detection times of the task is greater than or equal to the detection times threshold of the task, a task scheduling detection result of the task is generated based on the scheduling execution state of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
[0075] In some exemplary embodiments, generating a task scheduling detection result of a task based on the scheduling execution state of the task includes:
[0076] Determine whether the scheduling execution status of the task detected by the last task scheduling is the same as the scheduling execution status of the task detected by the previous task scheduling;
[0077] If they are the same, an abnormal task scheduling result is generated for the task;
[0078] If they are different, the task scheduling of the generated task is normal.
[0079] Specifically, when the current detection times of the task is greater than or equal to the detection times threshold of the task, the scheduling execution status of the last task is compared with the previous task to determine whether the task scheduling result of the task is normal.
[0080] Exemplarily, when the last task's scheduling execution status is that the task scheduling execution is completed, and the previous task's scheduling execution status is that the task scheduling execution is not completed, a normal task scheduling result is generated for the task; when the last task's scheduling execution status is that the task scheduling execution is not completed, and the previous task's scheduling execution status is that the task scheduling execution is not completed, an abnormal task scheduling result is generated for the task.
[0081] The scheduling execution status of the task can also be the scheduling execution count of the task. For example, when the scheduling execution status of the last task is that the scheduling execution count of the task is 1, and the scheduling execution status of the previous task is that the scheduling execution count of the task is 0, then a normal task scheduling result is generated for the task. When the scheduling execution status of the last task is that the scheduling execution count of the task is 0, and the scheduling execution status of the previous task is that the scheduling execution count of the task is 0, then an abnormal task scheduling result is generated for the task.
[0082] After a normal or abnormal result of task scheduling is generated, the task scheduling detection of the task is not affected by the result and is always in a state of responding to the task detection instruction. For example, after an abnormal task scheduling result of the task is generated when the current number of detections of the task is equal to the detection number threshold of the task, the detection is still ongoing, that is, the detection number threshold of the task is exceeded, and the task scheduling detection continues, thereby continuously generating task scheduling detection results.
[0083] In some exemplary embodiments, after generating a normal result of task scheduling of the task, the method further includes:
[0084] Reset the current detection count in the task scheduling detection information of the task.
[0085] When the number of detections is equal to the detection number threshold and a normal result of task scheduling is generated for the task, it is necessary to reset the current number of detections in the task scheduling detection information of the task to 0 to provide conditions for re-circulating the detection number.
[0086] In some exemplary embodiments, after generating a task scheduling exception result of a task, the method further includes:
[0087] Generate a task scheduling detection report for the task based on the task scheduling detection information and the task scheduling abnormality result of the task;
[0088] The task scheduling detection report is sent to the service node, so that the service node performs scheduling exception processing on the task based on the task scheduling detection report.
[0089] Specifically, the task scheduling detection report of the task itself carries a task identifier, and the business node can identify the task through the task identifier and record the current vehicle information; the current vehicle information may include: current time, current power supply voltage, current vehicle speed and current wheel speed. The business node can also calculate the delay time of the task through the number of detections in the task scheduling detection report of the task, providing reliable data support for judging the severity of the abnormal results, and making corresponding responses according to the severity of its task delay scheduling, such as: function degradation, function recovery or shutdown.
[0090] In addition, after generating the normal task scheduling result of the task, a task scheduling detection report of the task may also be generated; and the corresponding task scheduling detection report is sent to the business node so that the business node obtains the normal scheduling detection result of the task.
[0091] The following introduces a specific embodiment of a task scheduling detection method provided by the present application. In a first controller of automotive electronics that complies with the AUTOSAR architecture, a task scheduling detection instruction triggered by a hardware timer based on a time interval of a class of interrupt instructions is first received; the class of interrupt instructions includes a highest priority execution identifier; the task scheduling detection instruction is executed according to the highest priority to perform task scheduling detection on each task in a task set, and task scheduling detection information of each task is obtained; the task scheduling detection information represents the scheduling execution status of the corresponding task and the current number of detections of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval in the first controller is 1ms, and exemplarily, the scheduling execution cycle of the first task in the first controller is 10ms, and the scheduling execution cycle of the second task in the first controller is 100ms.
[0092] Get the deviation tolerance of the first task and the second task to be 10%;
[0093] Based on the product of the scheduling execution period of the first task (10 ms) and the deviation tolerance of the first task (10%), the scheduling execution deviation tolerance time of the first task is obtained to be 1 ms;
[0094] Based on the sum of the scheduling execution period of the first task (10ms) and the scheduling execution deviation tolerance time of the first task (1ms), the target scheduling execution period of the task is obtained to be 11ms;
[0095] Based on the ratio between the target scheduling execution period of the task, 11 ms, and the time interval, 1 ms, the detection number threshold of the task is 11. The detection number threshold of the second task is 110 using the same calculation method.
[0096] Taking the first task as an example, when the current number of detections is equal to the detection number threshold of 11, compare whether the scheduling execution status of the first task at the 11th detection is the same as the scheduling execution status of the first task at the 10th detection. For example, if the scheduling execution number of the first task at the 11th detection is 1 and the scheduling execution number of the first task at the 10th detection is 0, then a normal task scheduling result for the first task is generated, and the current number of detections in the task scheduling detection information of the first task is reset to 0 so that the current number of detections is re-circulated. Based on the task scheduling detection information of the first task and the normal task scheduling result of the first task, a task scheduling detection report for the first task is generated and sent to the business node, so that the business node obtains the task scheduling detection result of the first task.
[0097] Exemplarily, if the number of scheduled executions of the first task is 0 at the 11th detection and the number of scheduled executions of the first task is 0 at the 10th detection, a task scheduling exception result of the first task is generated, and a task scheduling detection report of the first task is generated based on the task scheduling detection information of the first task and the task scheduling exception result of the first task; the task scheduling detection report of the first task is sent to the business node, so that the business node performs scheduling exception processing on the first task based on the task scheduling detection report, and the task scheduling detection of the first task is performed as usual. When the number of scheduled executions of the first task is 0 at the 12th detection and the number of scheduled executions of the first task is 0 at the 11th detection, the task scheduling exception result of the first task continues to be generated, and based on the task scheduling detection information of the first task and the task scheduling exception result of the first task The service scheduling exception result is generated, and a task scheduling detection report for the first task is generated; the task scheduling detection report for the first task is sent to the business node, so that the business node performs scheduling exception processing on the first task based on the task scheduling detection report, and the task scheduling detection of the first task is performed as usual. If the scheduling execution number of the first task is 1 at the 13th detection, and the scheduling execution number of the first task is 0 at the 12th detection, then a normal task scheduling result for the first task is generated, and the current detection number 13 is reset to 0, so that the current detection number of the task scheduling detection of the first task is re-circulated, and a task scheduling detection report for the first task is generated based on the task scheduling detection information of the first task and the normal task scheduling result of the first task; the task scheduling detection report of the first task is sent to the business node.
[0098] It can be seen from the above technical scheme of the embodiment of the present application that the embodiment of the present application receives a task scheduling detection instruction, and performs a task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, to obtain task scheduling detection information of each task, and the task scheduling detection information represents the scheduling execution status of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set; for each task in the task set, based on the scheduling execution cycle and time interval of the task, a detection number threshold of the task is determined; when the current detection number of the task is greater than or equal to the detection number threshold of the task, a task scheduling detection result of the task is generated based on the scheduling execution status of the task; the task scheduling detection result represents whether the scheduling of the task is normal, thereby achieving the purpose of real-time monitoring of whether the scheduling of each periodic task of the controller is normal.
[0099] The present application also provides a task scheduling detection device, Figure 2 It is a structural block diagram of a task scheduling detection device, such as Figure 2 As shown, the task scheduling detection device 200 includes:
[0100] The detection module 210 is used to receive a task scheduling detection instruction, perform a task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information of each task; the task scheduling detection information represents the scheduling execution state of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set;
[0101] A detection times threshold determination module 220 is used to determine, for each task in the task set, a detection times threshold of the task based on the scheduling execution cycle and time interval of the task;
[0102] The result determination module 230 is used to generate a task scheduling detection result of the task based on the scheduling execution state of the task when the current detection times of the task is greater than or equal to the detection times threshold of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
[0103] In an exemplary embodiment, the detection module 210 includes:
[0104] A receiving module, used for receiving a task scheduling detection instruction triggered by a hardware timer based on a time interval of a type of interrupt instruction; the type of interrupt instruction includes a highest priority execution flag;
[0105] The detection execution module is used to execute the task scheduling detection instruction according to the highest priority to perform task scheduling detection on each task in the task set.
[0106] In an exemplary embodiment, the detection number threshold determination module 210 includes:
[0107] The deviation tolerance acquisition module is used to acquire the deviation tolerance of the task; the deviation tolerance of the task represents the percentage of the allowed scheduling execution deviation time of the task relative to the scheduling execution period of the task;
[0108] The scheduling execution deviation tolerance time calculation module is used to obtain the scheduling execution deviation tolerance time of the task based on the product between the scheduling execution period of the task and the deviation tolerance of the task;
[0109] A target scheduling execution cycle calculation module is used to obtain a target scheduling execution cycle of a task based on the sum of the scheduling execution cycle of the task and the scheduling execution deviation tolerance time of the task;
[0110] The detection times threshold calculation module is used to obtain the detection times threshold of the task based on the ratio between the target scheduling execution period of the task and the time interval.
[0111] In an exemplary embodiment, the determination result module 230 includes:
[0112] A judgment module, used to judge whether the scheduling execution state of the task detected in the last task scheduling is the same as the scheduling execution state of the task detected in the previous task scheduling;
[0113] The result generation module is used to generate an abnormal task scheduling result of the task if they are the same; if they are not the same, generate a normal task scheduling result of the task.
[0114] In an exemplary embodiment, the apparatus 200 further includes:
[0115] The reset module is used to reset the current detection times in the task scheduling detection information of the task.
[0116] In an exemplary embodiment, the apparatus 200 further includes:
[0117] A task scheduling detection report generation module is used to generate a task scheduling detection report for a task based on the task scheduling detection information of the task and the task scheduling abnormality result of the task;
[0118] The task scheduling detection report sending module is used to send the task scheduling detection report to the business node, so that the business node performs scheduling exception processing on the task based on the task scheduling detection report.
[0119] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0120] An embodiment of the present application also provides an electronic device, including a processor; a memory for storing instructions executable by the processor; wherein, when the processor is configured to execute the instructions stored in the memory, the task scheduling detection method provided in any of the above-mentioned embodiments is implemented.
[0121] The electronic device may be a terminal, a server or a similar computing device. For example, the electronic device is a terminal. Figure 3 is a block diagram of an electronic device running a task scheduling detection method according to an exemplary embodiment, specifically:
[0122] The terminal may include components such as an RF (Radio Frequency) circuit 310, a memory 320 including one or more computer-readable storage media, an input unit 330, a display unit 340, a sensor 350, an audio circuit 360, a WiFi (wireless fidelity) module 370, a processor 380 including one or more processing cores, and a power supply 390. Those skilled in the art will appreciate that Figure 3 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0123] The RF circuit 310 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 380 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 310 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a user identity module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. In addition, the RF circuit 310 can also communicate with the network and other terminals through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.
[0124] The memory 320 can be used to store software programs and modules. The processor 380 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 320 may also include a memory controller to provide the processor 380 and the input unit 330 with access to the memory 320.
[0125] The input unit 330 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 330 may include a touch-sensitive surface 331 and other input devices 332. The touch-sensitive surface 331, also known as a touch display screen or touchpad, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch-sensitive surface 331), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface 331 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 380, and can receive and execute commands sent by the processor 380. In addition, the touch-sensitive surface 331 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 331, the input unit 330 may further include other input devices 332. Specifically, other input devices 332 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
[0126] The display unit 340 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 340 may include a display panel 341. Optionally, the display panel 341 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 331 may cover the display panel 341. When the touch-sensitive surface 331 detects a touch operation on or near it, it is transmitted to the processor 380 to determine the type of touch event, and then the processor 380 provides corresponding visual output on the display panel 341 according to the type of touch event. Among them, the touch-sensitive surface 331 and the display panel 341 can be two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface 331 and the display panel 341 can also be integrated to realize input and output functions.
[0127] The terminal may also include at least one sensor 350, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 341 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 341 and / or the backlight when the terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the terminal posture (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the terminal, they will not be repeated here.
[0128] The audio circuit 360, the speaker 361, and the microphone 362 can provide an audio interface between the user and the terminal. The audio circuit 360 can transmit the received audio data to the speaker 361 after converting the electrical signal, which is converted into a sound signal for output by the speaker 361; on the other hand, the microphone 362 converts the collected sound signal into an electrical signal, which is received by the audio circuit 360 and converted into audio data, and then the audio data is output to the processor 380 for processing, and then sent to another terminal through the RF circuit 310, or the audio data is output to the memory 320 for further processing. The audio circuit 360 may also include an earplug jack to provide communication between an external headset and the terminal.
[0129] WiFi is a short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 370, which provides users with wireless broadband Internet access. Figure 3 A WiFi module 370 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as needed without changing the essence of the invention.
[0130] The processor 380 is the control center of the terminal, and uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal and processes data by running or executing software programs and / or modules stored in the memory 320, and calling data stored in the memory 320. Optionally, the processor 380 may include one or more processing cores; preferably, the processor 380 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 380.
[0131] The terminal also includes a power supply 390 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 380 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 390 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0132] An embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement any one of the task scheduling detection methods provided in the above method embodiments.
[0133] Optionally, in an embodiment of the present application, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0134] An embodiment of the present application also provides a computer program, which, when executed by a processor, implements any one of the task scheduling detection methods provided in the above method embodiments.
[0135] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0136] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0137] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0138] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A task scheduling detection method, characterized in that: The method comprises: Receive a task scheduling detection instruction, perform task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information of each task; the task scheduling detection information represents the scheduling execution state of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set; For each task in the task set, based on the scheduling execution cycle of the task and the time interval, determine a detection number threshold of the task; When the current detection times of the task is greater than or equal to the detection times threshold of the task, a task scheduling detection result of the task is generated based on the scheduling execution state of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
2. A task scheduling detection method according to claim 1, characterized in that: The receiving of the task scheduling detection instruction and performing task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction includes: Receiving a task scheduling detection instruction triggered by a hardware timer based on a time interval of a type of interrupt instruction; the type of interrupt instruction includes a highest priority execution identifier; The task scheduling detection instruction is executed according to the highest priority to perform task scheduling detection on each task in the task set.
3. A task scheduling detection method according to claim 1, characterized in that: The determining of the detection number threshold of the task based on the scheduling execution cycle of the task and the time interval includes: Obtaining a deviation tolerance of the task; the deviation tolerance of the task represents a percentage of an allowable scheduled execution deviation time of the task relative to a scheduled execution period of the task; Obtaining a scheduling execution deviation tolerance time of the task based on the product of the scheduling execution period of the task and the deviation tolerance of the task; Obtaining a target scheduling execution period of the task based on the sum of the scheduling execution period of the task and the scheduling execution deviation tolerance time of the task; Based on the ratio between the target scheduling execution period of the task and the time interval, a detection number threshold of the task is obtained.
4. A task scheduling detection method according to claim 1, characterized in that: The generating of the task scheduling detection result of the task based on the scheduling execution state of the task includes: Determine whether the scheduling execution state of the task detected in the last task scheduling is the same as the scheduling execution state of the task detected in the previous task scheduling; If they are the same, generating a task scheduling exception result for the task; If they are not the same, a normal task scheduling result of the task is generated.
5. A task scheduling detection method according to claim 4, characterized in that: After generating a normal result of task scheduling of the task, the method further includes: Reset the current detection times in the task scheduling detection information of the task.
6. A task scheduling detection method according to claim 4, characterized in that: After generating the task scheduling exception result of the task, the method further includes: Generate a task scheduling detection report for the task based on the task scheduling detection information of the task and the task scheduling abnormality result of the task; The task scheduling detection report is sent to a service node, so that the service node performs scheduling exception processing on the task based on the task scheduling detection report.
7. A task scheduling detection device, characterized in that: The device comprises: A detection module, used to receive a task scheduling detection instruction, perform task scheduling detection on each task in the task set based on the time interval of receiving the task scheduling detection instruction, and obtain task scheduling detection information of each task; the task scheduling detection information represents the scheduling execution state of the corresponding task and the current detection number of the corresponding task; each task in the task set is scheduled according to the corresponding scheduling execution cycle; the time interval is less than the shortest scheduling execution cycle in the task set; A detection times threshold determination module is used to determine, for each task in the task set, a detection times threshold of the task based on the scheduling execution cycle of the task and the time interval; The result determination module is used to generate a task scheduling detection result of the task based on the scheduling execution status of the task when the current detection times of the task is greater than or equal to the detection times threshold of the task; the task scheduling detection result indicates whether the scheduling of the task is normal.
8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement a task scheduling detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by a processor to implement a task scheduling detection method as described in any one of claims 1 to 6.
10. A computer program, characterized in that When the computer program is executed by a processor, a task scheduling detection method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Task execution method, system and device, storage medium and program product
CN120295798A