Method and system for scheduling timed tasks

By using multi-process parallel execution of scheduled tasks in the automobile production system, the execution order is determined based on the validity and priority of the tasks, which solves the problem of difficulty in ensuring the stability of scheduled task scheduling in complex production systems, and improves system stability and Resource utilization.

CN118733205APending Publication Date: 2024-10-01BMW BRILLIANCE AUTOMOTIVE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310323532.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In a complex automobile production system, the stability of multiple production systems is difficult to guarantee, leading to production failures, increased repairs, and high production risks, affecting product quality and brand image.

Method used

Provides a method for scheduling scheduled tasks, executing scheduled tasks in parallel through multiple processes, determining the order of execution based on the validity and priority of the tasks, setting and updating the next execution time of the tasks, ensuring that tasks are executed on time and handling exceptions .

Benefits of technology

It improves the stability and resource utilization of the production system, reduces production failures and repair work, and ensures the efficient operation and brand image of the production system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733205A_ABST
    Figure CN118733205A_ABST
Patent Text Reader

Abstract

The invention relates to a method and system for scheduling timed tasks. There is provided a method for scheduling timed tasks, comprising: in response to initiating execution of a first process, selecting a subset of tasks from a plurality of timed tasks allocated to the first process, the subset of tasks comprising timed tasks to be currently sequentially executed by the first process; in response to the fact that the task subsets are not empty, determining the execution sequence of the timed tasks in the task subsets according to the priorities; executing the timed tasks in the task subsets one by one by utilizing a first process according to the execution sequence; and in response to the fact that one timed task in the task subset is successfully executed, determining the next execution time of the timed task on the first process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of task scheduling algorithms, and more specifically to a method, a computer system, and a storage medium for scheduling timed tasks. Background Art

[0002] At present, there are various complex production systems in manufacturing plants. For example, for automobile production plants, there are systems that support the production of complete vehicles and powertrains, including production control systems and product quality management systems. These systems may include, for example, engine block casting control systems, engine machining control systems, engine assembly process production control systems, engine assembly process quality management systems, body stamping control systems, body welding control systems, complete vehicle assembly systems, complete vehicle quality management systems, and complete vehicle electronic and electrical testing systems.

[0003] Today's automobile production plants are highly automated, with hundreds of production systems. And with the expansion of factories, the introduction of new models, and the implementation of IT intelligent systems and data analysis, the number of production systems is increasing rapidly. These systems operate independently or in coordination with each other, jointly supporting intelligent, automated, green and low-carbon advanced manufacturing plants.

[0004] Advanced manufacturing factories that are highly intelligent, automated, green and low-carbon are highly dependent on the stability of the production system. The stability of the system directly determines the production efficiency of the factory. Therefore, there are extremely high requirements for the stability of the production system.

[0005] In order to ensure the stability of the production system, almost every system of the numerous production systems has its own software solution, which is installed on different servers, workstations or clouds, runs on multiple operating systems and has different interfaces and middleware. While this diversity of production systems brings flexible and advanced production capabilities, it also puts extremely high demands on the operation and maintenance of production systems. Because once a failure occurs in a complex production system environment, it will disrupt the production rhythm, increase the workload of rework, and increase production costs. In serious cases, it will cause the production line to stagnate and bring huge production risks. In the worst case, it may affect product quality and thus affect the brand image of the manufacturing factory, and even bring many compliance and legal issues. Therefore, ensuring that a wide variety of production systems can run stably has become a very challenging task. Summary of the invention

[0006] The present disclosure aims to provide a method, a computer system and a medium for scheduling timed tasks.

[0007] According to some embodiments of the present disclosure, a method for scheduling scheduled tasks is provided, comprising: in response to starting the execution of a first process, selecting a task subset from a plurality of scheduled tasks assigned to the first process, the task subset including scheduled tasks to be currently sequentially executed by the first process; in response to the task subset being not empty, determining the execution order of the scheduled tasks in the task subset according to the priority; executing the scheduled tasks in the task subset one by one using the first process according to the execution order; and in response to a scheduled task in the task subset being successfully executed, determining the next execution time of the scheduled task on the first process.

