System guard time determination method of multi-task system, multi-task system and medium

By determining the task guard time in a multitask system that meets the preset conditions, and dynamically adjusting the system guard time, the problem of slow or false reset time in a fixed-time watchdog timer in a multitask system is solved, and the system is quickly restored and stable.

CN119718729APending Publication Date: 2025-03-28GD MIDEA AIR CONDITIONING EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311259703.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In existing multitasking systems, the watchdog timer that fixes the system guard time is slow to reset when the task is abnormal, or it is easy to accidentally trigger the system reset when the multitasking is running.

Method used

By determining a specified task in a specified running state in a multitasking system, its corresponding task daemon time is used to determine the system daemon time. The specific method includes determining a target task in multiple tasks whose task guard time meets the preset time conditions, and dynamically adjusting the system guard time based on the task guard time of the task.

Benefits of technology

It realizes dynamic adjustment of system guard time in a multi-task system, so that the watchdog timer can quickly restore the system state while ensuring the stability of the multi-task system to the greatest extent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718729A_ABST
    Figure CN119718729A_ABST
Patent Text Reader

Abstract

The invention relates to a system guard time determination method of a multi-task system, the multi-task system and a medium. The method comprises the following steps: when a plurality of tasks of the multi-task system run at the same time, determining a specified task in a specified running state in the plurality of tasks; wherein the specified task corresponds to task guard time; the task guard time is used for representing the duration required by normal operation or starting of the specified task; determining a first target task of which the task guarding time meets a preset time condition in the specified tasks; and determining the system guard time of the multi-task system based on the task guard time corresponding to the first target task. According to the embodiment of the invention, the system guard time is continuously updated along with the task running process in the multi-task system, the system state can be quickly recovered when the task is abnormal, and the stability of the multi-task system can be ensured to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present specification relates to the technical field of multi-task systems, and in particular to a method for determining a system guard time of a multi-task system, a multi-task system, and a medium. Background Art

[0002] Generally, the system will be affected by various factors and cause task execution exceptions. For these exceptions, a watchdog timer is usually configured in the system to monitor the tasks in the system so that the system can be reset after an exception occurs. However, with the development of technology, the operating system design of equipment in various fields is becoming more and more complex, especially now there are many systems that can support multi-task operation.

[0003] Generally, the watchdog timer in the system will use a fixed system guard time to monitor tasks. However, if the system guard time is set too long, the system reset time will be slow when an abnormality occurs; and if the system guard time is set too short, it is easy to trigger a system reset by mistake when multiple tasks are running. Summary of the invention

[0004] The present specification aims to solve one of the technical problems in the related art at least to a certain extent. To this end, one purpose of the present specification is to propose a method for determining the system guard time of a multi-task system.

[0005] The second objective of this specification is to provide a system guard time determination device for a multi-task system.

[0006] The third objective of this specification is to provide a multi-tasking system.

[0007] A fourth objective of this specification is to provide a computer-readable storage medium.

[0008] To achieve the above-mentioned purpose, the first aspect of the embodiment of the present specification proposes a method for determining the system guard time of a multi-task system, and the system guard time determination method includes: when multiple tasks of the multi-task system are running simultaneously, determining a specified task in a specified running state among the multiple tasks; wherein the specified task corresponds to a task guard time; the task guard time is used to characterize the time required for the normal operation or startup of the specified task; determining a first target task whose task guard time meets a preset time condition among the specified tasks; and determining the system guard time of the multi-task system based on the task guard time corresponding to the first target task.

[0009] In some embodiments of the present specification, the designated running state is a running state; and determining the designated task in the designated running state among the multiple tasks includes: determining the running task in the running state among the multiple tasks.

[0010] In some embodiments of the present specification, determining the first target task in the designated task whose task guard time satisfies a preset time condition includes: determining the minimum task guard time among the task guard times corresponding to the designated task; and taking the designated task corresponding to the minimum task guard time as the first target task.

[0011] In some embodiments of the present specification, the designated task is stored in a linked list; the method further includes: after the first target task is completed, modifying the designated running state corresponding to the first target task to another running state. Among the remaining tasks and / or newly added tasks in the linked list, determine a second target task whose task guard time meets a preset time condition; wherein the remaining tasks are other designated tasks in the designated tasks except the first target task; the newly added task is a task in the designated running state that is newly added to the linked list during the running of the first target task; based on the task guard time corresponding to the second target task, determine the system guard time of the multi-task system.

[0012] In some embodiments of the present specification, the specified tasks are stored in a linked list; the method further includes: for any specified task in the linked list, obtaining the actual running time of any specified task; if the actual running time exceeds the task guard time corresponding to any specified task, marking any specified task.

[0013] In some embodiments of the present specification, the method also includes: if any of the specified tasks is the first target task, performing an exception handling operation; or if any of the specified tasks is other specified tasks other than the first target task, performing an exception handling operation when the other specified tasks are determined to be third target tasks whose task guard time satisfies the preset time condition.

