CN113886039A - Scheduling table synchronization method and device, electronic equipment and storage medium - Google Patents

Scheduling table synchronization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113886039A
CN113886039A CN202111097905.1A CN202111097905A CN113886039A CN 113886039 A CN113886039 A CN 113886039A CN 202111097905 A CN202111097905 A CN 202111097905A CN 113886039 A CN113886039 A CN 113886039A
Authority
CN
China
Prior art keywords
information
scheduling table
synchronization
synchronous
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111097905.1A
Other languages
Chinese (zh)
Other versions
CN113886039B (en
Inventor
秦民
周澍
谢广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Automotive Innovation Co Ltd
Original Assignee
China Automotive Innovation Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Automotive Innovation Co Ltd filed Critical China Automotive Innovation Co Ltd
Priority to CN202111097905.1A priority Critical patent/CN113886039B/en
Publication of CN113886039A publication Critical patent/CN113886039A/en
Application granted granted Critical
Publication of CN113886039B publication Critical patent/CN113886039B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a scheduling table synchronization method, a scheduling table synchronization device, electronic equipment and a storage medium, wherein the scheduling table synchronization method comprises the following steps: under the condition of receiving the starting information, controlling the first scheduling table to enter a to-be-synchronized state, and sending a to-be-synchronized signal to a second target object; under the condition of receiving the synchronous counting information, updating the current synchronous information and starting a first scheduling table based on the synchronous counting information, and sending synchronous starting information to a second target object; and under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, carrying out time synchronization on the first scheduling table until the first scheduling table meets the first preset condition, and determining that the state of the first scheduling table is a synchronous state. According to the technical scheme of the invention, the first scheduling table and the second scheduling table are in a synchronous state, so that tasks with excessive scheduling tables can be conveniently distributed to different scheduling tables of different cores, excessive loads can be balanced, and the performance of a multi-core chip can be fully utilized.

Description

Scheduling table synchronization method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the technical field of automotive controllers, and in particular, to a method and an apparatus for synchronizing schedules, an electronic device, and a storage medium.
Background
With the rapid development of automobile electronic technology, electronic appliance architectures of automobile electronics are continuously upgraded, and domain controllers have become the current mainstream, which results in heavier tasks carried by the controllers. To cope with such heavy tasks, multi-core chips are the best solution. How to distribute tasks to different cores of a chip and fully exert the performance of multiple cores becomes a hot topic.
For a controller conforming to Automotive Open System Architecture (AUTOSAR), tasks are allocated to different cores of a chip and many restrictions are encountered, wherein an important item is that a synchronization mechanism of a scheduling table can only be specific to a certain specific core. Therefore, when task allocation is performed, only tasks needing to use a scheduling table synchronization mechanism can be allocated to the same core, the load between each core cannot be fully balanced, the performance of a multi-core chip cannot be exerted, and even the functional requirements of a controller cannot be met due to the load problem.
Disclosure of Invention
The invention aims to provide a scheduling table synchronization method, a scheduling table synchronization device, an electronic device and a storage medium, wherein after synchronous counting information is received, a first scheduling table is started and subjected to time synchronization, synchronous starting information is simultaneously sent to a second target object so as to perform time synchronization on a second scheduling table of the second target object, and further the first scheduling table and the second scheduling table can be in a synchronous state, so that tasks with too many scheduling tables in one scheduling table can be distributed to different scheduling tables of different cores conveniently, too many loads can be balanced, and the performance of a multi-core chip can be fully utilized.
In order to achieve the purpose, the invention provides the following scheme:
a method of schedule synchronization applied to a first target object, the method comprising:
under the condition of receiving starting information sent by an external synchronization source, controlling a first scheduling table to enter a state to be synchronized, and sending a signal to be synchronized to a second target object, so that the second target object controls a second scheduling table corresponding to the second target object to enter the state to be synchronized;
under the condition of receiving synchronous counting information, updating current synchronous information and starting the first scheduling table based on the synchronous counting information, and sending synchronous starting information to the second target object so that the second target object obtains the updated current synchronous information, starting the second scheduling table and carrying out time synchronization on the second scheduling table according to the current synchronous information until the external counting information in the current synchronous information and the second current counting information of the second scheduling table meet a second preset condition, and determining that the state of the second scheduling table is a synchronous state;
and under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, carrying out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state.
Optionally, the time synchronization processing on the first scheduling table includes:
acquiring target counting information corresponding to a target task in the first scheduling table;
determining the current position of the first current counting information corresponding to the first scheduling table according to the first current counting information and the target counting information;
determining deviation information of the target task based on the current position and the synchronization count information;
and adjusting the time interval between the trigger times corresponding to two adjacent tasks in the next period of the first scheduling table according to the deviation information.
Optionally, the updating the current synchronization information and starting the first schedule table based on the synchronization count information includes:
updating external counting information in the current synchronization information based on the synchronization counting information;
and starting the first scheduling table, updating the synchronization frequency information corresponding to the first scheduling table in the current synchronization information, and updating the state corresponding to the first scheduling table in the current synchronization information to be in an unsynchronized state.
Optionally, the first preset condition is that a difference between the synchronous counting information and the first current counting information is smaller than a preset threshold; the second preset condition is that a difference value between the external counting information and the second current counting information is smaller than the preset threshold value.
Optionally, the method further includes:
and sending out a synchronous abnormal alarm when the time length between the time corresponding to the received synchronous counting information and the current time exceeds the preset time length.
In another aspect, the present invention further provides another method for synchronizing schedules, where the method includes:
the method comprises the steps that a first target object controls a first scheduling table to enter a to-be-synchronized state and sends a to-be-synchronized signal to a second target object under the condition that starting information sent by an external synchronization source is received, wherein the first target object corresponds to the first scheduling table;
the second target object controls a second scheduling table to enter a to-be-synchronized state under the condition that the second target object receives the to-be-synchronized signal, wherein the second target object corresponds to the second scheduling table;
under the condition that the first target object receives synchronous counting information, updating current synchronous information and starting the first scheduling table based on the synchronous counting information, and sending synchronous starting information to the second target object;
the second target object acquires updated current synchronous information under the condition that the second target object receives the synchronous starting information, and starts the second scheduling table according to the current synchronous information;
when the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, the first target object carries out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and the state of the first scheduling table is determined to be a synchronous state;
when the external counting information in the current synchronization information and the second current counting information of the second scheduling table do not meet the second preset condition, the second target object carries out time synchronization on the second scheduling table until the external counting information and the second current counting information meet the second preset condition, and the state of the second scheduling table is determined to be a synchronization state;
and under the condition that the states of the first scheduling table and the second scheduling table in the current synchronization information of the first target object are in a synchronous state, determining that the state of the multi-core scheduling table is in a synchronous state.
In another aspect, the present invention further provides a schedule table synchronization apparatus, including:
the synchronization module is used for controlling the first scheduling table to enter a synchronization state under the condition of receiving starting information sent by an external synchronization source, and sending a synchronization signal to a second target object so that the second target object controls a second scheduling table corresponding to the second target object to enter the synchronization state;
the starting module is used for updating current synchronous information and starting the first scheduling table based on the synchronous counting information under the condition that the synchronous counting information is received, and sending synchronous starting information to the second target object so that the second target object can acquire the updated current synchronous information, starting the second scheduling table and carrying out time synchronization on the second scheduling table according to the current synchronous information until the external counting information in the current synchronous information and the second current counting information of the second scheduling table meet a second preset condition, and determining the state of the second scheduling table to be a synchronous state;
and the synchronization module is used for carrying out time synchronization on the first scheduling table under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state.
In another aspect, the present invention provides another schedule synchronization apparatus, including:
the first to-be-synchronized module is used for controlling a first scheduling table to enter a to-be-synchronized state and sending a to-be-synchronized signal to a second target object under the condition that a first target object receives starting information sent by an external synchronization source, wherein the first target object corresponds to the first scheduling table;
the second to-be-synchronized module is used for controlling a second scheduling table to enter a to-be-synchronized state under the condition that the second target object receives the to-be-synchronized signal, and the second target object corresponds to the second scheduling table;
a first starting module, configured to, when the first target object receives synchronization count information, update current synchronization information and start the first schedule based on the synchronization count information, and send synchronization start information to the second target object;
the second starting module is used for acquiring updated current synchronous information under the condition that the second target object receives the synchronous starting information, and starting the second scheduling table according to the current synchronous information;
the first synchronization module is used for the first target object to perform time synchronization on the first scheduling table under the condition that the synchronous counting information and first current counting information of the first scheduling table do not meet a first preset condition until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state;
the second synchronization module is used for carrying out time synchronization processing on the second scheduling table under the condition that the external counting information in the current synchronization information and the second current counting information of the second scheduling table do not meet a second preset condition by the second target object until the external counting information and the second current counting information meet the second preset condition, and determining that the state of the second scheduling table is a synchronization state;
and the state determining module is used for determining that the state of the multi-core scheduling table is in a synchronous state under the condition that the states of the first scheduling table and the second scheduling table in the current synchronous information of the first target object are in the synchronous state.
In another aspect, the present invention further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform any of the schedule synchronization methods described above.
In another aspect, the present invention also provides a non-transitory computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement any of the schedule synchronization methods described above.
According to the scheduling table synchronization method, the scheduling table synchronization device, the electronic equipment and the storage medium, after the synchronous counting information is received, the first scheduling table is started and subjected to time synchronization, the synchronous starting information is sent to the second target object at the same time, so that the second scheduling table of the second target object is subjected to time synchronization, the first scheduling table and the second scheduling table can be in a synchronous state, and therefore tasks with excessive scheduling tables can be distributed to different scheduling tables of different cores conveniently, excessive loads can be balanced, and the performance of a multi-core chip can be fully utilized.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings used in the description of the embodiment or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art it is also possible to derive other drawings from these drawings without inventive effort.
FIG. 1 is a schematic diagram of an application environment provided by an embodiment of the invention;
FIG. 2 is a flowchart of a method for schedule synchronization according to an embodiment of the present invention;
FIG. 3 is a timing diagram illustrating a method for schedule synchronization according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method for schedule synchronization according to an embodiment of the present invention;
fig. 5 is a flowchart of a method for performing time tick processing on the first scheduling table according to an embodiment of the present invention;
FIG. 6 is a flowchart of a method for updating the current synchronization information and starting the first schedule according to the synchronization count information provided by the embodiment of the present invention;
fig. 7 is a block diagram of a schedule table synchronizing apparatus according to an embodiment of the present invention;
fig. 8 is a block diagram of another schedule synchronization apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
An embodiment of a scheduling table synchronization method according to the present invention is described below, and fig. 1 is a schematic diagram of an application environment provided by an embodiment of the present invention, which may include an external synchronization source and a multi-core controller; in one example, a multi-core controller may include core 0, core 1, and core 2. The external synchronization source may be a synchronization source external to the multi-core controller. An external synchronization source may be used to provide referenced timing information. The external synchronization source may include a synchronization counter. In practical application, an external synchronization source can send start information and synchronous counting information to any core in a multi-core controller, and the core receiving the start information or the synchronous counting information is a first target object; the second target object may be one or more cores of the multi-core controller other than the first target object. It will be appreciated that the second target object may include one or more cores, each of which may include one or more second schedules. The first target object may include one or more first schedules. In addition, each scheduling table corresponds to one driving counter, and when the value of the driving counter reaches the value corresponding to the task, the task is triggered.
It is noted that the present specification provides the method steps as described in the examples or flowcharts, but may include more or less steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system products may be executed sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) in accordance with the methods described in the embodiments or figures.
As shown in fig. 2, the present embodiment provides a schedule table synchronization method, and fig. 3 is a timing chart of the schedule table synchronization method provided by the present embodiment, and the method includes:
s201, under the condition that a first target object receives starting information sent by an external synchronization source, a first scheduling table is controlled to enter a to-be-synchronized state, a to-be-synchronized signal is sent to a second target object, and the first target object corresponds to the first scheduling table.
The starting information can be request information of multi-core schedule synchronization. The signal to be synchronized may be used to indicate a signal to enter a state to be synchronized. The startup information may include startup instructions. The states of the first schedule and the second schedule may include an unopened state, a to-be-synchronized state, an unsynchronized state, and a synchronized state. Specifically, the not-started state may refer to the schedule not being started and waiting for start information. The to-be-synchronized state may refer to a state in which the schedule has started and waits for a synchronization signal to start synchronization after receiving the synchronization signal. The unsynchronized state may refer to a state in which the schedule has started synchronization but has not completed synchronization. The synchronization state may refer to a state in which the schedule has completed synchronization.
In practical application, the external synchronization source may send the start information to the first target object in the multi-core after receiving the multi-core schedule synchronization request instruction. Specifically, the external synchronization source may initiate the start of the multi-core schedule at any core through an interface like startschedule tablegroup. After receiving the start information, the first target object may control the first schedule to enter a to-be-synchronized state, and send a to-be-synchronized signal to the second target object.
S202, under the condition that the second target object receives the signal to be synchronized, the second scheduling table is controlled to enter a state to be synchronized, and the second target object corresponds to the second scheduling table.
In practical application, after the second target object receives the signal to be synchronized, the second schedule can be controlled to enter a state to be synchronized. Specifically, after the multiple cores in the second target object receive the signal to be synchronized, each core may control its own schedule to enter a state to be synchronized.
S203, under the condition that the first target object receives the synchronous counting information, updating the current synchronous information and starting a first scheduling table based on the synchronous counting information, and sending synchronous starting information to the second target object.
Wherein the synchronization count information may be a value of an internal synchronization counter transmitted by the external synchronization source. The current synchronization information may characterize the synchronization status of the multi-core schedule and its various schedule members. The current synchronization information may include external count information, identification information of each schedule table, synchronization number information of each schedule table, and status information of each schedule table. The identification information of each schedule is used to identify the core to which the schedule belongs. The synchronization start information may refer to information requesting the second target object to start synchronization. For the synchronization frequency information of each scheduling table and the state information of each scheduling table in the current synchronization information, each core has the read-write permission; the external counting information in the current synchronization information can be that the first target object has the right of reading and writing, and the second target object has the right of reading, so that the extra overhead caused by protection mechanisms such as locks and the like used for avoiding simultaneous writing operation on the shared area can be reduced.
In practical applications, the external synchronization source may send synchronization count information to the first target object at intervals of a preset time length. The first target object may update the current synchronization information by overwriting the external count information originally in the current synchronization information with the value of the synchronization counter in the synchronization count information, in case the synchronization count information is received. When the first target object receives the synchronous counting information, the first scheduling table is started, and meanwhile synchronous starting information is sent to the second target object. Specifically, the first target object may notify cores in the second target object to synchronize in an interrupt manner.
And S204, under the condition that the second target object receives the synchronous starting information, acquiring the updated current synchronous information, carrying out time synchronization processing on the second scheduling table according to the current synchronous information, and starting the second scheduling table.
In practical application, after receiving the synchronization start information, each core in the second target object acquires the current synchronization information. After the schedule table is started, each core in the second target object can perform time synchronization processing on each schedule table according to the external counting information in the current synchronization information, so that the counting information of the driving counter corresponding to the schedule table of each core in the second target object is synchronized with the external counting information.
S205, when the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, the first target object carries out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and the state of the first scheduling table is determined to be a synchronous state.
Wherein the first current count information may refer to a value of a driving counter within the first target object. The first current count information may be used to determine a current position of the first schedule. The current position of the first schedule may characterize the current task trigger progress of the first schedule. The first preset condition may be that a difference between the synchronization count information and the first current count information is less than a preset threshold. The preset threshold may be a small value, and it is understood that the synchronization count information is substantially equal to the first current count information by the difference between the synchronization count information and the first current count information being smaller than the preset threshold, thereby determining that the state of the first schedule table is the synchronization state.
In practical application, when the synchronous count information and the first current count information do not satisfy the first preset condition, the first target object may perform time synchronization processing on the first scheduling table according to the synchronous count information. After time synchronization is completed, the synchronous counting information is basically equal to the first current counting information, and then the state of the first scheduling table is determined to be a synchronous state.
S206, under the condition that the external counting information in the current synchronous information and the second current counting information of the second scheduling table do not meet a second preset condition, the second target object carries out time synchronization on the second scheduling table until the external counting information and the second current counting information meet the second preset condition, and the state of the second scheduling table is determined to be a synchronous state.
Wherein the second preset condition may be that a difference value between the external counting information and the second current counting information is smaller than a preset threshold.
In practical application, when the external count information in the current synchronization information and the second current count information of the second schedule do not satisfy the second preset condition, each core of the second target object may perform time synchronization on the second schedule corresponding to each core according to the external count information. After time synchronization is completed, the second current counting information of the second scheduling table corresponding to each core is basically equal to the external counting information, and the state of the second scheduling table of each core is determined to be a synchronous state.
And S207, under the condition that the states of the first scheduling table and the second scheduling table in the current synchronization information of the first target object are in a synchronization state, determining that the state of the multi-core scheduling table is in the synchronization state.
The states of the multi-core schedule table can comprise an un-started state, a wait synchronization state, a synchronization unacknowledged state, an unsynchronized state and a synchronization state. The non-starting state can mean that the external synchronization source does not start the schedule table, or a part of the schedule table does not receive a signal to be synchronized; the waiting synchronization state may mean that the states of all the schedules have already entered a state to be synchronized; the synchronization unconfirmed state may be a state in which the second target object does not receive the synchronization start information after entering the wait synchronization state; an unsynchronized state may refer to all cores' schedules having started but not completing synchronization; the synchronization state may refer to the running time of the schedules of all cores coinciding with the time of the external synchronization source, completing the synchronization. The run time of a schedule may refer to the length of time the current time is relative to the time at which the schedule is triggered to start. It can be understood that, the driving counter in the schedule table may have errors due to the fact that the driving counter cannot achieve absolute accuracy in the counting process, and the driving counter of the schedule table needs to be synchronized with an external synchronization source through time synchronization.
In practical application, the first target object may obtain the corresponding states of the first schedule table and the second schedule table by obtaining the current synchronization information and according to the second schedule table identifier and the first schedule table identifier. When the states of the first schedule and the second schedule of each core are in a synchronous state, that is, the running time of the schedules of all cores is consistent with the time of the external synchronization source, it can be considered that synchronization is completed, that is, the state of the multi-core schedule is in a synchronous state. And when the first scheduling table and the second scheduling table have the unsynchronized state, the state of the multi-core scheduling table is the unsynchronized state.
After receiving the synchronous counting information, starting the first scheduling table and carrying out time synchronization processing, and simultaneously sending the synchronous starting information to the second target object so as to carry out time synchronization processing on the second scheduling table of the second target object, and further enabling the first scheduling table and the second scheduling table to be in a synchronous state, so that tasks with excessive scheduling tables can be distributed to different scheduling tables of different cores conveniently, excessive loads can be balanced, and the performance of a multi-core chip can be fully utilized.
As shown in fig. 4, the present embodiment provides a schedule synchronization method applied to a first target object, including:
s401, under the condition that starting information sent by an external synchronization source is received, the first scheduling table is controlled to enter a to-be-synchronized state, and a to-be-synchronized signal is sent to the second target object, so that the second target object controls the second scheduling table corresponding to the second target object to enter the to-be-synchronized state.
In practical applications, step S401 may refer to steps S201-S202 described above.
S402, under the condition that the synchronous counting information is received, updating the current synchronous information and starting a first scheduling table based on the synchronous counting information, and sending the synchronous starting information to a second target object to enable the second target object to obtain the updated current synchronous information, starting a second scheduling table and carrying out time synchronization on the second scheduling table according to the current synchronous information until the external counting information in the current synchronous information and the second current counting information of the second scheduling table meet a second preset condition, and determining that the state of the second scheduling table is a synchronous state.
In practical applications, step S402 may refer to steps S203-S204 described above.
And S403, under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, carrying out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state.
In practical applications, step S403 may refer to step S205 described above.
After receiving the synchronous counting information, starting the first scheduling table and carrying out time synchronization processing, and simultaneously sending the synchronous starting information to the second target object so as to carry out time synchronization processing on the second scheduling table of the second target object, and further enabling the first scheduling table and the second scheduling table to be in a synchronous state, so that tasks with excessive scheduling tables can be distributed to different scheduling tables of different cores conveniently, excessive loads can be balanced, and the performance of a multi-core chip can be fully utilized.
Fig. 5 is a flowchart of a method for performing time tick processing on a first scheduling table according to an embodiment of the present invention. In one possible embodiment, as shown in fig. 5, the time tick processing on the first schedule may include:
s501, acquiring target counting information corresponding to the target tasks in the first scheduling table.
Wherein the first schedule includes a plurality of tasks. The target task may refer to a task that the first schedule is to trigger next at the current time. The trigger time of each task corresponds to the value of the drive counter. The target count information may refer to a value of a driving counter corresponding to the target task.
In practical application, the target task can be determined through the task triggering condition. Each task has a corresponding relation with the value of the driving counter, and after the target task is determined, target counting information corresponding to the target task can be obtained in a table look-up mode.
S502, according to the first current counting information and the target counting information, determining the current position of the first current counting information corresponding to the first scheduling table.
The current position may refer to a relative position at the current time with a next task in the schedule as a reference point.
In practical application, all schedule members in the multi-core schedule and the basic time units of the internal counters and the synchronous counters thereof are consistent. The current position of the first current count information in the first schedule table may be determined based on a difference between the first current count information and the target count information. Specifically, according to the period, the basic time unit and the current position of the schedule table, the current position of the schedule table where the current time is located can be represented by the number of the basic time unit.
And S503, determining deviation information of the target task based on the current position and the synchronous counting information.
The deviation information of the target task may represent the deviation between the drive counter and the synchronous counter in the case of synchronous start.
In practical application, the difference value between the basic time unit number of the current position and the synchronous counting information can be obtained to obtain the deviation information of the target task.
And S504, adjusting the time interval between the corresponding trigger times of two adjacent tasks in the next period according to the deviation information.
After the deviation information of the target tasks is determined, the time interval between subsequent target tasks to be processed can be adjusted according to the deviation information. For example, when the current position of the scheduling table is determined to be ahead of the synchronous timer through the deviation information, the time interval between adjacent tasks in the next period can be shortened, and the total shortened time length is the same as the deviation information, so that the driving counter corresponding to the scheduling table and the synchronous counter are synchronized along with the completion of the tasks in the next period.
And determining deviation information of the target tasks according to the current position and the synchronous counting information, so that the scheduling table adjusts the time interval between the subsequent target tasks to be processed according to the deviation information, and the driving counter of the scheduling table is synchronized with the synchronous counter of the external synchronous source. Because the synchronization is carried out at intervals in the process of continuously completing the task, the accumulative effect of the errors of the two counters can be avoided.
Fig. 6 is a flowchart of a method for updating current synchronization information and starting a first schedule according to the synchronization count information according to an embodiment of the present invention. In one possible embodiment, as shown in fig. 6, updating the current synchronization information and starting the first schedule based on the synchronization count information may include:
s601, updating external counting information in the current synchronization information based on the synchronization counting information.
In practical application, the original external counting information in the current synchronization information can be overwritten by the synchronization counting information by overwriting the original data, so as to update the external counting information of the current synchronization information.
S602, starting the first scheduling table, updating the synchronization frequency information corresponding to the first scheduling table in the current synchronization information, and updating the state corresponding to the first scheduling table in the current synchronization information to be an unsynchronized state.
The synchronization frequency information may refer to the frequency of initiating synchronization from the start of the corresponding scheduling table to the current time.
In practical application, after the scheduling table is started, the state corresponding to the first scheduling table in the current synchronization information can be changed from the state to be synchronized into the unsynchronized state, and the state corresponding to the first scheduling table can be changed from the unsynchronized state into the synchronized state until synchronization is completed. The synchronization number information corresponding to any schedule can be increased by 1 each time the schedule changes from the wait synchronization state to the unsynchronized state. It should be noted that, the synchronization process of the schedule may not be completed, for example, in the synchronization process of the schedule, after the first target object receives the synchronization count information again, the first target object may update the external count information in the current synchronization information according to the latest received synchronization count information, and send the synchronization start information to the second target object; after receiving the synchronization start information, the second target object may increase the synchronization frequency information of the schedule corresponding to the second target object by 1, and meanwhile, the schedule in which synchronization is not completed may stop the previous synchronization process and perform synchronization again according to the current synchronization information updated again. It is understood that the plurality of schedules can be all synchronized to the same external counting information by the same synchronization time information of each schedule.
In one possible embodiment, the method may further include:
and sending out a synchronous abnormal alarm when the time length between the time corresponding to the received synchronous counting information and the current time exceeds the preset time length.
In practical application, the deviation information of the target task is determined through the current position and the synchronous counting information, the synchronization of a scheduling table and an external counter of an external synchronization source can be completed quickly, if the synchronization is not completed after the preset time length is exceeded, the synchronization process can be indicated to be abnormal, and an operator is reminded to perform fault detection by sending out a synchronous abnormal alarm.
Fig. 7 is a block diagram of a schedule table synchronizing apparatus according to an embodiment of the present invention. On the other hand, as shown in fig. 7, the present embodiment also provides a schedule table synchronizing device including:
the synchronization module 10 is configured to control the first schedule to enter a synchronization state and send a synchronization signal to the second target object under the condition that start information sent by an external synchronization source is received, so that the second target object controls a second schedule corresponding to the second target object to enter the synchronization state;
the starting module 20 is configured to, in a case that the synchronous counting information is received, update current synchronous information and start a first schedule table based on the synchronous counting information, and send synchronous starting information to a second target object, so that the second target object obtains the updated current synchronous information, and according to the current synchronous information, start a second schedule table and perform time synchronization on the second schedule table until external counting information in the current synchronous information and second current counting information of the second schedule table meet a second preset condition, and determine that a state of the second schedule table is a synchronous state;
and the synchronization module 30 is configured to perform timing processing on the first scheduling table when the synchronous counting information and the first current counting information of the first scheduling table do not satisfy a first preset condition, until the synchronous counting information and the first current counting information satisfy the first preset condition, and determine that the state of the first scheduling table is a synchronous state.
Fig. 8 is a block diagram of another schedule synchronization apparatus according to an embodiment of the present invention. On the other hand, as shown in fig. 8, the present embodiment also provides another schedule synchronization apparatus, including:
a first module to be synchronized 11, configured to, when a first target object receives start information sent by an external synchronization source, control a first schedule to enter a state to be synchronized, and send a signal to be synchronized to a second target object, where the first target object corresponds to the first schedule;
a second module to be synchronized 21, configured to control a second schedule to enter a state to be synchronized when a second target object receives a signal to be synchronized, where the second target object corresponds to the second schedule;
a first starting module 31, configured to, when the first target object receives the synchronization count information, update the current synchronization information and start the first schedule based on the synchronization count information, and send synchronization starting information to the second target object;
a second starting module 41, configured to, when the second target object receives the synchronous starting information, obtain updated current synchronous information, and start a second scheduling table according to the current synchronous information;
the first synchronization module 51 is configured to, when the synchronous count information and the first current count information of the first scheduling table do not satisfy a first preset condition, perform time synchronization processing on the first scheduling table by the first target object until the synchronous count information and the first current count information satisfy the first preset condition, and determine that the state of the first scheduling table is a synchronous state;
the second synchronization module 61 is configured to, when the external count information in the current synchronization information and the second current count information of the second scheduling table of the second target object do not satisfy a second preset condition, perform time synchronization on the second scheduling table until the external count information and the second current count information satisfy the second preset condition, and determine that the state of the second scheduling table is a synchronization state;
and the state determining module 71 is configured to determine that the state of the multi-core schedule is a synchronous state when the states of the first schedule and the second schedule in the current synchronization information of the first target object are both in the synchronous state.
On the other hand, an embodiment of the present invention further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform any of the schedule synchronization methods described above.
In another aspect, an embodiment of the present invention further provides a non-volatile computer-readable storage medium, on which computer program instructions are stored, where the computer program instructions, when executed by a processor, implement any of the schedule synchronization methods described above.
It is noted that while for simplicity of explanation, the foregoing method embodiments have been presented as a series of interrelated states or acts, it should be appreciated by those skilled in the art that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Similarly, the modules of the schedule synchronization apparatus are referred to as computer programs or program segments for performing one or more specific functions, and the distinction between the modules does not mean that actual program codes are necessarily separated. Further, the above embodiments may be arbitrarily combined to obtain other embodiments.
In the foregoing embodiments, the descriptions of the embodiments have respective emphasis, and reference may be made to related descriptions of other embodiments for parts that are not described in detail in a certain embodiment. Those of skill in the art will further appreciate that the various illustrative logical blocks, units, and steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate the interchangeability of hardware and software, various illustrative components, elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
The foregoing description has disclosed fully preferred embodiments of the present invention. It should be noted that those skilled in the art can make modifications to the embodiments of the present invention without departing from the scope of the appended claims. Accordingly, the scope of the appended claims is not to be limited to the specific embodiments described above.