[0008] According to some embodiments of the present disclosure, the method also includes: in response to all scheduled tasks in the task subset being executed, the first process sleeps for a specific time interval; and after the specific time interval has passed, the first process selects a task subset from the multiple scheduled tasks assigned to the first process for the next round of execution.

[0009] According to some embodiments of the present disclosure, the method further includes: in response to starting the execution of the second process, selecting a task subset from a plurality of timed tasks assigned to the second process, the task subset including timed tasks to be currently executed sequentially by the second process; in response to the task subset being not empty, determining the execution order of the timed tasks in the task subset according to the priority; executing the timed tasks in the task subset one by one using the second process according to the execution order; and in response to a timed task in the task subset being successfully executed, determining the next execution time of the timed task on the second process. The second process is different from the first process, and the timed tasks in the plurality of timed tasks assigned to the first process are different from the timed tasks in the plurality of timed tasks assigned to the second process.

[0010] According to some embodiments of the present disclosure, selecting a task subset from a plurality of scheduled tasks assigned to a first process includes selecting a scheduled task that satisfies the following conditions from the plurality of scheduled tasks: i) a value of a validity flag of the scheduled task indicates validity; and ii) a scheduled next execution time of the scheduled task is earlier than or equal to the current time.

[0011] According to some embodiments of the present disclosure, a scheduled task includes a one-time execution flag, and when the one-time execution flag of a scheduled task indicates that the scheduled task is executed once, after the scheduled task is executed by the first process, the validity flag of the scheduled task will be set to indicate invalid.

[0012] According to some embodiments of the present disclosure, the multiple scheduled tasks include respective scheduling time intervals, and wherein the scheduling time interval of a first scheduled task among the multiple scheduled tasks is different from the scheduling time interval of a second scheduled task among the multiple scheduled tasks.

[0013] According to some embodiments of the present disclosure, in response to a scheduled task in the task subset being successfully executed, determining the next execution time of the scheduled task on the first process includes: determining the scheduled next execution time of the scheduled task as the current execution time of the scheduled task; updating the next execution time to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task, where N is an integer greater than or equal to 1, and the value of N makes the updated next execution time later than the current time and closest to the current time.

[0014] According to some embodiments of the present disclosure, the scheduled task includes an exception handling flag. The method also includes: in response to an exception in the execution of the scheduled task in the task subset, checking the exception handling flag of the scheduled task; if the checked exception handling flag indicates that the task is not to be executed again immediately, updating the next execution time to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task; and if the checked exception handling flag indicates that the task is to be executed again immediately, not updating the next execution time.

[0015] According to some embodiments of the present disclosure, the method also includes: before starting the execution of the first process, setting the first execution time of each of the multiple scheduled tasks respectively, wherein the first execution time of the first scheduled task among the multiple scheduled tasks is different from the first execution time of the second scheduled task among the multiple scheduled tasks.

[0016] According to some embodiments of the present disclosure, the method also includes: before starting the execution of the first process, for each of the multiple scheduled tasks, determining the sum of the set first execution time of the scheduled task and N times the scheduling time interval of the scheduled task as the scheduled next execution time of the scheduled task, where N is an integer greater than or equal to 1, and the value of N makes the determined next execution time later than the current time and closest to the current time.

[0017] According to some embodiments of the present disclosure, the first process sleeping for a specific time interval includes that resources occupied by the first process are released during the period when the first process is sleeping.

[0018] According to some embodiments of the present disclosure, the scheduled task assigned to the first process and the scheduled task assigned to the second process are of different types, or the scheduled task assigned to the first process and the scheduled task assigned to the second process are used to monitor different objects.

[0019] According to some embodiments of the present disclosure, a computer system is provided, comprising: one or more processors, and a memory coupled to the one or more processors, the memory storing computer-readable program instructions, which when executed by the one or more processors perform the method described above.

[0020] According to some embodiments of the present disclosure, a computer-readable storage medium is provided, on which computer-readable program instructions are stored. When the instructions are executed by the processor, the method described above is performed.

