CN110990141A - Timed task processing method and device, computing equipment and storage medium - Google Patents

Timed task processing method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN110990141A
CN110990141A CN201911274511.1A CN201911274511A CN110990141A CN 110990141 A CN110990141 A CN 110990141A CN 201911274511 A CN201911274511 A CN 201911274511A CN 110990141 A CN110990141 A CN 110990141A
Authority
CN
China
Prior art keywords
task
linked list
information
pointer
timing
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
CN201911274511.1A
Other languages
Chinese (zh)
Other versions
CN110990141B (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.)
Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Original Assignee
Shenzhen Qianhai Huanrong Lianyi Information Technology Service 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 Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd filed Critical Shenzhen Qianhai Huanrong Lianyi Information Technology Service Co Ltd
Priority to CN201911274511.1A priority Critical patent/CN110990141B/en
Publication of CN110990141A publication Critical patent/CN110990141A/en
Application granted granted Critical
Publication of CN110990141B publication Critical patent/CN110990141B/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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

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)

Abstract

The invention relates to a timing task processing method, a timing task processing device, a computing device and a storage medium, wherein the method comprises the steps of constructing an annular array for storing a timing task set to obtain a linked list; acquiring related information in a position pointed by a pointer of a linked list to obtain task information; judging whether the turn number value in the task information is zero or not; if the circus value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from a timing task set; and if the number of turns in the task information is not zero, subtracting one from the number of turns in the task information, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information. The invention realizes the processing of timing tasks with improved efficiency.

Description

