Autosar-based task monitoring method and device, equipment, storage medium and product

By monitoring the execution status of Autosar system tasks in real time, backing up data, exception counting and reset mechanisms, the system's stability and security problems in abnormal situations are solved, and data consistency and rapid recovery are achieved.

CN118981405APending Publication Date: 2024-11-19DONGFENG MOTOR GRP
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410990426.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-19

Smart Images

  • Figure CN118981405A_ABST
    Figure CN118981405A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of vehicle-mounted controllers, in particular to an Autosar-based task monitoring method and device, equipment, a storage medium and a product. In the method, if the execution logic state of a monitoring task is normal, task data is used as backup data, and task time is recorded; if the execution logic state of the monitoring task is abnormal, carrying out abnormity counting; if the first backup data and the second backup data in the backup data are inconsistent, performing exception counting; and if the task time exceeds a preset time threshold value or the value of the abnormal count exceeds a preset abnormal count threshold value, resetting the monitoring task. According to the method, when a task runs normally, data are backed up in time, and task time is recorded; and when an exception occurs, exception counting is performed and a reset measure is taken, so that the influence of abnormal data on the system is reduced, the data consistency is guaranteed, the system is recovered in time, and the stability and safety of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of vehicle-mounted controllers, and in particular to an AUTOSAR-based task monitoring method, device, equipment, storage medium and product. Background Art

[0002] In modern automotive electronic control systems, the on-board controller usually uses Autosar

[0003] (AUTomotiveOpenSystemARchitecture) operating system. The AUTOSAR architecture supports the simultaneous running of multiple tasks through modular design and standardized interfaces, and each task can contain multiple software components. These tasks and components implement data exchange through interfaces. However, due to the complexity of the system, a task or component may have anomalies during operation, resulting in the generation of abnormal data. If these abnormal data are used by other tasks or components of the system, it may trigger a series of chain reactions, leading to operational errors of the entire system, and even causing the system to crash and reset. In the existing technical solutions, there is a lack of effective anomaly detection and processing mechanisms, as well as data consistency protection measures, which makes it difficult for the system to identify and handle anomalies in a timely manner when they occur, thereby affecting the stability and security of the system.

[0004] Therefore, how to improve the stability and security of the Autosar system has become a technical problem that needs to be solved urgently.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The main purpose of this application is to provide a task monitoring method, device, equipment, storage medium and product based on AUTOSAR, aiming to solve the technical problem of how to improve the stability and security of the AUTOSAR system.

[0007] To achieve the above object, the present application provides a task monitoring method based on Autosar, the method comprising the following steps:

[0008] If the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded;

[0009] If the execution logic state of the monitoring task is abnormal, an abnormality count is performed;

[0010] If the first backup data and the second backup data in the backup data are inconsistent, performing an exception counting;

[0011] If the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, the monitoring task is reset.

[0012] In one embodiment, before the step of using the task data as backup data and recording the task time if the execution logic state of the monitoring task is normal, the method further includes:

[0013] Obtain execution logic monitoring data at the task entry, before the core component runs, after the core component runs, and at the task exit respectively;

[0014] Based on the execution logic monitoring data, it is determined whether an abnormality occurs in the execution logic state of the monitoring task.

[0015] In one embodiment, the step of determining whether an abnormality occurs in the execution logic state of the monitoring task based on the execution logic monitoring data includes:

[0016] Based on the execution logic monitoring data, determining whether the monitoring task has reached the end node;

[0017] If not, determining that the execution logic state of the monitoring task is abnormal;

[0018] If so, based on the execution logic monitoring data, determining whether the execution logic sequence of the monitoring task complies with a preset logic execution sequence rule;

[0019] If so, determining that the execution logic state of the monitoring task is normal;

[0020] If not, it is determined that the execution logic state of the monitoring task is abnormal.

[0021] In one embodiment, if the first backup data and the second backup data in the backup data are inconsistent, the step of performing anomaly counting includes:

[0022] Retrieve the first backup data and the second backup data from the first backup area and the second backup area respectively;

[0023] Based on a preset verification algorithm, comparing the first backup data with the second backup data;

[0024] Determining whether the first backup data is consistent with the second backup data based on the comparison result;

[0025] If not, the corresponding abnormal event is recorded and the value of the preset abnormal counter is increased.

[0026] In one embodiment, if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, the step of resetting the monitoring task includes:

[0027] Acquire the task time and the value of the abnormality count in real time;

[0028] If the task time exceeds the preset time threshold or the abnormality count value exceeds the preset abnormality count threshold, stop the monitoring task;

