Task scheduling methods, devices, electronic equipment and computer program products

By identifying invariant prefix sequences and retaining existing time planning results when tasks change, time planning is only performed on the remaining subtasks, solving the problem of high computational load in existing technologies and improving the efficiency and response speed of task scheduling.

CN123068032APending Publication Date: 2026-11-10TP-LINK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611291603.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

Existing task scheduling systems require re-initializing all task parameters and reordering them when tasks change, resulting in a large amount of computation and making it difficult to meet the scheduling efficiency and response speed requirements in scenarios with frequent task changes.

Method used

By obtaining the first subtask sequence before the task change and the second subtask sequence after the change, the invariant prefix sequence is determined by comparing each position, and the existing time planning results are retained. Time planning is only performed on the remaining subtasks to avoid duplicate calculations.

Benefits of technology

It reduces the computational load and processing time of task scheduling, and improves scheduling efficiency in scenarios with task changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123068032A_ABST
    Figure CN123068032A_ABST
Patent Text Reader

Abstract

This application discloses a time-axis-based task scheduling method, apparatus, electronic device, and computer program product. The method includes: acquiring a first subtask sequence before a task change, and acquiring a second subtask sequence obtained according to the task change, both arranged according to the same preset scheduling priority rule; comparing each position sequentially from the first position of both sequences, and determining consecutive subtasks at corresponding positions that meet preset consistency conditions as an invariant prefix sequence; retaining the existing time planning results for each subtask in the first subtask sequence corresponding to the invariant prefix sequence, and determining the occupied time period based on the existing time planning results; and performing time planning on the remaining subtasks in the second subtask sequence following the invariant prefix sequence according to the arrangement order in the second subtask sequence, to obtain the task scheduling result. This application's solution can reduce the computational load of task timeline replanning during task changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and in particular relates to a time-axis-based task scheduling method, a time-axis-based task scheduling device, electronic equipment, and computer program products. Background Technology

[0002] As computing resources such as Graphics Processing Units (GPUs) are used to handle both real-time and routine tasks, scheduling systems typically need to allocate non-conflicting execution time slots for multiple subtasks within the execution window defined by the start and end times of each task. When tasks are added, edited, or deleted, existing task scheduling methods usually reinitialize all task parameters, reorder all subtasks, re-search for available time slots, and update scheduling results. Even if a task change only affects a small number of subtasks, the time planning results that are already determined and still valid in the original subtasks will be recalculated. As the number of tasks increases, this full-scale planning method generates a large amount of redundant calculations, increasing the processing time required for task changes and making it difficult to meet the requirements for scheduling efficiency and response speed in scenarios with frequent task changes. Therefore, how to reduce the computational load of replanning the timeline of tasks during task changes has become an urgent problem to be solved. Summary of the Invention

[0003] This application provides a time-axis-based task scheduling method, a time-axis-based task scheduling device, an electronic device, and a computer program product, which can reduce the computational load of task time-axis replanning during task changes.

[0004] Firstly, this application provides a time-axis-based task scheduling method, including: Get the first subtask sequence before the task change, and get the second subtask sequence obtained according to the task change. The first subtask sequence and the second subtask sequence are arranged according to the same preset scheduling priority rule. Starting from the first position of the first subtask sequence and the second subtask sequence, compare each position sequentially and determine the consecutive subtasks that meet the preset consistency condition at the corresponding positions as the invariant prefix sequence; Retain the existing time planning results of each subtask in the first subtask sequence that corresponds to the invariant prefix sequence, and determine the occupied time period based on the existing time planning results; Based on the occupied time period, the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence are time-planned according to the order in the second subtask sequence to obtain the task scheduling result.

[0005] Secondly, this application provides a time-axis-based task scheduling device, comprising: The first acquisition module is used to acquire the first subtask sequence before the task change and to acquire the second subtask sequence obtained according to the task change. The first subtask sequence and the second subtask sequence are arranged according to the same preset scheduling priority rule. The comparison module is used to compare the first and second subtask sequences bit by bit, starting from the first position, and determine the consecutive subtasks that meet the preset consistency conditions at the corresponding positions as the invariant prefix sequence. The first determining module is used to retain the existing time planning results of each subtask in the first subtask sequence corresponding to the invariant prefix sequence, and to determine the occupied time period based on the existing time planning results. The planning module is used to perform time planning for the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence, based on the occupied time period and in the order of arrangement in the second subtask sequence, to obtain the task scheduling result.

[0006] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect.

[0007] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.

[0008] Fifthly, this application provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the method described in the first aspect.

[0009] The advantages of this application compared with the prior art are as follows: By arranging the subtask sequences before and after the task change according to the same preset scheduling priority rule, and comparing each position to determine the invariant prefix sequence, this application can identify subtasks whose planning results are not affected during the task change process; by retaining the existing time planning results of each subtask in the invariant prefix sequence, and only performing time planning on the remaining subtasks thereafter, it avoids repetitive planning for all subtasks, reducing the computational load and processing time of task scheduling; at the same time, by determining the occupied time period based on the existing time planning results, the time planning of the remaining subtasks can be connected with the existing planning results, thereby improving the scheduling efficiency in task change scenarios.

[0010] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram illustrating the implementation process of the time-axis-based task scheduling method provided in this application embodiment; Figure 2 This is a structural block diagram of the time-axis-based task scheduling device provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0013] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.

[0014] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0015] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly indicating the number, specific order, or primary and secondary relationship of the indicated technical features.

[0016] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0017] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0018] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), unless otherwise expressly and specifically defined.

[0019] This application proposes a time-axis-based task scheduling method. This method can be applied to electronic devices with data processing capabilities. As an example only, the electronic device can be a server, computer equipment, resource management equipment, or a cluster of devices consisting of multiple computing nodes. In one application scenario, this task scheduling method can be used to manage GPU resources and schedule execution times for multiple tasks that require GPU resources. Each task can be executed once or multiple times within a scheduling cycle; therefore, the task scheduling method needs to allocate sufficient time for each execution within the allowed execution time range of the corresponding task, while avoiding conflicting tasks occupying the same time period. Of course, this application can also be used for processor resources, storage resources, network resources, or other resources that can be allocated according to time, and is not limited thereto.

[0020] Please see Figure 1 , Figure 1 The implementation flow of the task scheduling method applied to this electronic device is given, and the details are as follows: Step 101: Obtain the first subtask sequence before the task change, and obtain the second subtask sequence based on the task change.

[0021] During normal operation, the electronic device can maintain the various tasks currently participating in scheduling and their corresponding time planning results. When a task change request is received, the electronic device can determine the content to be scheduled before the task change and after adjustments based on the task change, so as to subsequently determine which existing time planning results are specifically affected by this task change.

[0022] Task changes can include adding, editing, or deleting tasks. Adding a task will add the corresponding task to the list of tasks to be scheduled; editing a task will change the task parameters of an existing task; deleting a task will remove the corresponding task from the list of tasks to be scheduled.

[0023] In some embodiments, to maintain the association between tasks and their corresponding subtasks, the electronic device may also maintain a task mapping table. The task mapping table records the mapping relationship between task identifiers and their corresponding subtasks. The electronic device can determine the subtask currently corresponding to a task based on the task mapping table, and process the associated subtasks according to the corresponding task identifier when adding, editing, or deleting a task.

[0024] It should be noted that the task mapping table is used to represent the relationship between tasks and subtasks, while the first subtask sequence and the second subtask sequence are used to represent the ordered sequence formed by subtasks participating in the timeline scheduling according to a preset scheduling priority rule. Electronic devices can determine the subtasks corresponding to a task based on the task mapping table, and further generate the first subtask sequence or the second subtask sequence according to the scheduling parameters of each subtask.

[0025] Considering that the same task can have multiple execution times, electronic devices can convert the task into a corresponding number of execution units according to each execution time. For ease of description, the execution units formed by a task according to different execution times are referred to as subtasks in this application. Thus, one task can correspond to one subtask or multiple subtasks.

[0026] Each subtask can carry corresponding scheduling parameters. For example, these parameters might include the task ID of the task it belongs to, the subtask ID used to distinguish different subtasks, the start time, the deadline, the duration, the priority, and the task type. If a subtask has already completed its time planning, it can also have the allocated time slots and end time, among other time planning results.

[0027] The electronic device can obtain a first subtask sequence based on the content to be scheduled before the task change. This first subtask sequence reflects all subtasks involved in scheduling before the task change occurred, and can retain the time planning results of each subtask that were determined before the task change. Simultaneously, the electronic device can adjust the content to be scheduled according to the task change, and obtain a second subtask sequence based on the adjusted content. This second subtask sequence reflects all subtasks that need to be scheduled after the task change takes effect.

[0028] For example, when a new task is added, the second subtask sequence can add the subtask corresponding to the new task to the existing subtasks; when a task is edited, the second subtask sequence can replace the original subtask corresponding to the edited task with a new subtask formed according to the parameters of the edited task; when a task is deleted, the second subtask sequence may no longer include the subtask corresponding to the deleted task.

