Task estimation and scheduling method, computer storage medium and electronic device
By receiving task registration information, observing processes and storing execution records, and using a decrementing function to estimate task execution time, the problem of cron's inability to meet complex scheduling needs and security vulnerabilities is solved, thus enabling support for complex scheduling rules and efficient utilization of system resources.
Patent Information
- Application Number
- CN202410705476.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-05-10
- Filing Date
- 2024-06-03
- Publication Date
- 2025-11-11
AI Technical Summary
Existing task scheduling technologies such as cron cannot meet complex scheduling needs and have security vulnerabilities that can be exploited by malicious attackers.
This paper provides a task estimation and scheduling method. By receiving task registration information, observing the process, storing execution records, and using a decrementing function to estimate the task execution time, it supports complex scheduling rules and permission verification, thereby improving security.
It enables support for complex scheduling rules, improves the utilization of system resources, and enhances system security and service quality.
Smart Images

Figure CN120929200A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a task estimation and scheduling technique, and more particularly to a task estimation and scheduling method, computer storage medium, and electronic device. Background Technology
[0002] In computers and servers, there are usually one or more tasks that need to be executed regularly, such as instructions or scripts. Various task scheduling technologies exist, such as the cron command-line utility program in Unix-like operating systems. Users responsible for building and maintaining the software environment (such as system administrators) can use cron to schedule one or more tasks so that these tasks are executed periodically at fixed times, dates, or cycles.
[0003] However, cron's scheduling rules are relatively simple and cannot meet more complex scheduling needs. For example, if a task needs to be executed every three days or every two weeks, cron requires the user to set a fixed monthly, weekly, hourly, and minute execution schedule for each task, including start and end times. Users cannot directly set a schedule to be executed every three days or every two weeks, which is relatively inconvenient to use.
[0004] Furthermore, the current cron scheduling mechanism has security concerns. Any process that can write to cron's configuration file will be executed by cron's daemon. Therefore, malicious attackers can use methods such as command injection to modify the configuration file to execute arbitrary commands, causing damage to computers or servers. Summary of the Invention
[0005] To address the aforementioned problems, the present invention provides a method for task estimation and scheduling, a computer storage medium, and an electronic device. The task estimation and scheduling method is executed by the electronic device and includes: receiving registration information of a task and storing the registration information; observing multiple processes executed by the electronic device; identifying a target process belonging to the task among the multiple processes based on the registration information; storing execution records of each execution of the target process by the electronic device; and estimating the future start time and execution duration of the task based on each execution record. The weight of each execution record in the estimation (i.e., the estimation of the future start time and execution duration of the task) is determined based on a decreasing function of the existing duration of each execution record.
[0006] The present invention also provides a computer storage medium storing instructions which are read by an electronic device to execute the above-described method for task estimation and scheduling.
[0007] The present invention also provides an electronic device, including a registration module, a task database, an observation module, a record database, and an estimation module. First, the registration module receives task registration information and writes it into the task database. Second, the observation module observes multiple processes executed by the electronic device, identifies the target process belonging to the task among these processes based on the registration information, and writes the execution record of each execution of the target process by the electronic device into the record database. Third, the estimation module estimates the future start time and execution duration of the task based on each execution record, wherein the weight of each execution record in the estimation is determined by a decreasing function of the existing duration of each execution record.
[0008] In one embodiment, the above task is an unscheduled task.
[0009] In one embodiment, the present invention can receive and store registration information of a task to be scheduled, and then execute the task to be scheduled based on the registration information.
[0010] In one embodiment, the registration information of the scheduled tasks of the present invention can be configured with a variety of complex scheduling rules, such as scheduling effective date, scheduling expiration date, subsequent tasks, triggering conditions, and waiting time and number of repetitions for re-executing tasks when an error occurs.
[0011] In one embodiment, the present invention can verify whether the registrant of a task has the permission to execute the executable file of the task, and only receives and stores the registration information of the task after the registrant passes the verification, so as to complete the registration of the task, thus having a high level of security.
[0012] In one embodiment, the present invention provides a user interface that can estimate the execution time and cycle of all scheduled and unscheduled tasks. The user interface displays the names and schedules of all scheduled and unscheduled tasks in the form of a calendar, weekly calendar, monthly calendar, or yearly calendar. This allows system administrators to quickly view the system resource usage of the electronic device at different times and to quickly find suitable times to schedule tasks.
[0013] Accordingly, the present invention can optimize the system resource utilization of the electronic device and improve the service quality and system utilization of the electronic device. Attached Figure Description
[0014] Figure 1 This is a schematic block diagram of an electronic device for performing a method of task estimation and scheduling according to the present invention.
[0015] Figure 2 and Figure 3 This is a flowchart of a task estimation and scheduling method according to the present invention.
[0016] Figure 4 and Figure 5 This is a schematic diagram illustrating the estimated execution time of the task according to the present invention.
[0017] Figures 6 to 8 This is a flowchart of a task estimation and scheduling method according to the present invention.
[0018] Explanation of main component symbols
[0019] 100 electronic devices
[0020] 101 User Interface
[0021] 102 Rule Processing Module
[0022] 103 Registration Module
[0023] 104 Task Database
[0024] 105 Timing Module
[0025] 106 Condition Check Module
[0026] 107 Execution Module
[0027] 108 Observation Module
[0028] 109 Record Database
[0029] 110 Prediction Module
[0030] Steps 21-22, 31-35, 61-63, 71-75, 81-83. Detailed Implementation
[0031] The following describes the implementation of the present invention through at least one embodiment. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification.
[0032] Figure 1 This is a schematic block diagram of an electronic device 100 for performing a method of task estimation and scheduling according to the present invention.
[0033] In one embodiment, the electronic device 100 may be an electronic device with data processing and computing functions, such as a computer, server, or network attached storage (NAS).
[0034] In addition, the electronic device 100 includes a user interface 101, a rule processing module 102, a registration module 103, a task database 104, a timing module 105, a condition checking module 106, an execution module 107, an observation module 108, a record database 109, and a prediction module 110.
[0035] In one embodiment, the rule processing module 102 is communicatively connected to the user interface 101; the registration module 103 is communicatively connected to the rule processing module 102; the task database 104 is communicatively connected to the user interface 101 and the registration module 103; the timing module 105 is communicatively connected to the task database 104; the condition checking module 106 is communicatively connected to the timing module 105; the execution module 107 is communicatively connected to the condition checking module 106; the record database 109 is communicatively connected to the execution module 107 and the observation module 108; and the estimation module 110 is communicatively connected to the user interface 101 and the record database 109.
[0036] In one embodiment, each of the elements 101 to 110 of the electronic device 100 is used to perform... Figures 2 to 6 The flowchart illustrates the methods for task estimation and scheduling.
[0037] The task can be a process that is executed periodically or irregularly by the electronic device 100, or a service that is continuously executed by the electronic device 100 and resides on the electronic device 100.
[0038] Specifically, tasks can be divided into two types: scheduled tasks and unscheduled tasks. Scheduled tasks refer to tasks for which scheduling rules need to be set on the electronic device 100. After the setting is completed, the electronic device 100 will execute the scheduled task periodically according to the scheduling rules. For example, a process used to periodically scan for viruses is a scheduled task. On the other hand, unscheduled tasks refer to tasks for which scheduling rules do not need to be set on the electronic device 100, or tasks for which scheduling rules cannot be set on the electronic device 100. For example, when a user or backup software on another electronic device uploads a file to the electronic device 100, the electronic device 100 must execute a specific process to receive, store, or process the file. Since this specific process is only passively executed when the user or backup software on the other electronic device uploads the file, its execution time cannot be determined in advance. Therefore, this specific process is an unscheduled task.
[0039] As described above, each of the components 101 to 110 of the electronic device 100 is used to perform... Figures 2 to 6The flowchart illustrates the task estimation and scheduling method. In other words, the user interface 101 receives registration information (i.e., the scheduling rules mentioned above) of tasks requiring scheduling from the registrant and displays the schedules for tasks requiring scheduling and those not requiring scheduling. The user interface 101 can be a graphical user interface (GUI) or other forms of interface, and the registrant of the tasks requiring scheduling can be the system administrator of the electronic device 100 or other users with the required permissions. The rule processing module 102 checks whether the newly input scheduling rules comply with the regulations of the electronic device 100 (e.g., checking whether attributes are compatible or whether values exceed the allowable range) and converts the newly input scheduling rules into the internal format of the electronic device 100.
[0040] The registration module 103 is used to receive registration information for unscheduled tasks (details described later) input by the registrant, as well as registration information for scheduled tasks that have been formatted by the rule processing module 102. The registrant for unscheduled tasks can be a process executed by the electronic device 100, such as a process responsible for installing and uninstalling applications.
[0041] In addition, the registration module 103 is also used to verify whether the registrant of each task (including each scheduled task and each unscheduled task) has the permission to execute the executable file of the task, and to write the registration information of each task into the task database 104. The task database 104 is used to store the registration information of each task.
[0042] The timing module 105 is used to maintain and manage the system time of the electronic device 100, and according to the time set by the scheduling rules, it causes the execution module 107 to execute the scheduled tasks. If the scheduling rules of a scheduled task include trigger conditions, the condition checking module 106 checks whether the trigger conditions have been met, and if the trigger conditions have been met, it causes the execution module 107 to execute the scheduled task.
[0043] The execution module 107 is used to execute the scheduled tasks and write the execution record of each execution of the scheduled tasks into the record database 109.
[0044] The observation module 108 is used to observe all processes executed by the electronic device 100, and to find the process belonging to each unscheduled task in all processes based on the registration information of the unscheduled task (hereinafter referred to as the target process), and then write the execution record of the target process executed by the electronic device 100 each time into the record database 109.
[0045] Database 109 is used to store the execution records of tasks that require scheduling and tasks that do not require scheduling.
[0046] The estimation module 110 is used to obtain or estimate the future start time and execution time of each scheduled task and non-scheduled task based on the execution records of scheduled and non-scheduled tasks, so that the user interface 101 can display the schedule of scheduled and non-scheduled tasks.
[0047] In one embodiment, the user interface 101, modules 102-103, 105-108, and 110 of the electronic device 100 can all be implemented as software, firmware, or hardware; if it is hardware, it can be a processing unit, processing core, or processor with data processing and computing functions; if it is software or firmware, it can include instructions executable by the electronic device 100. Furthermore, in Figure 1 In the illustrated embodiment, the task database 104 and the record database 109 are shown as databases inside the electronic device 100, while in another embodiment, the task database 104 and the record database 109 may be databases located outside the electronic device 100.
[0048] Figure 2 A flowchart of a task estimation and scheduling method performed by the electronic device 100 of the present invention.
[0049] First, in step 21, registration information is received to obtain the future start time and execution time of each task (including each scheduled task and each unscheduled task). The specific flow of step 21 for scheduled and unscheduled tasks is illustrated below. Figure 3 and Figure 7 .
[0050] Next, in step 22, the schedule of each task is displayed based on its future start time and execution time. The scheduling of each task in this step is displayed by the user interface 101. Specifically, the user interface 101 will display at least the task name, future start time, end time, and execution time of each task. The end time of each task is the sum of the start time and the execution time.
[0051] The user interface 101 can switch between calendar, weekly calendar, monthly calendar and annual calendar to display the schedule of each task. The user interface 101 can display different types of tasks in various styles.
[0052] Furthermore, the style may include at least one of the following: graphic, border color, text color, and background color. For example, scheduled tasks and unscheduled tasks may be displayed using different styles. Scheduled tasks with and without trigger conditions may be displayed using different styles. Scheduled tasks with different attributes may be displayed using different styles. Additionally, different categories of unscheduled tasks may also be displayed using different styles.
[0053] As described above, the user interface 101 displays the schedules of all scheduled and unscheduled tasks. In other words, the user interface 101 comprehensively displays the schedules of every task that will be executed in the future and may be executed in the future. Therefore, when the process returns to step 21 after step 22, the system administrator can conveniently and quickly find a suitable time point in the display screen of the user interface 101 to schedule new tasks (i.e., enter the registration information of new tasks that need to be scheduled), thereby improving the utilization rate of the electronic device 100.
[0054] Figure 3 This is a flowchart for each task that needs to be scheduled in step 21.
[0055] First, in step 31, the registrant adds a task to be scheduled on the user interface 101 and enters the registration information (i.e., scheduling rules) for the task.
[0056] The registration information for each scheduled task may include the task name, start time, start command, end time, end command, repetition type, repetition interval, schedule effective date, schedule expiration date, task type, subsequent tasks, error wait time, number of error repetitions, triggering conditions, and priority level. These attributes are explained in detail below.
[0057] Task Name: To be displayed on the user interface 101 for the system administrator of the electronic device 100 to view.
[0058] Start time: The time when the scheduled task will begin execution, for example, 18:00.
[0059] Start command: The command executed at the start execution time to initiate the scheduled task.
[0060] End execution time: The time when the scheduled task will end, for example, 21:00.
[0061] Termination instruction: An instruction executed at the termination execution time to terminate the scheduled task.
[0062] Repetition type: Specifies the frequency at which the scheduled task will be executed, such as once per hour, day, week, month, or year.
[0063] Repetition interval: Specifies the period during which the scheduled task will be executed repeatedly, such as once every ten days.
[0064] Schedule effective date and schedule expiration date: These are the dates on which the schedule for the task to be scheduled begins and expires, respectively. For example, the start time and end time can be collectively referred to as the execution time of the task to be scheduled, and the repetition type and repetition interval can be collectively referred to as the execution cycle of the task to be scheduled. The electronic device 100 will execute the task to be scheduled within the time interval from the schedule effective date to the schedule expiration date, according to the execution time and the execution cycle. If the time interval is outside the time interval from the schedule effective date to the schedule expiration date, the electronic device 100 will not execute the task to be scheduled. If the schedule effective date and schedule expiration date are not set, the electronic device 100 will only execute the task to be scheduled according to the execution time and the execution cycle.
[0065] Task Types: Tasks can be immediate, periodic, or service tasks. Immediate tasks are those requiring a relatively short execution time, such as synchronizing the system time of electronic device 100 via Network Time Protocol (NTP). Registration information for immediate tasks must include the start time and start command, but not the end time and end command. Periodic tasks are those requiring a relatively long execution time, such as disk data scrubbing. Service tasks are continuous, persistent services, such as web page services provided by a web server. Registration information for both periodic and service tasks must include the start time, start command, end time, and end command.
[0066] Subsequent task: Used to specify the subsequent task of the scheduled task. If the registration information of the scheduled task includes a subsequent task, the electronic device 100 will continue to execute the subsequent task after the scheduled task is successfully completed.
[0067] Error wait time: The wait time before re-execution of the scheduled task after an error occurs during its execution.
[0068] Error repetition count: The maximum number of times a scheduled task can be re-executed after consecutive errors occur. Specifically, after an error occurs during the execution of a scheduled task, the electronic device 100 will first wait for the time specified by the error waiting time, and then re-execute the scheduled task until the scheduled task has been successfully completed or the number of re-executions has reached the error repetition count.
[0069] Triggering conditions: These are triggering conditions related to the system resources of electronic device 100. For example, the utilization rate of the central processing unit (CPU) of electronic device 100 must be lower than a specified value of the triggering condition, or the amount of idle memory of electronic device 100 must be higher than a specified value of the triggering condition, or the disk I / O latency of electronic device 100 must be lower than a specified value of the triggering condition. This triggering condition is an additional judgment condition beyond the aforementioned execution time and execution cycle. Specifically, when the system time of electronic device 100 meets the execution time and execution cycle of the scheduled task, it checks whether the system resources of electronic device 100 meet the triggering condition. If the system resources meet the triggering condition, electronic device 100 executes the scheduled task; otherwise, it does not execute the scheduled task. This triggering condition can be used for tasks with low time constraints but high resource consumption, such as multimedia format conversion or disk data repair.
[0070] Priority: When multiple scheduled tasks meet the above execution time and execution cycle, or meet the above execution time, execution cycle and triggering conditions, the electronic device 100 will prioritize the execution of the task with the highest priority among these tasks.
[0071] Next, in step 32, the rule processing module 102 checks whether the registration information of the task to be scheduled complies with the regulations of the electronic device 100, and converts the registration information into the internal format of the electronic device 100.
[0072] In step 33, the registration module 103 verifies whether the registrant has permission to execute the executable file for the scheduled task based on their account password, access token, or session identification (session ID). For example, the registrant could be the system administrator of electronic device 100, the account password could be the one used by the system administrator to log in to electronic device 100, and the access token or session identification could be the one obtained by the system administrator after logging in to electronic device 100. If the registrant does not have the permission, the verification fails, and the registration module 103 interrupts the process. Figure 3 The process reports errors. If the registrant has the necessary permissions, the registrant passes the verification, and the registration module 103 receives the registration information that has been formatted by the rule processing module 102.
[0073] In step 34, the registration module 103 writes the registration information into the task database 104.
[0074] In step 35, the estimation module 110 obtains the future start time and execution time of the task to be scheduled based on the registration information and execution record of the task to be scheduled, so as to display it on the user interface 101.
[0075] The estimation module 110 can directly obtain the future start time of the scheduled task from the registration information of the task to be scheduled.
[0076] As for the future execution time of the scheduled task, if the registration information of the scheduled task includes the start time and end time of the scheduled task, the estimation module 110 can calculate the difference between the start time and the end time, and the difference is the future execution time of the scheduled task.
[0077] If the registration information of the scheduled task does not include the end execution time of the scheduled task, the estimation module 110 may estimate the future execution time of the scheduled task using one of the following methods.
[0078] The first method: As described above, the execution module 107 writes the execution record of each execution of each scheduled task into the record database 109. Each execution record includes the start time and end time of the execution of that scheduled task. Therefore, the estimation module 110 can calculate the difference between the start time and end time in the execution record of the previous execution of the scheduled task. This difference is the future execution time length of the scheduled task.
[0079] The second method: The estimation module 110 can use the above method to calculate the difference between the start time and the end time in the execution records of the first n executions of the scheduled task, a1, a2, ..., a n These n differences represent the execution time lengths of the first n executions of the task to be scheduled. Then, the estimation module 110 calculates the arithmetic mean of these n execution time lengths (a1 + a2 + ... + a...). n The arithmetic mean of n is the future execution time of the scheduled task, where n can be any integer greater than 1.
[0080] The third method: The estimation module 110 can use the above methods to calculate the execution time lengths a1, a2, ..., a of the first n executions of the scheduled tasks. n Then calculate the weighted average of these n execution times (a1*F(1)+a2*F(2)+…+a n*F(n)) / (F(1)+F(2)+…+F(n)), the weighted average is the future execution time of the task to be scheduled, where the weights F(1), F(2),…,F(n) are the output values obtained by inputting integers i=1,2,…,n into the function F(i).
[0081] Generally, the most recent execution record is more relevant, while older execution records are less relevant. Therefore, the function F(i) can be a decreasing function. In other words, the longer an execution record has existed, the smaller the output value of the function F(i), meaning its weight is smaller. Furthermore, among the n execution records from the first n executions, the first execution record is the most recent, and the nth execution record is the oldest. Therefore, the function F(i) can be viewed as a decreasing function of the existing time (i.e., lifetime) of each execution record.
[0082] For example, the decreasing function F(i) can be as follows: Figure 4 The cosine function shown is y = cos(x), and its output value y can be normalized. Specifically, the value of y is increased by 1 to shift its range from -1 to 1 to 0 to 2, and then the value of y is divided by 2 to change its range back to 0 to 1. Thus, the cosine function becomes y = (cos(x) + 1) / 2.
[0083] Additionally, the x value can be preprocessed. The y value corresponding to x values from 0 to π is from 1 to 0. Therefore, the sequence numbers i = 1, 2, ..., n of the n execution records of the first n executions can be adjusted to correspond to 0 to π. Thus, each sequence number i corresponds to i*π / n. Based on this, the decreasing function of the weight can be obtained as F(i) = (cos(i*π / n) + 1) / 2.
[0084] For example, if n equals 10, then the weight F(i) of the execution record with sequence number i = 1, 2, ..., 10 is as follows: Figure 5 As shown. By applying these weights F(i) to the above weighted average formula, the future execution time of the scheduled task can be estimated.
[0085] The fourth method: The prediction module 110 can use a model obtained through machine learning technology, and will estimate the execution time lengths a1, a2, ..., a of the n executions of the task to be scheduled. n Input the data into the model to estimate the future execution time of the scheduled task.
[0086] Based on the above methods, the estimation module 110 can obtain the future start time and execution time of the scheduled task.
[0087] Figure 6In a task estimation and scheduling method of the present invention, the timing module 105, the condition checking module 106 and the execution module 107 of the electronic device 100 execute a flowchart of the task to be scheduled.
[0088] First, in step 61, the timing module 105 checks whether the system time of the electronic device 100 matches the execution time and execution cycle in the registration information of any scheduled task. If the execution time and execution cycle of a scheduled task match the system time of the electronic device 100, the timing module 105 instructs the condition checking module 106 to check whether the triggering condition of the scheduled task has been met.
[0089] In step 62, if the system time equals the start time in the registration information of the scheduled task, and the registration information of the scheduled task includes a trigger condition, then the condition checking module 106 checks whether the system resources of the electronic device 100 have met the trigger condition. If the condition is met, the condition checking module 106 instructs the execution module 107 to execute the scheduled task. If the condition is not met, the condition checking module 106 interrupts the process. Figure 6 The process is to not execute the scheduled task.
[0090] On the other hand, if the system time is equal to the end execution time in the registration information of the task to be scheduled, or if the registration information of the task to be scheduled does not include the triggering condition, then the condition checking module 106 will not check the triggering condition and will directly instruct the execution module 107 to execute the task to be scheduled.
[0091] In step 63, execution module 107 executes the scheduled task. If the system time of electronic device 100 is equal to the start execution time in the registration information of the scheduled task, execution module 107 executes the start instruction in the registration information to initiate the scheduled task. If the system time of electronic device 100 is equal to the end execution time in the registration information of the scheduled task, execution module 107 executes the end instruction in the registration information to terminate the scheduled task.
[0092] In addition, the execution module 107 checks whether the scheduled task has successfully completed. If it has, the execution module 107 checks whether the registration information of the scheduled task includes subsequent tasks. If the registration information includes subsequent tasks, the execution module 107 executes the subsequent tasks. If the execution of the scheduled task ends due to an error, and the registration information includes the error waiting time and the number of error repetitions, the execution module 107 re-executes the scheduled task according to the error waiting time and the number of error repetitions in the registration information.
[0093] Before executing the subsequent task, if the registration information of the subsequent task includes a trigger condition, the process can return to step 62 so that the condition checking module 106 can check whether the system resources of the electronic device 100 have met the trigger condition. Similarly, before the scheduled task is repeatedly executed due to an error, if the registration information of the scheduled task includes a trigger condition, the process can return to step 62 so that the condition checking module 106 can check whether the system resources of the electronic device 100 have met the trigger condition.
[0094] Furthermore, the execution module 107 can observe the start and end times of each task it executes to generate an execution record for each task, and write the execution record to the record database 109. The execution record includes at least the start and end times of the task being executed.
[0095] Figure 7 This is a flowchart for each unscheduled task in step 21.
[0096] First, in step 71, the registration module 103 receives and stores the registration information of the unscheduled task provided by the registrant. This registration information may include the task name, category, and executable file name or execution instructions for the unscheduled task. The category of the unscheduled task may include, for example, data backup, disk data repair, or software execution license (license) checks.
[0097] In step 72, the observation module 108 observes all processes executed by the electronic device 100.
[0098] In step 73, the observation module 108 identifies the process belonging to the unscheduled task (hereinafter referred to as the target process) among all processes executed by the electronic device 100 based on the file name or execution instruction in the registration information of the unscheduled task.
[0099] In step 74, the observation module 108 observes the start and end times of each execution of the target task by the electronic device 100, generating an execution record for each execution of the target process, and then writes the execution record to the record database 109. Accordingly, the record database 109 stores the execution record. The execution record includes at least the start and end times of this execution of the target process, that is, the start and end times of this execution of the unscheduled task.
[0100] In step 75, the estimation module 110 estimates the future start time and execution time of the unscheduled task based on the above execution records of the unscheduled task, for display on the user interface 101.
[0101] Regarding the future start time of the unscheduled task, the estimation module 110 can estimate the future start time of the unscheduled task based on the start time in the two execution records of the two most recent executions of the target process by the electronic device 100.
[0102] For example, if the start times in the two most recent execution records are fixed times on fixed days in two consecutive years, then the future start time of the unscheduled task can be predicted to be the fixed time on that fixed day each year, such as 14:00 on December 25th of each year.
[0103] If the start times in the two most recent execution records are fixed times on fixed days in two adjacent months, then the future start time of the unscheduled task can be estimated to be the same fixed time on the same fixed day of each month, for example, 14:00 on the 23rd of each month.
[0104] If the start times in the two most recent execution records are fixed times on fixed days in two consecutive weeks, then the future start time of the unscheduled task can be predicted to be the same fixed time on the same fixed day of each week, for example, 14:00 every Tuesday.
[0105] If the start times in the two most recent execution records are fixed times on two consecutive days, then the future start time of the unscheduled task can be predicted to be that fixed time every day, such as 14:00 every day.
[0106] In addition, if the start times of the two most recent execution records are separated by a certain number of seconds (e.g., 3600 seconds), the start time of the most recent execution record can be added to that number of seconds to obtain the estimated start time of the next execution of the unscheduled task, and the start times of subsequent executions can be calculated in the same way.
[0107] As for the future execution time of the unscheduled task, the estimation module 110 can use any one of the first to fourth methods of estimating the future execution time of the scheduled task to estimate the future execution time of the unscheduled task.
[0108] Figure 8 The flowchart for step 71 is as follows.
[0109] First, in step 81, the registration module 103 receives registration information provided by the registrant of the unscheduled task. As described above, the registrant of the unscheduled task can be the process in the electronic device 100 responsible for installing and uninstalling applications, and this process can automatically register with the registration module 103 after installing an application to provide the application's registration information. Thus, the application becomes a newly registered executable file for the unscheduled task.
[0110] In step 82, the registration module 103 verifies whether the registrant has permission to execute the executable file for the unscheduled task based on their account password, access token, or session identifier. For example, the account password could be the one used by the system administrator or other user when logging into electronic device 100 to install the application. The access token could be an access token obtained after the system administrator or other user logs into electronic device 100, or an access token obtained after the application is installed. The session identifier could be a session identifier obtained after the system administrator or other user logs into electronic device 100. If the registrant does not have the permission, the verification fails, and the registration module 103 terminates. Figure 8 The process will then report any errors. If the registrant has the necessary permissions, the registrant will pass the verification.
[0111] In step 83, the registration module 103 writes the registration information of unscheduled tasks into the task database 104. Accordingly, the task database 104 stores the registration information.
[0112] For example, a system administrator can register four scheduled tasks and five unscheduled tasks on electronic device 100. The four scheduled tasks are: disk array data repair performed every weekend, system upgrade performed every Friday evening, and web server and database services performed every weekday from 8 AM to 5 PM. The five unscheduled tasks are: customer file backup scheduled for 1 AM to 2 AM daily, virus scan scheduled for 6 PM to 7 PM daily, multimedia format conversion scheduled for 8 PM to 9 PM daily, NTP system time synchronization scheduled for 2 seconds per hour, and software license check scheduled for 10 seconds per day at 3 AM daily. User interface 101 can display the names and schedules of these nine tasks for the system administrator to view.
[0113] In one embodiment, the present invention provides a computer storage medium, such as a memory, magnetic tape, magnetic disk, or optical disk. This computer storage medium can be used to store instructions that can be read by an electronic device 100 to execute the task estimation and scheduling method described above. In another embodiment, the computer storage medium is a non-transitory computer storage medium.
[0114] In summary, this invention provides a method for task estimation and scheduling, as well as a corresponding electronic device and computer storage medium. It displays the names and schedules of all tasks requiring scheduling through a user interface in the form of a calendar, weekly calendar, monthly calendar, or yearly calendar. It can also estimate the start time, end time, execution duration, and execution cycle of all unscheduled tasks, displaying their names and schedules through the user interface. Therefore, system administrators can quickly view the system resource usage of the electronic device at different times, and when new tasks need to be added to the electronic device, system administrators can quickly find suitable times to schedule the tasks.
[0115] Therefore, this invention optimizes the system resource utilization of the electronic device and improves its service quality and system utilization. Furthermore, this invention verifies whether a registrant has the authority to execute task-related instructions using methods such as account passwords, access tokens, or session identifiers, and only writes the task registration information to the task database after the registrant has been verified, thus providing higher security.
[0116] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify and alter the above embodiments without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention should be as set forth in the claims.
Claims
1. A method for task estimation and scheduling, performed by an electronic device, the method comprising: Receive the registration information of the first task and store the registration information of the first task; Observe the multiple processes executed by the electronic device; Based on the registration information of the first task, identify the target process belonging to the first task among the multiple processes; Stores the execution record of each time the electronic device executes the target process; and Based on each execution record, the future start time and execution duration of the first task are estimated, wherein the weight of each execution record in the estimation is determined by a decreasing function of the existing duration of each execution record.
2. The task estimation and scheduling method as described in claim 1, wherein, The registration information for the first task includes the filename or execution instructions of the executable file for the first task, and the methods for task estimation and scheduling also include: The target process can be located among the multiple processes based on the filename or the execution command.
3. The task estimation and scheduling method as described in claim 1, wherein, Each execution record includes the start time of the electronic device executing the target process, and the method for task estimation and scheduling also includes: The future start time of the first task is estimated based on the start time of the two execution records of the two most recent executions of the target process by the electronic device.
4. The task estimation and scheduling method as described in claim 1, wherein, Each execution record includes the start time and end time of the electronic device executing the target process, and the future execution time length of the first task is a weighted average calculated based on the start time of each execution record, the end time of each execution record, and each weight.
5. The task estimation and scheduling method as described in claim 1, wherein, The method also includes: Receive the registration information of the second task and store the registration information of the second task; Based on the registration information and execution records of the second task, obtain the future start time and execution duration of the second task; and The second task is performed based on the registration information of the second task.
6. The task estimation and scheduling method as described in claim 5, wherein, For each of the tasks in the first task and the second task, the methods for task estimation and scheduling also include: Verify whether the registrant of the task has the permission to execute the executable file of the task based on the registrant's account password, access token, or session identifier, and only receive and store the registration information of the task after the registrant of the task has passed the verification.
7. The task estimation and scheduling method as described in claim 5, wherein, The method also includes: The user interface of the electronic device receives the registration information for the second task; and The user interface displays the start time, end time, and execution time length of the first task and the second task in the future, wherein each end time is the sum of the corresponding start time and the corresponding execution time length.
8. The task estimation and scheduling method as described in claim 5, wherein, The registration information for this second task includes the execution time, execution cycle, schedule effective date, and schedule expiration date, and the methods for task estimation and scheduling also include: The second task shall be executed within the time interval from the effective date of the schedule to the expiration date of the schedule, according to the execution time and the execution cycle.
9. The task estimation and scheduling method as described in claim 5, wherein, The registration information for this second task includes subsequent tasks, and the methods for estimating and scheduling these tasks also include: After the second task is successfully completed, the subsequent task will be executed.
10. The task estimation and scheduling method as described in claim 5, wherein, The registration information for this second task includes the error wait time and the number of error repetitions, and the methods for task estimation and scheduling also include: If an error occurs during the execution of the second task, wait for the time specified by the error waiting time, and then repeat the execution of the second task until the second task has been successfully completed or the number of repetitions has reached the number of error repetitions.
11. The task estimation and scheduling method as described in claim 5, wherein, The registration information for this second task includes the execution time, execution cycle, and triggering conditions related to the system resources of the electronic device, and the method for task estimation and scheduling also includes: When the system time of the electronic device meets the execution time and execution cycle, check whether the system resources have met the trigger condition; and If the system resources meet the triggering condition, the second task will be executed; otherwise, the second task will not be executed.
12. A computer storage medium storing instructions that are read by an electronic device to perform the task estimation and scheduling method as described in any one of claims 1 to 11.
13. An electronic device comprising: The registration module is used to receive the registration information of a task and write the registration information into a task database. The observation module is used to observe multiple processes executed by the electronic device, and to find the target process belonging to the task among the multiple processes based on the registration information, and then write the execution record of the electronic device executing the target process each time into a record database. as well as The estimation module estimates the future start time and execution time of the task based on each execution record. The weight of each execution record in the estimation is determined by a decreasing function of the existing time length of each execution record.