[0029] The monitoring task is reloaded at the task entry, and the value of the preset abnormality counter is cleared.

[0030] In one embodiment, after the step of resetting the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, the method further includes:

[0031] Initialize each data segment of the monitoring task, and adjust the monitoring parameters based on the abnormal event data.

[0032] In addition, to achieve the above purpose, the present application also proposes a task monitoring device based on Autosar, and the task monitoring device based on Autosar includes:

[0033] The logic normal module is used to use the task data as backup data and record the task time if the execution logic state of the monitoring task is normal;

[0034] The logic exception module is used to count the exceptions if the execution logic state of the monitoring task is abnormal;

[0035] A backup exception module, used for performing an exception count if the first backup data and the second backup data in the backup data are inconsistent;

[0036] The reset module is used to reset the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold.

[0037] In addition, to achieve the above-mentioned objectives, the present application also proposes an Autosar-based task monitoring device, the device comprising: a memory, a processor, and an Autosar-based task monitoring program stored in the memory and executable on the processor, the Autosar-based task monitoring program being configured to implement the steps of the Autosar-based task monitoring method as described above.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, on which a task monitoring program based on Autosar is stored. When the task monitoring program based on Autosar is executed by a processor, the steps of the task monitoring method based on Autosar as described above are implemented.

[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the task monitoring method based on Autosar as described above.

[0040] In this application, if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data in the backup data is inconsistent with the second backup data, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset. This application ensures the validity and consistency of task data by monitoring the execution logic state of the task in real time. When the task is running normally, the data is backed up in time and the task time is recorded; when an abnormality occurs, an abnormality count is performed and reset measures are taken to quickly restore the system state. Through these measures, the impact of abnormal data on the system is effectively reduced, data consistency is guaranteed, and the system is restored in time, which ultimately improves the stability and security of the Autosar system. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a flow chart of the first embodiment of the task monitoring method based on Autosar of the present application;

[0042] Figure 2 This is a schematic diagram of a sub-flow in the second embodiment of the task monitoring method based on Autosar of this application;

[0043] Figure 3 This is a schematic diagram of a sub-flow in the third embodiment of the task monitoring method based on Autosar of this application;

[0044] Figure 4 This is a schematic diagram of the module structure of a task monitoring device based on Autosar in an embodiment of the present application;

[0045] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the Autosar-based task monitoring method in the embodiment of the present application.

[0046] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] 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.

[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0049] It should be noted that in modern automotive electronic control systems, on-board controllers usually use the Autosar (AUTomotive Open System ARchitecture) operating system. The Autosar architecture supports multiple tasks running simultaneously through modular design and standardized interfaces, and each task can contain multiple software components. Data interaction is achieved between these tasks and components through interfaces. However, due to the complexity of the system, a task or component may have an exception during operation, resulting in the generation of abnormal data. If these abnormal data are used by other tasks or components of the system, it may trigger a series of chain reactions, resulting in operational errors of the entire system, and even causing the system to crash and reset. In the existing technical solutions, there is a lack of effective anomaly detection and processing mechanisms, as well as data consistency protection measures, which makes it difficult for the system to identify and process anomalies in a timely manner when they occur, thereby affecting the stability and security of the system. Therefore, how to improve the stability and security of the Autosar system has become a technical problem that needs to be solved urgently.

[0050] The main solution of this application is: if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data and the second backup data in the backup data are inconsistent, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset.

[0051] This application ensures the validity and consistency of task data by monitoring the execution logic state of the task in real time. When the task is running normally, the data is backed up in time and the task time is recorded; when an abnormality occurs, the abnormality is counted and reset measures are taken to quickly restore the system state. Through these measures, the impact of abnormal data on the system is effectively reduced, data consistency is guaranteed, and the system is restored in time, which ultimately improves the stability and security of the Autosar system.

[0052] It should be noted that the execution subject of the method of this embodiment can be a computing service device with data processing, network communication and program running functions, or it can be the above-mentioned Autosar-based task monitoring device with the same or similar functions. This embodiment and the following embodiments will be described by taking the Autosar-based task monitoring device as an example.

[0053] Based on this, the first embodiment of the task monitoring method based on Autosar of this application is proposed, please refer to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the task monitoring method based on Autosar in this application.

[0054] In this embodiment, the task monitoring method based on Autosar includes the following steps:

[0055] S1: If the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded;

[0056] It should be noted that task data refers to all key data and status information generated during the task execution, including intermediate calculation results, state variable values, and timestamps. Backup data refers to the data copies generated during the task execution, which are stored in the designated backup area to ensure data security and redundancy. Task time refers to the time information from the start of task execution to the current moment, which is used to record the execution duration of the task.