[0021] According to some embodiments of the present disclosure, there is provided a device for scheduling timed tasks, comprising means for implementing the steps of the method described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components in the exemplary embodiments of the present disclosure.

[0023] Figure 1 A block diagram of an exemplary computer system / server 12 suitable for use in implementing embodiments of the present invention is shown.

[0024] Figure 2 A flowchart of a method for scheduling a timed task according to an embodiment of the present disclosure is shown;

[0025] Figure 3 A flowchart of a method for setting an initial next execution time of a task according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0026] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0027] Figure 1 A block diagram of an exemplary computer system / server 12 suitable for use in implementing embodiments of the present invention is shown. Figure 1The computer system / server 12 shown is merely an example and should not bring any limitation to the functionality and scope of use of embodiments of the present invention.

[0028] like Figure 1 As shown, computer system / server 12 is in the form of a general-purpose computing device. Components of computer system / server 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0029] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer system / server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media. Although Figure 1 Not shown, a magnetic disk drive and an optical disk drive may also be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present invention.

[0030] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0031] The computer system / server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the computer system / server 12, and / or any device that enables the computer system / server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the computer system / server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer system / server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer system / server 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0032] As described above, in the context of a large number of production systems with various types, the inventors of the present invention have proposed an integrated management system to monitor the stability of production systems. This system can centrally and uniformly manage various production systems, including automated monitoring and automated alarming.

[0033] For current production systems, there are hundreds of monitoring tasks. Depending on the monitored object, the time interval for each monitoring task may also be different. The monitoring time interval ranges from 1 minute to 24 hours, and may also exceed 24 hours. Therefore, in order to deal with these numerous monitoring tasks with different time intervals, the inventor proposes a method for uniformly scheduling these tasks.

[0034] This disclosure will introduce a method for processing multiple scheduled tasks using multiple processes of isomorphism (i.e., logically identical). The method according to the present invention is based on the following assumptions:

[0035] There are n processes running in the system that perform tasks: PS1, PS2, ..., PSn

[0036] There are m scheduled tasks in the system, and these m scheduled tasks are assigned to the above n processes for processing:

[0037] process Assigned tasks PS1 TSK11, TSK12, ..., TSK1m1 PS2 TSK21, TSK22, ..., TSK2m2 … … Psn TSKn1, TSKn2, ..., TSKnmn

[0038] Here, m1+m2+…+mn=m and when the integer pair<a,b> Not equal to integer pair<c,d> , TSKab is not equal to TSKcd. For example, the first "1" in TSK11 indicates that the task is executed by process PS1, and the second "1" in TSK11 indicates that the task is the first task executed by the process; the "n" in TSKn2 indicates that the task is executed by process PSn, and the "2" in TSKn2 indicates that the task is the second task executed by the process. In other words, only tasks with the same order and value of two subscripts represent the same task.

[0039] Please note that m1, m2, ..., mn are not necessarily equal numbers, so the number of tasks that each process is responsible for executing is not necessarily equal. From the allocation relationship between processes and tasks, it can be seen that the corresponding relationship between processes and tasks is a one-to-many relationship, that is, one task can execute multiple tasks, and each task is processed by at most one process. In addition, processes PS1, PS2, ..., PSn can be executed in parallel to process their respective tasks.

[0040] View now Figure 2 , Figure 2 A flowchart of a method 200 for scheduling a timed task according to an embodiment of the present disclosure is shown. The method 200 is, for example, Figure 1 The computer system / server 12 executes the method 200. The method 200 includes a task selection step 210 for execution in this round, a task sorting step 220, a task execution step 230, and a task next execution time determination step 240.

[0041] Figure 2 The method 200 illustrates the scheduling of a task by one process (e.g., PS1) among multiple parallel executed processes. It should be noted that the tasks in the present disclosure are tasks that need to be scheduled for execution periodically, and therefore are referred to as scheduled tasks hereinafter. According to one embodiment of the present disclosure, a plurality of scheduled tasks include respective scheduling time intervals, and a scheduling time interval of a first scheduled task among the plurality of scheduled tasks is different from a scheduling time interval of a second scheduled task among the plurality of scheduled tasks. In one example, the first scheduled task needs to be scheduled for execution every 1 minute, and the second scheduled task needs to be scheduled for execution every 12 hours.

