A task processing method and device

By using shared memory and exception handling objects to independently handle exception tasks in the automotive electronic operating system, the problem of exception task shutdown affecting normal tasks is solved, thus achieving functional safety and system stability.

CN114691334BActive Publication Date: 2025-10-21CHINA AUTOMOTIVE INNOVATION CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210331049.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-10-21
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

In automotive electronic operating systems, shutting down abnormal tasks can also shut down other normal tasks, leading to a loss of functionality. Current technology cannot effectively isolate abnormal tasks without affecting normal tasks.

Method used

By calling the exception handling object, the exception task identifier and unit identifier are written into shared memory, causing the target processing unit to perform a task shutdown operation. The exception task is handled independently by the ASIL processing task with a high functional safety level, avoiding affecting other normal tasks.

Benefits of technology

This allows abnormal tasks to be shut down directly without affecting normal operations, enhancing the functional safety of the automotive operating system and ensuring smooth system operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691334B_ABST
    Figure CN114691334B_ABST
Patent Text Reader

Abstract

The application discloses a task processing method and device, and belongs to the technical field of information processing, which comprises the following steps: responding to a task exception event; the task exception event comprises an exception task identifier of an exception task and a unit identifier of a target processing unit where the exception task is located; calling an exception processing object, and passing the exception task identifier and the unit identifier to the exception processing object; in the case that a processing unit where the exception processing object is located is inconsistent with the target processing unit, writing the exception task identifier and the unit identifier into a shared memory based on the exception processing object; so that the target processing unit performs a task closing operation on the exception task, which has the beneficial effects that the exception task can be specified to be closed, normal running tasks are not involved, and the function is safe and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing technology, and in particular to a task processing method and device. Background Art

[0002] With the development of the automotive industry and the increase in car ownership, safety issues have become a growing concern. Therefore, functional safety has become a hot topic in the development of automotive electronics and electrical systems.

[0003] To address functional safety requirements, automotive electronics operating system standards have introduced the concept of OS applications. This divides the entire functionality of an electronic control component into different applications based on the ASIL (Associated Safety Integrity Level) of the functional safety system. This allows the OS application corresponding to a non-critical function to be shut down if an error occurs during operation. The corresponding OS application can then be re-enabled after subsequent inspections have passed or the error has been resolved.

[0004] Functions are primarily executed through tasks within the OS. To reduce memory consumption and improve execution efficiency, a single OS application often contains multiple functions, or tasks. In other operating systems, when an abnormal task is detected, it is simply deleted, effectively deprecating it. However, in automotive electronic operating systems, tasks cannot be directly deleted. Instead, the corresponding OS application is shut down after the abnormal task is detected. This, however, will also shut down other functions, potentially causing some otherwise functioning functions to be shut down and rendered inoperable. Summary of the Invention

[0005] In order to overcome the shortcomings and deficiencies of the existing technology, the present invention discloses a task processing method and system that can close a specified abnormal task without affecting normal running tasks. The method includes:

[0006] In response to a task abnormality event, the task abnormality event includes an abnormal task identifier of the abnormal task and a unit identifier of a target processing unit where the abnormal task is located;

[0007] Calling an exception handling object, and passing the exception task identifier and the unit identifier to the exception handling object;

[0008] When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into a shared memory based on the exception handling object; so that the target processing unit performs a task closing operation on the exception task.

[0009] Furthermore, the method further comprises:

[0010] In a case where the processing unit where the exception processing object is located is consistent with the target processing unit, an exception task identifier is sent to the target processing unit based on the exception processing object, so that the target processing unit closes the exception task.

[0011] Furthermore, after writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object, the method further includes:

[0012] A task interruption instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit reads the exception task identifier from the shared memory and closes the exception task corresponding to the exception task identifier.

[0013] Furthermore, after writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object, the method further includes:

[0014] The preset processing unit detects the unit identifier in the shared memory with a preset detection cycle, and when a unit identifier matching the preset processing unit is detected, the abnormal task is closed based on the matching processing unit; the matching processing unit is the preset processing unit corresponding to the unit identifier in the shared memory.