Timed task processing method and device, computing equipment and storage medium
Technical Field
The present invention relates to computers, and more particularly, to a method and apparatus for processing a timed task, a computing device, and a storage medium.
Background
In the current service system, there is an inevitable need to implement the requirements of timed tasks, such as timed sending of mails and timed closing of orders, and when the number of scheduled jobs is increasing, many systems will use a special scheduling platform to process these timed jobs uniformly, but there is an inevitable need to poll the service table to determine which tasks need to be executed, thereby completing scheduling of system jobs.
The current system job scheduling is basically handed to a unified job scheduling platform, the working logic of the job platform regularly scans all data through expressions such as cron and the like, but the polling efficiency is low, each time the database is scanned, the database is basically scanned, the data executed each time can still be repeatedly scanned, although the result set clock does not appear, repeated calculation can still be carried out, if the execution time of one piece of data is too long, the following data operation can be influenced, and therefore, the time error between the data operation and the timing task processing is also obvious, so that the efficiency of processing the timing task is low.
Therefore, it is necessary to design a new method to achieve an efficient processing of timing tasks.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a timed task processing method, a timed task processing device, a timed task processing computing device and a storage medium.
In order to achieve the purpose, the invention adopts the following technical scheme: the timing task processing method comprises the following steps:
constructing a ring array for storing a timing task set to obtain a linked list;
acquiring related information in a position pointed by a pointer of a linked list to obtain task information;
judging whether the turn number value in the task information is zero or not;
if the circus value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from a timing task set;
and if the number of turns in the task information is not zero, subtracting one from the number of turns in the task information, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
The further technical scheme is as follows: after the constructing the ring array for storing the timing task set to obtain the linked list, the method further comprises:
a linked list is initialized.
The further technical scheme is as follows: the initializing linked list includes:
initializing the capacity of the linked list into sixty spaces;
defining a pointer for representing the execution sequence of the timed tasks and pointing the pointer to the position of zero.
The further technical scheme is as follows: the task information comprises the number of turns of the pointer circular linked list and the execution time of the timing task.
The further technical scheme is as follows: after sending the timing task corresponding to the task information to an execution thread to execute the timing task and deleting the executed timing task from the timing task set, the method further includes:
and calculating the storage position of the executed timing task by a calculation thread to obtain a storage position, storing the timing task to the storage position, and executing the related information in the position pointed by the pointer of the acquisition linked list to obtain task information.
The further technical scheme is as follows: the calculating the storage position of the executed timing task by the calculating thread comprises the following steps:
acquiring execution interval time of a timing task, and taking a remainder of the execution interval time and the array size as a preliminary numerical value;
and obtaining the storage position of the timing task according to the sum of the preliminary numerical value and the position of the current pointer.
The invention also provides a timed task processing device, which comprises:
the linked list forming unit is used for constructing an annular array for storing the timing task set to obtain a linked list;
the information acquisition unit is used for acquiring related information in the position pointed by the pointer of the linked list to obtain task information;
the judging unit is used for judging whether the turn number value in the task information is zero or not;
the execution unit is used for sending the timing task corresponding to the task information to an execution thread to execute the timing task and deleting the executed timing task from the timing task set if the circled value in the task information is zero;
and the circle value processing unit is used for subtracting one from the circle value in the task information if the circle value in the task information is not zero, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
The further technical scheme is as follows: further comprising:
and the initialization unit is used for initializing the linked list.
The invention also provides computer equipment which comprises a memory and a processor, wherein the memory is stored with a computer program, and the processor realizes the method when executing the computer program.
The invention also provides a storage medium storing a computer program which, when executed by a processor, is operable to carry out the method as described above.
Compared with the prior art, the invention has the beneficial effects that: the invention constructs a ring array for storing the timing task, and constructs the delay queue according to the position of the pointer and the information about the execution time carried by the timing task, when the circle value in the timing task is zero, the timing task is indicated to be executed, the timing task is deleted from the timing task set, if the circle value in the timing task is not zero, the execution time of the timing task is not reached, the executed timing task is deleted from the timing task set, the repeated calculation is not carried out, and the timing task is processed with improved efficiency.
The invention is further described below with reference to the accompanying drawings and specific embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a timing task processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for processing a timing task according to an embodiment of the present invention;
fig. 3 is a schematic sub-flow diagram of a method for processing a timing task according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a linked list provided by an embodiment of the present invention;
fig. 5 is a flowchart illustrating a method for processing a timed task according to another embodiment of the present invention;
fig. 6 is a schematic sub-flow chart of a method for processing a timed task according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a timed task processing apparatus provided in an embodiment of the present invention;
FIG. 8 is a schematic block diagram of an initialization unit of a timed task processing apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of a timed task processing apparatus according to another embodiment of the present invention;
FIG. 10 is a schematic block diagram of a computing unit of a timed task processing apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic block diagram of a computer device provided by 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 some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a timed task processing method according to an embodiment of the present invention. Fig. 2 is a schematic flowchart of a timing task processing method according to an embodiment of the present invention. The timing task processing method is applied to a server. The server performs data interaction with a plurality of actuators, performs control on timing task processing by using a linked list, namely an annular array, and distributes timing tasks to be executed to the actuators for execution.
Fig. 2 is a flowchart illustrating a timing task processing method according to an embodiment of the present invention. As shown in fig. 2, the method includes the following steps S110 to S160.
S110, constructing a ring array for storing the timing task set to obtain a linked list.
An array is an ordered sequence of elements, and if a set of a finite number of variables of the same type is named, this name is the array name. The individual variables that make up an array are referred to as the components of the array, also referred to as array elements, and sometimes as subscript variables. The numerical numbering used to distinguish the various elements of the array is referred to as the subscript. An array is a form in which elements having the same type are organized in an unordered fashion for processing convenience in programming. The sets of the like data elements which are arranged in a disordered way are called arrays, the arrays are sets for storing a plurality of data of the same type, the arrays have no concept of rings on the structure, so that the ring arrays can be replaced by ring linked lists, the next of the last node of the traditional linked list is generally null, but if the next points to the address of the first node, a ring linked list can be formed, so that the traversal can form a circular traversal, and the linked list can be formed. As shown in fig. 4, the linked list is used to store the timing tasks that need to be scheduled for execution.
And S120, initializing a linked list.
In an embodiment, referring to fig. 3, the step S120 may include steps S121 to S122.
And S121, initializing the capacity of the linked list into sixty spaces.
To cater for the time of 60 seconds in one minute, the array is initialized to 60 spaces by default, each second pointer points to the next position, i.e. each second pointer jumps by one position, i.e. the whole linked list has 60 array elements, each array element stores a set of timing tasks, and each set of timing tasks has several timing tasks.
And S122, defining a pointer for representing the execution sequence of the timing tasks, and pointing the pointer to a zero position.
A pointer is defined to point to zero first, and the pointer will move backward one position every one second.
S130, acquiring related information in the position pointed by the pointer of the linked list to obtain task information.
In this embodiment, the task information includes the number of turns of the pointer circular linked list and the execution time of the timing task.
The Set < Task > timing Task Set is stored in each position, and for each timing Task, two important parameters are stored in the Set < Task >: the number of turns of the pointer circular linked list cycleNum and the execution time of the timing task are represented, the cycleNum represents the number of turns of the pointer circular linked list, the time represents the time after which the timing task is executed, the unit is set to be second, the task set in the position pointed by the pointer needs to be taken out every time, each timing task cycleNum is reduced by 1, and when the cycleNum of the timing task reaches 0, the timing task is executed at the moment.
And S140, judging whether the turn number value in the task information is zero or not.
The number of turns in the task information indicates the number of times of the pointer circular linked list, and the number of turns and the execution time of the timing task can know the time at which the timing task is executed.
And S150, if the circle value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from the timing task set.
After the timing task is executed, the location where the timing task is stored is recalculated, and since the location pointed by the pointer is no longer the most initial location after the timing task is executed, the location where the timing task is stored needs to be recalculated.
And S160, if the circle number value in the task information is not zero, subtracting one from the circle number value in the task information, moving the pointer of the linked list backwards by one position, and returning to the step S130.
When the number of turns of the task information is not zero, the time for executing the timing task is not reached, and the number of turns in the task information is reduced by one every time a pointer passes.
For example: assuming that a mail is sent regularly, once every five minutes, the conversion is 300 seconds, the cycleNum in the initialized timed task is 5, the time is 300, since the pointer points to the array position of 0 at the moment, 300/60 is 5, exactly 5 cycles, because the timed task is placed in the timed task set with the array position of 0, when the pointer rotates to the position of zero every turn, a new thread is started, the pointer thread is not influenced to continue to operate downwards, the timed task in the pointed position of the pointer is taken out, whether the cycleNum in the timed task is 0 is judged, if not, the cycleNum of the timed task continues to be reduced by 1, if the cycleNum in the timed task is 0, the timed task is handed to the execution thread to execute, and the task is removed from the timed task set.
The timed task processing method comprises the steps of constructing an annular array used for storing timed tasks, constructing a delay queue according to the positions of pointers and information about execution time carried by the timed tasks, indicating that the timed tasks are executed when the circle value in the timed tasks is zero, deleting the timed tasks from the timed task set, indicating that the execution time of the timed tasks is not reached if the circle value in the timed tasks is not zero, deleting the executed timed tasks from the timed task set without repeated calculation, and realizing the purpose of processing the timed tasks with improved efficiency.
Fig. 5 is a flowchart illustrating a method for processing a timed task according to another embodiment of the present invention. As shown in fig. 5, the timed task processing method of the present embodiment includes steps S210 to S270. Steps S210 to S250 are similar to steps S110 to S150 in the above embodiments, and step S270 is similar to step S160 in the above embodiments, and are not repeated here. The added step S260 in the present embodiment is explained in detail below.
And S260, calculating a storage position of the executed timing task by the calculation thread to obtain a storage position, storing the timing task to the storage position, and executing the step S230.
In an embodiment, referring to fig. 6, the step S260 includes steps S261 to S262.
S261, obtaining execution interval time of the timing task, and taking a remainder of the execution interval time and the array size as a preliminary numerical value;
and S262, obtaining a storage position according to the sum of the preliminary numerical value and the position of the current pointer, and storing the timing task to the storage position.
After the executed timing task is removed from the linked list, the computing thread performs storage position computation on the timing task again, corresponding storage position computation is performed according to the array size and the time of the timing task, the timing task is supposed to be executed once every 30 seconds, when the position pointed by the pointer is 29, the timing task is taken out and executed, 30/300<1, then the timing task cycleNum is 0, and because 29+30 is 59, the executing thread puts the timing task at the position 59 again, the formula is simply: if the cyclic enum is not an integer, rounding down, and if the position is the remainder of the execution interval time/the size of the array + the position pointed by the current pointer, the cyclic enum is not unexpected or is in the original position, at the moment, resetting the cyclic enum to be 5, and after five minutes, continuing to execute the timing task. The embodiment has high efficiency and high time precision, and consumes less CPU resources compared with the whole data scanning.
Fig. 7 is a schematic block diagram of a timed task processing apparatus 300 according to an embodiment of the present invention. As shown in fig. 7, the present invention also provides a timed task processing device 300 corresponding to the above timed task processing method. The timed task processing apparatus 300 includes a unit for executing the above timed task processing method, and the apparatus may be configured in a server. Specifically, referring to fig. 7, the timed task processing device 300 includes a linked list forming unit 301, an information obtaining unit 303, a determining unit 304, an executing unit 305, and a lap value processing unit 306.
A linked list forming unit 301, configured to construct a ring array for storing a timing task set to obtain a linked list; an information obtaining unit 303, configured to obtain relevant information in a position pointed by a pointer of a linked list to obtain task information; a judging unit 304, configured to judge whether a turn number value in the task information is zero; an execution unit 305, configured to send the timing task corresponding to the task information to an execution thread to execute the timing task if the circled value in the task information is zero, and delete the executed timing task from the timing task set; and the circle value processing unit 306 is configured to subtract one from the circle value in the task information if the circle value in the task information is not zero, move the pointer of the linked list backward by one position, and return to the information related to the position pointed by the pointer of the acquired linked list, so as to obtain the task information.
In one embodiment, as shown in fig. 7, the apparatus further includes an initialization unit 302; the initialization unit 302 is used to initialize the linked list.
In one embodiment, as shown in fig. 8, the initialization unit 302 includes a capacity initialization subunit 3021 and a pointer definition subunit 3022.
A capacity initialization subunit 3021, configured to initialize the capacity of the linked list to sixty spaces;
a pointer definition subunit 3022 is used to define a pointer for indicating the execution order of the timed tasks and point the pointer to a position of zero.
Fig. 9 is a schematic block diagram of a timed task processing apparatus 300 according to another embodiment of the present invention. As shown in fig. 9, the timed task processing apparatus 300 of the present embodiment is the above-described embodiment, and a calculating unit 307 is added.
The calculating unit 307 is configured to perform storage location calculation on the executed timing task by using a calculation thread to obtain a storage location, store the timing task to the storage location, and execute related information in a location pointed by the pointer of the acquisition linked list to obtain task information.
In an embodiment, referring to fig. 10, the calculating unit 307 further includes a value forming subunit 3071 and a position calculating subunit 3072.
A numerical value forming subunit 3071, configured to obtain an execution interval time of the timing task, and take a remainder of the execution interval time and the array size as a preliminary numerical value; and the position calculating subunit 3072 is used for obtaining the storage position of the timing task according to the sum of the preliminary numerical value and the position where the current pointer is located.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation processes of the above timed task processing apparatus 300 and each unit may refer to the corresponding descriptions in the foregoing method embodiments, and for convenience and brevity of description, no further description is provided herein.
The timed task processing apparatus 300 may be implemented in the form of a computer program that can run on a computer device as shown in fig. 11.
Referring to fig. 11, fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a server.
Referring to fig. 11, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer programs 5032 include program instructions that, when executed, cause the processor 502 to perform a timed task processing method.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be caused to execute a timed task processing method.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 11 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps:
constructing a ring array for storing a timing task set to obtain a linked list; acquiring related information in a position pointed by a pointer of a linked list to obtain task information; judging whether the turn number value in the task information is zero or not; if the circus value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from a timing task set; and if the number of turns in the task information is not zero, subtracting one from the number of turns in the task information, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
And the task information comprises the number of turns of the pointer circular linked list and the execution time of the timing task.
In an embodiment, after implementing the step of constructing a ring array for storing a set of timing tasks to obtain a linked list, the processor 502 further implements the steps of:
a linked list is initialized.
In an embodiment, when the processor 502 implements the step of initializing the linked list, the following steps are specifically implemented:
initializing the capacity of the linked list into sixty spaces; defining a pointer for representing the execution sequence of the timed tasks and pointing the pointer to the position of zero.
In an embodiment, after implementing the steps of sending the timing task corresponding to the task information to the execution thread for executing the timing task, and deleting the executed timing task from the timing task set, the processor 502 further implements the following steps:
and calculating the storage position of the executed timing task by a calculation thread to obtain a storage position, storing the timing task to the storage position, and executing the related information in the position pointed by the pointer of the acquisition linked list to obtain task information.
In an embodiment, when the step of calculating the storage location of the executed timing task by the computing thread is implemented, the processor 502 specifically implements the following steps:
acquiring execution interval time of a timing task, and taking a remainder of the execution interval time and the array size as a preliminary numerical value; and obtaining the storage position of the timing task according to the sum of the preliminary numerical value and the position of the current pointer.
It should be understood that, in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program, when executed by a processor, causes the processor to perform the steps of:
constructing a ring array for storing a timing task set to obtain a linked list; acquiring related information in a position pointed by a pointer of a linked list to obtain task information; judging whether the turn number value in the task information is zero or not; if the circus value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from a timing task set; and if the number of turns in the task information is not zero, subtracting one from the number of turns in the task information, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
And the task information comprises the number of turns of the pointer circular linked list and the execution time of the timing task.
In an embodiment, after the step of constructing a ring array for storing a set of timing tasks to obtain a linked list is implemented by the processor executing the computer program, the following steps are further implemented:
a linked list is initialized.
In an embodiment, when the processor executes the computer program to implement the step of initializing the linked list, the following steps are specifically implemented:
initializing the capacity of the linked list into sixty spaces; defining a pointer for representing the execution sequence of the timed tasks and pointing the pointer to the position of zero.
In an embodiment, after the step of sending the timing task corresponding to the task information to the execution thread for execution of the timing task and deleting the executed timing task from the timing task set is implemented by the processor by executing the computer program, the following steps are further implemented:
and calculating the storage position of the executed timing task by a calculation thread to obtain a storage position, storing the timing task to the storage position, and executing the related information in the position pointed by the pointer of the acquisition linked list to obtain task information.
In an embodiment, when the step of calculating the storage location of the executed timing task by the computing thread is implemented by executing the computer program, the following steps are specifically implemented by the processor:
acquiring execution interval time of a timing task, and taking a remainder of the execution interval time and the array size as a preliminary numerical value; and obtaining the storage position of the timing task according to the sum of the preliminary numerical value and the position of the current pointer.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. 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 invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. The timing task processing method is characterized by comprising the following steps:
constructing a ring array for storing a timing task set to obtain a linked list;
acquiring related information in a position pointed by a pointer of a linked list to obtain task information;
judging whether the turn number value in the task information is zero or not;
if the circus value in the task information is zero, sending the timing task corresponding to the task information to an execution thread to execute the timing task, and deleting the executed timing task from a timing task set;
and if the number of turns in the task information is not zero, subtracting one from the number of turns in the task information, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
2. The timed task processing method according to claim 1, wherein after said building a ring array for storing the set of timed tasks to obtain a linked list, further comprising:
a linked list is initialized.
3. The timed task processing method according to claim 2, wherein said initializing a linked list comprises:
initializing the capacity of the linked list into sixty spaces;
defining a pointer for representing the execution sequence of the timed tasks and pointing the pointer to the position of zero.
4. The timed task processing method according to claim 1, wherein said task information includes the number of turns of the pointer circular linked list and the execution time of the timed task.
5. The method according to claim 1, wherein after sending the timed task corresponding to the task information to the execution thread to execute the timed task and deleting the executed timed task from the timed task set, the method further comprises:
and calculating the storage position of the executed timing task by a calculation thread to obtain a storage position, storing the timing task to the storage position, and executing the related information in the position pointed by the pointer of the acquisition linked list to obtain task information.
6. The timed task processing method according to claim 5, wherein said re-performing storage location calculation on the executed timed task by the calculation thread comprises:
acquiring execution interval time of a timing task, and taking a remainder of the execution interval time and the array size as a preliminary numerical value;
and obtaining the storage position of the timing task according to the sum of the preliminary numerical value and the position of the current pointer.
7. A timed task processing apparatus, comprising:
the linked list forming unit is used for constructing an annular array for storing the timing task set to obtain a linked list;
the information acquisition unit is used for acquiring related information in the position pointed by the pointer of the linked list to obtain task information;
the judging unit is used for judging whether the turn number value in the task information is zero or not;
the execution unit is used for sending the timing task corresponding to the task information to an execution thread to execute the timing task and deleting the executed timing task from the timing task set if the circled value in the task information is zero;
and the circle value processing unit is used for subtracting one from the circle value in the task information if the circle value in the task information is not zero, moving the pointer of the linked list backwards by one position, and returning the related information in the position pointed by the pointer of the acquired linked list to obtain the task information.
8. The timed task processing apparatus according to claim 7, further comprising:
and the initialization unit is used for initializing the linked list.
9. A computer device, characterized in that the computer device comprises a memory, on which a computer program is stored, and a processor, which when executing the computer program implements the method according to any of claims 1 to 6.
10. A storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.
CN201911274511.1A 2019-12-12 2019-12-12 Timed task processing method, device, computing equipment and storage medium Active CN110990141B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911274511.1A CN110990141B (en) 2019-12-12 2019-12-12 Timed task processing method, device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911274511.1A CN110990141B (en) 2019-12-12 2019-12-12 Timed task processing method, device, computing equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110990141A true CN110990141A (en) 2020-04-10
CN110990141B CN110990141B (en) 2024-04-26

