CN114691334A - Task processing method and device - Google Patents

Task processing method and device Download PDF

Info

Publication number
CN114691334A
CN114691334A CN202210331049.XA CN202210331049A CN114691334A CN 114691334 A CN114691334 A CN 114691334A CN 202210331049 A CN202210331049 A CN 202210331049A CN 114691334 A CN114691334 A CN 114691334A
Authority
CN
China
Prior art keywords
task
abnormal
processing unit
identifier
exception
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210331049.XA
Other languages
Chinese (zh)
Inventor
谢广
韩涛
秦民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Automotive Innovation Corp
Original Assignee
China Automotive Innovation Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Automotive Innovation Corp filed Critical China Automotive Innovation Corp
Priority to CN202210331049.XA priority Critical patent/CN114691334A/en
Publication of CN114691334A publication Critical patent/CN114691334A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a task processing method and a device, belonging to the technical field of information processing, wherein the method comprises the following steps: responding to a task exception event; the task abnormal event comprises an abnormal task identifier of an abnormal task and a unit identifier of a target processing unit where the abnormal task is located; calling an exception handling object, and transmitting the exception task identifier and the unit identifier to the exception handling object; writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; the target processing unit can execute task closing operation on the abnormal task, and the method has the advantages that the abnormal task can be appointed to be closed, the normally running task cannot be involved, and the function is safe and reliable.

Description