Claims (10)

1. A method of schedule synchronization, applied to a first target object, the method comprising:
under the condition of receiving starting information sent by an external synchronization source, controlling a first scheduling table to enter a state to be synchronized, and sending a signal to be synchronized to a second target object, so that the second target object controls a second scheduling table corresponding to the second target object to enter the state to be synchronized;
under the condition of receiving synchronous counting information, updating current synchronous information and starting the first scheduling table based on the synchronous counting information, and sending synchronous starting information to the second target object so that the second target object obtains the updated current synchronous information, starting the second scheduling table and carrying out time synchronization on the second scheduling table according to the current synchronous information until the external counting information in the current synchronous information and the second current counting information of the second scheduling table meet a second preset condition, and determining that the state of the second scheduling table is a synchronous state;
and under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, carrying out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state.
2. The method of claim 1, wherein said time-tick processing of said first schedule comprises:
acquiring target counting information corresponding to a target task in the first scheduling table;
determining the current position of the first current counting information corresponding to the first scheduling table according to the first current counting information and the target counting information;
determining deviation information of the target task based on the current position and the synchronization count information;
and adjusting the time interval between the trigger times corresponding to two adjacent tasks in the next period of the first scheduling table according to the deviation information.
3. The method of claim 1, wherein updating current synchronization information and starting the first schedule based on the synchronization count information comprises:
updating external counting information in the current synchronization information based on the synchronization counting information;
and starting the first scheduling table, updating the synchronization frequency information corresponding to the first scheduling table in the current synchronization information, and updating the state corresponding to the first scheduling table in the current synchronization information to be in an unsynchronized state.
4. The method according to claim 1, wherein the first preset condition is that a difference value between the synchronization count information and the first current count information is smaller than a preset threshold; the second preset condition is that a difference value between the external counting information and the second current counting information is smaller than the preset threshold value.
5. The method of claim 1, further comprising:
and sending out a synchronous abnormal alarm when the time length between the time corresponding to the received synchronous counting information and the current time exceeds the preset time length.
6. A method for schedule synchronization, the method comprising:
the method comprises the steps that a first target object controls a first scheduling table to enter a to-be-synchronized state and sends a to-be-synchronized signal to a second target object under the condition that starting information sent by an external synchronization source is received, wherein the first target object corresponds to the first scheduling table;
the second target object controls a second scheduling table to enter a to-be-synchronized state under the condition that the second target object receives the to-be-synchronized signal, wherein the second target object corresponds to the second scheduling table;
under the condition that the first target object receives synchronous counting information, updating current synchronous information and starting the first scheduling table based on the synchronous counting information, and sending synchronous starting information to the second target object;
the second target object acquires updated current synchronous information under the condition that the second target object receives the synchronous starting information, and starts the second scheduling table according to the current synchronous information;
when the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition, the first target object carries out time synchronization on the first scheduling table until the synchronous counting information and the first current counting information meet the first preset condition, and the state of the first scheduling table is determined to be a synchronous state;
when the external counting information in the current synchronization information and the second current counting information of the second scheduling table do not meet a second preset condition, the second target object carries out time synchronization on the second scheduling table until the external counting information and the second current counting information meet the second preset condition, and the state of the second scheduling table is determined to be a synchronization state;
and under the condition that the states of the first scheduling table and the second scheduling table in the current synchronization information of the first target object are in a synchronous state, determining that the state of the multi-core scheduling table is in a synchronous state.
7. A schedule synchronization apparatus, the apparatus comprising:
the synchronization module is used for controlling the first scheduling table to enter a synchronization state under the condition of receiving starting information sent by an external synchronization source, and sending a synchronization signal to a second target object so that the second target object controls a second scheduling table corresponding to the second target object to enter the synchronization state;
the starting module is used for updating current synchronous information and starting the first scheduling table based on the synchronous counting information under the condition that the synchronous counting information is received, and sending synchronous starting information to the second target object so that the second target object can acquire the updated current synchronous information, starting the second scheduling table and carrying out time synchronization on the second scheduling table according to the current synchronous information until the external counting information in the current synchronous information and the second current counting information of the second scheduling table meet a second preset condition, and determining the state of the second scheduling table to be a synchronous state;
and the synchronization module is used for carrying out time synchronization on the first scheduling table under the condition that the synchronous counting information and the first current counting information of the first scheduling table do not meet a first preset condition until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state.
8. A schedule synchronization apparatus, the apparatus comprising:
the first to-be-synchronized module is used for controlling a first scheduling table to enter a to-be-synchronized state and sending a to-be-synchronized signal to a second target object under the condition that a first target object receives starting information sent by an external synchronization source, wherein the first target object corresponds to the first scheduling table;
the second to-be-synchronized module is used for controlling a second scheduling table to enter a to-be-synchronized state under the condition that the second target object receives the to-be-synchronized signal, and the second target object corresponds to the second scheduling table;
a first starting module, configured to, when the first target object receives synchronization count information, update current synchronization information and start the first schedule based on the synchronization count information, and send synchronization start information to the second target object;
the second starting module is used for acquiring updated current synchronous information under the condition that the second target object receives the synchronous starting information, and starting the second scheduling table according to the current synchronous information;
the first synchronization module is used for the first target object to perform time synchronization on the first scheduling table under the condition that the synchronous counting information and first current counting information of the first scheduling table do not meet a first preset condition until the synchronous counting information and the first current counting information meet the first preset condition, and determining that the state of the first scheduling table is a synchronous state;
the second synchronization module is used for carrying out time synchronization processing on the second scheduling table under the condition that the external counting information in the current synchronization information and the second current counting information of the second scheduling table do not meet a second preset condition by the second target object until the external counting information and the second current counting information meet the second preset condition, and determining that the state of the second scheduling table is a synchronization state;
and the state determining module is used for determining that the state of the multi-core scheduling table is in a synchronous state under the condition that the states of the second scheduling table and the first scheduling table in the current synchronous information of the first target object are in the synchronous state.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the executable instructions to implement the schedule synchronization method of any of claims 1 to 5 or to implement the schedule synchronization method of claim 6.
10. A non-transitory computer readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed by a processor, implement the schedule synchronization method of any of claims 1 to 5 or implement the schedule synchronization method of claim 6.
CN202111097905.1A 2021-09-18 2021-09-18 Scheduling table synchronization method and device, electronic equipment and storage medium Active CN113886039B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111097905.1A CN113886039B (en) 2021-09-18 2021-09-18 Scheduling table synchronization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111097905.1A CN113886039B (en) 2021-09-18 2021-09-18 Scheduling table synchronization method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113886039A true CN113886039A (en) 2022-01-04
CN113886039B CN113886039B (en) 2023-12-22