[0057] Specifically, first obtain the execution data of the current task, including the key data and status information generated during the execution of the task. These data may include the intermediate calculation results of the task, the value of the state variable, and the timestamp of the task execution. After obtaining the task execution data, store the data in the designated backup area. Usually, the backup area is divided into two independent storage areas (such as backup area A and backup area B) to ensure data redundancy and security.

[0058] Furthermore, the execution time of the current task is recorded, including the timestamp of the task start and the current timestamp. The recorded task execution time is used for subsequent time threshold judgment and monitoring. While storing task data, the metadata related to the backup data is also updated, such as the data generation time, the backup data version number, and the source task ID of the backup data. These metadata are used to identify and manage backup data to ensure data consistency and traceability.

[0059] By backing up task data and recording task execution time in a timely manner when the task execution logic state is normal, it can ensure that the latest task data copy can still be provided in abnormal situations, which helps to quickly restore task operation. At the same time, recording the task execution time facilitates monitoring the running status of the task and responding to timeout processing. This mechanism effectively improves the data security and operation reliability of the system, and ultimately significantly improves the stability and security of the Autosar system.

[0060] S2: If the execution logic state of the monitoring task is abnormal, count the abnormalities;

[0061] It should be noted that the monitoring task refers to the task being monitored in the system, and its execution status needs to be monitored in real time to ensure its normal operation. The execution logic state refers to the sequence and correctness of the operation steps and status of the task during its operation. The exception count refers to the number of abnormal events recorded during the execution of the task, which is used to determine whether the task frequently has abnormalities.

[0062] Specifically, the execution logic state of the task is detected in real time through a predetermined monitoring mechanism. When the execution logic of the task deviates from the predetermined correct logic sequence, the system determines that the task state is abnormal. Once the execution logic state of the task is detected to be abnormal, the system immediately records the abnormal event. The recorded content includes the time when the abnormality occurred, the type of abnormality, the current state of the task, etc.

[0063] Furthermore, the system maintains an exception counter, which increases by 1 whenever an abnormal event is detected. The counter is used to track and accumulate the number of abnormal events, helping the system determine whether the task frequently has abnormalities. The recorded abnormal events and the updated abnormal counter value are stored in the task log. The log can be used for subsequent abnormality analysis and system optimization.

[0064] By detecting the execution logic state of tasks in real time and counting exceptions, it is possible to identify and record abnormalities in tasks in a timely manner. Maintenance of the exception counter helps evaluate the stability of tasks and helps the system take appropriate corrective measures when exceptions are frequent. This step effectively improves the anomaly detection and response capabilities, helps prevent serious failures, and thus improves the operational reliability of the system.

[0065] S3: If the first backup data and the second backup data in the backup data are inconsistent, performing an exception counting;

[0066] It should be noted that the first backup data is a copy of the task data stored in the first backup area, and the second backup data is a copy of the task data stored in another backup area.

[0067] Specifically, the first backup data and the second backup data are read from the first backup area and the second backup area respectively. The read data includes all key data and status information generated during the task execution. The first backup data and the second backup data are compared based on a preset verification algorithm. The verification algorithm can be a simple byte comparison or a more complex hash verification to ensure that the two copies of the data are completely consistent. Whether the first backup data is consistent with the second backup data is determined based on the comparison result. If the data is consistent, the backup data is considered to be correct and no further operation is required. If the data is inconsistent, it is determined to be a data anomaly.

[0068] Furthermore, when data inconsistency is detected, the abnormal event is recorded immediately. The recorded content includes the time when the abnormality occurred, the backup area involved, the data type, etc. An abnormality counter is maintained, and the value of the counter increases by 1 every time a data inconsistency is detected. The counter is used to track and accumulate the number of abnormal events to help the system determine the frequency of data consistency problems. The recorded abnormal events and the updated abnormality counter value are stored in the system log. The log can be used for subsequent abnormality analysis and system optimization.

[0069] By performing consistency checks on the first backup data and the second backup data and recording abnormalities, the system can promptly identify abnormalities in the data backup process. Maintenance of the abnormality counter helps evaluate the frequency of data consistency issues and helps the system take appropriate corrective measures when data anomalies are frequent. This step improves the system's ability to detect and respond to data consistency issues, ensures data accuracy and reliability, and thus improves the overall stability and operational safety of the system.

[0070] S4: If the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, reset the monitoring task.

