Task management method and device, electronic equipment and storage medium

By determining and calculating the execution cycle of the target task, the problem of slow response of the baseboard controller interface and the inability to preempt the sample test thread is solved, achieving efficient and accurate task management.

CN118567808APending Publication Date: 2024-08-30INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410703563.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the server, the baseboard controller interface responds slowly during task management, resulting in a longer management cycle and possible false alarms, and high-priority example test tasks may cause the example test thread to be unable to preempt the task.

Method used

By obtaining multiple tasks and their types and parameters, determine the target tasks that need to be executed periodically, and calculate the target execution cycle of the target task based on the call information and task parameters with a priority higher than the target task to ensure that the execution of high-priority tasks is not affected.

Benefits of technology

This avoids the situation where threads cannot preempt target tasks, improves the efficiency and accuracy of task management, and ensures the timely execution of high-priority tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567808A
    Figure CN118567808A
Patent Text Reader

Abstract

Embodiments of the invention provide a task management method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining a plurality of tasks, and task types and task parameters corresponding to the plurality of tasks; according to the task types of the tasks, determining a target task needing to be periodically executed from the tasks; detecting calling information of which the priority is higher than that of the target task in the tasks; and determining a target execution period of the target task according to the calling information of which the priority is higher than that of the target task and the task type and the task parameter of the target task, thereby determining the target execution period of the target task from multiple angles based on the scheduling information of which the priority is higher than that of the target task and the type and the task parameter of the target task. Compared with the prior art, execution of the target task with the high priority cannot be affected, and then the situation that the thread cannot preempt the target task is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a task management method, a task management device, an electronic device and a non-volatile readable storage medium. Background Art

[0002] In the server field, when managing tasks in the server, a baseboard controller is usually used for management. While performing task management, the baseboard controller can also provide users with a variety of human-computer interaction interfaces. These interfaces have time requirements or timeout strategies for the baseboard controller response. When the interface is called, if some management threads occupy more resources at this time, the baseboard controller interface will respond more slowly, which will not only lengthen the management cycle, but also cause management abnormalities, which will cause false alarms.

[0003] In the related art, to avoid the above problems, the interface priority is increased and the routine test cycle is reduced. However, this method will cause the routine test cycle to be untimely, and in the case of high-priority routine test tasks, the routine test thread may not be able to preempt tasks. Summary of the invention

[0004] In view of the above problems, embodiments of the present invention are proposed to provide a task management method, a task management device, an electronic device and a non-volatile readable storage medium that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problems, in a first aspect, an embodiment of the present invention discloses a task management method, the method comprising:

[0006] Obtain multiple tasks, as well as task types and task parameters corresponding to the multiple tasks;

[0007] Determining a target task that needs to be executed periodically from among the multiple tasks according to the task types of the multiple tasks;

[0008] Detecting call information of the multiple tasks having a higher priority than the target task;

[0009] A target execution period of the target task is determined according to the calling information of the task with a priority higher than that of the target task, the task type of the target task, and the task parameters.

[0010] Optionally, the multiple tasks include: a human-computer interaction task of a human-computer interaction type, a control task of a control type, and a routine test task of a routine test type; the call information includes the number of calls of the human-computer interaction task; the priority of the human-computer interaction type is higher than that of the control type and the routine test type; and determining the target task that needs to be executed periodically from the multiple tasks according to the task types of the multiple tasks includes:

[0011] The control task and the routine test task among the multiple tasks are determined as target tasks that need to be executed periodically.

[0012] Optionally, the task parameters include a default period, a maximum execution period, a minimum execution period, a processor occupancy rate, and a task update frequency of the multiple tasks; and determining a target execution period of the target task according to the call information of the task with a higher priority than the target task, the task type of the target task, and the task parameters, includes:

[0013] Determine a candidate period of the target task according to a preset period step value, the number of calls of the human-computer interaction task, the default period of the target task, the processor occupancy rate and the task update frequency;

[0014] The candidate period corresponding to the target task is calculated according to the following formula:

[0015] T=T0+Δt*w*Ta+Ti*Δt*w