[0029] After obtaining two subtask sequences, the electronic device can arrange the subtasks according to the same preset scheduling priority rule. This preset scheduling priority rule refers to the rule used to determine the order of different subtasks during the scheduling process. Because the two subtask sequences use the same arrangement criteria, subtasks unaffected before and after task changes are positionally comparable, thus supporting subsequent positional comparisons.

[0030] This step creates two sub-task sequences before and after the task change, with a unified arrangement basis, providing a comparative foundation for identifying sub-tasks that can continue to use the existing time planning results.

[0031] Step 102: Starting from the first position of the first subtask sequence and the second subtask sequence, compare each position sequentially and determine the consecutive subtasks that meet the preset consistency condition at the corresponding positions as the invariant prefix sequence.

[0032] After obtaining the first and second subtask sequences, the electronic device does not immediately re-plan the time for all subtasks in the second subtask sequence. Instead, it first determines whether there are any usable parts of the existing time planning results in the first subtask sequence.

[0033] Specifically, the electronic device can start from the first position of each of the two subtask sequences and compare the subtasks that are at the same position in the sequence one by one. For example, it can first compare the first subtask in the two sequences, then compare the second subtask in the two sequences, and continue comparing from front to back in this manner. The positions with the same sequence number in the two sequences can be called corresponding positions.

[0034] During the comparison process, the electronic device can determine whether the two subtasks at corresponding positions meet a preset consistency condition. This preset consistency condition is used to determine whether the two subtasks at corresponding positions can be regarded as the same scheduled execution unit before and after the task change, and whether their original time planning results can still be used.

[0035] If the two subtasks at the current corresponding position meet the preset consistency condition, the electronic device can continue to compare the next corresponding position; if not, it means that from this position onwards, the task change may have affected the arrangement or time planning of subsequent subtasks, and the comparison can be stopped.

[0036] Starting from the beginning of each of the two subtask sequences, a sequence of consecutive subtasks that meet a preset consistency condition constitutes an invariant prefix sequence. Here, "prefix" indicates that the sequence must be at the beginning of the entire subtask sequence, and "invariant" means that the subtasks within it remain consistent before and after task changes, and the existing time planning results are still applicable. If the two sequences do not meet the preset consistency condition at their beginning, the invariant prefix sequence can be empty.

[0037] For example, the first subtask sequence includes subtask A, subtask B, subtask C, and subtask D in sequence, and the second subtask sequence includes subtask A, subtask B, subtask E, and subtask C in sequence. The first two corresponding positions remain the same, while the third corresponding positions are subtask C and subtask E respectively. Therefore, subtask A and subtask B form an invariant prefix sequence, and the third sequence position becomes the changed position corresponding to this task change.

[0038] This step helps determine the continuous range from which existing time planning results can be directly used, and also helps determine the starting boundary for subsequent incremental planning.

[0039] Step 103: Retain the existing time planning results of each subtask in the first subtask sequence that corresponds to the invariant prefix sequence, and determine the occupied time period based on the existing time planning results.

[0040] Once the invariant prefix sequence is determined, the electronic device can confirm that the existing time planning results of subtasks located in the positions covered by the invariant prefix sequence within the first subtask sequence do not need to be recalculated due to this task change. Therefore, the electronic device can continue to retain the original time arrangements of these subtasks, that is, retain their existing time planning results.

[0041] The existing time planning results refer to the execution time arrangements that have been determined for the corresponding subtasks before the task changes occur. For example, a subtask may be scheduled to be executed from 10:00 AM to 10:30 AM on Monday; if segmented execution is allowed, a subtask may also have multiple allocated time periods.

[0042] It should be noted that the invariant prefix sequence is used to determine which sequence positions remain unchanged, and the time planning result used in this step comes from the first subtask sequence before the task change. If subtask A and subtask B in the first subtask sequence constitute an invariant prefix sequence, and they originally occupied the first time period and the second time period respectively, then the electronic device can continue to retain the first time period and the second time period.

[0043] After retaining the above time planning results, the electronic device can also determine the time range that has already been occupied. For ease of description, in this embodiment, the time range occupied by the existing time planning results of each subtask in the invariant prefix sequence is referred to as the occupied time period. When planning the time for other subtasks subsequently, these occupied time periods should be avoided to prevent time conflicts.

[0044] This step allows for the direct reuse of existing time planning results that are still valid in the invariant prefix sequence, and their conversion into time occupancy constraints that subsequent incremental planning must adhere to, thereby avoiding redundant planning for subtasks that are not affected by task changes.

[0045] Step 104: Based on the occupied time period, perform time planning on the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence according to the order in the second subtask sequence to obtain the task scheduling result.

[0046] After retaining the existing time planning results of the invariant prefix sequence, the electronic device only needs to process the portion of the second subtask sequence not covered by the invariant prefix sequence. For ease of description, in this embodiment, the subtasks in the second subtask sequence that are located after the invariant prefix sequence are referred to as the remaining subtasks. These can be subtasks that are directly added or whose parameters have changed in this task change, or subtasks whose parameters have not changed, but whose arrangement position or available time is affected by changes in other subtasks.

[0047] The electronic device can determine the time planning results for the remaining subtasks in the order of their arrangement in the second subtask sequence. For any remaining subtask, the corresponding execution time period can be determined within the allowed execution time range by combining its start time, end time, execution duration, and other scheduling parameters, while avoiding the occupied time period already determined in step 103.

[0048] After completing the time planning for all remaining subtasks, the electronic device can combine the existing time planning results for each subtask in the invariant prefix sequence with the time planning results obtained for each remaining subtask in this iteration to form the task scheduling result after the task change. This task scheduling result is used to represent the execution time arrangement of each subtask in the second subtask sequence after the task change.

[0049] This step allows for time planning only of the remaining subtasks that may be affected by task changes, based on the existing time planning results using the invariant prefix sequence, thus forming a complete task scheduling result after task changes.

[0050] Before determining the invariant prefix sequence, the first and second subtask sequences have already been arranged according to the same preset scheduling priority rules. Therefore, for subtasks whose arrangement has not changed due to task changes, their relative positions in the two sequences remain consistent, and the task scheduler can perform position-by-position comparison based on the sequence positions. Based on this, in some embodiments, the preset consistency conditions include: the subtask identifiers of two subtasks at corresponding positions are the same, and in the case of task editing, neither of these two subtasks corresponds to the task being edited. As mentioned above, subtask identifiers are used to distinguish different subtasks. If the subtask identifiers at the same position in two sequences are the same, they can generally be considered to correspond to the same execution unit before and after the task change. However, in the task editing scenario, comparing only the subtask identifiers may still lead to misjudgments. For example, if a user only modifies the execution duration of a task without modifying the start time, the subtasks generated before and after the edit may still have the same subtask identifier, but the original time planning result should no longer be used. Therefore, when a task is changed to task editing, it is also necessary to confirm that neither of the two compared subtasks corresponds to the task being edited. Based on the above-mentioned pre-defined consistency conditions, step 102 may specifically include: A1, determine the first and second positions of the first and second subtask sequences as the current comparison position.

[0051] The electronic device can use the first position of each of the two subtask sequences as the starting position for comparison. That is, when performing the first comparison, the current comparison position points to the first subtask in the first subtask sequence and the first subtask in the second subtask sequence, respectively.

[0052] The reason for starting the comparison from the beginning of the sequence is that the invariant prefix sequence should consist of two subtask sequences whose initial parts are consecutively consistent. If we skip the subtasks at the beginning of the sequence and start comparing from the middle, even if there are identical subtasks later on, it does not mean that the time planning results before them have not been affected by the task changes.

[0053] A2, determine whether both the first subtask sequence and the second subtask sequence include the subtask located at the current comparison position.

[0054] After determining the current comparison position, the electronic device can first determine whether both subtask sequences have comparable subtasks at that position. After tasks are added, deleted, or edited, the number of subtasks included in the second subtask sequence may differ from that of the first subtask sequence. Therefore, before each comparison, it is necessary to confirm that the current comparison position does not exceed the range of either subtask sequence.

[0055] For example, the first subtask sequence includes three subtasks, and the second subtask sequence includes two subtasks. When the electronic device completes the comparison of the positions of the first two sequences and determines the position of the third sequence as the new current comparison position, there is no longer a subtask in the second subtask sequence located at that position, and there is no need to continue the consistency judgment.

[0056] A3, if both the first and second subtask sequences include a subtask at the current comparison position, determine whether the two subtasks at the current comparison position meet the preset consistency condition.

[0057] If both subtask sequences have subtasks at the current comparison position, the electronic device can obtain the two subtasks at that position and determine whether they meet the aforementioned preset consistency condition.

[0058] When a task is changed to a new task or a deleted task, the electronic device can compare the subtask identifiers of two subtasks. If the subtask identifiers are the same, it can be determined that the current comparison position meets the preset consistency condition; if they are different, it means that the task change has changed the subtask corresponding to the current comparison position.