[0042] Method 200 starts with the task selection step 210 for this round of execution. In the task selection step 210 for this round of execution, in response to starting the execution of the first process, a task subset is selected from a plurality of timed tasks assigned to the first process, and the task subset includes the timed tasks to be currently executed sequentially by the first process. Taking the process PS1 in the above table as an example, a total of m1 tasks (TSK11, TSK12, ..., TSK1m1) are assigned to the process PS1. However, when the process PS1 starts to execute, all m1 tasks will not be executed, but only a task subset will be selected from these m1 tasks as the first round of execution. When this task subset is executed, the process PS1 will sleep for a period of time (expressed as SLP). When the sleep of the process PS1 ends, another task subset will be selected from the m1 tasks as the second round of execution, and so on.

[0043] According to one embodiment of the present disclosure, selecting a task subset from a plurality of scheduled tasks assigned to a first process may include selecting a scheduled task that satisfies the following conditions from the plurality of scheduled tasks: i) the value of the validity flag of the scheduled task indicates validity; and ii) the scheduled next execution time of the scheduled task is earlier than or equal to the current time.

[0044] For condition i), each scheduled task may have its own validity flag, which may be represented by V, and the value of V may be, for example, 0 or 1. When V is 0, it indicates that the task is currently invalid and the process does not process the task; and when V is 1, it indicates that the task is currently valid and the process needs to process the task.

[0045] For condition ii), each scheduled task may have a variable representing its next execution time, which may be represented as Tnext. As time passes, when the current time has reached (i.e., equal to) or exceeded (i.e., greater than or later than) Tnext of a scheduled task, this indicates that the scheduled task needs to be scheduled for execution at the current time of the judgment.

[0046] In short, in the task selection step 210 for this round of execution, based on the example in the above table, a scheduled task that satisfies both conditions i) and ii) is selected from m1 scheduled tasks for execution by process PS1 in this round. In one example, the selected scheduled tasks to be executed in this round include TSK11, TSK12, and TSK14 (here, m1>4).

[0047] How the initial Tnext of each scheduled task is set will be described in detail below. According to one embodiment of the present disclosure, method 200 may also include: before starting the execution of the first process, respectively setting the first execution time of each of the multiple scheduled tasks, wherein the first execution time of the first scheduled task in the multiple scheduled tasks is different from the first execution time of the second scheduled task in the multiple scheduled tasks. According to one embodiment of the present disclosure, method 200 may also include: before starting the execution of the first process, for each of the multiple scheduled tasks, determining the sum of the set first execution time of the scheduled task and N times the scheduling time interval of the scheduled task as the scheduled next execution time of the scheduled task. Here, N is an integer greater than or equal to 1, and the value of N makes the determined next execution time later than the current time and closest to the current time.

[0048] Figure 3 A flowchart of a method for setting the initial Tnext of a task according to an embodiment of the present disclosure is shown, and the method is executed before the corresponding process of the task is started. In this example method, each task is set with the following information:

[0049] Task scheduling interval: TI (Time Interval)

[0050] The first running time of the task: Tstart

[0051] The current running time of the task: Trun

[0052] The next running time of the task: Tnext

[0053] Figure 3The method starts in step 310, which is used to set the initial Tnext of a scheduled task. That is, the Tnext of the task is set before the task is executed for the first time. In step 310, the current time Tcur of the system is obtained. In step 320, the current running time Trun of the task is obtained. After defining a task, the first execution time Tstart is set for the task. According to one embodiment of the present disclosure, Tstart is set manually. Here, Trun is assigned to Tstart. In step 330, the task scheduling time interval TI is obtained. In step 340, it is determined whether Tnext is later than or equal to the current time Tcur. Here, Tnext = Trun + TI (that is, the sum of the first execution time and 1 times the scheduling time interval of the scheduled task). When Tnext is earlier than Tcur, it means that Tnext is already in the past. Tnext needs to be postponed by TI to make it in the future. In step 350, Trun is increased by TI, which causes Tnext (Trun + TI) to also increase by TI when the next loop to step 340. By looping through steps 340-350, Tnext=Tstart+N*TI, until Tnext>=Tcur, the loop stops. At this time, the value of N makes Tnext later than the current time and closest to the current time.

[0054] For example, in one example, suppose a scheduled task has a Tstart of 8:00 AM on March 15, a Tcur of 10:08 AM on March 15, and a TI of 1 hour. Figure 3 In the method, Tnext will be set to: 8:00+3*1 hours (i.e., 11:00 am on March 15). The value of N is 3, which makes Tnext later than the current time 10:08 and closest to the current time.

[0055] When the initial setting of Tnext of each scheduled task assigned to a process is completed, the corresponding process can be started, so that scheduling can be automatically performed to trigger the execution of the scheduled task.

[0056] Now return to reference Figure 2, in the task sorting step 220, in response to the task subset being not empty, the execution order of the scheduled tasks in the task subset is determined according to the priority. According to one embodiment of the present disclosure, when the task subset is empty, it means that there is no valid task that needs to be executed at present. At this time, the first process can be put to sleep for a period of time SLP. When the sleep ends, the task subset is selected again. When the task subset is not empty, the scheduled tasks are sorted according to the priority of each scheduled task in the task subset. In one example, the task of monitoring the failure of spray guns in the paint shop has a higher priority than the task of monitoring the inventory balance of specific accessories. In the above example, the selected scheduled tasks to be executed in this round include, for example, TSK11, TSK12 and TSK14. In step 220, for example, the execution order of these three tasks is determined to be TSK12, TSK14, TSK11.

[0057] In the task execution step 230, the scheduled tasks in the task subset are executed one by one using the first process according to the execution order. In the above example, for example, the first process will execute the scheduled tasks TSK12, TSK14, and TSK11 in sequence.

[0058] In the task next execution time determination step 240, in response to a scheduled task in the task subset being successfully executed, the next execution time of the scheduled task on the first process is determined. That is, when a scheduled task is successfully executed, its Tnext needs to be updated so that it can be scheduled for execution again after the expected TI. Without updating Tnext, since Tnext is a time value in the past that is earlier than the current time, the task will be selected for execution by the process in each subsequent round (i.e., each time the process wakes up from sleep).

[0059] According to an embodiment of the present disclosure, step 240 may include: determining the scheduled next execution time of the scheduled task as the current execution time of the scheduled task; updating the next execution time to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task. Here, N is an integer greater than or equal to 1, and the value of N makes the updated next execution time later than the current time and closest to the current time. Those skilled in the art can see that the update logic of Tnext of a task is similar to the following: Figure 3 The initial setup logic of Tnext is shown.

[0060] According to one embodiment of the present disclosure, method 200 may also include: in response to all scheduled tasks in the task subset being executed, the first process sleeps for a specific time interval; and after the specific time interval has passed, the first process selects a task subset from the multiple scheduled tasks assigned to the first process for the next round of execution.

[0061] The above example of TI being 1 hour and Tnext being 11:00 am on March 15th is continued. Assuming that Tcur when the first process is started is 11:35 am on March 15th, since the Tnext of the task is earlier than Tcur, this will cause the task to be executed by the first process in this round. In response to the successful completion of the task at 12:02, the Tnext of the task will be updated to: 11:00+2*1 hour (i.e., March 15th 13:00). Here, the value of N is 2, so that Tnext is updated to be later than the current time and closest to the current time.

[0062] Figure 2 The method 200 only describes a method for scheduling a timed task by one process. The method 200 is also applicable to other processes executed in parallel with the first process. According to one embodiment of the present disclosure, the method 200 may also include: in response to starting the execution of the second process, selecting a task subset from a plurality of timed tasks assigned to the second process, the task subset including timed tasks to be currently executed sequentially by the second process; in response to the task subset being not empty, determining the execution order of the timed tasks in the task subset according to the priority; executing the timed tasks in the task subset one by one using the second process according to the execution order; and in response to a timed task in the task subset being successfully executed, determining the next execution time of the timed task on the second process. Here, the second process is different from the first process, and the timed tasks in the plurality of timed tasks assigned to the first process are different from the timed tasks in the plurality of timed tasks assigned to the second process. That is, the second process is another process executed in parallel with the first process, and is responsible for processing the tasks assigned to the second process that are different from the tasks assigned to the first process. In addition, the number of processes that can be processed in parallel according to the present invention may be more than two, for example, n in the example shown in the above table.

[0063] According to an embodiment of the present disclosure, a scheduled task may further include a one-time execution flag. When the one-time execution flag of a scheduled task indicates that the scheduled task is a one-time execution, after the scheduled task is executed by the first process, the validity flag of the scheduled task will be set to indicate invalidity. In one embodiment, the one-time flag of the scheduled task is set by the user, and the flag is represented by C, for example. In one example, C can take a value of 0 or 1, for example. When C is 1, it means that after the task is executed once, the validity flag of the task will not be changed, that is, the task continues to be valid, so that the task can be executed again after each execution. When C is 0, it means that after the task is executed once, the validity flag of the task will be set to invalid, that is, the task will no longer be valid in the next round, and will not be executed again. Unless the validity flag is modified to valid, it will be scheduled for execution again. By providing a one-time label, a scheduled task that is executed once and a scheduled task that is executed periodically can be uniformly scheduled, thereby improving the system integration.

[0064] According to an embodiment of the present disclosure, the scheduled task may further include an exception handling flag. Method 200 may further include: in response to an exception in the execution of the scheduled task in the task subset, checking the exception handling flag of the scheduled task; if the checked exception handling flag indicates that the task is not to be executed again immediately, updating the next execution time to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task; and if the checked exception handling flag indicates that the task is to be executed again immediately, not updating the next execution time.

[0065] In an example according to the present invention, the exception handling flag can be represented as E. When the execution of the task is successful, the exception handling flag E is not checked. Only when an exception occurs in the execution of the task (for example, when the sensor reading cannot be obtained, when the connection to a specific device cannot be made), the exception handling flag E needs to be checked. Here, the occurrence of an exception does not mean that the monitoring task monitors a certain abnormal reading during normal execution, but means that the monitoring task cannot be executed normally.

[0066] In one example of the present invention, the exception handling flag E can take a value of 1 or 2, for example. When E takes a value of 1, when an exception occurs during the execution of a task, Tnext of the task is updated; when E takes a value of 2, when an exception occurs during the execution of a task, Tnext of the task is not updated. The logic of updating Tnext is the same as the logic in step 240. The exception handling flag E is used to indicate when the task is executed again if the task is not successfully executed in this round. When E=1, after an exception occurs, the task is not executed again immediately, but waits until the next execution time of the task arrives before scheduling the execution of the task, which is the same as the processing when the exception handling flag E is not set. When E=2, after an exception occurs, the task is immediately scheduled for execution in the next round, without waiting until the next execution time of the task arrives before executing the task. In the case of not updating Tnext, since Tnext is a time value in the past that is earlier than the current time, the task will inevitably be selected for execution by the process in the next round (i.e., the next time the process wakes up from sleep).

[0067] The following is an example to illustrate the exception handling flag E. Assume that the execution of task TSK14 ends at 8:05 am on March 16 (i.e., Tcur), Tnext of task TSK14 is 8:00 am on March 16 (this past time causes TSK14 to be scheduled for execution in this round), and TI of task TSK14 is 24 hours. Since the execution of TSK14 fails due to an exception, it is necessary to check the exception handling flag E of TSK14. When E=1 (i.e., when Tnext is updated normally), Tnext will be updated to 8:00 am on March 17 (original Tnext+TI), and will be scheduled for execution at 8:00 am the next day. In contrast, when E=2 (i.e., when Tnext is not updated), the value of Tnext remains unchanged and is still 8:00 am on March 16. In this case, when process PS1 is awakened after sleeping for a period of time SLP, for example at 8:30 am on March 16, since Tnext of TSK14 is in the past, TSK14 will be selected for execution in the current round. Compared with the case of E=1, this will cause TSK14 to be executed earlier.

[0068] By providing the exception handling flag E, it is possible to distinguish important scheduled tasks, and when an exception occurs in an important task, its scheduling cycle is ignored and the scheduled task is executed again as soon as possible, thereby providing higher monitoring reliability and timeliness.

[0069] According to an embodiment of the present disclosure, the first process sleeping for a specific time interval may include releasing the resources occupied by the first process during the first process sleeping period. By releasing system resources during the sleeping period, more sufficient system resources can be provided for other running processes, which improves resource utilization.

[0070] According to one embodiment of the present disclosure, the scheduled tasks assigned to the first process and the scheduled tasks assigned to the second process may be of different types. For example, the scheduled tasks assigned to the first process may be a task for monitoring temperature, and the tasks assigned to the second process may be a task for monitoring the working condition of an assembly robot arm. According to one embodiment of the present disclosure, the scheduled tasks assigned to the first process and the scheduled tasks assigned to the second process may be used to monitor different objects. For example, the scheduled tasks assigned to the first process may be a task for monitoring the final assembly workshop of the first factory, and the tasks assigned to the second process may be a task for monitoring the paint shop of the second factory. By assigning scheduled tasks to processes according to type or monitoring object, the execution of processes can be more conveniently controlled. For example, when the second factory is shut down for maintenance, the operation of the second process can be stopped, but the operation of the first process can be maintained, thereby improving resource utilization.

[0071] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.

[0072] According to one embodiment of the present invention, a computer system is provided, which includes one or more processors and a memory coupled to the one or more processors. The memory stores computer-readable program instructions, and the instructions are executed by the one or more processors: in response to starting the execution of a first process, a task subset is selected from a plurality of timed tasks assigned to the first process, the task subset includes timed tasks to be currently executed sequentially by the first process; in response to the task subset being not empty, the execution order of the timed tasks in the task subset is determined according to the priority; according to the execution order, the timed tasks in the task subset are executed one by one using the first process; and in response to a timed task in the task subset being successfully executed, the next execution time of the timed task on the first process is determined.

[0073] According to another embodiment of the present invention, a computer-readable storage medium is provided, on which computer-readable program instructions are stored, and when executed by a processor, the instructions perform: in response to starting the execution of a first process, selecting a task subset from a plurality of scheduled tasks assigned to the first process, the task subset including scheduled tasks to be currently executed sequentially by the first process; in response to the task subset being not empty, determining the execution order of the scheduled tasks in the task subset according to the priority; executing the scheduled tasks in the task subset one by one using the first process according to the execution order; and in response to a scheduled task in the task subset being successfully executed, determining the next execution time of the scheduled task on the first process.

[0074] According to another embodiment of the present invention, a device for scheduling scheduled tasks is provided, including: a device for selecting a task subset from multiple scheduled tasks assigned to the first process in response to starting the execution of a first process, the task subset including scheduled tasks to be currently executed sequentially by the first process; a device for determining the execution order of the scheduled tasks in the task subset according to the priority level in response to the task subset being not empty; a device for executing the scheduled tasks in the task subset one by one using the first process according to the execution order; and a device for determining the next execution time of the scheduled task on the first process in response to a scheduled task in the task subset being successfully executed.

[0075] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0076] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0077] The computer program instructions for performing the operation of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present invention.

[0078] Various aspects of the present invention are described herein with reference to the flow charts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each box of the flow chart and / or block diagram and the combination of each box in the flow chart and / or block diagram can be implemented by computer-readable program instructions.

[0079] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0080] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0081] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0082] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for scheduling timed tasks, include: In response to initiating execution of the first process, selecting a task subset from a plurality of scheduled tasks assigned to the first process, the task subset including scheduled tasks to be currently sequentially executed by the first process; In response to the task subset being not empty, determining the execution order of the scheduled tasks in the task subset according to the priority; Execute the scheduled tasks in the task subset one by one using the first process according to the execution order; as well as In response to a scheduled task in the task subset being successfully executed, determining a next execution time of the scheduled task on the first process.