[0016] Wherein, T represents the candidate cycle of the target task; T0 represents the default cycle of the target task; Δt is the preset cycle step value; w represents the weight of the target task; Ta represents the first score of the target task; Ti represents the second score of the target task; the weight of the target task is determined according to the task type of the target task; the first score of the target task is determined according to the processor occupancy of the target task and the number of calls of the human-computer interaction task; the second score of the target task is determined according to the task update frequency of the target task;

[0017] A target execution cycle of the target task is determined according to the candidate cycle of the target task, the maximum execution cycle and the minimum execution cycle.

[0018] Optionally, the control task includes a fan control task; and the method further includes:

[0019] Detecting a change in firmware temperature; determining a second score of the target task according to the change in firmware temperature;

[0020] If the target task is the fan control task, and the second score determined according to the change in the firmware temperature is less than zero, the first score of the target task is set to zero.

[0021] Optionally, determining a target execution cycle of the target task according to the candidate cycle of the target task, the maximum execution cycle, and the minimum execution cycle includes:

[0022] Determine whether the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period;

[0023] If the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period, determining the candidate period as the target execution period of the target task;

[0024] If the candidate period of the target task is less than or equal to the minimum execution period, determining the minimum execution period as the target execution period of the target task;

[0025] If the candidate period of the target task is greater than or equal to the maximum execution period, the maximum execution period is determined as the target execution period of the target task.

[0026] Optionally, the method further comprises:

[0027] The target execution period of the target task is written into a task module corresponding to the target task, so that the task module executes the target task according to the target execution period.

[0028] Optionally, the method further comprises:

[0029] According to the task types of the multiple tasks, determining whether there are upgrade tasks and routine test tasks among the multiple tasks;

[0030] If the upgrade task exists, stop executing the routine test task;

[0031] When the upgrade task is completed, continue to execute the routine test task according to the target execution period of the routine test task.

[0032] In a second aspect, an embodiment of the present invention discloses a task management device, the device comprising:

[0033] An acquisition module, used to acquire multiple tasks, and task types and task parameters corresponding to the multiple tasks;

[0034] A first determining module, configured to determine a target task that needs to be executed periodically from among the multiple tasks according to the task types of the multiple tasks;

[0035] A detection module, used for detecting call information of the multiple tasks having a higher priority than the target task;

[0036] The second determining module is used to determine the target execution period of the target task according to the calling information of the task with a higher priority than the target task, the task type of the target task and the task parameters.

[0037] Optionally, the multiple tasks include: a human-computer interaction task of a human-computer interaction type, a management and control task of a management and control type, and a routine test task of a routine test type; the call information includes the number of calls of the human-computer interaction task; the priority of the human-computer interaction type is higher than the priority of the management and control type and the routine test type; the first determination module includes:

[0038] The first determination submodule is used to determine the management and control tasks and the routine test tasks among the multiple tasks as target tasks that need to be executed periodically.

[0039] Optionally, the task parameters include a default period, a maximum execution period, a minimum execution period, a processor occupancy rate and a task update frequency of the plurality of tasks; and the second determination module includes:

[0040] A second determination submodule is used to determine a candidate period of the target task according to a preset period step value, the number of calls of the human-computer interaction task, the default period of the target task, the processor occupancy rate and the task update frequency;

[0041] The candidate period corresponding to the target task is calculated according to the following formula:

[0042] T=T0+Δt*w*Ta+Ti*Δt*w

[0043] Wherein, T represents the candidate cycle of the target task; T0 represents the default cycle of the target task; Δt is the preset cycle step value; w represents the weight of the target task; Ta represents the first score of the target task; Ti represents the second score of the target task; the weight of the target task is determined according to the task type of the target task; the first score of the target task is determined according to the processor occupancy of the target task and the number of calls of the human-computer interaction task; the second score of the target task is determined according to the task update frequency of the target task;

[0044] The third determination submodule is used to determine the target execution cycle of the target task according to the candidate cycle of the target task, the maximum execution cycle and the minimum execution cycle.

[0045] Optionally, the control task includes a fan control task; and the second determining module further includes:

[0046] A detection submodule, used for detecting a change in firmware temperature; the second score of the target task is determined according to the change in the firmware temperature;

[0047] A setting submodule is used to set the first score of the target task to zero if the target task is the fan control task and the second score determined according to the change in the firmware temperature is less than zero.