[0059] When a task is changed to task editing, the electronic device, in addition to comparing subtask identifiers, also needs to determine whether the two subtasks correspond to the task being edited. Even if the subtask identifiers of the two subtasks are the same, as long as they correspond to the task being edited, it should still be determined that the current comparison position does not meet the preset consistency condition. Therefore, the invariant prefix sequence can be made to end before reaching the subtask corresponding to the task being edited, avoiding the use of the original time planning result of the task being edited.

[0060] For example, both the first and second subtask sequences include subtask A, subtask B, and subtask C in sequence. This task change is used to edit the task to which subtask B belongs. Although the subtask identifier at the second position in both sequences is B, this subtask belongs to the task being edited. Therefore, the two sequences do not meet the preset consistency condition at the second position, and the invariant prefix sequence only includes subtask A.

[0061] A4. If the two subtasks being compared meet the preset consistency condition, the subtask in the second subtask sequence located at the current comparison position is determined as the subtask in the invariant prefix sequence, and the next sequence position is determined as the new current comparison position. Then, return to execute step A2 and subsequent steps.

[0062] If the two subtasks at the current comparison position meet the preset consistency condition, it means that the subtask corresponding to that position has not been affected by the current task change. The electronic device can include the subtask located at the current comparison position in the second subtask sequence into the invariant prefix sequence.

[0063] Subsequently, the electronic device can move the current comparison position forward by one sequence position, and at the new current comparison position, it can again determine whether both subtask sequences contain subtasks, and whether the corresponding subtasks meet the preset consistency condition. Through the above loop, only subtasks that consecutively meet the preset consistency condition starting from the first position of the sequence will enter the invariant prefix sequence in sequence.

[0064] A5. The comparison ends if the two subtasks being compared do not meet the preset consistency conditions, or if at least one of the first and second subtask sequences does not include the subtask located at the current comparison position.

[0065] When the two subtasks at the current comparison position do not meet the preset consistency condition, it indicates that the task change has already caused a subtask change at that position, or the subtask corresponding to the edited task has been reached, and the electronic device can stop further expanding the invariant prefix sequence. Similarly, when there is no subtask at the current comparison position in at least one subtask sequence, it indicates that at least one subtask sequence has been traversed, and the comparison can also end at this time.

[0066] At the end of the comparison, the subtasks that were previously determined consecutively starting from the first position of the sequence constitute the final invariant prefix sequence. The current comparison position reflects where the difference between the first and second subtask sequences begins to occur.

[0067] By following the steps above, starting from the first position of the two sub-task sequences and comparing them cyclically, and excluding the sub-tasks corresponding to the task being edited during task editing, we can accurately determine the invariant prefix sequence that can still be used for existing time planning results, thereby improving the reliability of incremental planning range identification.

[0068] In some embodiments, after the electronic device has determined the invariant prefix sequence and retained the existing time planning results of each subtask, since these existing time planning results are still valid, the time already occupied by the remaining subtasks should be avoided when time planning is performed on the remaining subtasks. As an example, the electronic device can use a greedy planning method to perform time planning on each remaining subtask sequentially according to the order in the second subtask sequence. The core idea is: when processing the current subtask to be planned, based on the currently available free position shown on the preset time axis, a time period that meets its execution requirements is preferentially allocated to the subtask to be planned; after completing the time period allocation for the current subtask to be planned, the preset time axis is updated according to the corresponding time period allocation result, and the next subtask is processed, without backtracking to adjust the preceding subtasks whose time planning has been completed. Thus, each subtask to be planned forms a local time allocation result based on the currently available free time position, and this local time allocation result further serves as the already occupied constraint when time planning subsequent subtasks, thereby gradually forming the time planning results for each remaining subtask according to the order in the second subtask sequence. Based on this, step 104 can specifically include: B1 maps the occupied time period to a preset time axis to determine the occupied and free positions in the preset time axis.

[0069] Before starting time planning for the remaining subtasks, the electronic device can establish a preset timeline to represent the current time occupancy. The time range covered by this preset timeline can be determined based on the scheduling cycle used for task scheduling. For example, in the case of a one-week scheduling cycle, the preset timeline can cover the time range from the start of the week to the end of the week.

[0070] The electronic device can also divide the time range according to a preset time granularity, so that the preset time axis consists of multiple sequentially arranged time positions. The preset time granularity can be set according to the scheduling accuracy requirements, for example, it can be seconds, minutes or other time units.

[0071] Electronic devices can determine the time periods corresponding to each existing time planning result based on the existing time planning results of each subtask in the invariant prefix sequence, and map the corresponding time periods to a preset time axis. Time positions on the preset time axis that are covered by a certain time period can be marked as occupied positions; the remaining time positions can be marked as idle positions.

[0072] In one example, the preset timeline can be represented as a Boolean array, where each element corresponds to a time position, and different Boolean values ​​indicate whether the position is occupied or idle. Of course, the preset timeline can also be a set of time intervals, a bitmap, or other data structures that can distinguish between occupied and idle positions.

[0073] B2, based on the idle position in the preset timeline, allocate at least one time period within the execution time window of the subtask to be planned to satisfy the execution duration of the subtask to be planned.

[0074] After obtaining the preset timeline, the electronic device can identify the first subtask in the second subtask sequence following the invariant prefix sequence as the initial subtask to be planned. As the planning process progresses, different remaining subtasks can be identified as subtasks to be planned in sequence.

[0075] For a currently planned subtask, the electronic device can determine the range of execution time allowed to be allocated based on its start and end times. For ease of description, this embodiment of the application refers to the time range defined by the start and end times of the planned subtask as the execution time window. The time period allocated to the subtask should fall within this execution time window.

[0076] After determining the execution time window, the electronic device can search for available positions within the preset time axis range corresponding to the execution time window, and allocate time periods to the planned subtasks based on the found available positions. The cumulative duration of at least one allocated time period should be sufficient to meet the execution duration of the planned subtasks.

[0077] Specifically, the electronic device can start from the time position corresponding to the start time of the subtask to be planned, search for an available position within the execution time window in chronological order, and prioritize using the earlier available position to allocate a time period for the subtask to be planned. Thus, when there are multiple available available positions, the earlier available position can be used first, without iterating through and comparing all possible combinations of time periods.

[0078] When a series of free locations are found, the electronic device can start allocating time from the beginning of the series of free locations and continue allocating time in the chronological direction until the duration of the allocated time period meets the total execution time of the planned sub-task, or reaches the end of the series of free locations.

[0079] If the duration of the current consecutive idle positions is insufficient to meet the total execution time of the planned subtask, the electronic device can first allocate the time period corresponding to the consecutive idle positions to the planned subtask, and then continue to search for the next idle position, and use the subsequent idle positions to continue allocating the remaining execution time, until the cumulative duration of the allocated time periods meets the execution time of the planned subtask.

[0080] For example, if the execution duration of a planned subtask is 30 seconds, and a 20-second consecutive idle period is first found within its execution time window, followed by a 15-second consecutive idle period, the electronic device can first allocate the aforementioned 20-second time slot, and then allocate a 10-second time slot from the latter idle period, so that the cumulative duration of the two allocated time slots reaches 30 seconds.

[0081] For example, if an electronic device first finds a continuous idle position with a duration not less than the execution duration of the planned subtask within the execution time window of the planned subtask, it can directly allocate a time period that satisfies the entire execution duration from the continuous idle position without continuing to search for subsequent idle positions.

[0082] When using the above greedy planning method, the time period allocation made by the electronic device for the current sub-task to be planned is mainly determined based on the available position in the current preset time axis; after the time period allocation of the current sub-task to be planned is completed, the time planning results of the sub-tasks arranged before the current sub-task to be planned will not be readjusted.

[0083] In some embodiments, when the task execution time window spans a preset scheduling period, the task scheduler of the electronic device can determine the time position corresponding to the subtask to be planned based on a continuous search process across the time window. Specifically, the task scheduler can use the time range between the start time and the end time of the subtask to be planned as the search range, and determine its mapping position on the preset time axis based on the current search time.

[0084] When the current search time exceeds the time range covered by the current preset scheduling period, the task scheduler can determine the time position of the current search time in the corresponding scheduling period based on the correspondence between the current search time and the preset scheduling period, and map the time position to the corresponding position in the preset time axis, and then continue to search for free positions based on the mapped time position.

[0085] In other words, when processing cross-cycle execution time windows, the task scheduler does not directly truncate the execution time window. Instead, it maintains the continuous time range corresponding to the execution time window and maps the time positions corresponding to each search time within this continuous time range to the time axis position of the corresponding scheduling cycle through a cycle mapping method, thereby achieving continuous searching of idle time within the cross-cycle time window. In one implementation, this step may further include: when the execution time window spans at least two scheduling cycles, mapping the time positions within the execution time window to the time axis position of the corresponding scheduling cycle according to the correspondence between the time positions within the execution time window and the preset scheduling cycle, and searching for idle positions based on the mapped time axis positions.