Task processing method and device
Technical Field
The present application relates to the field of information processing technologies, and in particular, to a task processing method and apparatus.
Background
With the development of the automobile industry, the automobile holding capacity is improved, and the safety problem becomes a key point of increasing attention. Therefore, the functional safety becomes a hot topic in the automobile electronic/electrical development process.
Aiming at the requirement of functional safety, the operating system standard of automotive electronics provides the concept of OS application, and all functions of a certain electric control part are divided into different applications according to the ASIL level of functional safety. Therefore, when some non-critical functions have errors in operation, the OS application corresponding to the non-critical functions can be directly closed. And restarting the OS application corresponding to the non-critical function after the subsequent check is passed or the error is solved.
The carrier of function execution is mainly a task in the OS. In order to reduce memory consumption and improve execution efficiency, one OS application includes multiple functions, i.e., multiple tasks. In other operating systems, when an abnormal task is monitored, the abnormal task is directly deleted, that is, the task does not exist, but in an automotive electronic operating system, the task cannot be directly deleted, and only after the abnormal task is monitored, the corresponding OS application is closed, but some other functions are closed in a linked manner, so that some functions which run normally are involved and closed, and the functions are lost.
Disclosure of Invention
In order to overcome the defects and shortcomings of the prior art, the invention discloses a task processing method and a task processing system, which can close a specified abnormal task and can not be connected to a task which normally runs. The method comprises the following steps:
responding to a task exception event; the task abnormal event comprises an abnormal task identifier of an abnormal task and a unit identifier of a target processing unit where the abnormal task is located;
calling an exception handling object, and transmitting the exception task identifier and the unit identifier to the exception handling object;
writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes a task closing operation on the abnormal task.
Still further, the method further comprises:
and under the condition that the processing unit where the exception handling object is located is consistent with the target processing unit, sending an exception task identifier to the target processing unit based on the exception handling object so that the target processing unit closes the exception task.
Further, after writing the exception task identifier and the unit identifier into the shared memory based on the exception handling object, the method further includes:
sending a task interrupt instruction to the target processing unit based on the exception handling object; and enabling the target processing unit to read the abnormal task identifier from the shared memory and close the abnormal task corresponding to the abnormal task identifier.
Further, after writing the exception task identifier and the unit identifier into the shared memory based on the exception handling object, the method further includes:
detecting unit identifiers in the shared memory at a preset detection period by a preset processing unit, and closing the abnormal tasks based on a matching processing unit under the condition that the unit identifiers matched with the preset processing unit are detected; the matching processing unit is a preset processing unit corresponding to the unit identifier in the shared memory.
Still further, after the responding to the task exception event, the method further comprises:
and updating the abnormal times of the abnormal task based on the abnormal task identifier to obtain the target abnormal times corresponding to the abnormal task.
Still further, the method further comprises:
determining a first closing instruction for the exception task under the condition that the target exception frequency is less than a preset frequency, and writing the first closing instruction into the shared memory based on the exception handling object under the condition that a processing unit where the exception handling object is located is inconsistent with the target processing unit;
and under the condition that the target abnormal times is more than or equal to the preset times, determining a second closing instruction for the abnormal task, and under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, writing the second closing instruction into the shared memory based on the abnormal processing object.
Furthermore, 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 the following steps:
determining the abnormal state of the abnormal task as a first state under the condition that the target processing unit calls the first closing service interface to close the abnormal task;
and determining the abnormal state of the abnormal task as a second state under the condition that the target processing unit calls the second closing service interface to close the abnormal task.
Still further, the method further comprises:
when the abnormal task is switched from the first state to a preset state, or when the time length for closing the abnormal task reaches a preset time length, calling the abnormal processing object, and transmitting the abnormal task identifier and the unit identifier to the abnormal processing object;
writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes task restart operation on the abnormal task.
Still further, the method further comprises:
writing a task restart service interface into the shared memory based on the exception handling object;
and calling the task restarting service interface based on the target processing unit to execute task restarting operation on the abnormal task corresponding to the abnormal task identifier.
In another aspect, the present application further provides a task processing system, including:
a response module: for responding to task exception events; the task abnormal event comprises an abnormal task identifier of an abnormal task and a unit identifier of a target processing unit where the abnormal task is located;
a calling module: the unit identifier is used for transmitting the unit identifier to the exception handling object;
executing a closing module: the processing unit is used for writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes a task closing operation on the abnormal task.
The application has the following beneficial effects:
the method comprises the steps of calling an exception handling object, writing an exception task identifier and a unit identifier into a shared memory of a target handling unit, reading the exception task identifier and the unit identifier by the target handling unit, closing an exception task corresponding to the exception task identifier and the unit identifier without influencing other normally running tasks, and informing the target handling unit of closing the exception task by the exception handling object under the condition that the exception handling object and the exception task are not in the same handling unit.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic diagram of a state switching of a basic task according to an embodiment of the present invention;
fig. 2 is a schematic diagram of state switching of an extended task according to an embodiment of the present invention;
FIG. 3 is a flowchart of a task processing method according to an embodiment of the present invention;
fig. 4 is a block diagram of a task processing system according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In an automotive electronic operating system, the carrier of function execution is mainly a task in an OS application. In order to reduce memory consumption and improve execution efficiency, one OS application includes a plurality of functions, that is, one OS application includes a plurality of tasks, and the execution of the tasks is arranged by a task scheduling unit; each task comprises a plurality of task states, including a basic task state and an extended task state, wherein the basic task state comprises a running state, a ready state and a suspension state, the extended task state is that a waiting state is added to the basic task state, the extended task state is compared with the basic task state, the task can be run only when an event occurs, if the task is abnormal in the running state, the abnormal task running is terminated, the abnormal task is converted into the suspension state, the abnormality in the suspension state can be activated and enters the running state, the abnormal task in the running state has a potential safety hazard, and if the OS application in which the abnormal task is located is directly closed, the normal task is run, so that the function is lost; therefore, in the present embodiment, a shutdown state and a forced shutdown state are added to a task state, referring to fig. 1-2, when a monitoring system monitors an abnormal task, the abnormal task is switched to the shutdown state, and after it is confirmed that the abnormal task is repaired, the abnormal task is switched to a suspend state or a wait state and can run; when the monitoring system monitors that the error frequency of the abnormal task exceeds the preset frequency, the task state of the abnormal task is switched to a forced closing state, and the forced closing state can be activated only by restarting the system, so that the functional safety of the electronic automobile operating system is enhanced.
In this embodiment, the technical problem to be solved by the present invention is to directly close a specified abnormal task, and not to tie up to a function running normally, so that the system runs smoothly, and the functional safety of the operating system is ensured. Referring to the flowchart of the task processing method of fig. 3, the execution subject may be a detection system; the method comprises the following steps:
step S101: responding to a task exception event; the task exception event comprises an exception task identifier of the exception task and a unit identifier of a target processing unit where the exception task is located;
the monitoring system monitors abnormal tasks, each task comprises identification information of the task and a target processing unit where the task is located, the task system can comprise a plurality of processing units, and the plurality of processing units work independently and do not influence each other; specifically, the processing unit may be a physical core, and the monitoring system obtains an abnormal task identifier and a unit identifier of the abnormal task, and specifies the physical core where the abnormal task is located.
After step S101, the method further comprises: and updating the abnormal times of the abnormal tasks based on the abnormal task identification to obtain the target abnormal times corresponding to the abnormal tasks.
And the monitoring system monitors the error times of the tasks and updates the error times to the variable of the abnormal task identifier representing the error times.
Step S103: calling an exception handling object, and transmitting an exception task identifier and a unit identifier to the exception handling object;
the monitoring system monitors the abnormal task and calls an API (application programming interface) corresponding to the abnormal processing object, specifically, the abnormal task identifier and the unit identifier are transmitted to the API corresponding to the abnormal processing object, so that the abnormal processing object performs subsequent processing based on the abnormal task identifier and the unit identifier.
An exception handling object, namely, a handling task with a higher Level of ASIL (automatic Safety integrity Level) and a function Safety, can issue an instruction to a specified exception task without influencing other tasks which normally run, and is safer and more reliable compared with the handling task with the lower Level of ASIL; the monitoring system transmits the abnormal task identifier and the unit identifier to the abnormal processing object, and the abnormal processing object can send an instruction to a target processing unit where the abnormal task is located according to the abnormal task identifier and the unit identifier, so that the target processing unit performs corresponding processing on the abnormal task.
Step S105: writing an abnormal task identifier and a unit identifier into a shared memory based on an abnormal processing object under the condition that a processing unit where the abnormal processing object is located is inconsistent with a target processing unit; so that the target processing unit performs a task close operation on the exception task.
The operating system is provided with a plurality of processing units, a plurality of tasks are distributed in different processing units, information interaction cannot be directly carried out between two tasks in different processing units, and a corresponding processing instruction cannot be directly sent to a target processing unit, so that the target processing unit can process an abnormal task; and the exception processing object writes the exception task identifier and the unit identifier into a shared memory, the shared memory can be read by all the processing units, and the target processing unit reads the exception task identifier and the unit identifier in the shared memory.
Step S201: and under the condition that the processing unit where the exception handling object is located is consistent with the target processing unit, sending an exception task identifier to the target processing unit based on the exception handling object so that the target processing unit closes the exception task.
The task interruption instruction is used for reminding the target processing unit to stop execution of the abnormal task, and under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, the target processing unit reads an abnormal identifier in the shared memory after being reminded, and performs state conversion on the abnormal task corresponding to the abnormal identifier.
The processing unit where the exception handling object is located is consistent with the target processing unit and can directly carry out information interaction, the exception handling object transmits an 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 an exception task corresponding to the exception task identifier.
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:
sending a task interrupt instruction to a target processing unit based on an exception handling object; and the target processing unit reads the abnormal task identifier from the shared memory and closes the abnormal task corresponding to the abnormal task identifier.
The exception handling object can send a task interrupt instruction to the specified target processing unit, the target processing unit reads an exception task identifier in the shared memory after receiving the task interrupt instruction, and executes task closing operation on an exception task corresponding to the exception task identifier. The exception handling object can send a task interrupt instruction to the target processing unit, which indicates that an exception task needs to be handled in the target processing unit, after receiving the task interrupt instruction, the target processing unit can read an exception task identifier of the exception task from the shared memory, and the target processing unit can know the exception task corresponding to the exception task identifier and perform closing operation on the exception task, so that the technical effect of closing the specified exception task is achieved.
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:
detecting unit identifiers in the shared memory at a preset detection period by a preset processing unit, and closing an abnormal task based on a matching processing unit under the condition that the unit identifiers matched with the preset processing unit are detected; the matching processing unit is a preset processing unit corresponding to the unit identifier in the shared memory.
The preset processing unit is any processing unit in an operating system, after an exception task identifier is written into a shared memory by an exception handling object, a task interrupt instruction is not sent to an appointed target processing unit, each processing unit polls and reads whether an exception task identifier matched with the own processing unit exists in the shared memory or not through a certain period, the matching means that the unit identifier of the preset processing unit is consistent with the unit identifier in the shared memory, each processing unit polls and reads the shared memory through the preset period, whether a task identifier of a task of the own processing unit exists in the shared memory or not is judged, if yes, the task identifier of the task of the own processing unit exists in a plurality of tasks of the own processing unit, and if yes, closing operation is executed on the exception task corresponding to the exception task identifier.
In the closing operation executing process, a corresponding executing instruction can be determined according to the abnormal information of the abnormal task at the current moment; specifically, the exception information may be the number of times that an exception task is abnormal, it is determined that a task state of the exception task is switched to an off state or a forced off state according to the number of times that the exception task is abnormal, if it is determined that the task state of the exception task is the off state, it is necessary to determine an instruction to close the exception task, so that the exception task is switched to the off state, and if it is determined that the task state is the forced off state, it is necessary to determine an instruction to forcibly close the exception task, so that the exception task is switched to the forced off state, the method includes:
step S401: determining a first closing instruction for the abnormal task under the condition that the target abnormal times are smaller than preset times, and writing the first closing instruction into the shared memory based on the abnormal processing object under the condition that a processing unit where the abnormal processing object is located is inconsistent with the target processing unit;
when the target abnormal times are smaller than the preset times, determining to convert the task state of the abnormal task into a closing state, determining to close an abnormal task instruction, namely a first closing instruction, and under the condition that a processing unit where the abnormal processing object is located is inconsistent with the target processing unit, writing the first instruction into the shared memory by the abnormal processing object, reading the first instruction by the target processing unit, and switching the abnormal task into the closing state; and if the processing unit where the exception processing object is located is consistent with the target processing unit, the target processing unit directly receives the first closing instruction and switches the exception task to a closing state or a waiting state.
The first closing instruction comprises a first closing service interface; the second closing instruction comprises a second closing service interface; the first closing service interface is an API service interface for converting the abnormal task from the basic task state and the extended task state to the closing state, the second closing service interface is an API service interface for converting the abnormal task state from the basic task state and the extended task state to the forced closing state,
step S501: determining the abnormal state of the abnormal task as a first state under the condition that the target processing unit calls the first closing service interface to close the abnormal task;
when the target processing unit determines to call the first closing service interface to close the abnormal task, the abnormal task is converted from the basic task state or the extended task state to the closing state, which specifically includes:
acquiring the current state of the abnormal task according to the abnormal task identifier based on the abnormal processing object; under the condition that the current state is the running state, a closing instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit releases resources occupied by the exception task, closes the exception task, and triggers the task scheduling unit; the task scheduling unit schedules the execution of the tasks;
under the condition that the current state is a ready state, sending a closing instruction to the target processing unit based on the exception handling object so that the target processing unit moves the exception task out of the ready state and closes the exception task;
when the current state is another state, such as a suspend state or a wait 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 exception task.
Step S503: and under the condition that the target processing unit calls the second closing service interface to close the abnormal task, determining the abnormal state of the abnormal task as a second state.
And under the condition that the target processing unit calls the second closing service interface to close the abnormal task, converting the abnormal task into a forced closing state, wherein the forced closing state can be converted from any state of the task, and as long as the abnormal frequency of the abnormal task exceeds the preset frequency, the target processing unit calls the second closing service interface to forcibly close the abnormal task.
When the abnormal task is switched to the closed state, the current state of the abnormal task needs to be acquired,
after the state of the abnormal task is switched to the closed state, the monitoring system can continue to monitor the abnormal task, and under the condition that the abnormal task is determined to be repaired, the abnormal task is switched from the closed state to the basic task state or the expanded task state, and the method comprises the following steps:
step S601: when the abnormal task is switched from the first state to the preset state or the time length for closing the abnormal task reaches the preset time length, calling an abnormal processing object, and transmitting the abnormal task identifier and the unit identifier to the abnormal processing object;
the abnormal task monitoring method comprises the steps that a preset state is an abnormal task state which can be converted into a ready state or a running state, the abnormal task is represented to be repaired, in order to ensure complete system functions, the abnormal task which is in a closed state reaches preset time and is not switched to a forced closed state is determined to be repaired, a monitoring system calls an abnormal processing object, the abnormal task in the closed state is switched to a basic task state or an expanded task state, and an abnormal task identifier and a unit identifier of the repaired abnormal task are transmitted to the abnormal processing object by the monitoring system.
Step S603: writing the abnormal task identifier and the unit identifier into a shared memory based on an abnormal processing object under the condition that a 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 restart operation on the exception task.
Step S701: writing the task restart service interface into the shared memory based on the exception handling object;
under the condition that a processing unit where the exception handling object is located is inconsistent with a target processing unit, the exception handling object writes a task restarting service interface into a shared memory;
similarly, under the condition that the processing unit where the exception handling object is located is consistent with the target processing unit, the exception handling object directly transmits 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 shutdown state to the ready state or the waiting state.
Step S703: and calling a task restarting service interface based on the target processing unit to execute task restarting operation on the abnormal task corresponding to the abnormal task identifier.
And the mark processing unit calls the task restarting service interface to execute task restarting operation on the abnormal task corresponding to the abnormal task identifier, the abnormal task in the closing state is switched to a suspension state or a waiting state, the abnormal task in the suspension state or the waiting state can be switched to a ready state, and then the abnormal task is started and switched to the running state.
Furthermore, before the abnormal task in the shutdown state is not determined to be repaired, the abnormal task is ensured not to be restarted, the monitoring system monitors the target task to be converted into the ready state or the running state, and judges whether the current state of the target task is the shutdown state or not. If the current state of the target task is not the closed state, the target task can continue to be switched by the processing unit of the target task.
After the monitoring system monitors that a task which has an error before the monitoring system normally runs once, the corresponding abnormal count is reduced, and the increasing and reducing rate can be set according to the actual situation, for example, the monitoring system monitors that the abnormal task has an abnormal number of times of 10 and a preset number of times of 15, calls an abnormal processing object to send a task interrupt instruction to a target processing unit, the target processing unit converts the abnormal task into a closed state, and after the abnormal task is determined to be repaired, the abnormal task in the closed state is not run, so the abnormal number of times cannot be increased, the abnormal task is also determined to be repaired within a certain time, the target processing unit converts the repaired abnormal task into a suspended state, and after the abnormal task is normally run once, the detection system reduces the record of the abnormal number of times of the abnormal task from the previous 10 times to 9 times, if the abnormal task is normally operated subsequently, the abnormal frequency can be cleared, if the abnormal frequency reaches 15, the abnormal task is switched to a closed state, and the current safety state of the abnormal task is objectively judged by increasing or decreasing the count.
In addition, the rate of increasing and decreasing the abnormal error times is set according to the system performance, for example, in an operating system, for some OS applications with high precision requirements, the safety requirements of the corresponding tasks are also increased, the rate of increasing the abnormal times of the corresponding tasks is increased, the corresponding abnormal tasks can be quickly and automatically switched to a closed state, even a forced closed state, the judgment condition for repairing the abnormal tasks can be increased, for example, the preset time in the closed state is prolonged, and the running tasks can be ensured to normally run; for tasks with lower precision requirements, the rate of increasing the number of abnormal times can be reduced, the operation of the abnormal processing object can be reduced, and the processing efficiency of the abnormal processing object can be improved.
Step S403: and under the condition that the target abnormal times is more than or equal to the preset times, determining a second closing instruction for the abnormal task, and under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, writing the second closing instruction into the shared memory based on the abnormal processing object.
When the target abnormal times are larger than or equal to the preset times, determining to convert the task state of the abnormal task into a forced closing state, determining a forced closing abnormal task instruction, namely a second closing instruction, by the abnormal processing object, writing the second instruction into the shared memory by the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, reading the second instruction by the target processing unit, and switching the abnormal task into the forced closing state; and if the processing unit where the exception processing object is located is consistent with the target processing unit, the target processing unit directly receives the second closing instruction and switches the exception task to a forced closing state.
Under the condition that the abnormal task is switched to a forced closing state, the current state of the abnormal task needs to be acquired, and the current state of the abnormal task is acquired according to the abnormal task identification based on the abnormal processing object; under the condition that the current state is the running state, a closing instruction is sent to the target processing unit based on the exception handling object, so that the target processing unit releases resources occupied by the exception task, the exception task is switched to a forced closing state, and a task scheduling unit is triggered; the task scheduling unit schedules the execution of other tasks.
Under the condition that the current state is a ready state, sending a closing instruction to a target processing unit based on an exception handling object so that the target processing unit moves an exception task out of the ready state and switches to a forced closing state;
under the condition of a suspension state or a waiting state of the current state, sending a closing instruction to the target processing unit based on the exception handling object so as to enable the target processing unit to close the exception task;
it should be noted that the abnormal task can be converted into the forced shutdown state only when the abnormal number of times of the abnormal task exceeds the preset number of times, and if the abnormal task can be activated to run at this time, a great potential safety hazard is caused.
The present embodiment also provides a task processing device, which can implement the functions of all the methods described above, and with reference to the structural block diagram of the task processing system in fig. 4, the system includes:
the response module 410: for responding to task exception events; the task exception event comprises an exception task identifier of the exception task and a unit identifier of a target processing unit where the exception task is located;
the calling module 420: the abnormal processing object is used for calling the abnormal processing object and transmitting the abnormal task identifier and the unit identifier to the abnormal processing object;
the execute shutdown module 430: the shared memory is used for writing the abnormal task identifier and the unit identifier into the shared memory based on the abnormal processing object under the condition that 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 close operation on the exception task.
The device also includes:
an interrupt instruction sending module: the processing unit is used for sending an abnormal task identifier to the target processing unit based on the abnormal processing object under the condition that 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;
and under the condition that the target abnormal times are more than or equal to the preset times, determining a second closing instruction for the abnormal task, and under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, writing the second closing instruction into the shared memory based on the abnormal processing object.
The execution module comprises:
a first identification reading module: the system comprises a task interrupt instruction, a task interrupt processing unit and a task interrupt processing unit, wherein the task interrupt instruction is used for sending a task interrupt instruction to a target processing unit based on an exception handling object; enabling the target processing unit to read the abnormal task identifier from the shared memory and close the abnormal task corresponding to the abnormal task identifier;
a second identification reading module: the system comprises a preset processing unit, a matching processing unit and a shared memory, wherein the preset processing unit is used for detecting unit identifiers in the shared memory in a preset detection period and closing an abnormal task based on the matching processing unit under the condition that the unit identifiers matched with the preset processing unit are detected; the matching processing unit is a preset processing unit corresponding to the unit identifier in the shared memory;
the device also includes:
a target anomaly number acquisition module: the abnormal task identification is used for updating the abnormal times of the abnormal task based on the abnormal task identification to obtain target abnormal times corresponding to the abnormal task;
the target abnormality acquisition number module further includes:
a shutdown instruction determination module: the first closing instruction is used for determining a first closing instruction for the abnormal task under the condition that the target abnormal frequency is smaller than the preset frequency, and writing the first closing instruction into the shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit;
a state determination module: the method comprises the steps that when a target processing unit calls a first closing service interface to close an abnormal task, the abnormal state of the abnormal task is determined to be a first state;
determining the abnormal state of the abnormal task as a second state under the condition that the target processing unit calls the second closing service interface to close the abnormal task;
a restart determination module: the abnormal task processing method comprises the steps of calling an abnormal processing object and transmitting an abnormal task identifier and a unit identifier to the abnormal processing object under the condition that the abnormal task is switched from a first state to a preset state or the condition that the time length for closing the abnormal task reaches the preset time length;
writing an abnormal task identifier and a unit identifier into a shared memory based on an abnormal processing object under the condition that a processing unit where the abnormal processing object is located is inconsistent with a target processing unit; so that the target processing unit performs a task restart operation on the exception task.
And the restarting execution module: the task restarting service interface is used for writing the task restarting service interface into the shared memory based on the exception handling object; and calling a task restarting service interface based on the target processing unit, and executing task restarting operation on the abnormal task corresponding to the abnormal task identifier.
The embodiment has the following effects:
1. calling an exception handling object with a high ASIL level and safe function, writing an exception task identifier and a unit identifier into a shared memory of a target processing unit, reading the exception task identifier and the unit identifier by the target processing unit, closing an exception task corresponding to the exception task identifier and the unit identifier without influencing other normally running tasks, and considering the exception handling object and the exception task.
2. And determining that the exception handling object selects to call the first closed service interface or the second closed service interface based on the target exception times, and if the exception handling object calls the first closed service interface, determining that the exception task state is a first state, and restarting the exception task in the first state.
3. If the abnormal processing object calls the second closing service interface, the abnormal task state is determined to be the second state, the abnormal task in the second state cannot be restarted, and the functional safety of the electronic automobile operating system is further enhanced.
4. The target processing unit can directly switch the state of the abnormal task by calling the service closing interface, and the process is simple and quick.
5. The monitoring function monitors a target task to be switched to a ready state or a running state, and when the task state of the target task is a closed state, the target processing unit cannot call a preset service interface to convert the target task into the ready state or the running state.
The present embodiment also provides an electronic device, which includes a processor and a memory, where at least one instruction, at least one program, a set of codes, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement a task processing method as in the method embodiment.
Embodiments of the present invention further provide a storage medium, which may be disposed in a server to store at least one instruction, at least one program, a set of codes, or a set of instructions for implementing a task processing method in the method embodiments, where the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by the processor to implement the method embodiments as described above.
Alternatively, in this embodiment, the storage medium may be located in at least one network server of a plurality of network servers of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The foregoing description has disclosed fully preferred embodiments of the present invention. It should be noted that those skilled in the art can make modifications to the embodiments of the present invention without departing from the scope of the appended claims. Accordingly, the scope of the appended claims is not to be limited to the specific embodiments described above.

Claims (10)

1. A task processing method, comprising:
responding to a task exception event; the task abnormal event comprises an abnormal task identifier of an abnormal task and a unit identifier of a target processing unit where the abnormal task is located;
calling an exception handling object, and transmitting the exception task identifier and the unit identifier to the exception handling object;
writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes task closing operation on the abnormal task.
2. The method of claim 1, further comprising:
and under the condition that the processing unit where the exception handling object is located is consistent with the target processing unit, sending an exception task identifier to the target processing unit based on the exception handling object so that the target processing unit closes the exception task.
3. The method of claim 1, wherein after writing the exception task identifier and the unit identifier to a shared memory based on the exception handling object, the method further comprises:
sending a task interrupt instruction to the target processing unit based on the exception handling object; and enabling the target processing unit to read the abnormal task identifier from the shared memory and close the abnormal task corresponding to the abnormal task identifier.
4. The method of claim 1, wherein after writing the exception task identifier and the unit identifier to a shared memory based on the exception handling object, the method further comprises:
detecting unit identifiers in the shared memory at a preset detection period by a preset processing unit, and closing the abnormal tasks based on a matching processing unit under the condition that the unit identifiers matched with the preset processing unit are detected; the matching processing unit is a preset processing unit corresponding to the unit identifier in the shared memory.
5. The method of claim 1, wherein after the response to a task exception event, the method further comprises:
and updating the abnormal times of the abnormal task based on the abnormal task identifier to obtain the target abnormal times corresponding to the abnormal task.
6. The method of claim 5, further comprising:
determining a first closing instruction for the exception task under the condition that the target exception frequency is less than a preset frequency, and writing the first closing instruction into the shared memory based on the exception handling object under the condition that a processing unit where the exception handling object is located is inconsistent with the target processing unit;
and under the condition that the target abnormal times is more than or equal to the preset times, determining a second closing instruction for the abnormal task, and under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit, writing the second closing instruction into the shared memory based on the abnormal processing object.
7. The method of claim 6, wherein the first shutdown instruction comprises a first shutdown service interface, and wherein the second shutdown instruction comprises a second shutdown service interface;
the method further comprises the following steps:
determining the abnormal state of the abnormal task as a first state under the condition that the target processing unit calls the first closing service interface to close the abnormal task;
and determining the abnormal state of the abnormal task as a second state under the condition that the target processing unit calls the second closing service interface to close the abnormal task.
8. The method of claim 7, further comprising:
when the abnormal task is switched from the first state to a preset state, or when the time length for closing the abnormal task reaches a preset time length, calling the abnormal processing object, and transmitting the abnormal task identifier and the unit identifier to the abnormal processing object;
writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes task restart operation on the abnormal task.
9. The method of claim 8, further comprising:
writing a task restart service interface into the shared memory based on the exception handling object;
and calling the task restarting service interface based on the target processing unit, and executing task restarting operation on the abnormal task corresponding to the abnormal task identifier.
10. A task processing apparatus, comprising:
a response module: for responding to task exception events; the task abnormal event comprises an abnormal task identifier of an abnormal task and a unit identifier of a target processing unit where the abnormal task is located;
a calling module: the unit identifier is used for transmitting the unit identifier to the exception handling object;
executing a closing module: the processing unit is used for writing the abnormal task identifier and the unit identifier into a shared memory based on the abnormal processing object under the condition that the processing unit where the abnormal processing object is located is inconsistent with the target processing unit; so that the target processing unit executes task closing operation on the abnormal task.
CN202210331049.XA 2022-03-30 2022-03-30 Task processing method and device Pending CN114691334A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210331049.XA CN114691334A (en) 2022-03-30 2022-03-30 Task processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210331049.XA CN114691334A (en) 2022-03-30 2022-03-30 Task processing method and device

Publications (1)

Publication Number Publication Date
CN114691334A true CN114691334A (en) 2022-07-01

Family

ID=82140428

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210331049.XA Pending CN114691334A (en) 2022-03-30 2022-03-30 Task processing method and device

Country Status (1)

Country Link
CN (1) CN114691334A (en)

Similar Documents

Publication Publication Date Title
CN103201724B (en) Providing application high availability in highly-available virtual machine environments
CN101464819B (en) Hardware driven processor state storage prior to entering low power mode
CN108874624B (en) Server, method for monitoring Java process and storage medium
US10545807B2 (en) Method and system for acquiring parameter sets at a preset time interval and matching parameters to obtain a fault scenario type
CN106789306B (en) Method and system for detecting, collecting and recovering software fault of communication equipment
CN101236515B (en) Multi-core system single-core abnormity restoration method
CN102141947A (en) Method and system for processing abnormal task in computer application system adopting embedded operating system
CN100583782C (en) Software upgrade method and device
CN110119325B (en) Server fault processing method, device, equipment and computer readable storage medium
CN110502399B (en) Fault detection method and device
CN113672306B (en) Server component self-checking abnormity recovery method, device, system and medium
CN111897626A (en) Cloud computing scene-oriented virtual machine high-reliability system and implementation method
CN114691334A (en) Task processing method and device
CN109062718B (en) Server and data processing method
US20060048000A1 (en) Process management system
US12008396B2 (en) Application state control method apparatus, and terminal and computer-readable storage medium
CN115499493A (en) Asynchronous transaction processing method and device, storage medium and computer equipment
CN111538604B (en) Distributed task processing system
CN118363737B (en) GPU interrupt reporting method, device, equipment and medium
CN114428695B (en) Abnormal hierarchical processing method and system for behavioral tree of group unmanned system
CN110968486A (en) Script running method and device
CN114895849B (en) Data migration storage method, device and management node
CN110109740B (en) Crontab command execution method and device
JP2000293407A (en) Monitoring controller, cpu monitoring method and program recording medium
CN107577571B (en) Problem positioning method and multi-core processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination