Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Execution method of time residual quantity order linked list timer

An execution method and time difference technology, applied in the direction of instruments, program control design, multi-channel program devices, etc., can solve problems such as affecting timing accuracy, reducing system running speed, occupying computer system resources, etc., to save resources and ensure timing accuracy. Effect

Active Publication Date: 2016-10-12
扬州航盛科技有限公司
View PDF5 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] In the prior art software timer, there are mainly two kinds of counting methods, one is that each task has its own count when there are multiple tasks counting, and the other is that each timing task has a separate thread, wherein the former The defects of the counting method are: when the number of tasks is large, the counter performance of each task will deteriorate and affect the timing accuracy; the defect of the latter counting method is that when the number of tasks is large, the software timer will occupy a large amount of computer system resources, reducing system speed

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Execution method of time residual quantity order linked list timer
  • Execution method of time residual quantity order linked list timer

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0028] Such as figure 1 The execution method of a time difference sequence linked list timer shown includes several timing tasks with different timing durations. When processing timing tasks, follow the steps below:

[0029] (1) Arrange all timing tasks in a doubly linked list in ascending order of timing duration;

[0030] (2) Each node counts according to t n to count:

[0031] (n≥2, t 1 = T 1 ) 1)

[0032] (3) Using a single counting thread, let t 1 '=t 1 / a, will t 1 ’ As the task count value under the first node, every execution count cycle will be t 1 ’ minus 1, the original t 1 The difference after subtracting 1 from the value of ’ is t after executing 1 counting cycle 1 ’ the actual value, when t 1 When 'is 0, delete the timing task under the first node in the doubly linked list, and create a separate execution thread at the same time, execute the timing task in the first node in the execution thread, and re-repair the linked list at this time, specifical...

Embodiment 2

[0045] The difference from Example 1 is that now there are 4 timing tasks respectively c1, c2, c3 and c4, c1 needs to run after 1s, c2 needs to run after 2s, c3 needs to run after 3s, and c4 needs to run after Run after 2s, set the counting period to 1s, the timing duration of c2 and c4 is the same, so c2 and c4 are under the same node in the linked list, the absolute count and relative count of c1 are respectively: T1=1, t1=1, c2 The absolute count and relative count of c4 and c4 are respectively T2=2, t2=2-1=1, the absolute count and relative count of c3 are respectively: T3=3, t3=3-2=1, and the total count in the linked list is t1+t2+t3=3; after 1s, the absolute count and task count in c1 are respectively: T1=1, t1'=1 / 1-1=0, at this time, c1 needs to be moved from the first in the linked list Delete the node and put it into the newly created execution thread to execute, trim the linked list, the trimmed linked list is: T1=2, t1=1, T2=3, t2=1, the total count in the linked l...

Embodiment 3

[0047] The difference from Examples 1 and 2 is that now there are 5 scheduled tasks, namely d1, d2, d3, d4 and d5, d1 needs to run after 1s, d2 needs to run after 2s, and d3 needs to run after 5s , d4 needs to run after 6s, d5 needs to run after 7s, set the counting period to 1s, the absolute count and relative count of d1 are respectively T1=1, t1=1-0=1; the absolute count and relative count of d2 T2=2, t2=T2-t1=2-1=1, the absolute and relative counts of d3 are T3=5, t3=T3-(t1+t2)=5-(1+1)=3 , the absolute and relative counts of d4 are T4=6, t4=T4-(t1+t2+t3)=1, and the absolute and relative counts of d5 are T5=7, t5=T5-(t1+t2+ t3+t4)=1, the total count of the linked list is t1+t2+t3+t4+t5=7; after 1s, the absolute count and task count in d1 are T1=1, t1'=1 / 1- 1=0, at this time, it is necessary to delete d1 from the first node in the linked list and put it into the newly created execution thread for execution, trim the linked list, and the trimmed linked list is: T1=2, t1=1, T...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides an execution method of a time residual quantity order linked list timer in the field of the computer technology, and comprises a plurality of tasks of different timing durations. The execution method comprises the following execution steps when tasks are processed: (1) arranging all tasks in a double linked list according to the ascending order of the timing durations; (2) ensuring that a time interval between the task under a current node and the task of a previous node is tn; (3) adopting a single counting thread to cause t1' to be equal to t1 / a, subtracting 1 from t1' when one counting period is executed each time, deleting the task under the first node when t1' is equal to 0, reconditioning the linked list, and executing the task under the first node; (4) returning to the (3) to circulate the above steps; and (5) when a new timing task is added, inserting the new task into a correct position in the linked list according to the requirement of the (1), and returning to the (3) to circulate the above steps. The execution method is high in timing accuracy, saves system resources, improves system performance and can be applied to the timing and executing work of a software timer.

Description

technical field [0001] The invention relates to an execution method of a timer, in particular to an execution method of a time difference sequence linked list timer. Background technique [0002] In the prior art software timer, there are mainly two kinds of counting methods, one is that each task has its own count when there are multiple tasks counting, and the other is that each timing task has a separate thread, wherein the former The defects of the counting method are: when the number of tasks is large, the counter performance of each task will deteriorate and affect the timing accuracy; the defect of the latter counting method is that when the number of tasks is large, the software timer will occupy a large amount of computer system resources, reducing The operating speed of the system. Contents of the invention [0003] Aiming at the defects in the prior art, the purpose of the present invention is to overcome the deficiencies in the above-mentioned prior art. The p...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/50
CPCG06F9/5038
Inventor 钱寅生
Owner 扬州航盛科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products