[0086] For example, if the preset scheduling cycle is one week, and the execution time window of a certain planned subtask extends from the current weekend to the beginning of the next week, the task scheduler can first search for an available position at the time position corresponding to the end of the current cycle; when the search time enters the next cycle, the time position corresponding to the search time is mapped to the corresponding position in the time axis of the next cycle to continue searching until the execution duration of the planned subtask is met or the deadline is reached.

[0087] Therefore, when the current search time exceeds a preset scheduling cycle, the search can return to the starting position of the preset timeline and continue until the deadline of the subtask to be planned is reached. Through this process, only the position in the preset timeline undergoes periodic looping, while the execution time window of the subtask to be planned is still processed according to the continuous time range from the start time to the deadline.

[0088] If the electronic device can find an idle position within the execution time window whose cumulative duration meets the execution duration, the time period allocation result of the subtask to be planned can be formed; if the cumulative duration of the idle position within the execution time window is insufficient to meet the execution duration, the time planning of the subtask to be planned can be determined to have failed.

[0089] B3, based on the time period allocation results of the sub-tasks to be planned, update the occupied positions in the preset timeline.

[0090] After completing the time period allocation for the current planned sub-task, the electronic device can record the allocated time period as the time planning result of the planned sub-task and determine the various time positions covered by the time period allocation result on the preset time axis.

[0091] Subsequently, the electronic device can update these time locations from idle to occupied. If multiple time periods are allocated to the planned subtask, the time locations covered by each time period can be updated separately. It should be noted that during the update, the occupied locations determined by the existing time planning results of the invariant prefix sequence in step B1 remain unchanged.

[0092] B4. If there is a next subtask following the planned subtask in the second subtask sequence, the next subtask is identified as the new planned subtask, and the execution steps B2 and subsequent steps are returned based on the updated preset timeline.

[0093] After completing the time planning for the current subtask and updating the preset timeline, the electronic device can determine whether there are any remaining subtasks in the second subtask sequence that have not yet completed their time planning. If so, the next subtask can be designated as a new subtask to be planned, according to the order in the second subtask sequence.

[0094] Subsequently, based on the updated preset timeline, the electronic device searches for available slots within the execution time window of the new planned subtasks and completes the corresponding time slot allocation and timeline update. The preset timeline used for each subtask's time planning already includes the occupied slots created by previously planned subtasks.

[0095] If a planned subtask fails to obtain a time period sufficient for execution within its execution time window, the electronic device can stop the subsequent loop and determine that the task scheduling was unsuccessful.

[0096] B5. If all remaining subtasks have completed their time planning, the task scheduling result is obtained based on the existing time planning results of each subtask in the invariant prefix sequence and the time planning results of each remaining subtask.

[0097] When all remaining subtasks in the second subtask sequence have completed their time planning, the subtasks in the second subtask sequence can be divided into two parts: the first part consists of the subtasks in the invariant prefix sequence, which continue to use the existing time planning results before the task change; the second part consists of the remaining subtasks located after the invariant prefix sequence, which use the time planning results obtained from this incremental planning.

[0098] The electronic device can integrate the two time planning results according to the order in the second subtask sequence to obtain the task scheduling result. In some embodiments, the electronic device can also use this result to update its maintained complete subtask list and save the time planning results corresponding to each subtask for use in task execution and the next task change.

[0099] Based on the above steps, the existing time planning results are mapped to the preset time axis, and the remaining sub-tasks are allocated time periods and their time occupancy status is updated in the order of the second sub-task sequence. This enables incremental planning to be completed while avoiding time conflicts and improves the efficiency of task time axis rescheduling.

[0100] Of course, electronic devices may also use other methods to plan the remaining subtasks based on the occupied time period, and this application embodiment does not limit this.

[0101] In some embodiments, during the incremental planning process described above, if the currently effective scheduling state is modified after the time planning of some remaining subtasks is completed, and subsequent subtask planning fails, the system may be in an intermediate state where only a partial update has been completed. To maintain the consistency of the task scheduling state, a corresponding unified commit and rollback mechanism is proposed. Therefore, step 104 can also specifically include: C1 generates a work timeline based on the occupied time period and generates candidate subtask data based on the second subtask sequence.

[0102] The electronic device can generate a working timeline for this incremental planning based on the occupied time periods corresponding to the existing time planning results of each subtask in the invariant prefix sequence. This working timeline is used to temporarily record the occupied status of each time position during this time planning process. The electronic device can copy the time occupancy status determined in step 103 based on the existing time planning results and use the copied timeline as the working timeline. Changes in the time occupancy status that occur during subsequent time planning of the remaining subtasks are first recorded on the working timeline, without directly modifying the currently effective timeline.

[0103] Simultaneously, the electronic device can generate candidate subtask data based on the second subtask sequence. The candidate subtask data may include each subtask in the second subtask sequence and its candidate time planning results. In one implementation, each subtask in the second subtask sequence can be copied, and the copied subtask data can be used as candidate subtask data.

[0104] In this process, subtasks in the invariant prefix sequence can retain their existing time planning results in the candidate subtask data, while the remaining subtasks following the invariant prefix sequence await the determination of their corresponding time planning results through subsequent steps. Before all incremental planning steps are successful, the candidate subtask data is not considered as the currently active scheduling state.

[0105] C2, based on the work timeline, performs time planning for each remaining subtask according to the order in the second subtask sequence, and records the time planning results to the candidate subtask data.

[0106] After obtaining the work timeline and candidate subtask data, the electronic device can perform time planning for each remaining subtask located after the invariant prefix sequence in the order of arrangement in the second subtask sequence.

[0107] For the remaining subtasks to be planned, the electronic device can allocate at least one time period within the execution time window of the remaining subtask, based on the idle position in the work time axis, to meet the execution duration. After completing the allocation of the corresponding time period, the electronic device can record the allocated time period as the time planning result of the remaining subtask in the candidate subtask data.

[0108] At the same time, electronic devices can also update the time position corresponding to the allocated time period to the occupied position in the working timeline, so that the next remaining subtask can be time-planned based on the updated time occupancy status.

[0109] The above processing can be performed cyclically according to the order of the second subtask sequence until all remaining subtasks have completed their time planning, or until any remaining subtask fails to obtain a time period that meets the execution duration within its execution time window.

[0110] C3, assuming all remaining subtasks have completed their time planning, obtains the task scheduling result based on the candidate subtask data, and updates the current subtask list based on the task scheduling result.

[0111] If all remaining subtasks in the second subtask sequence obtain time planning results that meet the corresponding execution requirements, then the incremental planning is successful.

[0112] At this point, the candidate subtask data includes both the existing time planning results of each subtask in the invariant prefix sequence that are retained, and the time planning results of each remaining subtask obtained in this incremental planning. Therefore, the electronic device can generate a task scheduling result covering each subtask in the second subtask sequence based on the candidate subtask data.

[0113] After obtaining the task scheduling results, the electronic device can update the current subtask list using candidate subtask data, so that each subtask after the task change and its time planning results become the current effective scheduling state.

[0114] Furthermore, the electronic device can update the task mapping table based on the type of task change. For example, when a new task is added, a mapping relationship between the new task identifier and the corresponding new subtask can be added to the task mapping table; when a task is edited, the mapping relationship between the edited task identifier and the newly generated subtask can be updated; when a task is deleted, the mapping relationship between the corresponding task identifier and the corresponding subtask can be deleted.

[0115] C4: If any remaining subtask has not completed its time schedule, discard the candidate subtask data and retain the current subtask list before the task change.

[0116] If any remaining subtask fails to obtain at least one time period within its execution time window that meets the required execution duration, the electronic device can determine that the incremental planning has failed and stop time planning for subsequent remaining subtasks.

[0117] Since the time planning results of each remaining subtask were previously recorded only in the candidate subtask data, and the changes in time occupancy status were only recorded in the working timeline, the electronic device can discard the candidate subtask data and working timeline generated this time, and not use the intermediate results to update the currently effective scheduling status.

[0118] In this scenario, the electronic device retains the current subtask list, current timeline, and task mapping table from before the task change. Corresponding task addition, editing, or deletion requests can be identified as failing time planning validation.

[0119] For example, in a task editing scenario, if a new subtask generated based on the edited task parameters cannot complete the time planning, the original task parameters and the original time planning results will still be retained; in a task addition scenario, if the subtask corresponding to the added task cannot complete the time planning, the added task will not be added to the current scheduling state; in a task deletion scenario, if the corresponding incremental planning fails, the candidate deletion result will not be submitted.

[0120] By following the steps above, all incremental planning can be completed on the temporary work timeline and candidate subtask data, and the results can be submitted uniformly after all planning is successful, which can avoid inconsistencies in the current scheduling status caused by planning failure.

[0121] It is important to note that steps C1-C4 and steps B1-B5 do not conflict and can be used in combination. Steps B1-B5 mainly explain how to allocate time slots to each remaining subtask based on the available positions in the preset timeline, how to update the time occupancy status, and how to perform time planning cyclically according to the order in the second subtask sequence. Steps C1-C4 further explain the data carrier used in the above time planning process and the timing of submitting the time planning results. That is, steps C1-C4 do not change the incremental planning process proposed in steps B1-B5, but rather, based on this incremental planning process, isolate the planning process through the working timeline and candidate subtask data, and control whether the planning results take effect through a unified submission and failure rollback mechanism.