Family

ID=70092888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911274511.1A Active CN110990141B (en) 2019-12-12 2019-12-12 Timed task processing method, device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110990141B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111221637A (en) * 2019-12-31 2020-06-02 苏州浪潮智能科技有限公司 Timing method, system, equipment and readable storage medium of server
CN111813517A (en) * 2020-06-29 2020-10-23 中国平安人寿保险股份有限公司 Task queue allocation method and device, computer equipment and medium
CN112346857A (en) * 2020-10-22 2021-02-09 杭州安恒信息技术股份有限公司 Data issuing method and device, computer equipment and storage medium
CN112650971A (en) * 2020-12-31 2021-04-13 新奥数能科技有限公司 Method, device and equipment for realizing formula calculation and storage medium
CN114358868A (en) * 2021-11-30 2022-04-15 杭州光云科技股份有限公司 Order sorting processing method and device, computer equipment and storage medium
CN115292023A (en) * 2022-10-08 2022-11-04 北京中科网威信息技术有限公司 Timing task processing method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272564A (en) * 2008-04-17 2008-09-24 中兴通讯股份有限公司 Soft real-time timing device module and method for soft real-time timing device scheduling
CN107220030A (en) * 2017-05-31 2017-09-29 北京北信源软件股份有限公司 Delayed tasks perform method and device
CN109308217A (en) * 2018-07-17 2019-02-05 威富通科技有限公司 A kind of date storage method and device of timeliness task
CN109426554A (en) * 2017-08-22 2019-03-05 中移(杭州)信息技术有限公司 A kind of the timing implementation method and device of server
CN109947568A (en) * 2019-03-15 2019-06-28 深圳市牛鼎丰科技有限公司 Timed task processing method, system, computer equipment and storage medium
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272564A (en) * 2008-04-17 2008-09-24 中兴通讯股份有限公司 Soft real-time timing device module and method for soft real-time timing device scheduling
CN107220030A (en) * 2017-05-31 2017-09-29 北京北信源软件股份有限公司 Delayed tasks perform method and device
CN109426554A (en) * 2017-08-22 2019-03-05 中移(杭州)信息技术有限公司 A kind of the timing implementation method and device of server
CN109308217A (en) * 2018-07-17 2019-02-05 威富通科技有限公司 A kind of date storage method and device of timeliness task
CN109947568A (en) * 2019-03-15 2019-06-28 深圳市牛鼎丰科技有限公司 Timed task processing method, system, computer equipment and storage medium
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
XIAO-XIAO XIE等: "A novel time pointer-based fast radar pulse interleaving algorithm", 《2012 5TH INTERNATIONAL CONGRESS ON IMAGE AND SIGNAL PROCESSING》, 25 February 2013 (2013-02-25), pages 1870 - 1874 *
张旭: "面向网络服务的传输协议设计与任务调度优化", 《中国博士学位论文全文数据库信息科技辑》, no. 05, 15 May 2017 (2017-05-15), pages 136 - 5 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111221637A (en) * 2019-12-31 2020-06-02 苏州浪潮智能科技有限公司 Timing method, system, equipment and readable storage medium of server
CN111221637B (en) * 2019-12-31 2022-05-31 苏州浪潮智能科技有限公司 Timing method, system, equipment and readable storage medium of server
CN111813517A (en) * 2020-06-29 2020-10-23 中国平安人寿保险股份有限公司 Task queue allocation method and device, computer equipment and medium
CN111813517B (en) * 2020-06-29 2023-08-04 中国平安人寿保险股份有限公司 Task queue allocation method and device, computer equipment and medium
CN112346857A (en) * 2020-10-22 2021-02-09 杭州安恒信息技术股份有限公司 Data issuing method and device, computer equipment and storage medium
CN112650971A (en) * 2020-12-31 2021-04-13 新奥数能科技有限公司 Method, device and equipment for realizing formula calculation and storage medium
CN112650971B (en) * 2020-12-31 2024-03-05 新奥数能科技有限公司 Method, device, equipment and storage medium for realizing formula calculation
CN114358868A (en) * 2021-11-30 2022-04-15 杭州光云科技股份有限公司 Order sorting processing method and device, computer equipment and storage medium
CN114358868B (en) * 2021-11-30 2023-09-22 杭州光云科技股份有限公司 Order sorting processing method, device, computer equipment and storage medium
CN115292023A (en) * 2022-10-08 2022-11-04 北京中科网威信息技术有限公司 Timing task processing method and device

Also Published As

Publication number Publication date
CN110990141B (en) 2024-04-26

Similar Documents

Publication Publication Date Title
CN110990141A (en) Timed task processing method and device, computing equipment and storage medium
CN110032438B (en) Delayed task execution method and device and electronic equipment
US20200019435A1 (en) Dynamic optimizing task scheduling
CN113535367B (en) Task scheduling method and related device
US20100293551A1 (en) Job scheduling apparatus and job scheduling method
US11775269B2 (en) Generating a synchronous digital circuit from a source code construct defining a function call
US11113176B2 (en) Generating a debugging network for a synchronous digital circuit during compilation of program source code
CN114510339B (en) Computing task scheduling method and device, electronic equipment and readable storage medium
CN109635034B (en) Training data resampling method and device, storage medium and electronic equipment
CN111078384A (en) Method and device for migrating core data, computer equipment and storage medium
CN110019538B (en) Data table switching method and device
CN113342500B (en) Task execution method, device, equipment and storage medium
US20090249343A1 (en) System, method, and computer program product for receiving timer objects from local lists in a global list for being used to execute events associated therewith
CN114281504A (en) Task scheduling method and device, electronic equipment and computer readable medium
CN111207763A (en) Path planning method, system, terminal and storage medium based on real-time routing
CN112165486B (en) Network address set splitting method and device
CN114969046A (en) Hash connection processing method, storage medium and equipment
US11630603B1 (en) Hardware device polling using delay order
US20230094430A1 (en) Regulation of throttling of polling based on processor utilizations
CN111158886A (en) Method and device for optimizing task scheduling of operating system and intelligent equipment
CN113722068A (en) Batch task processing method, device and equipment based on Azkaban and storage medium
CN109213590B (en) Method and apparatus for scheduling processors
CN111124491B (en) Batch processing method, device, equipment and storage medium
US20230126185A1 (en) Apparatus and method for executing automation scenario in parallel
CN108694249B (en) Data processing method, data processing device, computer equipment and storage medium

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