[0071] It should be noted that the preset time threshold is the maximum allowed value of the task execution time set in advance. If this value is exceeded, the task is considered to be abnormal. The preset abnormality count threshold is the maximum allowed number of abnormal events set in advance. If this value is exceeded, the task is considered to be in an abnormal state. Reset means stopping the execution of the current task and restarting the task to run again from the initial state.

[0072] Specifically, the execution time of the current task is monitored in real time and compared with the preset time threshold. At the same time, the value of the exception counter is monitored and compared with the preset exception count threshold. If the task execution time exceeds the preset time threshold, or the value of the exception counter exceeds the preset exception count threshold, the reset operation is triggered. If any of the conditions is met, the task is considered to be in an abnormal state and needs to be reset. Before triggering the reset operation, the system records the reset event, including the reason for the reset trigger (time limit exceeded or exception count exceeded), the current task status and related timestamps. These records are stored in the system log for subsequent analysis and debugging. Call the task stop function provided by the operating system to immediately stop the execution of the current task. Ensure that the task stops completely to prevent it from continuing to run and generating more errors.

[0073] Furthermore, clear the context information of the current task, including the task stack, register status, etc., to ensure that no error status is retained. Release the resources occupied by the task, such as memory, I / O ports, etc. Reinitialize the task's .BSS segment (the storage area for uninitialized global variables and static variables) to zero. Restore the task's .DATA segment (the storage area for initialized global variables and static variables) to its initial value. Reload the task code from the initial position of the task to ensure that the task is executed from the beginning. Verify the integrity of the task code to ensure that the code has not been modified or damaged. Reset the task's execution timer to zero and restart the timing. Reset the exception counter to zero and clear the previous exception record. Call the task start function provided by the operating system to restart the task. Ensure that the task starts execution from the initial state and runs in the expected logical order.

[0074] Optionally, after the task is restarted, closely monitor its execution status to ensure that it is running normally. If the task is abnormal again, record it in time and take appropriate measures.

[0075] By triggering a reset operation when the task time exceeds the preset time threshold or the value of the exception count exceeds the preset exception count threshold, the system can interrupt and restart the abnormal task in time. This process includes recording the reset event, clearing the task context, reinitializing the data segment, reloading the task code, and resetting the timer and exception counter to ensure that the task is restarted from a clean initial state. This step effectively prevents the task from being in an abnormal state for a long time or accumulating too many exceptions, ensuring that the system can quickly resume normal operation, significantly improving the reliability and stability of the system.

[0076] In this embodiment, if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data in the backup data is inconsistent with the second backup data, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset. This embodiment ensures the validity and consistency of the task data by monitoring the execution logic state of the task in real time. When the task runs normally, the data is backed up in time and the task time is recorded; when an abnormality occurs, an abnormality count is performed and reset measures are taken to quickly restore the system state. Through these measures, the impact of abnormal data on the system is effectively reduced, data consistency and timely system recovery are guaranteed, and ultimately the stability and security of the Autosar system are improved.

[0077] Based on the above first embodiment, a second embodiment of the task monitoring method based on Autosar is proposed. Figure 2 , Figure 2 This is a schematic diagram of a sub-process in the second embodiment of the task monitoring method based on Autosar of this application.

[0078] like Figure 2 As shown, in this embodiment, before step S1, the following steps are also included:

[0079] S1a: Obtain the execution logic monitoring data at the task entry, before the core component runs, after the core component runs, and at the task exit;

[0080] S1b: Based on the execution logic monitoring data, determine whether the execution logic state of the monitoring task is abnormal.

[0081] It should be noted that the task entry refers to the starting point where the task starts to execute, and the initial state data is obtained here. Before the core component runs, it refers to the state before the core component in the task starts to execute, and the relevant state data is obtained here. After the core component runs, it refers to the state after the core component in the task is completed, and the relevant state data is obtained here. Task exit refers to the end point where the task is completed, and the final state data is obtained here. The execution logic monitoring data is the task status and data obtained at specific monitoring points (task entry, before the core component runs, after the core component runs, and task exit) during the task execution process, which is used to judge the correctness of the task execution.

[0082] Specifically, when the task starts to execute, the initial state data is recorded at the task entrance. This data includes the initial variable values ​​of the task, resource allocation, and timestamp. Before the core component in the task starts to execute, the current state data is recorded. This data includes the preconditions required by the core component, dependent resources, and the intermediate state of the task. After the core component is executed, the current state data is recorded. This data includes the output results of the core component, the state variable values, and the resource usage. When the task is executed and reaches the task exit, the final state data is recorded. This data includes the final output of the task, the state variable values, and the released resources.