[0014] In some embodiments of the present specification, the method further includes: when multiple tasks of the multi-task system are executed in serial, determining a currently running task among the multiple tasks; and determining a task guard time corresponding to the currently running task as a system guard time of the multi-task system.

[0015] In some embodiments of the present specification, the method also includes: determining the working mode entered by the multi-task system according to the type of the received trigger signal; wherein the working mode is a first working mode or a second working mode; in the first working mode, multiple tasks of the multi-task system run simultaneously, and in the second working mode, multiple tasks of the multi-task system run in serial.

[0016] To achieve the above-mentioned purpose, the second embodiment of the present specification proposes a system guard time determination device for a multi-task system. The system guard time determination device includes: a designated task determination module, which is used to determine a designated task in a designated running state among the multiple tasks when multiple tasks of the multi-task system are running simultaneously; wherein the designated task corresponds to a task guard time; the task guard time is used to characterize the time required for the normal operation or startup of the designated task; a target task determination module, which is used to determine the first target task whose task guard time meets the preset time condition among the designated tasks; and a time determination module, which is used to determine the system guard time of the multi-task system based on the task guard time corresponding to the first target task.

[0017] To achieve the above-mentioned purpose, the third aspect embodiment of the present specification proposes a multi-tasking system, including a memory, a processor, and a system guard time determination program for the multi-tasking system stored in the memory and executable on the processor, wherein when the processor executes the system guard time determination program for the multi-tasking system, the system guard time determination method for the multi-tasking system as described in any one of the first aspects is implemented.

[0018] To achieve the above-mentioned purpose, the fourth aspect embodiment of the present specification proposes a computer-readable storage medium, on which a system guard time determination program for a multi-tasking system is stored. When the system guard time determination program for the multi-tasking system is executed by a processor, a system guard time determination method for a multi-tasking system as described in any one of the first aspects is implemented.

[0019] Through the above-mentioned embodiment, when multiple tasks of a multi-task system are running at the same time, first, a designated task in a designated running state is determined among the multiple tasks. A first target task whose task guard time meets the preset time condition is determined among the designated tasks, and the system guard time of the multi-task system is determined based on the task guard time corresponding to the first target task. In the event that the first target task that meets the preset time condition changes, the system guard time will also change. The system guard time of the embodiment of this specification is continuously updated as the tasks in the multi-task system run, and a suitable system guard time can be determined based on the preset time condition, so that the watchdog timer can quickly restore the system state when a task abnormality occurs and can maximize the stability of the multi-task system.

[0020] Additional aspects and advantages of the present specification will be given in part in the description below and in part will become apparent from the description below or will be learned through the practice of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a flow chart of a method for determining the system guard time of a multi-task system proposed in an embodiment of this specification.

[0022] Figure 2 It is a schematic diagram of the task guarding time and scheduling level of the air conditioner local object model in one embodiment of the present specification.

[0023] Figure 3 It is a schematic diagram of a linked list of an embodiment of this specification.

[0024] Figure 4 It is a schematic diagram of the running state transition of a task according to an embodiment of the present specification.

[0025] Figure 5 It is a flow chart of a method for determining the system guard time of an air conditioner according to an embodiment of the present specification.

[0026] Figure 6 It is a structural block diagram of a system guard time determination device for a multi-task system proposed in an embodiment of this specification.

[0027] Figure 7 is a structural block diagram of a multi-tasking system according to an embodiment of the present specification. DETAILED DESCRIPTION

[0028] The embodiments of the present specification are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present specification, and should not be construed as limiting the present specification.

[0029] Generally, the system will be affected by various factors and cause task execution exceptions. For example, the general system exceptions are divided into active exceptions and passive exceptions. Active exceptions are generally handled by active recovery protection, while passive exceptions refer to external interference suspension and memory usage segmentation errors. At present, in the relevant technology, in the case of system exceptions, a watchdog timer is usually configured in the system to monitor the tasks in the system so that the system can be reset after an exception occurs.

[0030] However, with the development of science and technology, the design of operating systems of equipment in various fields is becoming more and more complex, especially now there are many systems that can support multi-task operation. For example, in order to realize local applications and network applications, home appliances in current smart homes usually integrate local object models and network service components of home appliances into the system of home appliances. In this system of local object models and network service components, high real-time tasks and complex network tasks will coexist.

[0031] In general, the watchdog timer in the system usually uses a fixed system guard time to monitor tasks. However, if the system guard time is set too long, the system reset time will be slow when an abnormality occurs in a task; and if the system guard time is set too short, it is easy to trigger a system reset by mistake when multiple tasks are running. Therefore, the embodiments of this specification propose a method for determining the system guard time of a multi-task system, a multi-task system, and a medium.

[0032] Figure 1 This is a flow chart of a method for determining the system guard time of a multi-task system proposed in an embodiment of this specification. Figure 1 , the system guard time determination method includes:

[0033] S110, when multiple tasks of the multi-task system are running simultaneously, determining a designated task in a designated running state among the multiple tasks.