[0015] Furthermore, after responding to the task abnormality event, the method further includes:

[0016] The abnormal number of times of the abnormal task is updated based on the abnormal task identifier to obtain a target abnormal number of times corresponding to the abnormal task.

[0017] Furthermore, the method further comprises:

[0018] When the target number of exceptions is less than a preset number, determining a first closing instruction for the abnormal task, and when the processing unit where the exception handling object is located is inconsistent with the target processing unit, writing the first closing instruction into the shared memory based on the exception handling object;

[0019] When the target number of exceptions is greater than or equal to a preset number, a second shutdown instruction for the abnormal task is determined; when the processing unit where the exception handling object is located is inconsistent with the target processing unit, the second shutdown instruction is written into the shared memory based on the exception handling object.

[0020] Furthermore, the first shutdown instruction includes a first shutdown service interface, and the second shutdown instruction includes a second shutdown service interface;

[0021] The method further comprises:

[0022] In a case where the target processing unit calls the first shutdown service interface to shut down the abnormal task, determining the abnormal state of the abnormal task as a first state;

[0023] In a case where the target processing unit calls the second shutdown service interface to close the abnormal task, the abnormal state of the abnormal task is determined to be a second state.

[0024] Furthermore, the method further comprises:

[0025] When the abnormal task is switched from the first state to a preset state, or when the duration of the abnormal task being closed reaches a preset duration, calling the abnormal processing object and passing the abnormal task identifier and the unit identifier to the abnormal processing object;

[0026] When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into a shared memory based on the exception handling object; so that the target processing unit performs a task restart operation on the exception task.

[0027] Furthermore, the method further comprises:

[0028] Writing the task restart service interface into the shared memory based on the exception handling object;

[0029] The task restart service interface is called based on the target processing unit to perform a task restart operation on the abnormal task corresponding to the abnormal task identifier.

[0030] On the other hand, the present application also provides a task processing system, the system comprising:

[0031] Response module: used to respond to a task abnormality event; the task abnormality event includes an abnormal task identifier of the abnormal task and a unit identifier of a target processing unit where the abnormal task is located;

[0032] Calling module: used for calling the exception handling object and passing the exception task identifier and the unit identifier to the exception handling object;

[0033] Execution closing module: used for writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object when the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit performs a task closing operation on the abnormal task.

[0034] The implementation of this application has the following beneficial effects:

[0035] Calling the exception handling object can write the exception task identifier and unit identifier into the shared memory with the target processing unit. The target processing unit reads the exception task identifier and unit identifier and closes the exception task corresponding to the exception task identifier and unit identifier without affecting other normal operating tasks. Considering that the exception handling object and the exception task are not in the same processing unit, the exception handling object can notify the target processing unit to close the exception task. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0037] Figure 1 A schematic diagram of the state switching principle of the basic tasks provided by the embodiment of the present invention;

[0038] Figure 2 A state switching principle diagram of an extended task provided by an embodiment of the present invention;

[0039] Figure 3 A flowchart of a task processing method provided by an embodiment of the present invention;

[0040] Figure 4 This is a structural block diagram of the task processing system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0042] In automotive electronic operating systems, the carriers of functional operations are mainly tasks in OS applications. In order to reduce memory consumption and improve execution efficiency, an OS application will contain multiple functions, that is, an OS application will include multiple tasks, and the execution of tasks will be arranged through a task scheduling unit; each task includes multiple task states, including a basic task state and an extended task state, wherein the basic task state includes a running state, a ready state, and a suspended state, and the extended task state is to add a waiting state to the basic task state. Compared with the basic task state, the extended task state needs to wait for an event to occur before the task can be run. If an exception occurs when the task is in the running state, the abnormal task is terminated and the abnormal task is converted to a suspended state. The abnormality in the suspended state can be activated and enter the running state. The abnormal task is in the running state. There are security risks. If the OS application where the abnormal task is located is directly closed, it will involve the normal running tasks, resulting in loss of function; therefore, this embodiment adds a closed state and a forced closed state to the task state, refer to Figure 1-2 When the monitoring system detects an abnormal task, it switches the abnormal task to the closed state. After confirming that the abnormal state has been repaired, the abnormal task is switched to the suspended state or the waiting state and can be run; when the monitoring system detects that the number of errors of the abnormal task exceeds the preset number, the task state of the abnormal task is switched to the forced closed state. The forced closed state can only be activated by restarting the system, thereby enhancing the functional safety of the electronic vehicle operating system.