[0083] Furthermore, the execution logic monitoring data at the task entry, before the core component runs, after the core component runs, and at the task exit are compared to determine whether the execution logic of the task conforms to the predetermined correct logical order. Check whether there are logical sequence errors, abnormal key variable values, or improper resource use. If the changes in the execution logic data of the task between the monitoring points conform to the predetermined logical order and state transition rules, the task execution logic state is considered normal. If it is detected that the data does not conform to the predetermined logical order or there are abnormal changes, the task execution logic state is considered abnormal and the abnormal event is recorded.

[0084] By acquiring execution logic monitoring data at key execution points of tasks (task entry, before core components run, after core components run, and task exit), and judging the execution logic status of tasks based on these data, the system can monitor the operation of tasks in real time and promptly detect and handle logical anomalies. This monitoring mechanism ensures that tasks are executed in the expected logical order, preventing task failures or system crashes caused by logical errors, thereby improving system reliability and stability.

[0085] Based on the above first embodiment, in this embodiment, step S1b includes:

[0086] S1b1: Based on the execution logic monitoring data, determine whether the monitoring task has reached the end node;

[0087] S1b2: If not, determining that the execution logic state of the monitoring task is abnormal;

[0088] S1b3: If yes, based on the execution logic monitoring data, determine whether the execution logic sequence of the monitoring task complies with the preset logic execution sequence rule;

[0089] S1b4: If yes, determine that the execution logic state of the monitoring task is normal;

[0090] S1b5: If not, determine that the execution logic state of the monitoring task is abnormal.

[0091] It should be noted that the terminal node refers to the last state or step in the task execution process, indicating that the task has been completed. The preset logical execution sequence rule is a pre-defined task execution logic sequence, which is used to ensure that the task is performed in the correct steps and sequence.

[0092] Specifically, analyze the execution logic monitoring data obtained from each key monitoring point (such as task entry, before core component operation, after core component operation, and task exit). Check the current execution status of the task to determine whether it has reached the predetermined end node. If the analysis results show that the task fails to reach the end node as expected, immediately determine that the execution logic state of the task is abnormal. Record abnormal events, including the reason why the task did not reach the end node, the current status, and the timestamp. If the task reaches the end node, the system further analyzes the execution logic monitoring data. Compare the execution process of the task with the preset logic execution sequence rules, and check whether each step and state transition conforms to the predetermined order.

[0093] Furthermore, if each step and state transition of the task execution complies with the preset logical execution sequence rules, the system determines that the execution logic state of the task is normal. The normal execution state is recorded to ensure that the task is completed as expected. If a step or state transition of the task is detected to be inconsistent with the preset logical execution sequence rules, the system immediately determines that the execution logic state of the task is abnormal. The abnormal event is recorded, including the step that does not conform to the logical order, the current state and the timestamp.

[0094] By judging whether the task has reached the end node based on the execution logic monitoring data, and further checking whether the execution logic sequence conforms to the preset rules, logical anomalies in task execution can be discovered and handled in a timely manner. This refined monitoring and judgment mechanism ensures that tasks are strictly executed according to the predetermined logic, avoiding task failures or system failures caused by incorrect execution sequence, thereby improving system reliability and operational safety.

[0095] In this embodiment, if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data in the backup data is inconsistent with the second backup data, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset. This embodiment ensures the validity and consistency of the task data by monitoring the execution logic state of the task in real time. When the task runs normally, the data is backed up in time and the task time is recorded; when an abnormality occurs, an abnormality count is performed and reset measures are taken to quickly restore the system state. Through these measures, the impact of abnormal data on the system is effectively reduced, data consistency and timely system recovery are guaranteed, and ultimately the stability and security of the Autosar system are improved.

[0096] Based on the above second embodiment, a third embodiment of the task monitoring method based on Autosar is proposed. Figure 3 , Figure 3 This is a schematic diagram of a sub-process in the third embodiment of the task monitoring method based on Autosar of this application.

[0097] In this embodiment, step S3 includes:

[0098] S31: Acquire the first backup data and the second backup data from the first backup area and the second backup area respectively;

[0099] S32: comparing the first backup data with the second backup data based on a preset verification algorithm;

[0100] S33: determining whether the first backup data is consistent with the second backup data based on the comparison result;

[0101] S34: If not, record the corresponding abnormal event and increase the value of the preset abnormality counter.

[0102] It should be noted that the first backup area is a designated storage area for storing the first copy of the task data. The second backup area is a designated storage area for storing the second copy of the task data. The first backup data is a copy of the task data stored in the first backup area. The second backup data is a copy of the task data stored in the second backup area. The preset verification algorithm is a preset consistency algorithm for comparing two copies of data, which can be a simple byte comparison or a more complex hash verification. Abnormal events refer to events recorded when an abnormal situation is detected during the execution of a task, including the type of abnormality, the time of occurrence, and specific details.

[0103] Specifically, read the task data copy stored in the first backup area. These data include all key data and status information generated during the task execution. Read the task data copy stored in the second backup area. These data also include all key data and status information generated during the task execution, and should be consistent with the first backup data.

[0104] Furthermore, the first backup data and the second backup data are compared using a preset verification algorithm. The verification algorithm may be a simple byte comparison, a hash check, or other complex data consistency algorithms. Based on the comparison result of the verification algorithm, determine whether the first backup data and the second backup data are consistent. If the two copies of the data are consistent, the backup data is considered to be correct. If the comparison result shows that the two copies of the data are inconsistent, the corresponding abnormal event is recorded immediately. The abnormal event record includes the detected inconsistent data, the time of occurrence, the backup area involved, etc., and increases the value of the abnormal counter to track and accumulate the number of data consistency abnormalities.

[0105] By obtaining backup data from the first backup area and the second backup area respectively and comparing them based on a preset verification algorithm, data consistency can be effectively detected. Recording abnormal events and updating abnormal counters help to promptly identify and handle data inconsistency issues and ensure data accuracy and reliability. This step improves the system's ability to detect anomalies during data backup, avoids system failures caused by data inconsistency, and thus enhances system stability and security.

[0106] Based on the above second embodiment, in this embodiment, step S4 includes:

[0107] S41: Acquire the task time and the value of the abnormality count in real time;

[0108] S42: If the task time exceeds the preset time threshold or the abnormality count value exceeds the preset abnormality count threshold, stop the monitoring task;

[0109] S43: Reload the monitoring task at the task entry and clear the value of the preset abnormality counter.

[0110] It should be noted that the preset time threshold is the maximum allowed value of the task execution time that is preset. If this value is exceeded, the task is considered to be abnormal. The preset exception count threshold is the maximum allowed number of abnormal events that are preset. If this value is exceeded, the task is considered to be in an abnormal state. Stopping the monitoring task means stopping the currently executing task to prevent it from running further and generating errors. Reloading the task means re-executing the task from the beginning to ensure that the task starts running from a clean state. Clearing the exception counter means resetting the number of recorded abnormal events to zero so that the new monitoring cycle starts counting again.

[0111] Specifically, the execution time of the current task is monitored in real time, and the total time from the start of the task execution to the current moment is recorded. At the same time, the current value of the exception counter is obtained in real time, and the number of abnormal events that occurred during the task execution is recorded. The task time obtained in real time is compared with the preset time threshold. The exception count obtained in real time is compared with the preset exception count threshold. If the task time exceeds the preset time threshold, or the exception count exceeds the preset exception count threshold, the system determines that the task is in an abnormal state.

[0112] Furthermore, the task stop function provided by the operating system is called to immediately stop the execution of the current monitoring task. Ensure that the task is completely stopped to prevent it from continuing to run and generating more errors. Reload the task from the beginning, that is, restart the task from the task entry. When reloading the task, ensure that the task starts from a clean initial state to avoid the influence of the previous abnormal state. Reset the value of the exception counter to zero and clear the number of abnormal events previously recorded. In this way, the count can be restarted from the new monitoring cycle to avoid the influence of accumulated abnormal events.

[0113] By acquiring task time and exception count in real time, abnormal situations of tasks can be detected in time. When the task time or exception count exceeds the preset threshold, the task is immediately stopped and reloaded, and execution is restarted from the task entry, and the exception counter is cleared at the same time. This mechanism ensures that the task can quickly resume normal operation under abnormal circumstances, avoiding system instability caused by long-term operation or frequent exceptions, and significantly improving the reliability and operation efficiency of the system.

[0114] Based on the above second embodiment, in this embodiment, after step S4, the following is further included:

[0115] S4a: Initialize each data segment of the monitoring task, and adjust monitoring parameters based on abnormal event data.

[0116] It should be noted that initializing the data segment refers to resetting the memory area related to the task, including the task's .BSS segment (uninitialized global variables and static variable storage area) and .DATA segment (initialized global variables and static variable storage area) to ensure that the task starts running from a clean state. Abnormal event data refers to the detailed information of all abnormal events recorded during the execution of the task, including the abnormal type, occurrence time and specific details. Monitoring parameters refer to the parameters used to configure the task monitoring system, including time thresholds, abnormality count thresholds and other related configurations to ensure the effectiveness and accuracy of task monitoring.

