[go: up one dir, main page]

CN112306657B - Control method and device for realizing linear countdown of multiple events based on priority ordering - Google Patents

Control method and device for realizing linear countdown of multiple events based on priority ordering Download PDF

Info

Publication number
CN112306657B
CN112306657B CN202011186222.9A CN202011186222A CN112306657B CN 112306657 B CN112306657 B CN 112306657B CN 202011186222 A CN202011186222 A CN 202011186222A CN 112306657 B CN112306657 B CN 112306657B
Authority
CN
China
Prior art keywords
event
time
highest
thread
current thread
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.)
Active
Application number
CN202011186222.9A
Other languages
Chinese (zh)
Other versions
CN112306657A (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.)
Shanghai 2345 Network Technology Co ltd
Original Assignee
Shanghai 2345 Network Technology 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 Shanghai 2345 Network Technology Co ltd filed Critical Shanghai 2345 Network Technology Co ltd
Priority to CN202011186222.9A priority Critical patent/CN112306657B/en
Publication of CN112306657A publication Critical patent/CN112306657A/en
Application granted granted Critical
Publication of CN112306657B publication Critical patent/CN112306657B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

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

Abstract

The invention discloses a control method for realizing linear countdown of a plurality of events based on priority ordering, which triggers a second event to be ordered higher than the highest-level event in a current thread before or simultaneously or after executing the current thread, inserts the second event to be ordered into the current thread, and stores and updates the second event to be ordered. The invention can insert the event with the highest priority into the appointed thread, update the event based on the time of the current thread and the starting time of the current thread, and clear other events of the current thread, thereby realizing the insertion of the event with the highest level.

Description

Control method and device for realizing linear countdown of multiple events based on priority ordering
Technical Field
The invention belongs to the field of computer processing systems, and particularly relates to a control method and a device for realizing linear countdown of a plurality of events based on priority ordering.
Background
The string type is the most basic data type in redis, and it can store any form of string, including binary data. Can be used to store a user mailbox, and a JSON-enabled object is even a picture. A String type key allows the maximum capacity of stored data to be 512M, and String is as much as java arrayList to reduce frequent allocation of memory in a mode of pre-allocating redundant space, wherein each expansion is nearly doubled, and the maximum value of String is 512m. The method is characterized by supporting batch operation, setting of expiration time and self-increasing operation.
The countdown of events performed on a page and a background of an intelligent terminal belongs to a current common implementation mode, in an actual operation process, a plurality of events are often involved in sorting, the countdown is usually performed according to the importance degree of the events from high to low, when the events are inserted into a current thread again, judgment needs to be performed on the events, whether the events should be processed most preferentially is judged, and the technical problems to be solved are how to process the events, calculate the remaining countdown time, determine the total countdown time, determine the remaining time of other events and the like.
At present, in the prior art, there is no control method and apparatus for implementing linear countdown of a plurality of events based on priority ordering.
Disclosure of Invention
Aiming at the technical defects existing in the prior art, the invention aims to provide a control method and a device for realizing the linear countdown of a plurality of events based on priority ordering, and according to one aspect of the invention, the invention provides a control method for realizing the linear countdown of a plurality of events based on priority ordering, which comprises the following steps:
i: assigning all the events counted down according to the rule of the ordering ID;
ii: serializing a plurality of events based on the assignment result, inserting the events into a current thread and storing the events;
iii: recording the count-down time of each event, the sum of the count-down times of the first thread and the first record update time;
a. triggering a second event to be ordered higher than the highest level event in the current thread before, simultaneously with or after executing the current thread;
b. inserting the second event to be sequenced into the current thread and storing and updating the second event to be sequenced;
wherein, the step b comprises the following steps:
b1: determining the current time as second record updating time, and starting deduction from the countdown time of the highest-level event in the current thread according to the time difference of the first record updating time and the second record updating time from high to low until the deduction is completed;
b2: when the countdown time of the highest-level event remains, executing the step b3, and when the countdown time of the highest-level event is clear, executing the step b4;
b3: recording the remaining countdown time of the highest-level event, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as a second thread, and executing the step b5;
b4: deleting one or more events with zero countdown time, recording the remaining countdown time of the event after the deduction is completed, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as the second thread, and executing the step b5;
b5: the count down time of each event, the sum of the count down times of the second thread, and the second record update time are recorded.
Preferably, the rule of the sorting ID at least includes a character, a numerical value of a definition type, and a record-in self-increment ID, where the character is a letter, the numerical value of the definition type is a natural number of two digits, and the record-in self-increment ID is a natural number of three digits.
Preferably, before the step a, the method further comprises the following steps:
a1: assigning the first event to be ordered according to the rule of the ordering ID;
a2: the first to-be-sequenced event that is higher than the highest level event in the current thread is determined as the second to-be-sequenced event based on the rules of the sequencing ID.
Preferably, in the step b, the second event to be ordered is stored in REDIS STRING.
According to another aspect of the present invention, there is provided a control apparatus for implementing linear countdown of a plurality of events based on prioritization, comprising:
third processing means: assigning all the events counted down according to the rule of the ordering ID;
Fourth processing means: serializing a plurality of events based on the assignment result, inserting the events into a current thread and storing the events;
First recording means: recording the count-down time of each event, the sum of the count-down times of the first thread and the first record update time;
first processing means: triggering a second event to be ordered higher than the highest level event in the current thread before, simultaneously with or after executing the current thread;
and a second processing device: inserting the second event to be ordered into the current thread, storing and updating the second event to be ordered, wherein the second processing device comprises:
seventh processing means: determining the current time as second record updating time, and starting deduction from the countdown time of the highest-level event in the current thread according to the time difference of the first record updating time and the second record updating time from high to low until the deduction is completed;
Eighth processing means: when the countdown time of the highest-level event remains, executing the step b4, and when the countdown time of the highest-level event is clear, executing the step b5;
ninth processing means: recording the remaining countdown time of the highest-level event, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as a second thread, and executing the step b5;
Tenth processing means: deleting one or more events with zero countdown time, recording the remaining countdown time of the event after the deduction is completed, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as the second thread, and executing the step b5;
A second recording device: the count down time of each event, the sum of the count down times of the second thread, and the second record update time are recorded.
Preferably, the first processing device further includes:
Fifth processing means: assigning the first event to be ordered according to the rule of the ordering ID;
sixth processing means: the first to-be-sequenced event that is higher than the highest level event in the current thread is determined as the second to-be-sequenced event based on the rules of the sequencing ID.
The invention discloses a control method for realizing linear countdown of a plurality of events based on priority ordering, which triggers a second event to be ordered higher than the highest-level event in a current thread before or simultaneously or after executing the current thread, inserts the second event to be ordered into the current thread, and stores and updates the second event to be ordered. The invention can insert the event with the highest priority into the appointed thread, update the event based on the time of the current thread and the starting time of the current thread, and clear other events of the current thread, thereby realizing the insertion of the event with the highest level.
Drawings
Other features, objects and advantages of the present invention will become more apparent upon reading of the detailed description of non-limiting embodiments, given with reference to the accompanying drawings in which:
FIG. 1 is a schematic flow diagram of a control method for implementing linear countdown of a plurality of events based on prioritization in accordance with an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a control method for implementing linear countdown of a plurality of events based on prioritization according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram showing a specific flow of a second to-be-sequenced event triggering a higher-than-highest level event in a current thread before, simultaneously with, or after execution of the current thread according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram showing a specific process of inserting the second event to be sequenced into the current thread and storing and updating the second event according to the third embodiment of the present invention; and
FIG. 5 is a schematic block diagram of a control device for implementing linear countdown of a plurality of events based on prioritization, in accordance with an embodiment of the present invention.
Detailed Description
In order to better and clearly show the technical scheme of the invention, the invention is further described below with reference to the accompanying drawings.
It is understood by those skilled in the art that, aiming at the deficiencies of the prior art, the invention discloses a control method for realizing the linear countdown of a plurality of events based on priority ordering, wherein the event with the highest priority can be inserted into a designated thread, and the update is performed based on the time of the current thread and the starting time of the current thread, and other events of the current thread are cleared, so that the insertion of the event with the highest level is realized.
Fig. 1 shows a specific flow chart of a control method for implementing linear countdown of a plurality of events based on priority ordering, namely, priority, namely, a dividing rule of priority processing based on the degree of urgency of each event when the plurality of events exist in one thread, in the invention, preferably, after distinguishing the priority of each event, the countdown processing of the events is sequentially performed based on the priority order, and when the countdown of each event is completed, the countdown of the next event is started, further, the invention aims to disclose a control method capable of inserting events needing to be processed preferentially at any stage in the process of proceeding the processes, in particular, a control method for implementing linear countdown of the plurality of events based on priority ordering is provided, which comprises the following steps:
First, step S101 is performed, where a second event to be sequenced that is higher than the highest level event in the current thread is triggered before, during, or simultaneously with or after executing the current thread, in such an embodiment, it is first required to determine whether the event level of the second event to be sequenced is higher than the highest level event of all the current thread events, that is, only when the event level of the second event to be sequenced is compared with the highest level event in the current thread, and then the second event to be sequenced is still triggered when priority processing is required.
Further, the second to-be-sequenced event may be triggered before the current thread is executed, that is, in a preferred embodiment, when the current thread is ready to start executing, if the second to-be-sequenced event exists, the second to-be-sequenced event may be triggered while the current thread is being executed, that is, in a preferred embodiment, when the second to-be-sequenced event exists during the current thread is being executed, the current thread being executed is settled, and the second to-be-sequenced event is triggered, that is, in a very specific embodiment, when the current thread is being executed, the next round of thread is started, the second to-be-sequenced event is triggered, which does not affect the technical solution of the present invention, but in the present invention, the second to-be-sequenced event is preferably triggered during the current thread is being executed, which is not described in detail herein.
Then, proceeding to step S102, inserting the second event to be ordered into the current thread and storing and updating, as understood by those skilled in the art, when inserting the second event to be ordered into the current thread, it is necessary to settle the event existing in the current thread, where the settling includes at least deducting the time spent in the current insertion, deleting the time of the next event if the time spent in the deduction is completed, and preferably referring to the original thread in which the second event to be ordered is not inserted into the thread, further storing and updating refer to storing the time of the event, the time information after the insertion of the second event to be ordered, and updating the time after the insertion in the current state, which will be described in more detail in the following embodiments.
Fig. 2 is a schematic flow chart of a control method for implementing the countdown of multiple events based on priority ranking according to the first embodiment of the present invention, in such an embodiment, mainly used for explaining how to make priority judgment on the second events to be ranked, how to make priority judgment on all events in the current thread, how to effectively record the starting time, duration, etc. of the countdown of all events, so that fig. 2 is a specific perfection of the implementation of the steps in fig. 1, and is a preparation step before executing the steps in fig. 1, specifically, before step S101, the method further includes the following steps:
First, step S201 is entered, all the events to be counted down are assigned according to the rule of the ranking ID, in such an embodiment, after fig. 2 is performed, fig. 1 is performed, i.e. after step S203 is performed, it is understood by those skilled in the art that step S101 is performed, further, all the events to be counted down do not include the second event to be ranked, which preferably means that all the events to be counted down need to be counted down when the second event to be ranked has not yet been inserted.
Preferably, the rule of the sorting ID at least includes a character, a numerical value of a definition type, and a record-in self-increment ID, where the character is a letter, the numerical value of the definition type is a natural number of two digits, and the record-in self-increment ID is a natural number of three digits. In such an embodiment the character is preferably an english letter of a-Z, e.g. M, S, while in other embodiments it may be a special character, e.g. @, -! The numerical value of the defined type is preferably a natural number of two digits, such as 01, 58, 33, etc., and this numerical value preferably refers to the importance, priority of the event, e.g. the higher the numerical value, the higher the priority of the event is represented, e.g. if 01, 02, 03 is present, 03 represents the highest priority event numerical value, and the record binning self-increment ID represents the number of the event in binning order, e.g. event 1 is 101, event 2 is 102, event 3 is 103.
Further, in combination with the above analysis, we can assign a value to a plurality of events according to the above rule of ordering ID, where the value is unique and includes a priority rule based on the above rule, for example, event 1 is S01101, event 2 is S02103, event 3 is S02105, event 4 is S03104, and we can learn that the priority of event 4 is highest, and the sequence of events is event 3, time 2, and event 1.
Then, step S202 is entered, after a plurality of events are serialized based on the assignment result, a current thread is inserted and stored, in combination with the embodiment in step S201, after event 1, event 2, event 3 and event 4 are sequenced according to the order of priority, a current thread is inserted, event information of a user is stored in an array, and redis is used for storage after the array is serialized, the validity period of redis is set as the sum of all event remaining time in seconds, specifically, in a preferred embodiment, the countdown time of event 1 is 1 hour, the countdown time of event 2 is 6 hours, the countdown time of event 3 is 8 hours, and the countdown time of event 4 is 6 hours, and then the above event information is preferably stored.
Finally, proceeding to step S203, recording the countdown time of each event, the sum of the countdown times of the first thread, and the first record update time, in combination with the embodiments in step S201 and step S202, the countdown time of the event 1 is 1 hour, the countdown time of the event 2 is 6 hours, the countdown time of the event 3 is 8 hours, and the countdown time of the event 4 is 6 hours, where it is understood that the count down time of the event 1, the count down time of the event 2, the count down time of the event 3, and the count down time of the event 4 are the first thread, the sum of the count down times of the first thread is 21 hours, and the first record update time is the time for recording these information, for example, the time for recording all the events and starting to execute the first thread is 8:00.
Fig. 3 shows a specific flow chart of a second embodiment of the present invention, in which the second event to be sequenced is triggered before, during or after the execution of the current thread, and the second event to be sequenced is triggered higher than the highest level event in the current thread, and in such an embodiment, steps that need to be executed before the second event to be sequenced is inserted into the current thread are mainly disclosed, specifically, before the step S101, the steps further include:
First, proceeding to step S1011, assigning the first event to be ordered according to the rule of ordering ID, those skilled in the art understand that step S1011 and step S1012 are also performed before step S101, and step S201 to step S203 are also performed before step S101, further, we understand that step S1011 and step S1012 should be performed after step S201 to step S203 are performed, i.e. after all the priority ordering, recording and storing for the current threads are completed, step S1011 is performed.
Further, there may be a plurality of first events to be ordered, and when the event having to be higher in priority than the highest priority in the current thread can be completed in the current thread insertion, fig. 3 mainly determines the first event to be ordered. Specifically, in a preferred embodiment, after the first to-be-sequenced event performs the rule of sequencing ID according to the step in fig. 2, the first to-be-sequenced event is assigned as S04105.
Finally, proceeding to step S1012, determining a first event to be ordered higher than the highest level event in the current thread as a second event to be ordered based on the rule of the ordering ID, in such an embodiment, in conjunction with step S1011, if the first event to be ordered is S04105, it is obvious that the priority of S04105 will be higher than S03104 of event 4, determining the first event to be ordered as a second event to be ordered, whereas in other embodiments, if the first event to be ordered is S02108, S01105, S03101, it cannot pass the audit, and once the first event to be ordered is determined as a second event to be ordered, it is explained that step S101 needs to be executed.
Fig. 4 is a schematic flow chart showing a specific process of inserting the second event to be sequenced into the current thread and storing and updating the second event, which is a detailed description of step S102, and specifically includes the following steps as understood by those skilled in the art:
First, step S1021 is performed, where the current time is determined as the second record update time, the time difference between the first record update time and the second record update time is deducted from the countdown time of the highest-level event in the current thread in the order from high to low until the deduction is completed, in this embodiment, based on the specific embodiment and the specific embodiment in fig. 1 to 3, that is, there is an event 1 of S01101, an event 2 of S02103, an event 3 of S02105, an event 4 of S03104, the countdown time of the event 1 is 1 hour, the countdown time of the event 2 is 6 hours, the countdown time of the event 3 is 8 hours, the countdown time of the event 4 is 6 hours, and the time when recording all the events and starting to execute the first thread is 8:00, at the same time, the second event to be sequenced is S04105, the current time is determined as the second record update time, and further, the user 15: and triggering an event with higher level, namely a second event to be ordered, wherein the second event to be ordered needs to be inserted into an array and ordered, and the content and the validity period of redis are obtained first, and the consumed 7 hours are obtained according to update_time.
Further, in the execution process of the first thread, 7 hours have been consumed, and the first thread starts counting down from the event 4, so that it can be obtained that the event 4 is consumed, and then the consumption of 1 hour of the event 3 is continued, namely, the time difference between the first record updating time and the second record updating time starts counting down from the time of the highest-level event in the current thread according to the sequence from high to low until the counting down is completed, and the time difference between the first record updating time and the second record updating time is 7 hours.
Then, step S1022 is performed, when the countdown time of the highest-level event remains, step S1023 is performed, and when the countdown time of the highest-level event is zero, step S1024 is performed, where step S1022 is a determination step, that is, the time difference between the first record update time and the second record update time starts to be deducted from the highest-level time until the deduction is completed, and since there are a plurality of events, and there are also different time differences between the first record update time and the second record update time, step S1022 may be divided into two cases.
When the countdown time of the highest-level event remains, step S1023 is performed, the remaining countdown time of the highest-level event is recorded, the second event to be ordered is inserted as the highest-level event into the current thread and is determined as the second thread, and step S1025 is performed, in a preferred embodiment, if the countdown time of the highest-level event is 10 hours and the time difference between the first recorded update time and the second recorded update time is 3 hours, the remaining countdown time of the highest-level event is 7 hours, and the second event to be ordered is inserted as the highest-level event into the current thread and is determined as the second thread.
When the countdown time of the highest-level event is zero, step S1024 is performed, one or more events whose countdown times are zero are deleted, the remaining countdown time of the event after the deduction is completed is recorded, the second event to be ordered is inserted as the highest-level event into the current thread and is determined as the second thread, and step S1025 is performed, in such an embodiment, in combination with the embodiment in step S1021, and when the time difference between the first record updating time and the second record updating time is 7 hours and the countdown time of the event 4 is 6 hours, the event 4 can be obtained to be consumed, then the 1 hour of the event 3 is continuously consumed, the countdown time of the event 3 is 8 hours, at the moment, the event 3 still remains the countdown time for 7 hours, and the second event to be sequenced is used as the highest-level event to be inserted into the current thread and is determined to be the second thread.
Finally, step S1025 is entered to record the count-down time of each event, the sum of the count-down times of the second thread and the second record update time, and step S1024 is combined, if the count-down time of the second event to be sequenced is 24 hours, the count-down time of each event is recorded: the countdown time of the second event to be sequenced is 24 hours, the countdown time of the event 3 is 7 hours, the countdown time of the event 2 is 6 hours, the countdown time of the event 1 is 1 hour, the sum of the countdown time of the second thread is 38 hours, and meanwhile, the second record update time is 15:00.
Fig. 5 is a schematic block diagram of a control device for implementing a linear countdown of a plurality of events based on prioritization according to an embodiment of the present invention, and in combination with fig. 1 to 4, fig. 5 adopts the control method described in fig. 1 to 4, and provides a control device for implementing a linear countdown of a plurality of events based on prioritization, which includes a first processing device 1: triggering a second to-be-sequenced event that is higher than the highest level event in the current thread before or simultaneously with or after executing the current thread, the working principle of the first processing device 1 may refer to the aforementioned step S101, and will not be described herein.
Further, the control device further comprises a second processing device 2: the second event to be sequenced is inserted into the current thread and stored and updated, and the working principle of the second processing device 2 can refer to the aforementioned step S102, which is not described herein again.
Further, the control device further comprises a third processing device 3: all the events counted down are assigned according to the rule of the ordering ID, and the working principle of the third processing device 3 can refer to the aforementioned step S201, which is not described herein.
Further, the control device further comprises a fourth processing device 4: the plurality of events are serialized based on the assignment result and then inserted into the current thread for storage, and the working principle of the fourth processing apparatus 4 can refer to the aforementioned step S202, which is not described herein again.
Further, the control device further comprises a first recording device 5: the countdown time of each event, the sum of the countdown times of the first thread and the first record update time are recorded, and the working principle of the first recording device 5 can refer to the aforementioned step S203, which is not repeated herein.
Further, the first processing device 1 further includes a fifth processing device 11: the first event to be ordered is assigned according to the rule of the ordering ID, and the working principle of the fifth processing device 11 may refer to the aforementioned step S1011, which is not described herein.
Further, the first processing device 1 further comprises a sixth processing device 12: the first to-be-sequenced event higher than the highest level event in the current thread is determined as the second to-be-sequenced event based on the rule of the sequencing ID, and the working principle of the sixth processing apparatus 12 may refer to the aforementioned step S1012, which is not repeated herein.
Further, the second processing means 2 includes seventh processing means 21: determining the current time as a second record update time, and starting deduction from the countdown time of the highest-level event in the current thread according to the sequence from high to low by using the time difference between the first record update time and the second record update time until the deduction is completed, wherein the working principle of the seventh processing device 21 can refer to the aforementioned step S1021, and is not repeated herein.
Further, the second processing means 2 includes eighth processing means 22: when the countdown time of the highest-level event remains, step S1025 is executed, and when the countdown time of the highest-level event is zero, step S1025 is executed, and the working principle of the eighth processing device 22 may refer to the foregoing step S1022, which is not described herein.
Further, the second processing means 2 includes ninth processing means 23: the remaining countdown time of the highest-level event is recorded, the second event to be ordered is inserted into the current thread as the highest-level event and is determined as the second thread, and step S1025 is executed, and the working principle of the ninth processing device 23 may refer to the foregoing step S1023, which is not described herein.
Further, the second processing means 2 includes tenth processing means 24: deleting one or more events with zero countdown time, recording the remaining countdown time of the event after the deduction is completed, inserting the second event to be sequenced as the highest-level event into the current thread and determining the second event as the second thread, and executing step S1025, wherein the working principle of the tenth processing device 24 can refer to the aforementioned step S1024, and will not be repeated here.
Further, the second processing means 2 comprises second recording means 25: the countdown time of each event, the sum of the countdown times of the second thread and the second record update time are recorded, and the working principle of the second recording device 25 can refer to the aforementioned step S1025, which is not repeated herein.
The foregoing describes specific embodiments of the present invention. It is to be understood that the invention is not limited to the particular embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the claims without affecting the spirit of the invention.

Claims (6)

1. A control method for realizing linear countdown of a plurality of events based on priority ordering is characterized by comprising the following steps:
i: assigning all the events counted down according to the rule of the ordering ID;
ii: serializing a plurality of events based on the assignment result, inserting the events into a current thread and storing the events;
iii: recording the count-down time of each event, the sum of the count-down times of the first thread and the first record update time;
a. triggering a second event to be ordered higher than the highest level event in the current thread before, simultaneously with or after executing the current thread;
b. inserting the second event to be sequenced into the current thread and storing and updating the second event to be sequenced;
wherein, the step b comprises the following steps:
b1: determining the current time as second record updating time, and starting deduction from the countdown time of the highest-level event in the current thread according to the time difference of the first record updating time and the second record updating time from high to low until the deduction is completed;
b2: when the countdown time of the highest-level event remains, executing the step b3, and when the countdown time of the highest-level event is clear, executing the step b4;
b3: recording the remaining countdown time of the highest-level event, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as a second thread, and executing the step b5;
b4: deleting one or more events with zero countdown time, recording the remaining countdown time of the event after the deduction is completed, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as the second thread, and executing the step b5;
b5: the count down time of each event, the sum of the count down times of the second thread, and the second record update time are recorded.
2. The control method according to claim 1, wherein the rule of the sorting ID includes at least a character, a numerical value of a definition type, and a record-entry self-increment ID, wherein the character is a letter, the numerical value of the definition type is a natural number of two digits, and the record-entry self-increment ID is a natural number of three digits.
3. The control method according to claim 1 or 2, characterized by further comprising, before the step a, the steps of:
a1: assigning the first event to be ordered according to the rule of the ordering ID;
a2: the first to-be-sequenced event that is higher than the highest level event in the current thread is determined as the second to-be-sequenced event based on the rules of the sequencing ID.
4. The control method according to claim 1 or 2, characterized in that in step b the second events to be ordered are stored in the REDIS STRING.
5. A control apparatus for implementing linear countdown of a plurality of events based on prioritization, employing the control method of any one of claims 1-4, comprising:
third processing means (3): assigning all the events counted down according to the rule of the ordering ID;
Fourth processing device (4): serializing a plurality of events based on the assignment result, inserting the events into a current thread and storing the events;
First recording device (5): recording the count-down time of each event, the sum of the count-down times of the first thread and the first record update time;
First processing device (1): triggering a second event to be ordered higher than the highest level event in the current thread before, simultaneously with or after executing the current thread;
second processing means (2): inserting the second event to be sequenced into the current thread and storing and updating the second event to be sequenced;
wherein the second processing device (2) comprises:
Seventh processing means (21): determining the current time as second record updating time, and starting deduction from the countdown time of the highest-level event in the current thread according to the time difference of the first record updating time and the second record updating time from high to low until the deduction is completed;
eighth processing means (22): when the countdown time of the highest-level event remains, executing the step b4, and when the countdown time of the highest-level event is clear, executing the step b5;
Ninth processing means (23): recording the remaining countdown time of the highest-level event, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as a second thread, and executing the step b5;
Tenth processing means (24): deleting one or more events with zero countdown time, recording the remaining countdown time of the event after the deduction is completed, inserting the second event to be sequenced into the current thread as the highest-level event and determining the second event as the second thread, and executing the step b5;
second recording means (25): the count down time of each event, the sum of the count down times of the second thread, and the second record update time are recorded.
6. The control device according to claim 5, characterized in that the first processing device (1) further comprises:
Fifth processing means (11): assigning the first event to be ordered according to the rule of the ordering ID;
Sixth processing means (12): the first to-be-sequenced event that is higher than the highest level event in the current thread is determined as the second to-be-sequenced event based on the rules of the sequencing ID.
CN202011186222.9A 2020-10-30 2020-10-30 Control method and device for realizing linear countdown of multiple events based on priority ordering Active CN112306657B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011186222.9A CN112306657B (en) 2020-10-30 2020-10-30 Control method and device for realizing linear countdown of multiple events based on priority ordering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011186222.9A CN112306657B (en) 2020-10-30 2020-10-30 Control method and device for realizing linear countdown of multiple events based on priority ordering

Publications (2)

Publication Number Publication Date
CN112306657A CN112306657A (en) 2021-02-02
CN112306657B true CN112306657B (en) 2024-08-09

Family

ID=74332276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011186222.9A Active CN112306657B (en) 2020-10-30 2020-10-30 Control method and device for realizing linear countdown of multiple events based on priority ordering

Country Status (1)

Country Link
CN (1) CN112306657B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552567A (en) * 2020-04-27 2020-08-18 北京奇艺世纪科技有限公司 Thread management method and device, electronic equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6697935B1 (en) * 1997-10-23 2004-02-24 International Business Machines Corporation Method and apparatus for selecting thread switch events in a multithreaded processor
JP2000194573A (en) * 1998-12-24 2000-07-14 Toshiba Corp System and method for thread control
JP6056986B2 (en) * 2013-11-13 2017-01-11 富士通株式会社 Event management program, event management method, and distributed system
CN105573840B (en) * 2015-12-08 2019-06-14 东软集团股份有限公司 The event-handling method and device of work flow operation phase
US10489220B2 (en) * 2017-01-26 2019-11-26 Microsoft Technology Licensing, Llc Priority based scheduling
CN107688926B (en) * 2017-08-24 2021-06-08 成都掌控者网络科技有限公司 Definable time task propelling method based on automatic circulation
CN109614222B (en) * 2018-10-30 2022-04-08 成都飞机工业(集团)有限责任公司 Multithreading resource allocation method
CN111651864B (en) * 2020-05-12 2023-03-17 北京华如科技股份有限公司 Event centralized emission type multi-heterogeneous time queue optimization simulation execution method and system
CN111813552B (en) * 2020-07-16 2021-12-03 济南浪潮数据技术有限公司 Scheduling execution method, device and medium based on multi-thread task

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552567A (en) * 2020-04-27 2020-08-18 北京奇艺世纪科技有限公司 Thread management method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112306657A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
US10740308B2 (en) Key_Value data storage system
US5487164A (en) Distribution-based replacement selection sorting system
EP2069979B1 (en) Dynamic fragment mapping
US9619500B2 (en) Hardware implementation of a tournament tree sort algorithm
US9418093B2 (en) System and method for scheduling and arbitrating events in computing and networking
CN102893265A (en) Managing storage of individually accessible data units
CN112650449B (en) Method and system for releasing cache space, electronic device and storage medium
CN113177050A (en) Data balancing method, device, query system and storage medium
CN112306657B (en) Control method and device for realizing linear countdown of multiple events based on priority ordering
CN108646987B (en) File volume management method and device, storage medium and terminal
CN116561171B (en) Method, device, equipment and medium for processing dual-time-sequence distribution of inclination data
CN113342897A (en) Data synchronization method and device
CN117808552A (en) Order scheduling method, order scheduling device, computer equipment and storage medium
CN107688634A (en) Method for writing data and device, electronic equipment
CN109240987B (en) Method and system for prefetching data based on time for mobile internet
CN115292023B (en) Timing task processing method and device
US6874072B2 (en) Method, apparatus and article of manufacture for managing a reusable linear access storage medium
US5806064A (en) Method for multi-field ordering of data base records with sequence variables
CN114020434A (en) Task processing method and device, electronic equipment and storage medium
CN111581448B (en) Method and device for warehousing card bin information
EP1965315A1 (en) Automatic update of document clustering system and method
CN117093345B (en) Task linked list execution method and device, terminal equipment and storage medium
CN115391052B (en) Robot task processing method and device, electronic equipment and storage medium
CN113486021B (en) Method and device for determining daily average balance of account in distributed banking system
US11989590B2 (en) Method and system for resource allocation

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