[0034] The specified task has a task guarding time corresponding to it; the task guarding time is used to represent the time required for the normal operation or startup of the specified task.

[0035] S120, determining a first target task in the designated task whose task guard time satisfies a preset time condition.

[0036] S130: Determine the system guard time of the multi-task system based on the task guard time corresponding to the first target task.

[0037] In an embodiment of the present specification, a multi-task system is configured with a watchdog timer. A watchdog timer (WDT) is a hardware timer that is usually used to monitor the operating status of an embedded system and take measures when the system is stagnant or abnormal. Using a fixed-time watchdog timer to reset the system is a common system robustness enhancement measure. When the system is operating normally, a signal is sent to the watchdog timer regularly to indicate that the system is operating normally. This signal is usually implemented by writing a watchdog register or executing a specific instruction. If the system is operating normally, the watchdog timer will not time out. If an abnormal situation occurs in the system, the watchdog timer will take effect after the timer times out. Once the watchdog timer times out, it will send a reset signal to the system, causing the system to restart. This will force the system to return to a normal state to some extent. Therefore, if a watchdog timer with a fixed system guard time is still used when multiple tasks of the multi-task system are running simultaneously, it may cause a false triggering of the system reset. Therefore, the system guard time of the watchdog timer in the embodiment of the present specification is continuously updated as the tasks run.

[0038] Specifically, each of the multiple tasks in the multi-task system is provided with a corresponding task guard time, which is used to characterize the time required for the normal operation or startup of the corresponding task. If multiple tasks of the multi-task system are running at the same time, a specified task in a specified running state is determined among the multiple tasks. The running state of a task in the system can have multiple forms, such as running state, blocked state, ready state, etc. The specified running state can be set according to different system requirements.

[0039] The task guarding time corresponding to different designated tasks may be different. When multiple tasks are running at the same time, if the watchdog timer is to be able to quickly restore the system state when a task abnormality occurs while monitoring multiple tasks and to maximize the stability of the multi-task system, it is necessary to set a suitable system guarding time for the watchdog timer. Therefore, in the embodiment of the present specification, it is necessary to determine the first target task whose task guarding time meets the preset time condition in the designated task. Then, based on the task guarding time corresponding to the first target task, the system guarding time of the multi-task system is determined. It can be understood that when the first target task changes, the system guarding time will also change with the task guarding time corresponding to the first target task.

[0040] Through the above-mentioned embodiment, when multiple tasks of a multi-task system are running at the same time, first, a designated task in a designated running state is determined among the multiple tasks. A first target task whose task guard time meets the preset time condition is determined among the designated tasks, and the system guard time of the multi-task system is determined based on the task guard time corresponding to the first target task. In the event that the first target task that meets the preset time condition changes, the system guard time will also change. The system guard time of the embodiment of this specification is continuously updated as the tasks in the multi-task system run, and a suitable system guard time can be determined based on the preset time condition, so that the watchdog timer can quickly restore the system state when a task abnormality occurs and can maximize the stability of the multi-task system.

[0041] In some embodiments of the present specification, the designated running state is a running state. Determining a designated task in the designated running state from among multiple tasks includes: determining a running task in the running state from among multiple tasks.

[0042] In a multi-tasking system, the running state of a task is determined by the running state of its corresponding thread, which can include multiple forms. For the running state of a thread, it can include: thread scheduling running state (RUNNING), thread scheduling blocking state (PEND), thread scheduling ready state (RDY), and thread scheduling sleeping state (SLP). Among them, when a thread is in the thread scheduling running state, it means that it is currently executing instructions on the CPU, that is, it is running its task code. When a thread is in the thread scheduling blocking state, it means that it cannot continue to execute for some reason, usually due to waiting for some external event to occur, such as waiting for the completion of an I / O operation, waiting for a mutex lock, waiting for a signal, etc. A thread in the thread scheduling blocking state does not occupy the CPU, so it can give other threads a chance to execute. Once the waiting event occurs, the thread will transfer to the thread scheduling ready state. When a thread is in the thread scheduling ready state, it means that it is ready to execute, but has not yet been allocated a CPU time slice. When a thread is in the thread scheduling sleeping state, it means that it has actively given up the execution right of the CPU because it needs to wait for a period of time or until a certain event occurs. Threads in the thread scheduling sleeping state do not occupy CPU resources, so it helps to reduce system load. A thread can enter the sleep state through mechanisms such as timed waiting and conditional variables, and be awakened under specific conditions and converted to the ready state.

[0043] In an embodiment of the present specification, a multi-task system supports multi-threaded concurrency and parallel operation. Multiple tasks can be executed by multiple threads, wherein each task can contain multiple threads, and different tasks can be executed in parallel. For each task, the running state corresponding to the task can be determined based on the running state of its thread. Exemplarily, if the threads contained in task A are all in the thread scheduling ready state at the current moment, the running state corresponding to task A at the current moment is the ready state. If any thread in task A is in the thread scheduling running state, the running state corresponding to task A is the running state. In addition to the ready state and the running state, the running state of a task also includes a sleeping state and a blocked state.