[0117] Specifically, reset the task's .BSS segment (uninitialized global and static variable storage area) to zero. Ensure that all uninitialized variables start with a value of zero when the task is restarted, avoiding the use of old invalid data. Restore the task's .DATA segment (initialized global and static variable storage area) to its initial value. Ensure that all initialized variables have the correct initial value when the task is restarted, ensuring that the task can run normally.

[0118] Furthermore, all abnormal event data recorded during the task execution are collected and analyzed, including the abnormal type, frequency of occurrence, and specific time point. If the task execution time often exceeds the preset time threshold, consider adjusting the time threshold appropriately to avoid frequent false triggering. If the abnormal count often exceeds the preset abnormal count threshold, consider adjusting the abnormal count threshold to more accurately reflect the abnormal status of the task. According to the specific operating environment of the task and the analysis results of the abnormal data, adjust other relevant monitoring parameters to improve the accuracy and effectiveness of the monitoring system.

[0119] By initializing each data segment of the monitoring task, the system ensures that the task starts running from a clean and consistent state when it is restarted, avoiding anomalies caused by the use of old data. At the same time, based on the collected and analyzed abnormal event data, the monitoring parameters are adjusted to make the monitoring system more accurate and sensitive, effectively reduce false positives and missed positives, and improve the overall efficiency and reliability of task monitoring. This mechanism significantly improves the system's recovery ability and adaptability in the face of task anomalies, ensuring the stability of the system and operational safety.

[0120] In this embodiment, if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data in the backup data is inconsistent with the second backup data, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset. This embodiment ensures the validity and consistency of the task data by monitoring the execution logic state of the task in real time. When the task runs normally, the data is backed up in time and the task time is recorded; when an abnormality occurs, an abnormality count is performed and reset measures are taken to quickly restore the system state. Through these measures, the impact of abnormal data on the system is effectively reduced, data consistency and timely system recovery are guaranteed, and ultimately the stability and security of the Autosar system are improved.

[0121] The present application also provides a task monitoring device based on Autosar, please refer to Figure 4 , Figure 4This is a schematic diagram of the module structure of a task monitoring device based on Autosar in an embodiment of the present application. The task monitoring device based on Autosar includes:

[0122] The logic normal module 401 is used to use the task data as backup data and record the task time if the execution logic state of the monitoring task is normal;

[0123] The logic exception module 402 is used to count the exceptions if the execution logic state of the monitoring task is abnormal;

[0124] A backup exception module 403, configured to perform an exception count if the first backup data and the second backup data in the backup data are inconsistent;

[0125] The reset module 404 is used to reset the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold.

[0126] The Autosar-based task monitoring device provided in the embodiment of the present application adopts the Autosar-based task monitoring method in the above embodiment, which can solve the technical problem of how to improve the stability and safety of the Autosar system. Compared with the prior art, the beneficial effects of the Autosar-based task monitoring device provided in the embodiment of the present application are the same as the beneficial effects of the Autosar-based task monitoring method provided in the above embodiment, and the other technical features of the Autosar-based task monitoring device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0127] The present application provides an Autosar-based task monitoring device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Autosar-based task monitoring method in the above-mentioned embodiment.

[0128] Reference below Figure 5, which shows a schematic diagram of the structure of an Autosar-based task monitoring device suitable for implementing the embodiment of the present application. The Autosar-based task monitoring device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The AUTOSAR-based task monitoring device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0129] like Figure 5 As shown, the task monitoring device based on Autosar may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the task monitoring device based on Autosar are also stored in RAM1004. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the Autosar-based mission monitoring device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an Autosar-based mission monitoring device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0130] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0131] The Autosar-based task monitoring device provided by the present application adopts the Autosar-based task monitoring method in the above-mentioned embodiment, which can solve the technical problem of how to improve the stability and safety of the Autosar system. Compared with the prior art, the beneficial effects of the Autosar-based task monitoring device provided by the present application are the same as the beneficial effects of the Autosar-based task monitoring method provided in the above-mentioned embodiment, and the other technical features in the Autosar-based task monitoring device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0132] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0133] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0134] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the Autosar-based task monitoring method in the above-mentioned embodiment.

[0135] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0136] The above-mentioned computer-readable storage medium may be included in the task monitoring device based on Autosar; or it may exist independently without being assembled into the task monitoring device based on Autosar.

[0137] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the task monitoring device based on Autosar, the task monitoring device based on Autosar: if the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; if the execution logic state of the monitoring task is abnormal, an abnormality count is performed; if the first backup data in the backup data is inconsistent with the second backup data, an abnormality count is performed; if the task time exceeds the preset time threshold or the value of the abnormality count exceeds the preset abnormality count threshold, the monitoring task is reset. The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, and the programming language includes an object-oriented programming language such as Java, Smalltalk, C++, and also includes a conventional procedural programming language such as "C" language or similar programming language. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (for example, through the Internet using an Internet service provider).

[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0139] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0140] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned task monitoring method based on Autosar, and can solve the technical problem of how to improve the stability and safety of the Autosar system. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the task monitoring method based on Autosar provided in the above-mentioned embodiment, and will not be repeated here.

[0141] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned Autosar-based task monitoring method.

[0142] The computer program product provided in this application can solve the technical problem of how to improve the stability and security of the Autosar system. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiment of this application are the same as the beneficial effects of the task monitoring method based on Autosar provided in the above embodiment, which will not be repeated here.

[0143] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A task monitoring method based on Autosar, characterized in that: The method comprises: If the execution logic state of the monitoring task is normal, the task data is used as backup data and the task time is recorded; If the execution logic state of the monitoring task is abnormal, an abnormality count is performed; If the first backup data and the second backup data in the backup data are inconsistent, performing an exception counting; If the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, the monitoring task is reset.

2. The method according to claim 1, characterized in that Before the step of using the task data as backup data and recording the task time if the execution logic state of the monitoring task is normal, the method further includes: Obtain execution logic monitoring data at the task entry, before the core component runs, after the core component runs, and at the task exit respectively; Based on the execution logic monitoring data, it is determined whether an abnormality occurs in the execution logic state of the monitoring task.

3. The method according to claim 2, characterized in that The step of judging whether the execution logic state of the monitoring task is abnormal based on the execution logic monitoring data includes: Based on the execution logic monitoring data, determining whether the monitoring task has reached the end node; If not, determining that the execution logic state of the monitoring task is abnormal; If so, based on the execution logic monitoring data, determining whether the execution logic sequence of the monitoring task complies with a preset logic execution sequence rule; If so, determining that the execution logic state of the monitoring task is normal; If not, it is determined that the execution logic state of the monitoring task is abnormal.

4. The method according to claim 1, characterized in that The step of performing abnormality counting if the first backup data and the second backup data in the backup data are inconsistent comprises: Retrieve the first backup data and the second backup data from the first backup area and the second backup area respectively; Based on a preset verification algorithm, comparing the first backup data with the second backup data; Determining whether the first backup data is consistent with the second backup data based on the comparison result; If not, the corresponding abnormal event is recorded and the value of the preset abnormal counter is increased.

5. The method according to claim 4, characterized in that The step of resetting the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold comprises: Acquire the task time and the value of the abnormality count in real time; If the task time exceeds the preset time threshold or the abnormality count value exceeds the preset abnormality count threshold, stop the monitoring task; The monitoring task is reloaded at the task entry, and the value of the preset abnormality counter is cleared.

6. The method according to claim 1, characterized in that After the step of resetting the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold, the method further includes: Initialize each data segment of the monitoring task, and adjust the monitoring parameters based on the abnormal event data.

7. A task monitoring device based on Autosar, characterized in that: The device comprises: The logic normal module is used to use the task data as backup data and record the task time if the execution logic state of the monitoring task is normal; The logic exception module is used to count the exceptions if the execution logic state of the monitoring task is abnormal; A backup exception module, used for performing an exception count if the first backup data and the second backup data in the backup data are inconsistent; The reset module is used to reset the monitoring task if the task time exceeds a preset time threshold or the value of the abnormality count exceeds a preset abnormality count threshold.

8. A computer device, characterized in that: The device includes: a memory, a processor, and an Autosar-based task monitoring program stored in the memory and executable on the processor, wherein the Autosar-based task monitoring program is configured to implement the steps of the Autosar-based task monitoring method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium stores an Autosar-based task monitoring program, which, when executed by a processor, implements the steps of the Autosar-based task monitoring method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the task monitoring method based on Autosar as claimed in any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Storage equipment monitoring device and monitoring method thereof

    CN120670253A

  • Processor fault identification method and device, electronic equipment and readable storage medium

    CN120909880A

  • Abnormal task processing method and device, computer equipment and storage medium

    CN120950294A

  • Abnormal task handling methods, apparatus, computer equipment and storage media

    CN120950294B