[0122] In some task change scenarios, all subtasks in the second subtask sequence may belong to an invariant prefix sequence. For example, when deleting a task at the end of the subtask sequence that does not affect the remaining subtasks, or when the task change request does not cause any valid subtask changes, there may be no remaining subtasks in the second subtask sequence that need to be replanned. Based on this, after step 103 and before step 104, the electronic device also performs the following operations: D1 determines whether the invariant prefix sequence includes all subtasks in the second subtask sequence.

[0123] Electronic devices can determine whether the number of subtasks included in the invariant prefix sequence is the same as the number of subtasks included in the second subtask sequence.

[0124] Since the invariant prefix sequence is a sequence of subtasks determined continuously from the first position of the second subtask sequence, when the number of subtasks included in the invariant prefix sequence is the same as the number of subtasks included in the second subtask sequence, it can be determined that the invariant prefix sequence includes all subtasks in the second subtask sequence.

[0125] Accordingly, when the number of subtasks included in the invariant prefix sequence is less than the number of subtasks included in the second subtask sequence, it can be determined that there are still remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence.

[0126] Of course, electronic devices can also make the above judgment using the end position of the invariant prefix sequence, the starting index of the remaining subtasks, or other data that can represent the range of the invariant prefix. This application embodiment does not limit this.

[0127] D2, if the invariant prefix sequence includes all subtasks in the second subtask sequence, determine the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence as empty, and directly obtain the task scheduling result based on the existing time planning results of each subtask in the invariant prefix sequence.

[0128] If the invariant prefix sequence includes all subtasks in the second subtask sequence, then there are no subtasks in the second subtask sequence that are located after the invariant prefix sequence. In other words, the remaining subtasks that need to be re-planned are empty.

[0129] In this scenario, each subtask in the second subtask sequence can utilize the existing time planning results of the corresponding subtask before the task change. Therefore, the electronic device does not need to re-search for idle time slots or repeatedly execute the time planning of the remaining subtasks; instead, it can directly determine the existing time planning results of each subtask in the invariant prefix sequence as the task scheduling result after the task change.

[0130] For example, the first subtask sequence includes subtask A, subtask B, subtask C, and subtask D in sequence. The task deletion operation only deletes subtask D, which is at the end of the sequence. The second subtask sequence includes subtask A, subtask B, and subtask C in sequence. If subtask A, subtask B, and subtask C form an invariant prefix sequence, then all subtasks in the second subtask sequence can use the existing time planning results, without needing to re-plan the time for subtask A, subtask B, and subtask C.

[0131] If the second subtask sequence is empty, for example, if the task change is used to delete all current tasks, then both the invariant prefix sequence and the remaining subtasks can be empty, and the resulting task scheduling result can also be empty. The electronic device can clear the current subtask list and its corresponding time occupancy status based on this empty task scheduling result.

[0132] Accordingly, step 104 can be triggered if the invariant prefix sequence does not include all subtasks in the second subtask sequence. That is, if the invariant prefix sequence does not include all subtasks in the second subtask sequence, it means that there are still remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence. In this case, the electronic device can continue to execute step 104, that is, based on the occupied time periods corresponding to the existing time planning results of each subtask in the invariant prefix sequence, perform time planning for each remaining subtask according to the order in the second subtask sequence, and combine the existing time planning results of the invariant prefix sequence to obtain the task scheduling result.

[0133] By following the steps above, when all subtasks in the second subtask sequence can reuse existing time planning results, the corresponding results can be directly reused, thereby further reducing unnecessary time planning operations.

[0134] In some embodiments, where the task change specifically manifests as task editing, the electronic device can redetermine the subtasks corresponding to the task based on the edited task parameters, and allow the newly determined subtasks to participate in subsequent scheduling along with the subtasks of other unedited tasks. In this case, the second subtask sequence can be obtained as follows: E1 generates at least one new subtask corresponding to the edited task based on the edited task's post-editing task parameters.

[0135] After receiving a task editing request, the electronic device can determine the task that needs to be edited based on the request. For ease of description, the task targeted by this task editing is referred to as the edited task in this embodiment of the application.

[0136] Specifically, the electronic device can first query the task mapping table based on the task identifier of the task to be edited. If the corresponding task identifier does not exist in the task mapping table, it means that there is no corresponding task that can be edited at present, and the electronic device can refuse to edit the task; if it exists, the edited task parameters of the task to be edited can be obtained.

[0137] Edited task parameters refer to the task parameters that the edited task should adopt after the current task editing takes effect. These parameters may include one or more of the following: start time, end time, execution duration, and task type. Even if the user only modifies one parameter, the electronic device can regenerate a new subtask corresponding to that task based on the complete edited task parameters.

[0138] If the task being edited corresponds to only one execution within a scheduling cycle, a new subtask can be generated; if the task being edited has multiple start times or needs to be executed multiple times within a scheduling cycle, new subtasks can be generated for each different execution. Each new subtask can record the task identifier of the task being edited, as well as its corresponding start time, end time, execution duration, and task type.

[0139] E2, exclude the original subtasks belonging to the edited task from the first subtask sequence, and obtain the retained subtasks.

[0140] The subtasks belonging to the edited task in the first subtask sequence reflect the execution arrangement of the task before editing. Since the edited task has adopted new task parameters, these pre-edited subtasks should not continue to participate in the post-edited time planning. For ease of description, these subtasks are referred to as the original subtasks in this embodiment.

[0141] The electronic device can use the task identifiers recorded in each subtask to find the original subtasks belonging to the task being edited from the first subtask sequence and exclude them from the candidate scheduling content after task editing. The remaining subtasks after exclusion correspond to other tasks that were not directly modified in this task editing and can be called reserved subtasks.

[0142] It should be noted that the above exclusion operations are mainly used to form a set of candidate edited subtasks, and do not require the original subtasks to be permanently deleted from the currently effective system state immediately. Electronic devices can first complete the above processing in the candidate data or copy data.

[0143] E3 merges the new subtask with the retained subtask and arranges them according to the preset scheduling priority rules to obtain the second subtask sequence.

[0144] After obtaining the new subtasks corresponding to the task being edited and the retained subtasks corresponding to other tasks, the electronic device can merge the two to form a set of candidate subtasks to be scheduled after task editing.

[0145] Changes in task parameters may alter the position of new subtasks in the scheduling order. For example, if the start time of the task being edited is moved forward, its corresponding new subtasks may need to be placed before some of the retained subtasks. Therefore, after merging, the electronic device can uniformly arrange the new and retained subtasks according to a preset scheduling priority rule, and the arrangement result is the second subtask sequence corresponding to the task editing.

[0146] In some embodiments, when the task change specifically manifests as the addition of a new task, the electronic device can convert the new task into a corresponding subtask, which, together with the existing subtasks, forms a second subtask sequence after the task is added. In this case, the second subtask sequence can be obtained as follows: F1 receives a request to add a new task and retrieves the task parameters for the new task.

[0147] F2 generates at least one new subtask corresponding to the new task based on the task parameters of the new task.

[0148] F3 merges the newly added subtask with each subtask in the first subtask sequence and arranges them according to the preset scheduling priority rules to obtain the second subtask sequence.

[0149] A new task request can include task parameters such as a task identifier, at least one start time, execution duration, and task type. The electronic device can first query the task mapping table based on the task identifier to avoid adding an already existing task. If the task identifier already exists, the device can reject the request or prompt the user to perform a task editing operation.

[0150] If a new task has multiple start times, the electronic device can generate corresponding new subtasks for each start time. Each start time corresponds to one execution of the new task, forming a new subtask. Each new subtask can record a task identifier to indicate its assigned task.

[0151] In some examples, the electronic device can generate a subtask identifier based on the task identifier of the newly added task and the sequence number of each newly added subtask, and determine the corresponding deadline based on parameters such as task type and start time.

[0152] After a new subtask is generated, the electronic device can merge it with each subtask in the first subtask sequence and rearrange them according to the preset scheduling priority rules to obtain the second subtask sequence after the task is added.

[0153] In some embodiments, when the task change specifically manifests as task deletion, the second subtask sequence can be obtained in the following manner: G1 receives a task deletion request, which includes at least one task identifier to be deleted.

[0154] G2 verifies the identifiers of each task to be deleted based on the task mapping table, and determines the valid task identifiers that exist in the task mapping table.

[0155] G3 excludes subtasks that belong to the tasks corresponding to the valid task identifiers to be deleted from the first subtask sequence, and obtains candidate retained subtasks.

[0156] G4 arranges the candidate retained subtasks according to the preset scheduling priority rules to obtain the second subtask sequence.