Family

ID=79009806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111097905.1A Active CN113886039B (en) 2021-09-18 2021-09-18 Scheduling table synchronization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113886039B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359238A (en) * 2008-09-02 2009-02-04 中兴通讯股份有限公司 Time synchronization method and system for multi-core system
CN101714108A (en) * 2008-10-03 2010-05-26 富士通株式会社 Synchronization control apparatus, information processing apparatus, and synchronization management method
CN107579795A (en) * 2017-10-23 2018-01-12 广州供电局有限公司 The method for synchronizing time of distributed multi bri device and distributed multiport system
CN108139945A (en) * 2015-10-13 2018-06-08 奥托立夫开发公司 Vehicle safety electronic control system
US20190222407A1 (en) * 2018-01-17 2019-07-18 Mitsubishi Electric Corporation Master control device and synchronous communication system using same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359238A (en) * 2008-09-02 2009-02-04 中兴通讯股份有限公司 Time synchronization method and system for multi-core system
CN101714108A (en) * 2008-10-03 2010-05-26 富士通株式会社 Synchronization control apparatus, information processing apparatus, and synchronization management method
CN108139945A (en) * 2015-10-13 2018-06-08 奥托立夫开发公司 Vehicle safety electronic control system
CN107579795A (en) * 2017-10-23 2018-01-12 广州供电局有限公司 The method for synchronizing time of distributed multi bri device and distributed multiport system
US20190222407A1 (en) * 2018-01-17 2019-07-18 Mitsubishi Electric Corporation Master control device and synchronous communication system using same

Also Published As

Publication number Publication date
CN113886039B (en) 2023-12-22

Similar Documents

Publication Publication Date Title
CN107291547B (en) Task scheduling processing method, device and system
US8190941B2 (en) Field control system
US9407573B2 (en) Bandwidth control in a controller area network (CAN)
US10139799B2 (en) Controller to modify an execution condition during program execution
EP3076293A2 (en) Control apparatus
US10025286B2 (en) Simulation system, programmable controller, simulation device, and engineering tool
JP2020535559A5 (en)
CN109783157B (en) Method and related device for loading algorithm program
EP3419793B1 (en) Robot controller system, robot arrangement, computer program and method therefor
US10994675B2 (en) Vehicle control device and vehicle system
US20150378773A1 (en) Communication system, programmable indicator, information processing device, operation control method, information processing method, and program
US20120317576A1 (en) method for operating an arithmetic unit
US20160357547A1 (en) Engineering tool program and network system
CN107798039B (en) Data synchronization method and device
CN105308570A (en) Method and apparatus for data transfer to the cyclic tasks in a distributed real-time system at the correct time
US20120102175A1 (en) Computer System, Simulation Method and Program
CN113886039A (en) Scheduling table synchronization method and device, electronic equipment and storage medium
US9170839B2 (en) Method for job scheduling with prediction of upcoming job combinations
JP2010267091A (en) Information processing apparatus, method of controlling the same, and computer program
EP3336708A1 (en) Deterministic timing evaluation
CN106445668B (en) Timing method and device of timer
KR101349561B1 (en) Apparatus and method for scheduling partition based criticality
EP2207070A1 (en) Field control device and field control method
CN110209509B (en) Data synchronization method and device among multi-core processors
US10417040B2 (en) Job scheduler test program, job scheduler test method, and information processing apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant