Global task scheduling method and system of time-aware state machine based on event triggering
By using an event-triggered time-aware state machine to generate logical time vectors and reach consensus in a distributed system, the state machine is driven to execute tasks. This solves the scheduling inconsistency problem caused by time zone rule updates and daylight saving time switching in existing technologies, and achieves inherent consistency and flexible task scheduling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN XINGZONG DIGITAL TECH CO LTD
- Filing Date
- 2025-12-25
- Publication Date
- 2026-05-12
AI Technical Summary
Existing task scheduling technologies suffer from several drawbacks when dealing with time zones and daylight saving time: they cannot handle future time zone rule updates, cannot properly handle the 'vanishing time' and 'repeating time' generated during daylight saving time switching, have high computational overhead, system performance is affected by the consistency of node time zone databases, and have poor scalability.
An event-triggered time-aware state machine is adopted, which generates a logical time vector through a physical clock adapter. A distributed consensus engine is used to achieve consensus in the distributed system and drive the time-aware state machine to perform state transitions to execute tasks. This decouples the physical time zone rules from the scheduling logic, achieving inherent consistency and robust handling of time anomalies.
It achieves architectural-level decoupling, inherent consistency, and natural immunity to time anomalies. It can handle scheduling inconsistencies in cross-time zone and cross-regional environments, possesses strong expressive power and flexibility, and solves the problems of tight coupling and state fragility in existing technologies.
Smart Images

Figure CN122019074A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of distributed computing, task scheduling and time synchronization, and in particular to a global task scheduling method and system based on an event-triggered time-aware state machine. Background Technology
[0002] In the context of globalized business, software systems need to provide scheduled services to users around the world, such as generating reports, sending messages, and performing batch data processing. These tasks are typically managed by task scheduling systems, the core of which is to ensure that tasks are executed accurately at the user's desired "local time." However, existing scheduling technologies have many insurmountable shortcomings when dealing with time zones, especially daylight saving time.
[0003] Existing technical solutions mainly include: static conversion schemes based on UTC time, schemes based on Cron expressions and runtime dynamic calculation, and preprocessing schemes based on commercial calendar libraries. These solutions generally suffer from the following inherent defects: they cannot handle future updates to time zone rules; they cannot correctly handle the "disappearing time" and "repeating time" generated during daylight saving time switching; they have high computational overhead, and system performance is affected by the number of tasks; the correctness of the system heavily depends on the consistency of the local time zone databases of all nodes, making the system fragile; the logic for handling time anomalies is complex and scattered, resulting in poor scalability.
[0004] Therefore, there is an urgent need in this field for a new task scheduling scheme that can fundamentally decouple time rules from scheduling logic, possess inherent consistency, and gracefully handle time anomalies. Summary of the Invention
[0005] This invention provides a global task scheduling method and system based on an event-triggered time-aware state machine, which can achieve global task scheduling that is decoupled from physical time zone rules, has inherent consistency, and can robustly handle time anomalies.
[0006] The first aspect of this invention provides a global task scheduling method based on an event-triggered time-aware state machine, comprising: In response to the physical time reaching a preset logical epoch boundary, a logical time vector describing the logical time state is generated, wherein the logical time vector includes at least an epoch vector for indicating the active epoch and a logical time index for indicating the logical time progress within the current epoch. The logical time vector is submitted to the distributed consensus engine so that multiple nodes in the distributed system can reach a consensus on the logical time vector and form a consensus logical time vector. The consensus-based logical time vector is used as input to drive the time-aware state machine of the corresponding task to perform state transitions. The state transition function of the time-aware state machine is configured to determine whether to trigger the execution state based on the consensus-based logical time vector and the preset task scheduling logic. When the time-aware state machine transitions to the execution state, the execution of the corresponding task is triggered.
[0007] Optionally, in response to the physical time reaching a preset logical epoch boundary, a logical time vector describing the logical time state is generated, including: When physical time reaches the starting boundary of a new epoch, a new logical time vector is generated. The epoch vector in the new logical time vector is updated to include the identifier of the new epoch, and the logical time index corresponding to the new epoch is reset to the initial value. Within the new era, logical time indexing is advanced using preset logical time units.
[0008] Optionally, a logical epoch is defined by a quadruple, which includes the epoch's unique identifier, epoch type, and start and end boundaries on the absolute timeline.
[0009] Optionally, the logical time vector is submitted to the distributed consensus engine to enable multiple nodes in the distributed system to reach a consensus on the logical time vector, including: The physical clock adapter acts as the proposer, initiating a consensus proposal on the logical time vector to multiple nodes that act as recipients; An improved Paxos consensus algorithm is run across multiple nodes to form and broadcast a consensus logical time vector to all subscribers.
[0010] Optionally, the transition conditions of the state transition function of the time-aware state machine include: A switch in the epoch vector within the consensus logical time vector has been detected; and, The logical time index of the target epoch type in the consensus logical time vector has been detected to have reached the preset trigger value.
[0011] Optionally, the detection of an epoch vector switch is achieved by comparing the difference between the epoch vector in the currently received consensus logical time vector and the consensus logical time vector received at the previous moment.
[0012] A second aspect of the present invention provides a global task scheduling system based on an event-triggered time-aware state machine, comprising: A physical clock adapter is used to monitor the physical time stream and generate a logical time vector describing the logical time state when the physical time reaches a preset logical epoch boundary. The logical time vector includes at least an epoch vector indicating the active epoch and a logical time index indicating the logical time progress within the current epoch. The distributed consensus engine communicates with the physical clock adapter to receive the logical time vector and coordinate multiple nodes in the distributed system to reach a consensus on the logical time vector, forming a consensus logical time vector. The time-aware state machine pool communicates with the distributed consensus engine and contains at least one time-aware state machine corresponding to a specific task. It is used to receive the consensus logical time vector and drive its own state transition according to the preset state transition logic. The task executor communicates with the time-aware state machine pool and is used to execute the corresponding task when the time-aware state machine transitions to the execution state.
[0013] A third aspect of the present invention provides a global task scheduling device based on an event-triggered time-aware state machine, comprising: One or more processors; A memory on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the global task scheduling method based on an event-triggered time-aware state machine as described in any of the preceding claims.
[0014] A fourth aspect of the present invention provides a computer storage medium for storing a program, which, when executed, implements the global task scheduling method based on an event-triggered time-aware state machine as described in any of the preceding claims.
[0015] Beneficial effects: Complete decoupling at the architectural level. This invention encapsulates the volatile "physical time and time zone rule calculation" in an independent physical clock adapter module, separating it from the stable "logical state decision" core scheduling logic. When the time zone rules are updated, only the adapter needs to be updated; the core scheduling remains unchanged.
[0016] Inherent distributed consistency. This invention synchronizes "logical time state" through a consensus mechanism, rather than relying on the local physical clocks or time zone settings of each node, fundamentally solving the problem of task execution disorder caused by clock drift and environmental inconsistency in a distributed environment.
[0017] Natural immunity to time anomalies. The mechanism of triggering judgment based on logical state (epoch switching, index advancement) in this invention enables the system to process "repeated times" logically continuously without having to deal with non-existent "disappearance times", thus avoiding ambiguity based on comparison of absolute time points.
[0018] Powerful expressiveness and flexibility. The time-aware state machine model of this invention can express complex state-based scheduling strategies, far exceeding traditional time-based scheduling methods. For example, it can realize task flows with dependencies and conditional judgments. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, 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 recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a global task scheduling method based on an event-triggered time-aware state machine, provided in an embodiment of the present invention; Figure 2 A global task scheduling system architecture diagram provided in this embodiment of the invention; Figure 3 A schematic diagram of the structure of a global task scheduling system based on an event-triggered time-aware state machine provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention. Detailed Implementation
[0021] This invention provides a global task scheduling method and system based on an event-triggered time-aware state machine, which can achieve global task scheduling that is decoupled from physical time zone rules, has inherent consistency, and can robustly handle time anomalies.
[0022] To facilitate understanding, the application scenarios of the embodiments of the present invention will be introduced first.
[0023] In a globalized business context, software systems need to provide scheduled services to users worldwide, such as generating reports, sending messages, and performing batch data processing. These tasks are typically managed by task scheduling systems, the core of which is ensuring that tasks are executed accurately at the user's desired "local time." However, existing scheduling technologies have many insurmountable drawbacks when dealing with time zones, especially daylight saving time. This section introduces existing technologies and their shortcomings: Static conversion schemes based on UTC time convert the user-input local time (e.g., "New York time 9:00") to UTC time all at once when the task is created, according to the time zone rules at that time, and store the UTC time in the scheduling queue. This method cannot handle time zone rule updates. If a local government announces a change to its daylight saving time rules or time zone offset in the future, all converted UTC times after that date will be incorrect. For example, a task created before the rule change and scheduled to execute after the change might be triggered at the wrong physical time due to the use of outdated conversion rules. Furthermore, it cannot correctly handle repeated times. During the "time fold" at the end of daylight saving time, the static conversion scheme cannot distinguish between "the first 1:30" and "the second 1:30," potentially leading to duplicate task execution or incorrectly executing only once.
[0024] This scheme, based on Cron expressions and runtime dynamic calculation, stores the Cron expression of each task and its corresponding timezone (e.g., 0 9**1-5 and America / New_York). The scheduler dynamically calculates the UTC time of the next trigger point at runtime. This method has high performance overhead; the scheduler needs to frequently calculate the next trigger time for all tasks, resulting in a large computational load, especially with a large number of tasks. It also has strong system state dependencies, requiring the scheduler process to keep its local timezone database up-to-date. Inconsistent tzdata versions on different servers can lead to inconsistent calculation results and scheduling chaos. Furthermore, the handling of "vanishing times" is complex: when the calculation encounters a non-existent local time (e.g., 2:30 at the start of daylight saving time), various compensation strategies (e.g., skipping, advancing, and delaying) need to be embedded in the calculation logic, making the core scheduling algorithm bloated and difficult to maintain.
[0025] The preprocessing scheme based on a commercial calendar library uses an external commercial calendar library to pre-calculate all execution times (UTCs) for a task over the next year and injects them into the scheduling queue. This method lacks flexibility; for long-cycle tasks, it requires periodic (e.g., annual) recalculation and queue updates, which is cumbersome. It also suffers from distributed consistency issues; in a distributed environment, multiple scheduler nodes need to synchronize this pre-processed execution schedule, increasing system complexity and the difficulty of state synchronization. Essentially, it's still about chasing future time points; this scheme merely shifts the pressure of dynamic calculation from runtime to the preprocessing stage, without changing its fundamental nature of "chasing future time points," and remains constrained by the reliability of physical clocks and queue management.
[0026] The shortcomings of existing technologies can be summarized as follows: tight coupling, with the core scheduling logic tightly coupled with volatile, external time zone rules; fragile state, with the correctness of the system heavily dependent on the consistency of the operating environment (time zone database) of all nodes; complex logic, with the code for handling time anomalies (such as daylight saving time boundaries) being scattered and complex, and prone to errors; and poor scalability, with the scheduling model based on absolute time points struggling to guarantee strong consistency in a distributed environment.
[0027] Therefore, this invention proposes a global task scheduling method and system based on an event-triggered time-aware state machine, which decouples the volatile physical time calculation from the stable logical state decision-making, and synchronizes the global logical time through a consensus mechanism. This fundamentally solves the scheduling inconsistency problem caused by daylight saving time and time zone rule changes in cross-time zone and cross-regional environments, and has natural immunity to time anomalies such as "disappearing time" and "repeated time".
[0028] See Figure 1 The figure is a flowchart illustrating a global task scheduling method based on an event-triggered time-aware state machine according to an embodiment of the present invention. The global task scheduling method based on an event-triggered time-aware state machine provided in this embodiment of the present invention can be implemented, for example, through the following steps S101-103.
[0029] Combination Figure 2 To explain, Figure 2 This is a diagram illustrating a global task scheduling system architecture provided in an embodiment of the present invention. (Attached) Figure 1 This invention demonstrates the core architecture and data flow of the global task scheduling system proposed in this paper. The entire system is divided into three logical layers from top to bottom: the input and definition layer, the core engine layer, and the driver layer.
[0030] At the input and definition layer, users specify task plans (e.g., "9:00 AM New York Time") through the user intent definer. The system understands and structures the user intent based on predefined time rules (such as time zones, holidays, business days, etc.) in the global logical epoch rule base.
[0031] The core engine layer is the central hub of the system. The physical clock adapter monitors the physical time event stream in real time and parses the logical meaning of physical time according to the loaded epoch / logical time definition. Based on this parsing result, the logical time vector generator generates a logical time vector describing the current logical time state and submits it as a proposed new LTV to the consensus engine. The consensus engine is responsible for reaching an agreement on the LTV value among distributed nodes, forming a consensus LTV. This consensus LTV is broadcast to the time-aware state machine pool, where each state machine instance corresponds to a specific task and performs internal state transitions accordingly.
[0032] In the driver layer, when the time-aware state machine transitions to the execution state, it sends a state transition signal, "Execute," to the state transition trigger. The trigger then calls the task executor, which ultimately executes the specific business task.
[0033] S101: In response to the physical time reaching the preset logical epoch boundary, generate a logical time vector describing the logical time state.
[0034] In this embodiment of the invention, when physical time reaches the starting boundary of a new epoch, a new logical time vector is generated. The epoch vector in the new logical time vector is updated to include the identifier of the new epoch, and the logical time index corresponding to the new epoch is reset to its initial value. Within the new epoch, the logical time index is advanced using a preset logical time unit. A logical epoch is defined by a quadruple, which includes the unique identifier of the epoch, the epoch type, and the starting and ending boundaries on the absolute timeline.
[0035] Specifically, the logical time vector and its generation mechanism: the logical epoch is the basic unit for constructing logical time, defining a meaningful and continuous block of time. A logical epoch E is a quadruple. ID represents the unique identifier of the epoch, such as nyse_business_day_20241104; Type represents the epoch type, such as nyse_business_day, gregorian_calendar_day, london_banking_hour; Start_UTC, End_UTC represent the start and end boundaries of the epoch on the absolute timeline (UTC timestamps). The Logical Time Vector (LTV) is a global state vector describing the current logical time of the system. It represents the global state of the system and is the object of consensus among all nodes, defined as: ; in, The epoch vector is a set of key-value pairs {Epoch_Type_1:Epoch_ID_1,Epoch_Type_2:Epoch_ID_2,...} that indicates the currently active epoch of various types. The Logic_Time_Index is a logical time index, a set of key-value pairs {Epoch_Type_1:Index_1,Epoch_Type_2:Index_2,...} that indicates the logical time progress within the current epoch. For example, Index can be an integer starting from 0 and incrementing to represent "the current logical hour of the week".
[0036] The generation and advancement of LTV involves the physical clock adapter B1 monitoring the physical time stream. Internally, it maintains an up-to-date timezone database. When physical time reaches the boundary defined by a certain epoch (e.g., UTC time reaches 00:00 New York time on November 4, 2024), the physical clock adapter B1 generates a new LTV proposal.
[0037] The beginning of a new era is indicated as: LTV_old / LTV_new are old / new logical time vectors used in the consensus process to distinguish between the previously agreed-upon state and the new state being proposed, and to detect state changes, for example, by comparing... r and To determine whether an era has switched.
[0038] Update Epoch_Vector to: ; Resetting Logic_Time_Index means: ; Subsequently, every logical time unit (e.g., 1 logical hour), the physical clock adapter B1 will propose again, incrementing Logic_Time_Index as follows: LTV_new.Logic_Time_Index['nyse_business_day']+=1.
[0039] In this embodiment of the invention, the LTV advancement proposal is based on physical time events, but the content of the proposal is a logical state. All complex calculations regarding time zones and daylight saving time are completely encapsulated within a single module, the physical clock adapter B1. It calculates the UTC time corresponding to "New York time 2024-11-04 09:00 EST", but the output is not this UTC time, but a logical state (Epoch_ID='nyse_business_day_20241104', Index=9).
[0040] S102: Submit the logical time vector to the distributed consensus engine so that multiple nodes in the distributed system can reach a consensus on the logical time vector and form a consensus logical time vector.
[0041] In this embodiment of the invention, the physical clock adapter acts as the proposer and initiates a consensus proposal for the logical time vector to multiple nodes that act as recipients; the improved Paxos consensus algorithm is run among the multiple nodes to form and broadcast the consensus logical time vector to all subscribers.
[0042] Specifically, since LTV is the global state of the system, all nodes must reach a consensus on it. This invention employs a lightweight, customized variant of the Paxos consensus algorithm. The physical clock adapter B1, acting as the sole proposer, sends a Propose(LTV_new, Sequence_Number) request to the consensus cluster. Sequence_Number is a sequence number, a monotonically increasing unique number generated by the proposer in the consensus algorithm, attached to LTV_new to ensure the orderliness and correctness of the consensus process and prevent outdated proposals from being accepted. Multiple nodes in the distributed system act as receivers. Once a majority accepts an LTV value, the consensus engine B3 broadcasts a Learn(LTV_committed) message to all subscribers, primarily the time-aware state machine pool B4. LTV_committed represents the committed logical time vector, indicating a globally consistent logical time vector confirmed by the distributed consensus engine, serving as the authoritative "logical current time," broadcast to all time-aware state machines to drive state transitions.
[0043] In this embodiment of the invention, the object of consensus is not task data, but rather "which logical state the current time has reached." This ensures that the entire distributed system has a unified understanding of "what business time it is now," fundamentally solving the problems caused by inconsistent local server time or timezone settings.
[0044] S103: Take the consensus logical time vector as input to drive the time-aware state machine of the corresponding task to perform state transitions.
[0045] In this embodiment of the invention, the transition conditions of the state transition function of the time-aware state machine include: detecting a switch in the epoch vector in the consensus logical time vector; and detecting that the logical time index of the target epoch type in the consensus logical time vector reaches a preset trigger value.
[0046] Specifically, the Time-Aware State Machine (TASM) is defined as the execution core of this invention, serving as the execution unit for task scheduling. Its parameters define the lifecycle and behavior of the task. Each task is modeled as a TASM instance. A TASM is a six-tuple. .
[0047] in, It is a finite set of states; This is the initial state, which is the first state that TASM enters after it is created; , which is the input alphabet, is the set of inputs that can drive TASM to perform state transitions, i.e., the logical time vector that achieves consensus. Each consensus-reached LTV will be used as input to affect all registered TASMs; To output the alphabet, TASM can send signals or events when a state transition occurs; these signals are those emitted during state transitions, such as... F represents the set of final states. Once a state in this set is entered, the TASM's lifecycle ends, and it no longer responds to any input. For example... ; This is the state transition function, the brain of TASM, defining which new state TASM should transition to given a specific current state and specific inputs. The function signature is represented as follows: This is the core of the business scheduling logic, which is usually implemented by a series of IF-THEN rules or CASE statements.
[0048] The refined design of the state transition function δ is illustrated by taking the task "Execution at 09:00 on a weekday at the New York Stock Exchange" as an example.
[0049] State S_Waiting: Transition condition δ(S_Waiting,LTV)=S_Pre_Execute IF:(LTV.Epoch_Vector['nyse_business_day'] != Previous_LTV.Epoch_Vector['nyse_business_day'])AND(LTV.Logic_Time_Index['nyse_business_day']>= 9). in, The change signifies the start of a new day. Era transitions are detected by comparing the old and new LTVs; Logic_Time_Index >= 9 means the current logical time has entered the "9 o'clock" logical time period. This invention perfectly avoids "vanishing time" through a refined design of the state transition function δ. Because the "vanishing" 2:30 will not cause Logic_Time_Index to advance to 9, it will not trigger a transition. For "repeating time," since LTVs are logically continuous, It will smoothly progress from 8 to 9, triggering only once.
[0050] S104: When the time-aware state machine transitions to the execution state, the execution of the corresponding task is triggered.
[0051] In an embodiment of the present invention, state This is a ready state, where resource checks and dependency verification can be performed. Its direction... The transition can be triggered by internal conditions (such as resource readiness) or a brief logical timeout (such as the next LTV cycle).
[0052] state In this state, the system sends a Trigger_Execute signal to drive the task executor C2 to execute the task.
[0053] The states S_Post_Execute and S_Completed handle the logic after execution and eventually enter the completed state.
[0054] The beneficial effects are as follows: Complete decoupling at the architectural level: separating the volatile "physical time calculation" from the stable "logical state decision-making". Updates to time zone rules only require updating the physical clock adapter module, without any changes to the core scheduling logic (TASM), achieving a perfect separation of concerns.
[0055] Inherent distributed consistency: It synchronizes "logical time" through a consensus mechanism, rather than relying on the local clocks of each node, fundamentally solving the problem of inconsistent task execution caused by clock drift and different time zone settings in a distributed environment.
[0056] Natural immunity to time anomalies: "vanishing time" and "repeating time" are handled naturally and uniformly at the logical time vector level. The system will never attempt to trigger a task at a logically non-existent moment, thus avoiding ambiguity caused by absolute time comparisons.
[0057] Powerful expressiveness and flexibility: The TASM model can express complex, state-based scheduling strategies, far exceeding the capabilities of traditional cron expressions. For example, it can easily implement dependency-based scheduling such as "execute after T+1 hours if the preceding task succeeds".
[0058] Theoretical depth and technical barriers: This invention is no longer a simple engineering optimization, but a creative integration of state machine theory, vector clock concept and distributed consensus algorithm to build a brand-new scheduling paradigm with a solid theoretical foundation.
[0059] Based on the methods provided in the above embodiments, this invention also provides a global task scheduling system based on an event-triggered time-aware state machine. The following describes the global task scheduling system based on an event-triggered time-aware state machine in conjunction with the accompanying drawings. See Figure 3 The figure is a schematic diagram of the structure of a global task scheduling system based on an event-triggered time-aware state machine provided in an embodiment of the present invention.
[0060] The global task scheduling system 300 based on event-triggered time-aware state machines provided in this embodiment of the invention includes: a physical clock adapter 301, a distributed consensus engine 302, a time-aware state machine pool 303, and a task executor 304.
[0061] The physical clock adapter 301 is used to monitor the physical time stream and generate a logical time vector describing the logical time state when the physical time reaches a preset logical epoch boundary. The logical time vector includes at least an epoch vector indicating the active epoch and a logical time index indicating the logical time progress within the current epoch. The distributed consensus engine 302 communicates with the physical clock adapter to receive the logical time vector and coordinate multiple nodes in the distributed system to reach a consensus on the logical time vector, forming a consensus logical time vector. The time-aware state machine pool 303 is connected to the distributed consensus engine and contains at least one time-aware state machine corresponding to a specific task. It is used to receive the consensus logic time vector and drive its own state transition according to the preset state transition logic. Task executor 304 is communicatively connected to the time-aware state machine pool and is used to execute the corresponding task when the time-aware state machine transitions to the execution state.
[0062] In one possible implementation, the physical clock adapter 301 is specifically used for: When physical time reaches the starting boundary of a new epoch, a new logical time vector is generated. The epoch vector in the new logical time vector is updated to include the identifier of the new epoch, and the logical time index corresponding to the new epoch is reset to the initial value. Within the new era, logical time indexing is advanced using preset logical time units.
[0063] In one possible implementation, a logical epoch is defined by a quadruple that includes the epoch's unique identifier, the epoch type, and the start and end boundaries on the absolute timeline.
[0064] In one possible implementation, the time-aware state machine pool 303 is specifically used for: The physical clock adapter acts as the proposer, initiating a consensus proposal on the logical time vector to multiple nodes that act as recipients; An improved Paxos consensus algorithm is run across multiple nodes to form and broadcast a consensus logical time vector to all subscribers.
[0065] In one possible implementation, the transition conditions of the state transition function of the time-aware state machine include: A switch in the epoch vector within the consensus logical time vector has been detected; and, The logical time index of the target epoch type in the consensus logical time vector has been detected to have reached the preset trigger value.
[0066] In one possible implementation, the detection of an epoch vector switch is achieved by comparing the difference between the epoch vector in the currently received consensus logical time vector and the consensus logical time vector received at the previous moment. Since the global task scheduling system 300 based on event-triggered time-aware state machines is an apparatus corresponding to the global task scheduling method based on event-triggered time-aware state machines provided in the above method embodiments, the specific implementation of each unit of the global task scheduling system 300 based on event-triggered time-aware state machines is based on the same concept as in the above method embodiments. Therefore, for the specific implementation of each unit of the global task scheduling system 300 based on event-triggered time-aware state machines, please refer to the description of the global task scheduling method based on event-triggered time-aware state machines in the above method embodiments, and will not be repeated here.
[0067] This invention also provides a global task scheduling device based on an event-triggered time-aware state machine, the device comprising: a processor and a memory; The memory is used to store instructions; The processor is configured to execute the instructions in the memory to perform the global task scheduling method based on an event-triggered time-aware state machine mentioned in the above embodiments.
[0068] It should be noted that the hardware structure of the global task scheduling device based on an event-triggered time-aware state machine provided in the embodiments of the present invention can be as follows: Figure 4 The structure shown, Figure 4 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention.
[0069] Please see Figure 4 As shown, device 400 includes: processor 410, communication interface 420, and memory 430. The number of processors 410 in device 400 can be one or more. Figure 4 Taking a processor as an example, in this embodiment of the invention, the processor 410, communication interface 420, and memory 430 can be connected via a bus system or other means. Figure 4 Taking the connection between China and Israel via the bus system 440 as an example.
[0070] Processor 410 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. Processor 410 may further include hardware chips. These hardware chips may be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0071] The memory 430 may include volatile memory, such as random-access memory (RAM); the memory 430 may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 430 may also include a combination of the above types of memory.
[0072] Optionally, the memory 430 stores an operating system and programs, executable modules, or data structures, or subsets thereof, or extended sets thereof. The programs may include various operation instructions for implementing various operations. The operating system may include various system programs for implementing various basic business processes and handling hardware-based tasks. The processor 410 can read the programs from the memory 430 to implement the global task scheduling method based on an event-triggered time-aware state machine provided in this embodiment of the invention.
[0073] The bus system 440 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system 440 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0074] This invention also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the global task scheduling method based on an event-triggered time-aware state machine mentioned in the above embodiments.
[0075] This invention also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the global task scheduling method based on an event-triggered time-aware state machine mentioned in the above embodiments.
[0076] Although the invention has been specifically shown and described in conjunction with preferred embodiments, those skilled in the art should understand that various changes in form and detail may be made to the invention without departing from the spirit and scope of the invention as defined in the appended claims, all of which shall be within the scope of protection of the invention.
Claims
1. A global task scheduling method based on an event-triggered time-aware state machine, characterized in that, The method includes: In response to the physical time reaching a preset logical epoch boundary, a logical time vector describing the logical time state is generated, wherein the logical time vector includes at least an epoch vector for indicating the active epoch and a logical time index for indicating the logical time progress within the current epoch. The logical time vector is submitted to the distributed consensus engine so that multiple nodes in the distributed system can reach a consensus on the logical time vector and form a consensus logical time vector. The consensus-based logical time vector is used as input to drive the time-aware state machine of the corresponding task to perform state transitions. The state transition function of the time-aware state machine is configured to determine whether to trigger the execution state based on the consensus-based logical time vector and the preset task scheduling logic. When the time-aware state machine transitions to the execution state, the execution of the corresponding task is triggered.
2. The method according to claim 1, characterized in that, The step of generating a logical time vector describing the logical time state in response to the physical time reaching a preset logical epoch boundary includes: When physical time reaches the starting boundary of a new epoch, a new logical time vector is generated, wherein the epoch vector in the new logical time vector is updated to include the identifier of the new epoch, and the logical time index corresponding to the new epoch is reset to the initial value; Within the new era, the logical time index is advanced using a preset logical time unit.
3. The method according to claim 1, characterized in that, The logical epoch is defined by a quadruple, which includes the epoch's unique identifier, epoch type, and start and end boundaries on the absolute timeline.
4. The method according to claim 1, characterized in that, Submitting the logical time vector to the distributed consensus engine so that multiple nodes in the distributed system can reach a consensus on the logical time vector includes: The physical clock adapter acts as the proposer, initiating a consensus proposal for the logical time vector to multiple nodes that act as recipients; An improved Paxos consensus algorithm is run across the multiple nodes to form and broadcast the consensus logical time vector to all subscribers.
5. The method according to claim 1, characterized in that, The transition conditions of the state transition function of the time-aware state machine include: A switch in the epoch vector within the consensus logical time vector was detected; and, The logical time index of the target epoch type in the consensus logical time vector was detected to have reached a preset trigger value.
6. The method according to claim 5, characterized in that, The detection of epoch vector switching is achieved by comparing the difference between the epoch vector in the currently received consensus logical time vector and the consensus logical time vector received at the previous moment.
7. A global task scheduling system based on an event-triggered time-aware state machine, characterized in that, The system includes: A physical clock adapter is used to monitor the physical time stream and generate a logical time vector describing the logical time state when the physical time reaches a preset logical epoch boundary. The logical time vector includes at least an epoch vector indicating the active epoch and a logical time index indicating the logical time progress within the current epoch. A distributed consensus engine, which is communicatively connected to the physical clock adapter, is used to receive the logical time vector and coordinate multiple nodes in the distributed system to reach a consensus on the logical time vector, forming a consensus logical time vector. The time-aware state machine pool is communicatively connected to the distributed consensus engine and includes at least one time-aware state machine corresponding to a specific task. It is used to receive the consensus logical time vector and drive its own state transition according to the preset state transition logic. The task executor is communicatively connected to the time-aware state machine pool and is used to execute the corresponding task when the time-aware state machine transitions to the execution state.
8. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is used to store instructions; The processor is configured to execute the instructions in the memory to perform the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, Including instructions that, when run on a computer, cause the computer to perform the method described in any one of claims 1-6 above.