[0157] After receiving a task deletion request, the electronic device can sequentially query the task identifiers to be deleted in the task mapping table. When a task deletion request includes multiple task identifiers, it can also be recorded as a batch deletion request. Task identifiers that can be found are identified as valid task identifiers to be deleted; those that cannot be found are marked as failed deletion operations. Subsequently, the electronic device can traverse the first subtask sequence, excluding subtasks belonging to the tasks corresponding to valid task identifiers to be deleted based on the task identifiers recorded for each subtask. The remaining subtasks after exclusion are candidate retained subtasks. Since the candidate retained subtasks were originally arranged according to the same preset scheduling priority rule, they can directly form the second subtask sequence if their relative order remains unchanged; alternatively, they can be re-arranged according to the same rule to ensure the arrangement result conforms to a unified rule.

[0158] Furthermore, if all remaining subtasks have completed their time planning, the electronic device can update the current subtask list based on the task scheduling results and delete each valid task identifier to be deleted from the task mapping table; conversely, if any remaining subtask has not completed its time planning, the electronic device can retain the current subtask list and task mapping table before the task deletion.

[0159] For a single batch deletion request, electronic devices can employ atomic processing. Atomic processing here means that for all valid task identifiers to be deleted obtained from the task mapping table, they are either deleted uniformly after incremental planning is approved, or none are deleted if incremental planning fails. Task identifiers not present in the task mapping table can be marked as deletion failures and are not included in the atomic deletion set corresponding to valid task identifiers to be deleted.

[0160] If incremental planning is successful, the electronic device can uniformly update the current subtask list and remove each valid task identifier from the task mapping table. If any remaining subtask fails to complete its time planning, or if constraint anomalies or data anomalies are detected during the planning process, the current system state can be left unupdated without using the candidate retained subtasks and their corresponding time planning results, and the valid task identifiers will not be removed from the task mapping table.

[0161] Electronic devices can also generate deletion results, which may include a list of task identifiers that were successfully deleted and a list of task identifiers that failed to be deleted, so that the caller can know the processing status of each task to be deleted.

[0162] In some embodiments, after obtaining the task scheduling result, although the result can indicate the execution time arrangement corresponding to each subtask, it is usually difficult to intuitively determine whether there is a potential timeout risk in the current scheduling result based solely on whether the subtask has already been assigned execution time. Therefore, in this case, the electronic device can also analyze the time slack of each subtask, specifically including: H1 retrieves the deadline for each subtask and the corresponding end time of each subtask in the task scheduling result.

[0163] The electronic device can iterate through each subtask participating in this scheduling and obtain its deadline and end time for each. The deadline is used to limit the latest time that the corresponding subtask should be completed and can be stored as part of the subtask parameters.

[0164] The end time indicates the moment when a subtask completes its execution according to the task scheduling results. A subtask can be assigned to one time period or multiple time periods. When a subtask corresponds to multiple assigned time periods, the end time of the latest assigned time period can be determined as the end time of the subtask.

[0165] The subtasks obtained in this step can include both subtasks in the invariant prefix sequence and the remaining subtasks following the invariant prefix sequence. The end time of the former can be determined based on the existing time planning results that are retained, while the end time of the latter can be determined based on the time planning results obtained in this incremental planning.

[0166] H2 determines the remaining time for each subtask based on the time interval between the end time and the deadline of each subtask.

[0167] After obtaining the end time and deadline of each subtask, the electronic device can determine the time interval between the corresponding end time and deadline, and use this time interval as the remaining time for the corresponding subtask.

[0168] The remaining time here refers to the amount of time remaining before the deadline of a subtask after it has been completed according to the current task scheduling results. The longer the remaining time, the more latency tolerance the subtask has; the shorter the remaining time, the closer its completion time is to the deadline.

[0169] For example, if one subtask has a finish time of 10:00 and a deadline of 10:05, then it has 5 minutes remaining. Another subtask has a finish time of 10:04:50 and a deadline of 10:05, then it has 10 seconds remaining. Although both can be completed before the deadline, the latter subtask has significantly less time remaining.

[0170] H3 identifies subtasks with remaining time less than or equal to a preset high-risk time threshold as high-risk subtasks.

[0171] Electronic devices can compare the remaining time of each subtask with a preset high-risk time threshold. The preset high-risk time threshold is a pre-set critical value used to distinguish high-risk subtasks from other subtasks in terms of remaining time. It can be set according to task execution stability, resource load, and risk tolerance.

[0172] For example, a preset high-risk time threshold can be set to 30 seconds. If a subtask has 20 seconds remaining, it can be identified as a high-risk subtask; if another subtask has 2 minutes remaining, it can be excluded from the high-risk subtask category. The above values ​​are merely examples.

[0173] High-risk subtasks are those that can be completed before the deadline according to the current task scheduling results, but whose end time is approaching the deadline and have a relatively high potential risk of timeout. Identifying a subtask as high-risk does not mean that the current planning result has already timed out, but rather that there is limited time leeway available to absorb actual execution fluctuations.

[0174] H4 generates task scheduling risk warning information based on high-risk sub-tasks.

[0175] After identifying high-risk subtasks, the electronic device can organize the relevant information of the high-risk subtasks and generate task scheduling risk warning information. This information may include one or more of the following: the subtask identifier of the high-risk subtask, the task identifier of the task to which it belongs, the end time, the deadline, and the remaining time.

[0176] Electronic devices can send task scheduling risk warning information to task management platforms, operation and maintenance terminals or other risk management modules, or save it to a preset storage area for subsequent query and analysis.

[0177] By following the steps above, the remaining time between the end time and the deadline of each subtask can be analyzed, and high-risk subtasks can be identified and task scheduling risk warning information can be generated, enabling timely identification of potential timeout risks in task scheduling results.

[0178] In some embodiments, when the number of subtasks involved in scheduling is large, outputting only the information of each high-risk subtask is not convenient for intuitively determining which time ranges the scheduling risks are concentrated in. Therefore, H4 can specifically include: H41, based on the allocated time periods of each high-risk sub-task, determine the high-risk time periods corresponding to each high-risk sub-task; The electronic device can read the time planning results of each high-risk subtask and obtain the corresponding allocated time slots. Since a high-risk subtask may be allocated only one time slot or multiple separate time slots, all allocated time slots of each high-risk subtask can be processed separately.

[0179] To facilitate the visualization of risk distribution across the overall timeline, electronic devices can aggregate the time ranges covered by each allocated time period according to a preset time unit. For example, this preset time unit could be hours. The electronic device can convert the second-level time ranges covered by each allocated time period into corresponding hourly ranges, and identify the hourly ranges occupied by high-risk sub-tasks as high-risk time periods.

[0180] The high-risk period here refers to a preset time range covered by the allocated time periods of at least one high-risk sub-task. The high-risk period is used to reflect the distribution of task scheduling risks on the timeline, and does not indicate that the time range itself will necessarily time out.

[0181] For example, if the assigned time period for a certain high-risk sub-task is from 10:20 AM to 11:10 AM on Tuesday, then this time period covers the two-hour range corresponding to 10:00 AM and 11:00 AM on Tuesday. The electronic device can identify both of these two-hour ranges as the high-risk time period corresponding to the high-risk sub-task.

[0182] In some examples, electronic devices can identify different high-risk time periods using time units formed by weekday and hour numbers. When multiple assigned time periods for the same high-risk subtask overlap with the same high-risk time period, only one record for that high-risk time period needs to be retained.

[0183] H42 generates a list of high-risk time periods based on each high-risk time period and the main task identifier of the main task to which the high-risk subtasks occupying each high-risk time period belong.

[0184] To distinguish it from subtasks, this embodiment refers to the aforementioned task as the main task. The same main task can be divided into multiple subtasks based on different execution times. Therefore, in addition to having a corresponding subtask identifier, high-risk subtasks also record the main task identifier of the main task to which they belong.

[0185] Electronic devices can locate all high-risk subtasks that are covered by the allocated time period for each high-risk time period, and read the main task identifier of the main task to which these high-risk subtasks belong. This allows the establishment of a correspondence between high-risk time periods and their corresponding main task identifiers.

[0186] For example, the allocated time periods for both the first and second high-risk sub-tasks cover the high-risk period corresponding to 3 PM on Thursday. If the first high-risk sub-task belongs to Task A and the second high-risk sub-task belongs to Task B, the electronic device can associate the high-risk time period with the main task identifiers of Task A and Task B. If multiple high-risk sub-tasks corresponding to the same main task occupy the same high-risk time period, only one main task identifier for that main task can be retained to avoid duplicate recording.

[0187] Electronic devices can combine high-risk time periods and their corresponding main task identifiers to generate a list of high-risk time periods. Each list item may include a high-risk time period and at least one corresponding main task identifier, and may also include auxiliary information such as the start time, end time, or number of corresponding high-risk sub-tasks of the high-risk time period.

[0188] In some embodiments, the electronic device can also arrange the list items in the high-risk time period list according to the order of each high-risk time period within a preset scheduling period. Further, time units without corresponding high-risk subtasks within the preset scheduling period can be defined as normal time periods, and a normal time period list can be generated based on each normal time period. Then, the high-risk time period list and the normal time period list are output together in chronological order. Here, a normal time period is a time unit not occupied by a high-risk subtask, and not necessarily an idle time period not occupied by any subtask.

[0189] Through the above steps, high-risk time periods can be determined based on the allocated time periods of high-risk sub-tasks, and each high-risk time period can be associated with the corresponding main task identifier to generate a list of high-risk time periods, which can intuitively display the time distribution of task scheduling risks and related tasks.

[0190] In some embodiments, as described above, both the first and second subtask sequences are arranged according to the same preset scheduling priority rule. To ensure that subtasks with different real-time requirements can participate in time planning in a uniform and repeatable order, the preset scheduling priority rule can be specifically set based on the task type and start time.

[0191] The electronic device can read the task type and start time of each subtask and determine the corresponding scheduling priority value accordingly. The task type can include real-time tasks and regular tasks. Real-time tasks are those that need to be prioritized for execution and are more sensitive to scheduling delays; regular tasks have lower timeliness requirements compared to real-time tasks.

[0192] The start time indicates the time at which a subtask is allowed to begin execution. When scheduling using a periodic timeline, the start time can be expressed as the time offset of that time position relative to the start of a preset scheduling period. The preset scheduling period can be one day, one week, or other pre-set cycles.

[0193] For subtasks corresponding to real-time tasks, the start time of the subtask can be directly determined as the scheduling priority value. For subtasks corresponding to ordinary tasks, the sum of the total duration of the preset scheduling period and the start time of the subtask can be determined as the scheduling priority value. Electronic devices arrange subtasks in ascending order of scheduling priority value; the smaller the scheduling priority value, the higher the scheduling priority of the corresponding subtask.

[0194] It should be noted that both the first and second subtask sequences are arranged using the same preset scheduling priority rule. Since the preset scheduling priority rule determines the scheduling priority value of a subtask based on its task type and start time, if a task change does not alter the task type and start time of the relevant subtasks, the same set of subtasks before and after the change can form the same arrangement order according to the same rule.

[0195] Based on the aforementioned deterministic arrangement, when a task is added, edited, or deleted, the task scheduler can compare the first and second subtask sequences before and after the task change position by position, and determine the invariant prefix sequence based on whether the subtasks in consecutive positions meet the preset consistency conditions, thereby accurately identifying the consecutive subtasks that are not affected during the task change process.

[0196] Taking a week as the preset scheduling period and seconds as the time unit as an example, the total duration of a week is 604,800 seconds. If the start time of a real-time subtask is 3,600 seconds, its scheduling priority value is 3,600; if the start time of a regular subtask is also 3,600 seconds, its scheduling priority value is 608,400. Therefore, the scheduling priority values ​​of regular tasks are generally placed after the scheduling priority values ​​of real-time tasks, ensuring that all real-time tasks can be scheduled before regular tasks.

[0197] For multiple subtasks of the same task type, since their scheduling priority values ​​all increase with the start time, the subtask with the earlier start time is arranged before the subtask with the later start time.

[0198] In some embodiments, to ensure the determinism of the subtask arrangement result, when at least two subtasks have the same scheduling priority value, the electronic device can also arrange the corresponding subtasks according to a preset secondary sorting rule. For example, subtasks with the same scheduling priority value can be arranged according to a preset order of their subtask identifiers. Thus, for the same set of subtasks, the same arrangement result can be obtained when arranged according to the preset scheduling priority rule.

[0199] In other embodiments, task configuration constraints can be used to prevent different subtasks from having the same task type and start time, or to make subtasks with the same task type and start time have the same subtask identifier. This application does not limit this.

[0200] In some embodiments, to enable electronic devices to continue using the established task scheduling results after system restart, service switching, or device failure recovery, this application also proposes a method for persisting and restoring the scheduling results. Based on this, the above task scheduling method may further include: I1, after obtaining the task scheduling result, converts the task scheduling result into the corresponding scheduling data entity.

[0201] I2 stores each scheduling data entity in batches to a preset database.

[0202] I3 reads each scheduling data entity from a preset database when the task scheduler of the electronic device starts.

[0203] I4 restores the current subtask list and task mapping table based on each scheduling data entity.

[0204] The scheduling data entity can record information such as subtask identifier, task identifier of the task to which it belongs, start time, end time, execution duration, task type, allocated time period, and end time. After the task scheduling results are uniformly submitted as the current effective state, the electronic device can convert each subtask and its time planning results into a scheduling data entity.

[0205] Subsequently, the electronic device can write multiple scheduling data entities in batches to a pre-defined database. Batch storage reduces the interaction overhead of writing one record at a time and ensures consistency in the results of multiple subtasks resulting from the same task change. If necessary, database transactions can also be used to ensure that the same batch of scheduling data entities is written uniformly.

[0206] When the electronic device's task scheduler restarts, it can read the saved scheduling data entities from a preset database and restore the current subtask list and task mapping table based on the information recorded therein. The electronic device can also reconstruct the occupied positions of the current timeline based on the allocated time periods of each subtask, thereby continuing to process subsequent task changes without having to reschedule all tasks.

[0207] In some embodiments, if the data read from the preset database is incomplete or the verification fails, the electronic device may refuse to use the corresponding scheduled data entity to restore the state and output restoration error information to prevent erroneous data from entering the currently effective scheduling state.

[0208] By following the steps above, the currently effective task scheduling results can be saved, and the current subtask list, task mapping table, and time occupancy status can be restored when the electronic device starts up. This can reduce the repetitive planning caused by system restarts and improve the continuity of task scheduling status.

[0209] As can be seen from the above, the embodiments of this application, by arranging the subtask sequences before and after the task change according to the same preset scheduling priority rule and comparing them bit by bit to determine the invariant prefix sequence, can identify subtasks whose planning results are not affected during the task change process; by retaining the existing time planning results of each subtask in the invariant prefix sequence and only performing time planning on the remaining subtasks thereafter, the redundant planning of all subtasks is avoided, reducing the computational load and processing time of task scheduling; at the same time, by determining the occupied time period based on the existing time planning results, the time planning of the remaining subtasks can be connected with the existing planning results, thereby improving the scheduling efficiency in the task change scenario.

[0210] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0211] Corresponding to the time-axis-based task scheduling method provided above, this application also provides a time-axis-based task scheduling apparatus. Please refer to... Figure 2 The task scheduling device 2 in this embodiment includes: The first acquisition module 201 is used to acquire the first sub-task sequence before the task change and to acquire the second sub-task sequence obtained according to the task change. The first sub-task sequence and the second sub-task sequence are arranged according to the same preset scheduling priority rule. The comparison module 202 is used to compare the first and second subtask sequences bit by bit, starting from the first position of each sequence, and to determine the consecutive subtasks that meet the preset consistency conditions at the corresponding positions as the invariant prefix sequence. The first determining module 203 is used to retain the existing time planning results of each subtask in the first subtask sequence corresponding to the invariant prefix sequence, and to determine the occupied time period based on the existing time planning results. The planning module 204 is used to perform time planning on the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence, based on the occupied time period and in the order of arrangement in the second subtask sequence, to obtain the task scheduling result.

[0212] In some embodiments, the preset consistency conditions include: the subtask identifiers of two subtasks at corresponding positions are the same, and when the task is changed to task editing, neither of the two subtasks is a subtask corresponding to the task being edited; the comparison module 202 includes: The first determining unit is used to determine the first and second sub-task sequences as the current comparison position; The first judgment unit is used to determine whether both the first subtask sequence and the second subtask sequence include subtasks located at the current comparison position; The second judgment unit is used to determine whether two subtasks at the current comparison position meet a preset consistency condition when both the first subtask sequence and the second subtask sequence include subtasks located at the current comparison position. The second determining unit is used to determine the subtask located at the current comparison position in the second subtask sequence as the subtask in the invariant prefix sequence when the two subtasks being compared meet the preset consistency condition, and to determine the next sequence position as the new current comparison position, thereby triggering the first judgment unit to run. The comparison termination unit is used to terminate the comparison if the two subtasks being compared do not meet a preset consistency condition, or if at least one of the first subtask sequence and the second subtask sequence does not include the subtask located at the current comparison position.

[0213] In some embodiments, the planning module 204 includes: The mapping unit is used to map the occupied time period to a preset time axis to determine the occupied and free positions in the preset time axis. The allocation unit is used to allocate at least one time period within the execution time window of the subtask to be planned based on the idle position in the preset time axis, which satisfies the execution duration of the subtask to be planned. The subtask to be planned is initially the first subtask in the second subtask sequence after the invariant prefix sequence. The update unit is used to update the occupied positions in the preset timeline based on the time period allocation results of the sub-tasks to be planned. The third determining unit is used to determine the next subtask as a new subtask to be planned when there is a next subtask following the subtask to be planned in the second subtask sequence, and to trigger the allocation unit to run based on the updated preset time axis. The output unit is used to obtain the task scheduling result based on the existing time planning results of each subtask in the invariant prefix sequence and the time planning results of each remaining subtask, provided that the time planning of all remaining subtasks has been completed.

