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

An Execution Method of Time Difference Sequential Linked List Timer

An execution method and time difference technology, applied in the direction of instruments, multi-channel program devices, program control design, etc., can solve problems such as affecting timing accuracy, reducing system running speed, and deteriorating counter performance, saving resources and ensuring timing accuracy. Effect

Active Publication Date: 2019-05-21
扬州航盛科技有限公司
View PDF5 Cites 0 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
  • An Execution Method of Time Difference Sequential Linked List Timer
  • An Execution Method of Time Difference Sequential Linked List Timer
  • An Execution Method of Time Difference Sequential 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 present invention provides an execution method of a time difference sequence linked list timer in the field of computer technology, which includes several tasks with different timing durations. When processing tasks, the following steps are executed: (1) All tasks are arranged from small to large according to the timing duration. The large order is arranged in a doubly linked list; (2) The time interval between the task under the current node and the task under the previous node is t n ; (3) Using a single counting thread, make t 1 '=t 1 / a, every time a counting cycle is executed, t 1 ’ minus 1, t 1 When 'is 0, delete the task under the first node, trim the linked list, and execute the task under the first node; (4) return to step (3) repeat the above steps; (5) when adding a new scheduled task, press (1) Insert the new task into the correct position in the linked list according to the requirements, and return to step (3) to cycle the above steps; the present invention has high timing accuracy, saves system resources, improves system performance, and can be applied to the timing and execution of software timers.

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
Patent Type & Authority Patents(China)
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