[0044] In the embodiment of the present specification, the watchdog timer can monitor whether an abnormal situation occurs in the task in the running state. Therefore, the system guard time used by the watchdog timer is determined in the task guard time corresponding to the designated task in the running state. The designated running state is the running state, and the running task in the running state is determined as the designated task among multiple tasks.

[0045] In some embodiments of the present specification, determining a first target task whose task guarding time satisfies a preset time condition in a specified task includes: determining a minimum task guarding time in the task guarding times corresponding to the specified task, and taking the specified task corresponding to the minimum task guarding time as the first target task.

[0046] Since the multi-task system of the embodiments of this specification supports multiple tasks running simultaneously, and the task guard times corresponding to multiple tasks may be different. Therefore, in order to reduce the abnormal situation that tasks with smaller task guard times cannot be monitored due to unreasonable system guard time settings, in the embodiments of this specification, the minimum task guard time is determined among the task guard times corresponding to the specified tasks, the specified task corresponding to the minimum task guard time is used as the first target task, and the minimum task guard time is used as the system guard time.

[0047] Specifically, the minimum superposition algorithm TW+ = (Tn < Tn+1)? Tn : Tn+1 can be used to determine the system guard time. Where TW represents the system guard time, n represents the label of the specified task, and Tn represents the specified task n. By judging the size of the task guard times of any two specified tasks through the above formula, the minimum task guard time among the specified tasks is finally determined as the system guard time TW.

[0048] Exemplarily, taking the air conditioner in a smart home as an example for illustration. Due to application requirements, multiple physical models can be integrated in the air conditioner to meet various functional requirements of the air conditioner. For example, the air conditioner can integrate physical models such as the surround wind function physical model, the self-cleaning physical model, the electric auxiliary heating physical model, the ECO physical model, and the Bluetooth physical model, etc. Each physical model corresponds to a task, and the normal operation or startup required time of different models is different. Therefore, different physical models may correspond to different task guard times. And, according to the different functions supported by different physical models, their scheduling levels may also be different. Please refer to Figure 2 , the task guard times corresponding to the surround wind function physical model, the self-cleaning physical model, and the electric auxiliary heating physical model are all 4 seconds, the task guard time corresponding to the ECO physical model is 10 seconds, and the task guard time corresponding to the Bluetooth physical model is 15 seconds. Figure 2 The scheduling level represented by the ordinate in [] can be understood as the scheduling priority of the threads included in the physical model. For example, when the surround wind physical model and the self-cleaning physical model are running simultaneously, the scheduling frequency of the threads included in the surround wind physical model is higher than the scheduling frequency of the threads included in the self-cleaning physical model.

[0049] If after the air conditioner is started, due to user control, Figure 2The shown surround wind function object model, self-cleaning object model, electric auxiliary heating object model, ECO object model and Bluetooth object model are all in operation. Then determine that the minimum task guard time among the task guard times corresponding to the above five object models is 4 seconds. The three object models with corresponding task guard times of 4 seconds include the surround wind function object model, the self-cleaning object model, and the electric auxiliary heating object model. At this time, the first target task can be determined based on the scheduling level corresponding to the object model. That is, the designated task with the highest scheduling level among the designated tasks corresponding to the minimum task guard time can be used as the first target task. That is, the above-mentioned surround wind function object model is used as the first target task. If the number of designated tasks corresponding to the minimum task guard time is one, the designated task corresponding to the minimum task guard time is directly used as the first target task.

[0050] In this case, the system guard time of the watchdog timer of the air conditioner is 4 seconds. Since the task guard time of the surround wind function object model is the shortest and the scheduling level is the highest, the surround wind function object model generally runs to the end the fastest. At the end of the operation of the surround wind function object model, the watchdog timer will be fed, that is, a signal will be sent to the watchdog timer to indicate normal operation. When the watchdog timer receives the signal, the timer is reset. At this time, the object models in the running state also include the self-cleaning object model, the electric auxiliary heating object model, the ECO object model, and the Bluetooth object model. Then, the first target task is re-determined in the remaining four object models: the self-cleaning object model, and the task guard time of 4 seconds corresponding to the self-cleaning object model is used as the system guard time, so that the watchdog timer continues to monitor the tasks in the running state. Since these five models are running at the same time, during the operation of the surround wind function object model, the other four are also running. Therefore, if there is no abnormality in the self-cleaning object model, the timer will be fed within 4 seconds. If the operation of the self-cleaning model is abnormal and the timer is not fed within 4 seconds, the watchdog timer will time out. At this time, the self-cleaning model will immediately perform an exception handling operation. For example, the watchdog timer sends a reset signal to the multitasking system to restart the multitasking system.

[0051] In some embodiments of the present specification, the designated tasks are stored in a linked list. The system guard time determination method also includes: after the first target task completes running, modifying the designated running state corresponding to the first target task to other running states. Among the remaining tasks and / or newly added tasks in the linked list, determine a second target task whose task guard time meets the preset time condition. Among them, the remaining tasks are other designated tasks in the designated tasks except the first target task. The newly added task is a task in the designated running state that is newly added to the linked list during the running process of the first target task. Based on the task guard time corresponding to the second target task, the system guard time of the multi-task system is determined.