[0048] Optionally, the third determining submodule includes:

[0049] A judging unit, configured to judge whether the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period;

[0050] a first determining unit, configured to determine the candidate cycle as a target execution cycle of the target task if the candidate cycle of the target task is greater than the minimum execution cycle and less than the maximum execution cycle;

[0051] a second determining unit, configured to determine the minimum execution cycle as a target execution cycle of the target task if the candidate cycle of the target task is less than or equal to the minimum execution cycle;

[0052] The third determining unit is configured to determine the maximum execution cycle as the target execution cycle of the target task if the candidate execution cycle of the target task is greater than or equal to the maximum execution cycle.

[0053] Optionally, the device further comprises:

[0054] The writing module is used to write the target execution period of the target task into the task module corresponding to the target task, so that the task module executes the target task according to the target execution period.

[0055] Optionally, the device further comprises:

[0056] A judging module, used for judging whether there are upgrade tasks and routine test tasks in the multiple tasks according to the task types of the multiple tasks;

[0057] A stop module, used for stopping the execution of the routine test task if the upgrade task exists;

[0058] The execution module is used to continue to execute the routine test task according to the target execution period of the routine test task when the upgrade task is completed.

[0059] In a third aspect, the present invention shows a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned task management method when executing the computer program.

[0060] In a fourth aspect, the present invention shows a non-volatile readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned task management method are implemented.

[0061] The embodiments of the present invention include the following advantages:

[0062] In an embodiment of the present invention, a plurality of tasks and task types and task parameters corresponding to the plurality of tasks are first obtained, and then a target task that needs to be executed periodically is determined from the plurality of tasks according to the task types of the plurality of tasks, and then the calling information of the plurality of tasks having a higher priority than the target task is detected, and finally the target execution period of the target task is determined according to the calling information of the task having a higher priority than the target task, the task type and task parameters of the target task, thereby determining the target execution period of the target task from multiple angles based on the scheduling information of the task having a higher priority than the target task, and the type and task parameters of the target task. Compared with the prior art, this will not affect the execution of the target task with a higher priority, thereby preventing the thread from being unable to preempt the target task. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 is a flow chart of a task management method provided by an embodiment of the present invention;

[0064] Figure 2 This is a structural block diagram of a baseboard management controller provided by an embodiment of the present invention.

[0065] Figure 3 is a flow chart of another task management method provided by an embodiment of the present invention;

[0066] Figure 4 is a structural block diagram of a task management device provided by an embodiment of the present invention;

[0067] Figure 5 is a structural block diagram of an electronic device provided by an embodiment of the present invention;

[0068] Figure 6 It is a structural block diagram of a non-volatile readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0069] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0070] In the related art, in order to avoid the slow response of the baseboard controller interface, the interface priority is increased, and the routine test cycle is reduced, resulting in the routine test cycle being untimely. In the case of high-priority routine test tasks, the routine test thread may be unable to preempt the task. In order to solve the above technical problems, the present invention provides a task management method, first obtaining multiple tasks, and the task types and task parameters corresponding to the multiple tasks, and then determining the target task that needs to be executed periodically from the multiple tasks according to the task types of the multiple tasks, and then detecting the scheduling information of the multiple tasks with a priority higher than the target task, and finally determining the target execution cycle of the target task according to the scheduling information of the target task with a priority higher than the target task, the task type and task parameters of the target task, thereby determining the target execution cycle of the target task from multiple angles based on the scheduling information of the target task with a priority higher than the target task, and the type and task parameters of the target task. Compared with the prior art, it will not affect the execution of the high-priority target task, thereby avoiding the thread from being unable to preempt the target task.

[0071] Reference Figure 1 , shows a flowchart of a task management method provided by an embodiment of the present invention, and the method may specifically include the following steps:

[0072] Step 101: Acquire multiple tasks, and task types and task parameters corresponding to the multiple tasks.

[0073] In an embodiment of the present invention, the task management method of the present invention can be applied to an intelligent information management module, and the intelligent information management module can be arranged in a baseboard management controller BMC (Baseboard Management Controller). Task modules may also be arranged on the baseboard management controller, such as: a human-computer interaction module, a management and control module and a routine test module. The human-computer interaction module may be provided with an IPMI interface (Intelligent Platform Management Interface), a WEB interface (World Wide Web) and a Redfish interface. The human-computer interaction module is used to perform human-computer interaction tasks. The management and control module may be provided with a fan control interface, and the management and control module is used to perform management and control tasks. The routine test module may be provided with a PUS (Procedure Under Test) routine test interface, a controller routine test interface and other FRU (Field Replaceable Unit) routine test interfaces, and the routine test module is used to perform routine test tasks. In the present invention, routine test tasks refer to routine detection tasks, and also refer to periodic detection tasks. For example Figure 2 , which shows a structural block diagram of a baseboard management controller provided by an embodiment of the present invention.

[0074] In an embodiment of the present invention, the intelligent information management module is started first. After the intelligent information management module is started, the task modules are started in sequence. After the task modules are started, the module information in the modules can be registered to the intelligent information management module, wherein the module information can include: multiple tasks in the module, and task types and task parameters corresponding to the multiple tasks. At this time, the intelligent information management module can obtain multiple tasks, and task types and task parameters corresponding to the multiple tasks. In the present invention, the intelligent information module can also periodically obtain multiple tasks in the task module, and task types and task parameters corresponding to the multiple tasks.

[0075] Step 102 : determining a target task that needs to be executed periodically from among the multiple tasks according to the task types of the multiple tasks.

[0076] In the embodiment of the present invention, after a plurality of tasks and the task types and task parameters corresponding to the plurality of tasks are acquired, a target task to be executed may be determined from the plurality of tasks according to the task types of the plurality of tasks.

[0077] In one embodiment, multiple tasks may include: human-computer interaction tasks of human-computer interaction type, management and control tasks of management and control type, and routine test tasks of routine test type; the priority of the human-computer interaction type is higher than the priority of the management and control type and the routine test type; according to the task types of multiple tasks, determining the target tasks that need to be executed periodically from the multiple tasks may include: determining the management and control tasks and routine test tasks among the multiple tasks as target tasks that need to be executed periodically.

[0078] In the present invention, the human-computer interaction task is a task that needs to be responded to and executed immediately, and there is no need to consider the execution cycle. Faster execution of human-computer interaction tasks can bring better experience to users. Therefore, through the task type, the management and control tasks and routine test tasks are determined as target tasks that need to be executed periodically. The human-computer interaction tasks are not considered in order to avoid determining the human-computer interaction tasks as target tasks, thereby determining the corresponding target execution cycle, resulting in the execution of human-computer interaction tasks according to the execution cycle, making the human-computer interaction tasks unresponsive, and reducing the user experience.

[0079] Step 103: Detect the calling information of the multiple tasks whose priority is higher than that of the target task.

[0080] In the embodiment of the present invention, after determining the target task that needs to be executed periodically, the calling information of the tasks with a higher priority than the target task can be detected.

[0081] In one embodiment, the call information may include the number of calls of the human-computer interaction task; the priority of the human-computer interaction type is higher than the priority of the control type and the example test type. Therefore, the human-computer interaction task can be determined from multiple tasks, and the number of calls of the human-computer interaction task can be detected. It should be noted that the detection of the number of calls of the human-computer interaction task in the present invention can also be the detection of the number of calls of the human-computer interaction task within a certain time range. The number of calls of the human-computer interaction task also refers to the number of calls of the interface in the human-computer interaction module. If the number of calls of the human-computer interaction task is more, it proves that the calling frequency of the human-computer interaction task is higher, indicating that the user interacts with the substrate information management controller more frequently, and at this time it is necessary to release the thread to prioritize the interaction task.

[0082] Step 104 : determining a target execution period of the target task according to the calling information of the task with a higher priority than the target task, the task type of the target task, and the task parameters.

[0083] In an embodiment of the present invention, after detecting the calling information of a task with a higher priority than the target task among multiple tasks, the target execution period of the target task can be determined based on the calling information of the task with a higher priority than the target task, the task type corresponding to the target task and the task parameters corresponding to the target task.

[0084] In one embodiment, the task parameters may include a default period, a maximum execution period, a minimum execution period, a processor occupancy rate, and a task update frequency of a plurality of tasks; determining a target execution period of a target task according to the call information of a task with a higher priority than the target task, the task type of the target task, and the task parameters may include:

[0085] Determine the candidate cycle of the target task according to the preset cycle step value, the number of calls of the human-computer interaction task, the default cycle of the target task, the processor occupancy rate and the task update frequency;

[0086] The candidate period corresponding to the target task is calculated according to the following formula (1):

[0087] T=T0+Δt*w*Ta+Ti*Δt*w Formula (1)

[0088] Wherein, T represents the candidate period of the target task; T0 represents the default period of the target task; △t is the preset cycle step value; w is the weight of the target task; Ta represents the first score of the target task; Ti represents the second score of the target task; the weight of the target task is determined according to the task type of the target task; the first score of the target task is determined according to the processor occupancy of the target task and the number of calls of the human-computer interaction task; the second score of the target task is determined according to the task update frequency of the target task; the target execution cycle of the target task is determined according to the candidate cycle, maximum execution cycle and minimum execution cycle of the target task.

[0089] It should be noted that the default period and preset period step value of the target task in the present invention can be pre-set in the intelligent information management module, for example, the default period is 2000ms, and the preset period step value is 100ms. The specific values ​​of the default period and preset period step value of the target task can be set according to actual needs, and the present invention is not specifically limited here. The weight of the target task in the present invention can be determined according to the task type of the target task, and the first preset relationship between the task type and the weight can be pre-set, and then the weight of the target task is determined based on the first preset relationship between the task type and the weight.

[0090] The present invention can also pre-set a second preset relationship between the processor occupancy rate of the target task and the number of calls of human-computer interaction and the first score, and then determine the first score of the target task based on the processor occupancy rate of the target task and the number of calls of human-computer interaction and the second preset relationship.

[0091] The present invention may also pre-set a third preset relationship between the task update frequency of the target task and the second score, and then determine the second score of the target task according to the task update frequency of the target task and the third preset relationship.

[0092] For example, taking the control task as an example, the default period is 2000ms, the preset period step value is 100ms, the weight of the determined control task is 10, the first score of the determined control task is 2, and the second score of the determined control task is 1. Then, according to the above formula (1), T=2000+100*10*2+1*100*10 is calculated, that is, T=5000ms, so the candidate period of the control task is 5000ms.

[0093] The present invention determines the candidate cycle of the target task according to the preset cycle step value, the number of calls of the human-computer interaction task, the default cycle of the target task, the processor occupancy rate and the task update frequency. The candidate cycle of the target task can be considered from multiple angles, which is equivalent to considering only from the perspective of priority in the prior art. The target candidate cycle determined by the present invention is more in line with actual needs.

[0094] In one embodiment, the control task includes a fan control task; the change in firmware temperature is detected, and the second score of the target task can be determined according to the change in firmware temperature. If the target task is a fan control task, and the second score determined according to the change in firmware temperature is less than zero, the first score of the target task is set to zero. In one scenario, when the change in firmware temperature is too large, it proves that rapid heat dissipation is required and the execution cycle of the fan control task needs to be shortened. Therefore, according to the change in firmware temperature, it can be determined that the second score of the fan control task is less than zero, thereby setting the first score of the fan control task to zero, making the calculated candidate cycle smaller, and quickly executing the fan control task to reduce the firmware temperature, thereby protecting the firmware.

[0095] For example, taking the fan control task as an example, the default period is 5000ms, the preset period step value is 100ms, the weight of the determined control task is 2, and the second score of the determined fan control task is 0, then the first score of the fan control task is set to 0, then according to the above formula (1), T = 5000 + 100 * 2 * 0 + (-2) * 100 * 10 is calculated, that is, T = 3000ms, then the candidate period of the fan control task is 3000ms.

[0096] In an embodiment of the present invention, the first score and the second score of the target task can also be determined according to the priority corresponding to the target task. The higher the priority, the lower the determined first score and the second score. Therefore, compared with the prior art, although the candidate period of the target task is adjusted according to the priority, for the target task with a high priority, the determined candidate period is still kept at a smaller value, so that the thread will not be unable to preempt the target task.

[0097] In one embodiment, determining the target execution cycle of the target task according to the candidate cycle, maximum execution cycle and minimum execution cycle of the target task may include: judging whether the candidate cycle of the target task is greater than the minimum execution cycle and less than the maximum execution cycle; if the candidate cycle of the target task is greater than the minimum execution cycle and less than the maximum execution cycle, determining the candidate cycle as the target execution cycle of the target task; if the candidate cycle of the target task is less than or equal to the minimum execution cycle, determining the minimum execution cycle as the target execution cycle of the target task; if the candidate cycle of the target task is greater than or equal to the maximum execution cycle, determining the maximum execution cycle as the target execution cycle of the target task. Thus, the determined target execution cycle is between the maximum execution cycle and the minimum execution cycle, avoiding the target task being executed too slowly due to the calculated candidate cycle being too large, or the target task being executed too quickly due to the calculated candidate cycle being too small, thereby occupying the thread.

[0098] In an embodiment of the present invention, after determining the target execution cycle of the target task, it may also include: writing the target execution cycle of the target task into a task module corresponding to the target task, so that the task module executes the target task according to the target execution cycle, so that the task module can execute the tasks in the task module according to the determined target execution cycle.

[0099] In the embodiment of the present invention, it is also possible to determine whether there are upgrade tasks and routine test tasks among the multiple tasks according to the task types of the multiple tasks; if there is an upgrade task, the routine test task is stopped; when the upgrade task is completed, the routine test task is continued to be executed according to the target execution period of the routine test task. This avoids the situation where the routine test task is executed while the upgrade task is executed at the same time, resulting in abnormal results of the routine test task, or the result of the routine test task is the result of the routine test before the upgrade, thereby ensuring the rapid completion of the upgrade task and reducing invalid routine tests.

[0100] In an embodiment of the present invention, multiple tasks, as well as task types and task parameters corresponding to the multiple tasks are obtained; a target task that needs to be executed periodically is determined from the multiple tasks according to the task types of the multiple tasks; calling information of the multiple tasks with a priority higher than the target task is detected; a target execution period of the target task is determined according to the calling information of the task with a priority higher than the target task, the task type and task parameters of the target task, thereby determining the target execution period of the target task from multiple angles based on the scheduling information of the task with a priority higher than the target task, as well as the type and task parameters of the target task. Compared with the prior art, this will not affect the execution of the target task with a high priority, thereby preventing the thread from being unable to preempt the target task.

[0101] like Figure 3 FIG. 1 is a flowchart of another task management method provided by an embodiment of the present invention, and the specific steps are as follows:

[0102] The task module is started, and multiple tasks, as well as the task types and task parameters corresponding to the multiple tasks are obtained, wherein the task parameters may include: maximum execution cycle, minimum execution cycle, processor occupancy rate and task update frequency. According to the task type, a target task that needs to be executed periodically is determined from multiple tasks, and according to the task type, the weight of the target task is determined, and according to the processor occupancy rate, the first score of the target task is determined, and according to the task update frequency and the firmware temperature change, the second score of the target task is determined, and it is determined whether the second score of the target task is a negative number. If the second score of the target task is not a negative number, the candidate cycle of the target task is calculated according to the preset algorithm. If the second score of the target task is a negative number, the first score of the target task is set to zero, and the candidate cycle of the target task is calculated according to the preset algorithm. The target cycle is determined according to the candidate cycle, the maximum execution cycle and the minimum execution cycle, and the target cycle is written into the task module corresponding to the target task.

[0103] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0104] Reference Figure 4 , shows a structural block diagram of a task management device provided by an embodiment of the present invention, which may specifically include the following modules:

[0105] An acquisition module 401 is used to acquire multiple tasks, and task types and task parameters corresponding to the multiple tasks;

[0106] A first determining module 402 is used to determine a target task that needs to be executed periodically from the multiple tasks according to the task types of the multiple tasks;

[0107] A detection module 403 is used to detect the call information of the multiple tasks whose priority is higher than the target task;

[0108] The second determining module 404 is configured to determine a target execution period of the target task according to the calling information of the task with a higher priority than the target task, the task type of the target task, and the task parameters.

[0109] In one embodiment, the multiple tasks include: a human-computer interaction task of a human-computer interaction type, a control task of a control type, and a test task of a test type; the call information includes the number of calls of the human-computer interaction task; the priority of the human-computer interaction type is higher than the priority of the control type and the test type; the first determination module 402 includes:

[0110] The first determination submodule is used to determine the management and control tasks and the routine test tasks among the multiple tasks as target tasks that need to be executed periodically.

[0111] In one embodiment, the task parameters include a default period, a maximum execution period, a minimum execution period, a processor occupancy rate, and a task update frequency of the plurality of tasks; the second determination module 404 includes:

[0112] A second determination submodule is used to determine a candidate period of the target task according to a preset period step value, the number of calls of the human-computer interaction task, the default period of the target task, the processor occupancy rate and the task update frequency;

[0113] The candidate period corresponding to the target task is calculated according to the following formula:

[0114] T=T0+Δt*w*Ta+Ti*Δt*w

[0115] Wherein, T represents the candidate cycle of the target task; T0 represents the default cycle of the target task; Δt is the preset cycle step value; w represents the weight of the target task; Ta represents the first score of the target task; Ti represents the second score of the target task; the weight of the target task is determined according to the task type of the target task; the first score of the target task is determined according to the processor occupancy of the target task and the number of calls of the human-computer interaction task; the second score of the target task is determined according to the task update frequency of the target task;

[0116] The third determination submodule is used to determine the target execution cycle of the target task according to the candidate cycle of the target task, the maximum execution cycle and the minimum execution cycle.

[0117] In one embodiment, the control task includes a fan control task; the second determining module 404 further includes:

[0118] A detection submodule, used for detecting a change in firmware temperature; the second score of the target task is determined according to the change in the firmware temperature;

[0119] A setting submodule is used to set the first score of the target task to zero if the target task is the fan control task and the second score determined according to the change in the firmware temperature is less than zero.

[0120] In one embodiment, the third determining submodule includes:

[0121] A judging unit, configured to judge whether the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period;

[0122] a first determining unit, configured to determine the candidate cycle as a target execution cycle of the target task if the candidate cycle of the target task is greater than the minimum execution cycle and less than the maximum execution cycle;

[0123] a second determining unit, configured to determine the minimum execution cycle as a target execution cycle of the target task if the candidate cycle of the target task is less than or equal to the minimum execution cycle;

[0124] The third determining unit is configured to determine the maximum execution cycle as the target execution cycle of the target task if the candidate execution cycle of the target task is greater than or equal to the maximum execution cycle.

[0125] In one embodiment, the device further comprises:

[0126] The writing module is used to write the target execution period of the target task into the task module corresponding to the target task, so that the task module executes the target task according to the target execution period.

[0127] In one embodiment, the device further comprises:

[0128] A judging module, used for judging whether there are upgrade tasks and routine test tasks in the multiple tasks according to the task types of the multiple tasks;

[0129] A stop module, used for stopping the execution of the routine test task if the upgrade task exists;

[0130] The execution module is used to continue to execute the routine test task according to the target execution period of the routine test task when the upgrade task is completed.

[0131] In an embodiment of the present invention, an acquisition module is used to acquire multiple tasks, and task types and task parameters corresponding to the multiple tasks; a first determination module is used to determine a target task that needs to be executed periodically from multiple tasks according to the task types of the multiple tasks; a detection module is used to detect call information of a task with a higher priority than the target task among the multiple tasks; a second determination module is used to determine a target execution period of the target task according to the call information of a task with a higher priority than the target task, the task type and task parameters of the target task, thereby determining the target execution period of the target task from multiple angles based on the scheduling information of a task with a higher priority than the target task, as well as the type and task parameters of the target task. Compared with the prior art, this will not affect the execution of a target task with a high priority, thereby preventing the thread from being unable to preempt the target task.

[0132] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0133] like Figure 5 , showing a structural block diagram of an electronic device provided in an embodiment of the present invention, including:

[0134] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned task management method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0135] like Figure 6, showing that an embodiment of the present invention also provides a structural block diagram of a non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned task management method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0136] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0137] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0138] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0139] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0141] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0142] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0143] The above is a detailed introduction to a task management method, a task management device, an electronic device and a non-volatile readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A task management method, It is characterized in that The method comprises: Obtain multiple tasks, as well as task types and task parameters corresponding to the multiple tasks; Determining a target task that needs to be executed periodically from among the multiple tasks according to the task types of the multiple tasks; Detecting call information of the multiple tasks having a priority higher than the target task; A target execution period of the target task is determined according to the calling information of the task with a priority higher than that of the target task, the task type of the target task, and the task parameters.

2. The task management method according to claim 1, It is characterized in that The multiple tasks include: human-computer interaction tasks of human-computer interaction type, control tasks of control type and routine test tasks of routine test type; the call information includes the number of calls of the human-computer interaction task; the priority of the human-computer interaction type is higher than the priority of the control type and the routine test type; according to the task types of the multiple tasks, the target task that needs to be executed periodically is determined from the multiple tasks, include: The control task and the routine test task among the multiple tasks are determined as target tasks that need to be executed periodically.

3. The task management method according to claim 2, It is characterized in that The task parameters include the default cycle, maximum execution cycle, minimum execution cycle, processor occupancy rate and task update frequency of the plurality of tasks; the calling information of the task with a priority higher than the target task, The task type and the task parameters of the target task determine the target execution period of the target task, including: Determine a candidate period of the target task according to a preset period step value, the number of calls of the human-computer interaction task, the default period of the target task, the processor occupancy rate and the task update frequency; The candidate period corresponding to the target task is calculated according to the following formula: T=T0+Δt*w*Ta+Ti*Δt*w Wherein, T represents the candidate period of the target task; T0 represents the default period of the target task; □t is the preset cycle step value; w is the weight of the target task; Ta represents the first score of the target task; Ti represents the second score of the target task; the weight of the target task is determined according to the task type of the target task; the first score of the target task is determined according to the processor occupancy of the target task and the number of calls of the human-computer interaction task; the second score of the target task is determined according to the task update frequency of the target task; A target execution cycle of the target task is determined according to the candidate cycle of the target task, the maximum execution cycle and the minimum execution cycle.

4. The task management method according to claim 3, It is characterized in that The control task includes a fan control task; the method further includes: Detecting a change in firmware temperature; determining a second score of the target task according to the change in firmware temperature; If the target task is the fan control task, and the second score determined according to the change in the firmware temperature is less than zero, the first score of the target task is set to zero.

5. The task management method according to claim 3, It is characterized in that The step of determining a target execution cycle of the target task according to the candidate cycle of the target task, the maximum execution cycle, and the minimum execution cycle includes: Determine whether the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period; If the candidate period of the target task is greater than the minimum execution period and less than the maximum execution period, determining the candidate period as the target execution period of the target task; If the candidate period of the target task is less than or equal to the minimum execution period, determining the minimum execution period as the target execution period of the target task; If the candidate period of the target task is greater than or equal to the maximum execution period, the maximum execution period is determined as the target execution period of the target task.

6. The task management method according to claim 1, It is characterized in that The method further includes: writing the target execution period of the target task into a task module corresponding to the target task, so that the task module executes the target task according to the target execution period.

7. The task management method according to claim 1, It is characterized in that The method further comprises: judging whether there are upgrade tasks and routine test tasks in the multiple tasks according to the task types of the multiple tasks; If the upgrade task exists, stop executing the routine test task; When the upgrade task is completed, continue to execute the routine test task according to the target execution period of the routine test task.

8. A task management device, It is characterized in that The device comprises: An acquisition module, used to acquire multiple tasks, and task types and task parameters corresponding to the multiple tasks; A first determining module, configured to determine a target task that needs to be executed periodically from among the multiple tasks according to the task types of the multiple tasks; A detection module, used for detecting call information of the multiple tasks having a higher priority than the target task; The second determining module is used to determine the target execution period of the target task according to the calling information of the task with a higher priority than the target task, the task type of the target task and the task parameters.

9. An electronic device, It is characterized in that include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the task management method according to any one of claims 1 to 7 are implemented.

10. A non-volatile readable storage medium, It is characterized in that The non-volatile readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the task management method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Point position polling method and device, electronic equipment and storage medium

    CN119383119A