[0043] In this embodiment, the technical problem to be solved by the present invention is to be able to directly close the specified abnormal task without affecting the normal function, so that the system runs smoothly and the functional safety of the operating system is guaranteed. Figure 3 The task processing method flow chart is as follows, and the execution subject may be a detection system; the method includes:

[0044] Step S101: responding to a task abnormality event; the task abnormality event includes an abnormal task identifier of the abnormal task and a unit identifier of a target processing unit where the abnormal task is located;

[0045] The monitoring system detects abnormal tasks. Each task contains the identification information of the task and the target processing unit where the task is located. The task system may include multiple processing units, and the multiple processing units work independently without affecting each other. Specifically, the processing unit can be a physical core. The monitoring system obtains the abnormal task identification and unit identification of the abnormal task to clarify the physical core where the abnormal task is located.

[0046] After step S101 , the method further includes: updating the abnormality times of the abnormal task based on the abnormal task identifier to obtain a target abnormality times corresponding to the abnormal task.

[0047] The monitoring system detects the number of errors in the task and updates the number of errors to a variable representing an abnormal task identifier of the number of errors.

[0048] Step S103: calling the exception handling object and passing the exception task identifier and unit identifier to the exception handling object;

[0049] The monitoring system detects an abnormal task and calls the API interface corresponding to the exception handling object. Specifically, the abnormal task identifier and unit identifier are passed into the API interface corresponding to the exception handling object, so that the exception handling object performs subsequent processing based on the abnormal task identifier and unit identifier.

[0050] The exception handling object, that is, a processing task with a higher level of functional safety ASIL (Automotive Safety Integration Level), can issue instructions to the specified exception task without affecting other normal operating tasks. It is safer and more reliable than processing tasks with a lower ASIL level. The monitoring system passes the exception task identifier and unit identifier to the exception handling object. The exception handling object can issue instructions to the target processing unit where the exception task is located based on the exception task identifier and unit identifier, so that the target processing unit can make corresponding processing on the exception task.

[0051] Step S105: When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into the shared memory based on the exception handling object; so that the target processing unit performs a task closing operation on the exception task.

[0052] There are multiple processing units in the operating system, and multiple tasks are distributed in different processing units. Two tasks in different processing units cannot directly exchange information, and it is also impossible to directly issue corresponding processing instructions to the target processing unit so that the target processing unit can process the abnormal task; the exception handling object writes the abnormal task identifier and unit identifier into the shared memory, which can be read by all processing units, and the target processing unit reads the abnormal task identifier and unit identifier in the shared memory.

[0053] Step S201: When the processing unit where the exception processing object is located is consistent with the target processing unit, an exception task identifier is sent to the target processing unit based on the exception processing object, so that the target processing unit closes the exception task.

[0054] Among them, the task interrupt instruction is used to remind the target processing unit to stop the execution of the abnormal task. When the processing unit where the exception processing object is located is inconsistent with the target processing unit, the target processing unit reads the exception identifier in the shared memory after being reminded, and performs state conversion on the abnormal task corresponding to the exception identifier.

[0055] The processing unit where the exception handling object is located is consistent with the target processing unit, and can directly exchange information. The exception handling object transmits the exception task identifier to the target processing unit, and the target processing unit directly reads the exception task identifier transmitted by the exception handling object, so that the target processing unit closes the exception task corresponding to the exception task identifier.

[0056] After writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object in step S105, the method further includes:

[0057] A task interruption instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit reads the exception task identifier from the shared memory and closes the exception task corresponding to the exception task identifier.

[0058] The exception handling object can send a task interruption instruction to the specified target processing unit. After receiving the task interruption instruction, the target processing unit reads the abnormal task identifier in the shared memory and performs a task closing operation on the abnormal task corresponding to the abnormal task identifier. The exception handling object can send a task interruption instruction to the target processing unit, indicating that there is an abnormal task in the target processing unit that needs to be processed. After receiving the task interruption instruction, the target processing unit can read the abnormal task identifier of the abnormal task in the shared memory. The target processing unit can know the abnormal task corresponding to the abnormal task identifier and close it, achieving the technical effect of closing the specified abnormal task.

[0059] In another embodiment, after writing the exception task identifier and the unit identifier into the shared memory based on the exception handling object, the method further includes:

[0060] The preset processing unit detects the unit identifier in the shared memory with a preset detection cycle, and when a unit identifier matching the preset processing unit is detected, the abnormal task is closed based on the matching processing unit; the matching processing unit is the preset processing unit corresponding to the unit identifier in the shared memory.

[0061] Among them, the preset processing unit is any processing unit in the operating system. After the exception handling object writes the exception task identifier into the shared memory, it does not send a task interrupt instruction to the specified target processing unit. Instead, each processing unit polls the shared memory to see if there is an exception task identifier that matches its own processing unit through a certain period. Matching means that the unit identifier of the preset processing unit is consistent with the unit identifier in the shared memory. Each processing unit reads the shared memory through a preset period polling to see if there is a task identifier of the task of its own processing unit in the shared memory. If so, it means that there is an exception task among the multiple tasks in its own processing unit, and the exception task corresponding to the exception task identifier is closed.

[0062] During the execution of the shutdown operation, a corresponding execution instruction may be determined based on the abnormal information of the abnormal task at the current moment; specifically, the abnormal information may be the number of times the abnormal task has been abnormal, and the task state of the abnormal task is determined to be switched to the shutdown state or the forced shutdown state based on the number of times the abnormal task has been abnormal. If the task state is determined to be the shutdown state, a shutdown abnormal task instruction needs to be determined so that the abnormal task is switched to the shutdown state. If the task state is determined to be the forced shutdown state, a forced shutdown abnormal task instruction needs to be determined so that the abnormal task is switched to the forced shutdown state. The method includes:

[0063] Step S401: when the target number of exceptions is less than a preset number, determining a first shutdown instruction for the abnormal task, and when the processing unit where the exception handling object is located is inconsistent with the target processing unit, writing the first shutdown instruction into the shared memory based on the exception handling object;

[0064] When the target exception number is less than the preset number, it is determined that the task state of the abnormal task is converted to the closed state, and the abnormal task closing instruction, that is, the first closed instruction, is determined. When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception handling object writes the first instruction into the shared memory, and the target processing unit reads the first instruction and switches the abnormal task to the closed state; if the processing unit where the exception handling object is located is consistent with the target processing unit, the target processing unit directly receives the first closed instruction and switches the abnormal task to the closed state or the waiting state.

[0065] The first shutdown instruction includes a first shutdown service interface; the second shutdown instruction includes a second shutdown service interface; the first shutdown service interface is an API service interface for converting an abnormal task from a basic task state and an extended task state to a closed state, and the second shutdown service interface is an API service interface for converting an abnormal task state from a basic task state and an extended task state to a forced closed state.

[0066] Step S501: when the target processing unit calls the first shutdown service interface to close the abnormal task, the abnormal state of the abnormal task is determined to be the first state;

[0067] When the target processing unit determines to call the first shutdown service interface to close the abnormal task, the abnormal task is converted from the basic task state or the extended task state to the closed state, specifically as follows:

[0068] Based on the exception handling object, the current state of the abnormal task is obtained according to the abnormal task identifier; if the current state is the running state, a shutdown instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit releases the resources occupied by the abnormal task, closes the abnormal task, and triggers the task scheduling unit; the task scheduling unit arranges the execution of the task;

[0069] When the current state is the ready state, a close instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit moves the abnormal task out of the ready state and closes the abnormal task;

[0070] When the current state is other states, such as the suspended state or the waiting state, a close instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit closes the abnormal task.

[0071] Step S503: When the target processing unit calls the second closing service interface to close the abnormal task, the abnormal state of the abnormal task is determined to be the second state.

[0072] When the target processing unit calls the second shutdown service interface to close the abnormal task, the abnormal task is converted to a forced shutdown state. The forced shutdown state can be converted from any state of the task. As long as the number of abnormalities of the abnormal task exceeds the preset number, the target processing unit calls the second shutdown service interface to force the abnormal task to close.

[0073] When switching an abnormal task to the closed state, it is necessary to obtain the current state of the abnormal task.

[0074] After the abnormal task is switched to the closed state, the monitoring system can continue to monitor the abnormal task. When the abnormal task is determined to have been repaired, the abnormal task is switched from the closed state to the basic task state or the extended task state. The method includes:

[0075] Step S601: When the abnormal task is switched from the first state to the preset state, or when the abnormal task is closed for a preset time, calling the abnormal processing object, and passing the abnormal task identifier and the unit identifier to the abnormal processing object;

[0076] Among them, the preset state is the state of the abnormal task that can be converted to the ready state or the running state, which means that the abnormal task has been repaired. To ensure that the system is fully functional, the abnormal task that has been in the closed state for the preset time but has not been switched to the forced closed state is also determined to have been repaired. The monitoring system calls the exception handling object and switches the abnormal task in the closed state to the basic task state or the extended task state. The monitoring system passes the abnormal task identifier and unit identifier of the repaired abnormal task to the exception handling object.

[0077] Step S603: When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into the shared memory based on the exception handling object; so that the target processing unit performs a task restart operation on the exception task.

[0078] Step S701: writing the task restart service interface into the shared memory based on the exception handling object;

[0079] When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception handling object writes the task restart service interface into the shared memory;

[0080] Similarly, when the processing unit where the exception handling object is located is consistent with the target processing unit, the exception handling object directly passes the restart task interface to the target processing unit, and the target processing unit directly calls the restart task interface to convert the abnormal task from the closed state to the ready state or the waiting state.

[0081] Step S703: Based on the target processing unit, the task restart service interface is called to perform a task restart operation on the abnormal task corresponding to the abnormal task identifier.

[0082] The target processing unit calls the task restart service interface to perform the task restart operation on the abnormal task corresponding to the abnormal task identifier, switching the abnormal task in the closed state to the suspended state or the waiting state. The abnormal task in the suspended state or the waiting state can be switched to the ready state, and then start switching to the running state.

[0083] Furthermore, to ensure that abnormal tasks in the closed state cannot be restarted until they are confirmed to be repaired, the monitoring system monitors the target task that is about to transition to the ready state or the running state and determines whether the target task is currently in the closed state. If it is determined to be in the closed state, the target task cannot be switched to another state by the processing unit where the target task resides. If the target task is currently in a state other than the closed state, the target task can continue to be switched to another state by the processing unit where the target task resides.

[0084] After the monitoring system detects that the task that had an error before is running normally once, the corresponding exception count is reduced, and the rate of increase and decrease can be set according to the actual situation. For example, the monitoring system detects that the number of exceptions of the abnormal task is 10, and the preset number is 15. The exception handling object is called to send a task interrupt instruction to the target processing unit. After the target processing unit converts the abnormal task to the closed state, it is determined that the abnormal task has been repaired. The abnormal task in the closed state is not run, so the number of exceptions will not increase. Within a certain period of time, the abnormal task is also judged to have been repaired. The target processing unit converts the repaired abnormal task to the suspended state, and after running the abnormal task normally once, the detection system will reduce the record of the number of exceptions of the abnormal task from the previous 10 times to 9 times. If the abnormal task continues to run normally, the number of exceptions can be cleared. If the number of exceptions reaches 15, the abnormal task is converted to the closed state. The current safety status of the abnormal task is objectively judged by the increase and decrease of the count.

[0085] In addition, the rate of increase or decrease of the number of exception errors can be set according to the system performance. For example, in the operating system, for some OS applications with high precision requirements, the security requirements of the corresponding tasks will also become higher. The rate of increase of the number of corresponding task exceptions will be increased, so that the corresponding abnormal tasks can be quickly switched to the closed state, or even forced to close. The judgment conditions for repairing abnormal tasks can also be improved, such as extending the preset time in the closed state to ensure that all running tasks can operate normally. For tasks with lower precision requirements, the rate of increase of the number of exceptions can be reduced, the operations of the exception handling objects can be reduced, and the processing efficiency of the exception handling objects can be improved.

[0086] Step S403: When the target exception number is greater than or equal to the preset number, determine a second shutdown instruction for the abnormal task, and when the processing unit where the exception handling object is located is inconsistent with the target processing unit, write the second shutdown instruction into the shared memory based on the exception handling object.

[0087] When the target exception number is greater than or equal to the preset number, it is determined that the task state of the abnormal task is converted to the forced closing state, and the exception handling object determines the forced closing instruction of the abnormal task, that is, the second closing instruction. When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception handling object writes the second instruction into the shared memory, and the target processing unit reads the second instruction and switches the abnormal task to the forced closing state; if the processing unit where the exception handling object is located is consistent with the target processing unit, the target processing unit directly receives the second closing instruction and switches the abnormal task to the forced closing state.

[0088] When switching an abnormal task to a forced-closed state, it is necessary to obtain the current state of the abnormal task, and obtain the current state of the abnormal task based on the abnormal task identifier based on the abnormal handling object; when the current state is the running state, a shutdown instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit releases the resources occupied by the abnormal task, switches the abnormal task to a forced-closed state, and triggers the task scheduling unit; the task scheduling unit arranges the execution of other tasks.

[0089] When the current state is the ready state, a shutdown instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit moves the abnormal task out of the ready state and switches to the forced shutdown state;

[0090] When the current state is a suspended state or a waiting state, a closing instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit closes the abnormal task;

[0091] It should be noted that an abnormal task can only be switched to the forced shutdown state when the number of abnormalities has exceeded the preset number. If the abnormal task can be activated and run at this time, it will cause a huge security risk. Therefore, after the abnormal task is switched to the forced shutdown state, it cannot be restarted. It can only be restarted by restarting the operating system.

[0092] This embodiment also provides a task processing device, which can realize the functions of all the above methods. Figure 4 The task processing system structure diagram includes:

[0093] Response module 410: used to respond to a task abnormality event; the task abnormality event includes the abnormal task identifier of the abnormal task and the unit identifier of the target processing unit where the abnormal task is located;

[0094] Calling module 420: used to call the exception handling object and pass the exception task identifier and unit identifier to the exception handling object;

[0095] Execution closing module 430: for writing the abnormal task identifier and unit identifier into the shared memory based on the abnormal processing object when the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit performs a task closing operation on the abnormal task.

[0096] The device also includes:

[0097] Interrupt instruction sending module: used for sending an abnormal task identifier to the target processing unit based on the abnormal processing object when the processing unit where the abnormal processing object is located is consistent with the target processing unit, so that the target processing unit closes the abnormal task;

[0098] When the target number of exceptions is greater than or equal to the preset number, a second shutdown instruction for the abnormal task is determined. When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the second shutdown instruction is written into the shared memory based on the exception handling object.

[0099] The execution modules include:

[0100] A first identification reading module is used to send a task interruption instruction to a target processing unit based on an exception handling object, so that the target processing unit reads the abnormal task identification from a shared memory and closes the abnormal task corresponding to the abnormal task identification;

[0101] A second identification reading module is configured to detect the unit identification in the shared memory at a preset detection period in the preset processing unit, and when a unit identification matching the preset processing unit is detected, close the abnormal task based on the matching processing unit; the matching processing unit is the preset processing unit corresponding to the unit identification in the shared memory;

[0102] The device also includes:

[0103] Target abnormality number acquisition module: used to update the abnormality number of the abnormal task based on the abnormal task identifier to obtain the target abnormality number corresponding to the abnormal task;

[0104] The target exception acquisition module also includes:

[0105] A shutdown instruction determination module is used to determine a first shutdown instruction for the abnormal task when the target abnormal number is less than a preset number, and write the first shutdown instruction into the shared memory based on the abnormal processing object when the processing unit where the abnormal processing object is located is inconsistent with the target processing unit;

[0106] A state determination module is configured to determine the abnormal state of the abnormal task as a first state when the target processing unit calls the first shutdown service interface to close the abnormal task;

[0107] In a case where the target processing unit calls the second closing service interface to close the abnormal task, determining the abnormal state of the abnormal task as the second state;

[0108] Restart determination module: used for calling the exception handling object when the abnormal task switches from the first state to the preset state, or when the abnormal task is closed for a preset time, and passing the abnormal task identifier and the unit identifier to the exception handling object;

[0109] When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into the shared memory based on the exception handling object; so that the target processing unit performs a task restart operation on the exception task.

[0110] Restart execution module: used to write the task restart service interface into the shared memory based on the exception handling object; call the task restart service interface based on the target processing unit, and execute the task restart operation on the abnormal task corresponding to the abnormal task identifier.

[0111] Implementing this embodiment has the following effects:

[0112] 1. Calling an exception handling object with a high ASIL level of functional safety can write the exception task identifier and unit identifier into the shared memory with the target processing unit. The target processing unit reads the exception task identifier and unit identifier, and closes the exception task corresponding to the exception task identifier and unit identifier without affecting other normal operating tasks, and taking into account the exception handling object and the exception task.

[0113] 2. Based on the target number of exceptions, determine whether the exception handling object chooses to call the first shutdown service interface or the second shutdown service interface. If the exception handling object calls the first shutdown service interface, the abnormal task state is determined to be the first state, and the abnormal task in the first state can be restarted.

[0114] 3. If the exception handling object calls the second shutdown service interface, the abnormal task state is determined to be the second state, and the abnormal task in the second state cannot be restarted, further enhancing the functional safety of the electronic automobile operating system.

[0115] 4. The target processing unit can directly switch the status of the abnormal task by calling the shutdown service interface. The process is simple and fast.

[0116] 5. The monitoring function monitors the target task to be switched to the ready state or the running state. When the task state of the target task is closed, the target processing unit cannot call the preset service interface to convert the target task to the ready state or the running state.

[0117] This embodiment also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement a task processing method as described in the method embodiment.

[0118] An embodiment of the present invention also provides a storage medium, which can be set in a server to store at least one instruction, at least one program, code set or instruction set for implementing a task processing method in a method embodiment. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement a task processing method provided by the above-mentioned method embodiment.

[0119] Optionally, in this embodiment, the storage medium may be located in at least one of a plurality of network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as 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.

[0120] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention 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 numbers used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof 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.

[0121] The above description fully discloses the specific embodiments of the present invention. It should be noted that any modifications made by those skilled in the art to the specific embodiments of the present invention do not depart from the scope of the claims. Accordingly, the scope of the claims of the present invention is not limited solely to the foregoing specific embodiments.

Claims

1. A task processing method, characterized in that: include: Responding to mission exceptions; The task abnormal event includes an abnormal task identifier of the abnormal task and a unit identifier of a target processing unit where the abnormal task is located; Calling an exception handling object, and passing the exception task identifier and the unit identifier to the exception handling object; In a case where the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into a shared memory based on the exception handling object; so that the target processing unit performs a task closing operation on the exception task; when the processing unit is a physical core, the target processing unit where the exception task is located is the physical core where the exception task is located, and the physical core where the exception task is located is determined by obtaining the exception task identifier and unit identifier through a monitoring system; In a case where the processing unit where the exception processing object is located is consistent with the target processing unit, an exception task identifier is sent to the target processing unit based on the exception processing object, so that the target processing unit closes the exception task.

2. The method according to claim 1, characterized in that After writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object, the method further includes: A task interruption instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit reads the exception task identifier from the shared memory and closes the exception task corresponding to the exception task identifier.

3. The method according to claim 1, characterized in that After writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object, the method further includes: The preset processing unit detects the unit identifier in the shared memory with a preset detection cycle, and when a unit identifier matching the preset processing unit is detected, the abnormal task is closed based on the matching processing unit; the matching processing unit is the preset processing unit corresponding to the unit identifier in the shared memory.

4. The method according to claim 1, wherein After responding to the task abnormality event, the method further includes: The abnormal number of times of the abnormal task is updated based on the abnormal task identifier to obtain a target abnormal number of times corresponding to the abnormal task.

5. The method according to claim 4, characterized in that The method further comprises: When the target number of exceptions is less than a preset number, determining a first closing instruction for the abnormal task, and when the processing unit where the exception handling object is located is inconsistent with the target processing unit, writing the first closing instruction into the shared memory based on the exception handling object; When the target number of exceptions is greater than or equal to a preset number, a second shutdown instruction for the abnormal task is determined; when the processing unit where the exception handling object is located is inconsistent with the target processing unit, the second shutdown instruction is written into the shared memory based on the exception handling object.

6. The method according to claim 5, characterized in that The first shutdown instruction includes a first shutdown service interface, and the second shutdown instruction includes a second shutdown service interface; The method further comprises: In a case where the target processing unit calls the first shutdown service interface to shut down the abnormal task, determining the abnormal state of the abnormal task as a first state; In a case where the target processing unit calls the second shutdown service interface to close the abnormal task, the abnormal state of the abnormal task is determined to be a second state.

7. The method according to claim 6, characterized in that The method further comprises: When the abnormal task is switched from the first state to a preset state, or when the duration of the abnormal task being closed reaches a preset duration, calling the abnormal processing object and passing the abnormal task identifier and the unit identifier to the abnormal processing object; When the processing unit where the exception handling object is located is inconsistent with the target processing unit, the exception task identifier and the unit identifier are written into a shared memory based on the exception handling object; so that the target processing unit performs a task restart operation on the exception task.

8. The method according to claim 7, characterized in that The method further comprises: Writing the task restart service interface into the shared memory based on the exception handling object; The target processing unit calls the task restart service interface to execute a task restart operation on the abnormal task corresponding to the abnormal task identifier.

9. A task processing device, characterized in that: include: Response module: used to respond to task abnormal events; The task abnormal event includes an abnormal task identifier of the abnormal task and a unit identifier of a target processing unit where the abnormal task is located; when the processing unit is a physical core, the target processing unit where the abnormal task is located is the physical core where the abnormal task is located, and the physical core where the abnormal task is located is determined by obtaining the abnormal task identifier and unit identifier through a monitoring system; Calling module: used for calling the exception handling object and passing the exception task identifier and the unit identifier to the exception handling object; An execution closing module is configured to write the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object when the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, so that the target processing unit performs a task closing operation on the abnormal task; The interrupt instruction sending module is used to send an abnormal task identifier to the target processing unit based on the abnormal processing object when the processing unit where the abnormal processing object is located is consistent with the target processing unit, so that the target processing unit closes the abnormal task.

Citation Information

Patent Citations

  • Data sharing method for multiple virtual machines of central computing platform based on vehicle-mounted Ethernet

    CN112153116A

  • Method and apparatus for executing task by means of cluster server, and device and storage medium

    WO2020211376A1