[0052] In the embodiment of this specification, the multi-task system is configured with a linked list, and the linked list stores a number of tasks in different running states in the system. Figure 3 , Figure 3 The linked list shown shows the related information of some tasks or object models supported by the air conditioner. Among them, Name is used to indicate the name of the task or object model; State is used to indicate the current running state of the task or model; Prio is used to indicate the scheduling priority of the task or object model; StackSize is used to indicate the stack size of the thread contained in the task or object model; MinFreesize is used to indicate the minimum memory size required for the task or object model to run; WdtTime is used to indicate the task guard time corresponding to the task or object model; %CPU is used to indicate the proportion of the CPU occupied by the task or object model at the current moment; Candidate is used to indicate the candidate state of the thread contained in the task or object model.

[0053] Depend on Figure 3 It can be seen that the tasks in the linked list all have corresponding running statuses. When multiple tasks are running continuously, if a task is completed, the running status of the task can be modified directly in the linked list. If there are new tasks during the running of the first target task, the new tasks will be added to the linked list.

[0054] In the embodiments of the present specification, the system guard time changes with the change of the designated task in the designated running state. Specifically, when the first target task is completed, the designated running state corresponding to the first target task is modified to another running state. Exemplarily, if the designated running state is the running state, then when the first target task is completed, the running state of the first target task can be modified to the sleeping state or the first target task can be directly removed from the linked list.

[0055] At this time, the remaining tasks in the running state are other designated tasks in the designated tasks except the first target task. If a new task in the running state is added to the linked list during the operation of the first target task, the newly added task is determined. At this time, the designated tasks in the running state include the remaining tasks and the newly added tasks. Since the tasks in the running state have changed, it is necessary to redetermine the system guard time at this time. Therefore, a second target task whose task guard time meets the preset time condition can be determined among the remaining tasks and the newly added tasks. The task guard time corresponding to the second target task is determined as the system guard time. Among them, the preset time condition can be for determining the minimum task guard time.

[0056] It is understandable that if there is no newly added task in the specified running state in the linked list during the running of the first target task, the second target task can be determined from the remaining tasks. If the remaining tasks in the running state are zero after the first target task is completed, and there is a newly added task in the linked list during the running of the first target task, the second target task can be determined from the newly added tasks.

[0057] In an example, see Figure 4 , the multi-task system includes backup tasks, ready tasks, running tasks, blocked tasks and completed tasks. If there is a ready task converted to a running task, the task guard time used to determine the system guard time is increased. Therefore, when redetermining the system guard time, the judgment of the task guard time of the converted running task is superimposed. Similarly, if there is a backup task converted to a running task, when redetermining the system guard time, the judgment of the task guard time of the converted running task is superimposed. If there is a running task converted to a ready task, a blocked task, or a completed task, when redetermining the system guard time, the task guard time of the task in the conversion state is deleted.

[0058] In some embodiments of the present specification, the specified tasks are stored in a linked list. The system guard time determination method further includes: for any specified task in the linked list, obtaining the actual running time of any specified task. If the actual running time exceeds the task guard time corresponding to any specified task, marking any specified task.

[0059] In the embodiments of the present specification, the system guard time of the watchdog timer adopts the minimum task guard time among the task guard times of the specified tasks. The watchdog timer can timely monitor the first target task or some specified tasks whose task guard time is close to the minimum task guard time. However, since multiple tasks in the embodiments of the present specification can run simultaneously, it is possible that a specified task A with a longer task guard time has timed out, and the first target task runs normally and the timer is fed, the timer will not time out and cannot monitor the specified task A. Or, Figure 2 When the surrounding wind function model and the self-cleaning object model are running at the same time, the surrounding wind function model is still 4 seconds after re-determining the system guard time after completing the operation. At this time, the self-cleaning object model has also been running for a period of time during the operation of the surrounding wind function model. If the self-cleaning object model is abnormal, the watchdog timer will trigger the abnormal handling operation on it only if the self-cleaning object model has not been fed after 4 seconds. The abnormal situation of the self-cleaning object model cannot be monitored in time. Therefore, in the embodiments of this specification, the watchdog timer can also be assisted by a linked list to complete the operation monitoring of the specified task together.

[0060] Specifically, a linked list traversal cycle is set for the linked list to traverse the actual running time of any specified task in the linked list in the specified running state based on the linked list traversal cycle. The actual running time is the time from the moment when the running state of any specified task is converted to the running state to the current moment. It is determined whether the actual running time of any specified task exceeds the task guard time corresponding to any specified task. If the actual running time exceeds the task guard time corresponding to any specified task, any specified task is marked.

[0061] In some cases, in addition to traversing any specified task based on the linked list traversal cycle, any specified task can also be traversed when the specified task in the specified running state changes. In this way, abnormal tasks in the specified tasks can be discovered more promptly.

[0062] In some embodiments of the present specification, the system guard time determination method also includes: if any designated task is a first target task, performing an exception handling operation; or if any designated task is other designated tasks other than the first target task, performing an exception handling operation when the other designated tasks are determined to be third target tasks whose task guard time meets a preset time condition.

[0063] In order to maximize the stability of the system, when a specified task with an abnormal operation is found through the traversal of the linked list, the specified task is first marked, and then a decision is made whether to immediately perform the exception handling operation based on whether the marked specified task is the first target task.

[0064] Specifically, if any of the marked designated tasks is the first target task, it means that the system guard time used at this time is the task guard time corresponding to any of the marked designated tasks. The designated task is the task with the smallest task guard time among all the current designated tasks, and the watchdog timer is also in the state of monitoring the designated task. Therefore, when it is determined that any of the designated tasks is the first target task, the exception handling operation is immediately executed, such as restarting the multi-task system.

[0065] If any designated task is a designated task other than the first target task, it indicates that there is a first target task with a higher scheduling level or a longer task guarding time period than the designated task, which is being monitored by the watchdog timer. In this case, in order to ensure system stability, the exception handling operation can be performed until the designated task is determined to be a third target task whose task guarding time meets the preset time condition. When the designated task is determined to be the third target task, it indicates that the designated task has the highest scheduling level and the shortest task guarding time, and is being monitored by the watchdog timer.

[0066] In some embodiments of the present specification, the system guard time determination method further includes: when multiple tasks of the multi-task system are executed in serial mode, determining a currently executed task among the multiple tasks, and determining the task guard time corresponding to the currently executed task as the system guard time of the multi-task system.

[0067] In the embodiment of the present specification, the multi-task system not only supports multiple tasks to run simultaneously, but also supports multiple tasks to run in series. When multiple tasks run in series, the determination of the system guard time is different from that when the tasks run simultaneously.

[0068] In the serial operation mode, multiple tasks are executed in the specified order, and the next task can only be started after the previous task is completed. This ensures the order and dependency between tasks. In this case, the current running task in the running state can be directly queried, and then the task guard time corresponding to the current running task is determined as the system guard time of the multi-task system. After the current running task is completed, the current running task is re-determined, and the system guard time is updated based on the re-determined task guard time of the current running task.

[0069] Through the above method, the watchdog timer can monitor each task more accurately and detect abnormal operation of the task in time.

[0070] In some embodiments of the present specification, the system guard time determination method further includes: determining the working mode entered by the multi-task system according to the type of the received trigger signal. The working mode is a first working mode or a second working mode; in the first working mode, multiple tasks of the multi-task system run simultaneously, and in the second working mode, multiple tasks of the multi-task system run in serial.

[0071] Since the multi-task system of the embodiment of the present specification can support two working modes, one is to support multiple tasks to run simultaneously, and the other is to support multiple tasks to run in serial mode. The system has different scheduling methods for task threads in the two modes. Therefore, the first working mode and the second working mode can be divided based on whether the tasks are run in serial mode. In the case of receiving a trigger signal for determining the task execution mode, it is determined whether the multi-task system enters the first working mode or the second working mode based on the type of the trigger signal.

[0072] In a specific embodiment, an air conditioner in a smart home is used as an example. After the air conditioner is produced, it will first be quality inspected, and the quality inspection tasks in the quality inspection mode need to be run in serial. For example, the air conditioner needs to run tasks in serial mode when performing OTA upgrades, in flight mode, and in network distribution mode. When the air conditioner is in the actual application process of the user, its local object model generally needs to run at the same time. Therefore, the trigger signal received by the air conditioner can be a signal from a quality inspection machine, a signal from a server, or a signal from a remote control. The operating mode that the air conditioner is to enter can be determined based on the category of the trigger signal.

[0073] For the air conditioner, the first working mode can be set as a special working mode. In the special working mode, the execution of tasks or models is specific and runs in a serial manner. The task guard time corresponding to the current running task that is currently in operation can be used as the system guard time. Exemplarily, in the special working mode, the models or tasks that can be run by the air conditioner include: BootLoader boot mode (4 seconds), engineering mode (10 seconds), self-test mode (2 seconds), module itself OTA upgrade mode (5 seconds), electronic control equipment OTA upgrade mode (5 seconds), flight mode (15 seconds), network distribution mode (10 seconds), etc. Among them, the time in brackets represents the corresponding task guard time.

[0074] For the air conditioner, the second working mode can be set to the local object model hybrid mode. In the local object model hybrid mode, multiple object models or tasks can run at the same time. Similarly, each task or object model has its own corresponding task guard time. Exemplarily, in the local object model hybrid mode, the models or tasks that the air conditioner can run may include: Bluetooth bridge bridging model (15 seconds), Bluetooth local linkage model (15 seconds), digital remote control direct connection model (15 seconds), electric auxiliary heating object model (4 seconds), self-cleaning object model (4 seconds), intelligent temperature control object model (5 seconds), ECO object model (10 seconds), surround wind function fog model object model (4 seconds), etc. Among them, the time in brackets represents the corresponding task guard time.

[0075] In a specific embodiment, based on the above theoretical basis, an air conditioner is taken as an example to illustrate the complete working process of the air conditioner. Figure 5 , the method for determining the system guard time of the air conditioner may include:

[0076] S501, receiving a trigger signal.

[0077] S502: Determine whether the task is executed in a serial manner based on the type of the trigger signal.

[0078] S503: If the task needs to be run in a serial manner, the air conditioner enters a special working mode.

[0079] S504, querying the tasks in the blocked state in the special working mode.

[0080] S505 , determining a priority running task in the blocked state tasks based on the execution order of the tasks or based on the running priority of the tasks, and switching the state of the priority running task to the ready state.

[0081] S506, if there is still a currently running task, while waiting for the currently running task to complete execution, convert the priority running task from the ready state to the running state as the currently running task, and update the system guard time based on the task guard time of the priority running task.

[0082] S507, query the real-time running status of the current running task, and store the real-time task status of the current running task in the local storage unit of the air conditioner. Monitor the current running task based on the system guard time.

[0083] S508, detecting whether the watchdog timer has timed out for maintenance.

[0084] S509: When the watchdog timer times out for maintenance, perform a system abnormal reset and restore the user status.

[0085] S510: If the task does not need to be executed in a serial manner, the air conditioner enters a local physical model hybrid mode.

[0086] S511, querying the tasks in the blocked state in the local object model hybrid mode.

[0087] S512, switching the waiting task in the blocked state to the ready state, scheduling the thread of the waiting task based on the running priority of the waiting task, etc., so that the waiting task becomes a designated task in the running state.

[0088] S513: Determine, based on a minimum superposition algorithm, the minimum task guarding time among the task guarding times of the specified tasks as the system guarding time.

[0089] S514, determining whether the system guard time has changed.

[0090] When the system guard time changes, execute steps S507, S508, and S509.

[0091] S515: When the system guard time does not change, query the task completion status of the specified task.

[0092] S516, determining whether there is a task in the specified task that has been successfully completed and needs to be terminated.

[0093] S517: If it exists, update the running status of the completed task to the completed status.

[0094] S518, when it is determined that a task in the backup state has been converted to the blocked state, execute steps S511, S512, S513, and S514, and determine whether the system guard time has changed. If the system guard time has changed, execute steps S507, S508, and S509.

[0095] The specific limitations on the method for determining the system guard time of the air conditioner can be found in the above limitations on the method for determining the system guard time of the multi-task system, which will not be repeated here.

[0096] Corresponding to the above-mentioned embodiment, the embodiment of this specification proposes a system guard time determination device for a multi-task system.

[0097] See also Figure 6 , the system guard time determination device includes:

[0098] The designated task determining module 610 is used to determine a designated task in a designated running state among the multiple tasks when multiple tasks of the multi-task system are running simultaneously.

[0099] The specified task has a task guarding time corresponding to it; the task guarding time is used to represent the time required for the normal operation or startup of the specified task.

[0100] The target task determination module 620 is used to determine the first target task whose task guard time meets the preset time condition in the specified task.

[0101] The time determination module 630 is used to determine the system guard time of the multi-task system based on the task guard time corresponding to the first target task.

[0102] Through the above-mentioned embodiment, when multiple tasks of a multi-task system are running at the same time, first, a designated task in a designated running state is determined among the multiple tasks. A first target task whose task guard time meets the preset time condition is determined among the designated tasks, and the system guard time of the multi-task system is determined based on the task guard time corresponding to the first target task. In the event that the first target task that meets the preset time condition changes, the system guard time will also change. The system guard time of the embodiment of this specification is continuously updated as the tasks in the multi-task system run, and a suitable system guard time can be determined based on the preset time condition, so that the watchdog timer can quickly restore the system state when a task abnormality occurs and can maximize the stability of the multi-task system.

[0103] The specific limitations on the system guard time determination device for a multi-tasking system can be found in the limitations on the system guard time determination method for a multi-tasking system mentioned above, which will not be repeated here. Each module in the above-mentioned system guard time determination device for a multi-tasking system can be implemented in whole or in part through software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0104] Corresponding to the above embodiment, the embodiment of this specification also provides a multi-tasking system.

[0105] Figure 7 is a block diagram of a multi-task system according to an embodiment of the present specification, such as Figure 7 As shown, the multi-tasking system 700 includes a memory 704, a processor 702, and a system guard time determination program 706 stored in the memory 704 and executable on the processor 702. When the processor 702 executes the system guard time determination program 706, it implements any of the system guard time determination methods described above.

[0106] According to the multi-tasking system of the embodiment of the present specification, when the processor 702 executes the system guard time determination program 706, the system guard time is continuously updated as the tasks in the multi-tasking system run, and a suitable system guard time can be determined based on preset time conditions, so that the watchdog timer can quickly restore the system status when a task abnormality occurs and can maximize the stability of the multi-tasking system.