[0214] In some embodiments, when the task is changed to task editing, the first acquisition module 201 includes: The first generation unit is used to generate at least one new subtask corresponding to the edited task based on the edited task parameters. The exclusion unit is used to exclude the original subtasks belonging to the task being edited from the first subtask sequence, so as to obtain the retained subtasks; The merging unit is used to merge the new subtask with the retained subtask and arrange them according to the preset scheduling priority rules to obtain the second subtask sequence.

[0215] In some embodiments, the task scheduling device 2 further includes: The second acquisition module is used to acquire the deadline of each subtask and the corresponding end time of each subtask in the task scheduling result. The second determining module is used to determine the remaining time for each subtask based on the time interval between the end time and the deadline of each subtask. The third determination module is used to determine subtasks whose remaining time is less than or equal to a preset high-risk time threshold as high-risk subtasks. The generation module is used to generate task scheduling risk warning information based on high-risk sub-tasks.

[0216] In some embodiments, the generation module includes: The fourth determining unit is used to determine the high-risk time period corresponding to each high-risk sub-task based on the allocated time period of each high-risk sub-task. The second generation unit is used to generate a list of high-risk time periods based on each high-risk time period and the main task identifier of the main task to which the high-risk subtasks occupying each high-risk time period belong.

[0217] In some embodiments, the preset scheduling priority rule is set according to the task type and start time of each subtask; wherein, the scheduling priority value of the subtask corresponding to the real-time task is the start time, and the scheduling priority value of the subtask corresponding to the normal task is the sum of the total duration of the preset scheduling period and the start time. The smaller the scheduling priority value, the higher the scheduling priority of the corresponding subtask.

[0218] As can be seen from the above, the embodiments of this application, by arranging the subtask sequences before and after the task change according to the same preset scheduling priority rule and comparing them bit by bit to determine the invariant prefix sequence, can identify subtasks whose planning results are not affected during the task change process; by retaining the existing time planning results of each subtask in the invariant prefix sequence and only performing time planning on the remaining subtasks thereafter, the redundant planning of all subtasks is avoided, reducing the computational load and processing time of task scheduling; at the same time, by determining the occupied time period based on the existing time planning results, the time planning of the remaining subtasks can be connected with the existing planning results, thereby improving the scheduling efficiency in the task change scenario.

[0219] Corresponding to the time-axis-based task scheduling method provided above, this application also provides an electronic device. Please refer to... Figure 3 The electronic device 3 in this application embodiment includes: a memory 301, and one or more processors 302. Figure 3(Only one is shown in the diagram) and a computer program stored in memory 301 and executable on the processor. Specifically, the processor 302 implements the various steps in the above method embodiments by running the aforementioned computer program stored in memory 301.

[0220] It should be understood that, in the embodiments of this application, the processor 302 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0221] Memory 301 may include read-only memory and random access memory, and provides instructions and data to processor 302. Some or all of memory 301 may also include non-volatile random access memory. For example, memory 301 may also store device type information.

[0222] This application also provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.

[0223] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0224] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0225] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0226] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.

[0227] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0228] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing associated hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer-readable storage device, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the contents of the aforementioned computer-readable storage media may be appropriately added to or subtracted from the contents according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media may not include electrical carrier signals and telecommunication signals.

[0229] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A task scheduling method based on a time axis, characterized in that, include: Obtain the first subtask sequence before the task change, and obtain the second subtask sequence obtained according to the task change. Both the first subtask sequence and the second subtask sequence are arranged according to the same preset scheduling priority rule. Starting from the first position of the first subtask sequence and the second subtask sequence, compare each position sequentially and determine the consecutive subtasks that meet the preset consistency condition at the corresponding positions as the invariant prefix sequence; The existing time planning results of each subtask in the first subtask sequence corresponding to the invariant prefix sequence are retained, and the occupied time period is determined based on the existing time planning results; Based on the occupied time period, the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence are time-planned according to the arrangement order in the second subtask sequence to obtain the task scheduling result.

2. The task scheduling method as described in claim 1, characterized in that, The preset consistency conditions include: the subtask identifiers of two subtasks at corresponding positions are the same, and when the task is changed to task editing, neither of the two subtasks is a subtask corresponding to the task being edited; the step of comparing each position sequentially from the first and second subtask sequences to determine consecutive subtasks at corresponding positions that satisfy the preset consistency conditions as an invariant prefix sequence includes: The first and second sub-task sequences are determined as the current comparison position; Determine whether both the first subtask sequence and the second subtask sequence include a subtask located at the current comparison position; If both the first subtask sequence and the second subtask sequence include a subtask located at the current comparison position, determine whether the two subtasks located at the current comparison position satisfy the preset consistency condition; If the two subtasks being compared satisfy the preset consistency condition, the subtask located at the current comparison position in the second subtask sequence is determined as the subtask in the invariant prefix sequence, and the next sequence position is determined as the new current comparison position. Then, the process returns to the step of determining whether the first subtask sequence and the second subtask sequence both include the subtask located at the current comparison position and subsequent steps. The comparison ends if the two subtasks being compared do not meet the preset consistency condition, or if at least one of the first subtask sequence and the second subtask sequence does not include a subtask located at the current comparison position.

3. The task scheduling method as described in claim 1, characterized in that, Based on the occupied time period, the remaining subtasks in the second subtask sequence following the invariant prefix sequence are time-planned according to their order in the second subtask sequence to obtain the task scheduling result, including: The occupied time period is mapped to a preset time axis to determine the occupied and free positions in the preset time axis; Based on the idle positions in the preset time axis, at least one time period is allocated within the execution time window of the subtask to be planned to satisfy the execution duration of the subtask to be planned, wherein the subtask to be planned is initially the first subtask in the second subtask sequence after the invariant prefix sequence; Based on the time period allocation results of the sub-tasks to be planned, update the occupied positions in the preset timeline; If there is a next subtask following the planned subtask in the second subtask sequence, the next subtask is identified as a new planned subtask, and the execution of the idle position based on the updated preset timeline is returned to the execution time window of the planned subtask, and the steps and subsequent steps are allocated to at least one time period that satisfies the execution duration of the planned subtask. If all remaining subtasks have completed their time planning, the task scheduling result is obtained based on the existing time planning results of each subtask in the invariant prefix sequence and the time planning results of each remaining subtask.

4. The task scheduling method as described in claim 1, characterized in that, In the case where the task is changed to task editing, obtaining the second subtask sequence based on the task change includes: Based on the edited task parameters of the edited task, generate at least one new subtask corresponding to the edited task; Exclude the original subtasks belonging to the task being edited from the first subtask sequence to obtain the retained subtasks; The new subtask is merged with the retained subtask and arranged according to the preset scheduling priority rule to obtain the second subtask sequence.

5. The task scheduling method according to any one of claims 1 to 4, characterized in that, After obtaining the task scheduling result, the task scheduling method further includes: Obtain the deadline for each subtask, and the corresponding end time of each subtask in the task scheduling result; The remaining time for each subtask is determined based on the time interval between the end time and the deadline of each subtask. Subtasks whose remaining time is less than or equal to a preset high-risk time threshold are identified as high-risk subtasks. Based on the high-risk sub-tasks, task scheduling risk warning information is generated.

6. The task scheduling method as described in claim 5, characterized in that, The step of generating task scheduling risk warning information based on the high-risk sub-tasks includes: Based on the allocated time periods of each of the high-risk sub-tasks, determine the high-risk time periods corresponding to each of the high-risk sub-tasks; A list of high-risk time periods is generated based on each of the aforementioned high-risk time periods and the main task identifier of the main task to which the high-risk subtasks occupying each of the aforementioned high-risk time periods belong.

7. The task scheduling method according to any one of claims 1 to 4, characterized in that, The preset scheduling priority rule is set according to the task type and start time of each subtask; wherein, the scheduling priority value of the subtask corresponding to the real-time task is the start time, and the scheduling priority value of the subtask corresponding to the normal task is the sum of the total duration of the preset scheduling period and the start time. The smaller the scheduling priority value, the higher the scheduling priority of the corresponding subtask.

8. A time-axis-based task scheduling device, characterized in that, include: The first acquisition module is used to acquire the first subtask sequence before the task change and to acquire the second subtask sequence obtained according to the task change. The first subtask sequence and the second subtask sequence are arranged according to the same preset scheduling priority rule. The comparison module is used to compare the first and second subtask sequences bit by bit, starting from the first position, and determine the consecutive subtasks that meet the preset consistency condition at the corresponding positions as the invariant prefix sequence. The first determining module is used to retain the existing time planning results of each subtask in the first subtask sequence corresponding to the invariant prefix sequence, and to determine the occupied time period based on the existing time planning results; The planning module is used to perform time planning on the remaining subtasks in the second subtask sequence that are located after the invariant prefix sequence, based on the occupied time period and in the order of arrangement in the second subtask sequence, to obtain the task scheduling result.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by one or more processors, implements the method as described in any one of claims 1 to 7.