2. The method according to claim 1, further comprising: include: In response to all scheduled tasks in the task subset being executed, the first process sleeping for a specific time interval; as well as After the specific time interval has passed, the first process selects a task subset from the multiple scheduled tasks assigned to the first process for the next round of execution.

3. The method according to claim 1, further comprising: include: In response to initiating execution of the second process, selecting a task subset from a plurality of scheduled tasks assigned to the second process, the task subset including scheduled tasks to be currently sequentially executed by the second process; In response to the task subset being not empty, determining the execution order of the scheduled tasks in the task subset according to the priority; Executing the scheduled tasks in the task subset one by one using the second process according to the execution order; as well as In response to a scheduled task in the task subset being successfully executed, determining a next execution time of the scheduled task on the second process, The second process is different from the first process, and the scheduled tasks among the multiple scheduled tasks assigned to the first process are different from the scheduled tasks among the multiple scheduled tasks assigned to the second process.

4. The method according to claim 1, wherein selecting a task subset from a plurality of scheduled tasks assigned to the first process comprises selecting a scheduled task that satisfies the following conditions from the plurality of scheduled tasks: i) the value of the validity flag of the timed task indicates validity; and ii) The scheduled next execution time of the scheduled task is earlier than or equal to the current time.

5. The method according to claim 4, wherein the scheduled task includes a one-time execution flag, and wherein when the one-time execution flag of a scheduled task indicates that the scheduled task is a one-time execution, after the scheduled task is executed by the first process, the validity flag of the scheduled task will be set to indicate invalid.

6. The method according to claim 4, wherein the multiple scheduled tasks include respective scheduling time intervals, and wherein the scheduling time interval of a first scheduled task among the multiple scheduled tasks is different from the scheduling time interval of a second scheduled task among the multiple scheduled tasks.

7. The method according to claim 6, wherein in response to a scheduled task in the task subset being successfully executed, determining the next execution time of the scheduled task on the first process include: Determining the scheduled next execution time of the scheduled task as the current execution time of the scheduled task; Update the next execution time to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task, Wherein N is an integer greater than or equal to 1, and the value of N is selected so that the updated next execution time is later than the current time and closest to the current time.

8. The method according to claim 7, wherein the timing task includes an exception handling flag, and the method further include: In response to an exception occurring in the execution of a scheduled task in the task subset, checking an exception handling flag of the scheduled task; If the checked exception handling flag indicates that the task will not be executed again immediately, the next execution time is updated to the sum of the current execution time of the scheduled task and N times the scheduling time interval of the scheduled task; as well as If the checked exception handling flag indicates that the task is to be executed again immediately, the next execution time is not updated.

9. The method according to claim 4, further comprising: include: Before starting the execution of the first process, the first execution time of each of the plurality of scheduled tasks is set respectively. Wherein, a first execution time of a first scheduled task among the multiple scheduled tasks is different from a first execution time of a second scheduled task among the multiple scheduled tasks.

10. The method according to claim 9, further comprising: include: Before starting the execution of the first process, for each of the plurality of scheduled tasks, the sum of the set first execution time of the scheduled task and N times the scheduling time interval of the scheduled task is determined as the scheduled next execution time of the scheduled task, Wherein N is an integer greater than or equal to 1, and the value of N is selected so that the determined next execution time is later than the current time and closest to the current time.

11. The method according to claim 2, wherein the first process sleeps for a specific time interval include: During the period when the first process is dormant, resources occupied by the first process are released.

12. The method according to claim 3, in, The scheduled task assigned to the first process and the scheduled task assigned to the second process are of different types, or the scheduled task assigned to the first process and the scheduled task assigned to the second process are used to monitor different objects.

13. A computer system, include: one or more processors; and A memory coupled to the one or more processors, the memory storing computer-readable program instructions, which, when executed by the one or more processors, perform the method of any one of claims 1-12.

14. A computer-readable storage medium storing computer-readable program instructions, wherein the instructions, when executed by a processor, perform the method according to any one of claims 1 to 12.

15. A device for scheduling timed tasks, comprising means for implementing the steps of the method as claimed in any one of claims 1 to 12.