[0107] Corresponding to the above embodiments, the embodiments of this specification further propose a computer-readable storage medium, on which a system guard time determination program is stored, and when the system guard time determination program is executed by a processor, any of the above system guard time determination methods is implemented.

[0108] According to the computer-readable storage medium of the embodiment of this specification, when the system guard time determination program is executed by the processor, the system guard time is continuously updated as the task runs in the multi-tasking system, and a suitable system guard time can be determined based on preset time conditions, so that the watchdog timer can quickly restore the system status when a task exception occurs and can maximize the stability of the multi-tasking system.

[0109] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0110] It should be understood that various parts of this specification can be implemented in hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0111] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0112] In the description of this specification, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing this specification and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on this specification.

[0113] In addition, the terms "first", "second", etc. used in the embodiments of this specification are only used for descriptive purposes and should not be understood as indicating or implying relative importance, or implicitly indicating the number of technical features indicated in this embodiment. Therefore, the features defined by the terms "first", "second", etc. in the embodiments of this specification can explicitly or implicitly indicate that the embodiment includes at least one of the features. In the description of this specification, the word "multiple" means at least two or two or more, such as two, three, four, etc., unless otherwise clearly and specifically defined in the embodiments.

[0114] In this specification, unless otherwise clearly specified or limited in the embodiments, the terms "install", "connect", "connect" and "fix" etc. appearing in the embodiments should be understood in a broad sense. For example, the connection can be a fixed connection, a detachable connection, or an integrated connection. It can be understood that it can also be a mechanical connection, an electrical connection, etc.; of course, it can also be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal connection of two elements, or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this specification can be understood according to the specific implementation situation.

[0115] In this specification, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.

[0116] Although the embodiments of the present specification have been shown and described above, it is understood that the above embodiments are exemplary and are not to be construed as limitations on the present specification. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present specification.

Claims

1. A method for determining system guard time of a multi-task system, characterized in that: The method comprises: When multiple tasks of the multi-task system are running simultaneously, a designated task in a designated running state is determined among the multiple tasks; wherein the designated task corresponds to a task guard time; the task guard time is used to characterize the time required for the normal operation or startup of the designated task; Determine a first target task in the designated task whose task guard time satisfies a preset time condition; Based on the task guard time corresponding to the first target task, a system guard time of the multi-task system is determined.

2. The method according to claim 1, characterized in that The designated running state is a running state; and determining the designated task in the designated running state among the multiple tasks includes: A running task in the running state is determined among the multiple tasks.

3. The method according to claim 1, characterized in that The step of determining, in the designated task, a first target task whose task guard time satisfies a preset time condition comprises: Determine a minimum task guarding time among the task guarding times corresponding to the specified task; The designated task corresponding to the minimum task guard time is used as the first target task.

4. The method according to claim 1, characterized in that: The specified tasks are stored in a linked list; the method further comprises: After the first target task is completed, modifying the specified running state corresponding to the first target task to another running state; Among the remaining tasks and / or newly added tasks in the linked list, determine a second target task whose task guard time satisfies a preset time condition; wherein the remaining tasks are other designated tasks among the designated tasks except the first target task; the newly added task is a task in the designated running state that is newly added to the linked list during the running of the first target task; Based on the task guard time corresponding to the second target task, the system guard time of the multi-task system is determined.

5. The method according to claim 1, characterized in that The specified tasks are stored in a linked list; the method further comprises: For any specified task in the linked list, obtaining the actual running time of any specified task; If the actual running time exceeds the task guard time corresponding to any of the specified tasks, any of the specified tasks is marked.

6. The method according to claim 5, characterized in that The method further comprises: If any of the specified tasks is the first target task, performing an exception handling operation; or If any of the designated tasks is a designated task other than the first target task, when the other designated task is determined to be a third target task whose task guard time satisfies the preset time condition, an exception handling operation is performed.

7. The method according to claim 1, characterized in that The method further comprises: When a plurality of tasks of the multi-task system are executed in a serial manner, determining a currently executed task among the plurality of tasks; The task guard time corresponding to the currently running task is determined as the system guard time of the multi-task system.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: The working mode entered by the multi-task system is determined according to the type of the received trigger signal; wherein the working mode is the first working mode or the second working mode; in the first working mode, multiple tasks of the multi-task system run simultaneously, and in the second working mode, multiple tasks of the multi-task system run in serial.

9. A multi-tasking system, characterized in that: The invention comprises a memory, a processor and a system guard time determination program for a multi-tasking system which is stored in the memory and can be run on the processor. When the processor executes the system guard time determination program for the multi-tasking system, the system guard time determination method for the multi-tasking system as described in any one of claims 1 to 8 is implemented.

10. A computer-readable storage medium, characterized in that: A system guard time determination program for a multi-task system is stored thereon, and when the system guard time determination program for the multi-task system is executed by a processor, the system guard time determination method for the multi-task system as claimed in any one of claims 1-8 is implemented.