CN102761541B - timer processing method and system - Google Patents

timer processing method and system Download PDF

Info

Publication number
CN102761541B
CN102761541B CN201210178477.XA CN201210178477A CN102761541B CN 102761541 B CN102761541 B CN 102761541B CN 201210178477 A CN201210178477 A CN 201210178477A CN 102761541 B CN102761541 B CN 102761541B
Authority
CN
China
Prior art keywords
time
chained list
node
timer
task
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.)
Expired - Fee Related
Application number
CN201210178477.XA
Other languages
Chinese (zh)
Other versions
CN102761541A (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.)
Opzoon Technology Co Ltd
Original Assignee
Opzoon 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 Opzoon Technology Co Ltd filed Critical Opzoon Technology Co Ltd
Priority to CN201210178477.XA priority Critical patent/CN102761541B/en
Publication of CN102761541A publication Critical patent/CN102761541A/en
Application granted granted Critical
Publication of CN102761541B publication Critical patent/CN102761541B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of timer processing method and system, relate to network communication technology field, said method comprising the steps of: S1: set up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time; S2: newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest.The present invention carries out the timer processed by all needs of overtime chain table record, and select to carry out timing with the immediate task of current time, make only need set up a timer in processing procedure, decrease the total quantity of registration timer, improve the performance of CPU.

Description

Timer processing method and system
Technical field
The present invention relates to network communication technology field, particularly a kind of timer processing method and system.
Background technology
When test I nternet protocol safety (IPSEC) creates maximum number, need to realize a large amount of IPSEC negotiation at short notice, 20 IPSEC tunnels are consulted in now setting 1 second, consult 20,000 altogether, so each IPSEC tunnel creates internet key exchange (IKE) security association (Security Association to I haven't seen you for ages, SA) overtime timer and an IPSEC SA overtime timer, like this will at registration per second 40 timers, but timer triggers by CPU and realizes, and registration 40,000 timers in the short time, very big to the pressure of CPU, have impact on the performance of CPU greatly.
Summary of the invention
(1) technical problem that will solve
The technical problem to be solved in the present invention is: the total quantity how reducing registration timer, to improve the performance of CPU.
(2) technical scheme
For solving the problems of the technologies described above, the invention provides a kind of timer processing method, said method comprising the steps of:
S1: set up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time;
S2: newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest.
Preferably, further comprising the steps of after step S2:
S3: if current time arrives the triggered time of described timer, then process the corresponding task of described present node, and delete the present node in described overtime chained list, returns step S2, until there is no node in described overtime chained list, then process ends.
Preferably, after the corresponding task of described present node being processed in step S3, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
Preferably, described task is IKE SA task or IPSEC SA task.
Preferably, described overtime chained list is doubly linked list, and the node put in order as linked list head of described overtime chained list is node that the nearest time-out time of distance current time is corresponding and the node of chained list tail is the node that distance current time time-out time is farthest corresponding.
Preferably, when needing when there being new task to insert described overtime chained list, comprise the following steps:
Obtain the time-out time of described new task, according to the time-out time of described new task using described new task as in chained list overtime described in node city.
Preferably, if the time-out time of described new task is nearer than the triggered time distance current time of described timer, then described timer is cancelled, set up new timer, and using the triggered time of the time-out time of described new task as new timer.
The invention also discloses a kind of timer processing system, described system comprises:
Chained list sets up module, and for setting up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time;
Time block, for newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest.
Preferably, described system also comprises:
Processing module, if the triggered time arriving described timer for current time, then processes the corresponding task of described present node, and deletes the present node in described overtime chained list.
Preferably, after the corresponding task of described present node being processed in described processing module, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
(3) beneficial effect
The present invention carries out the timer processed by all needs of overtime chain table record, and select to carry out timing with the immediate task of current time, make only need set up a timer in processing procedure, decrease the total quantity of registration timer, improve the performance of CPU.
Accompanying drawing explanation
Fig. 1 is the flow chart of the timer processing method according to one embodiment of the present invention;
Fig. 2 is the flow chart of the timer processing system according to one embodiment of the present invention.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples for illustration of the present invention, but are not used for limiting the scope of the invention.
Fig. 1 is the flow chart of the timer processing method according to one embodiment of the present invention; With reference to Fig. 1, said method comprising the steps of:
S1: set up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time; In present embodiment, described task is IKE SA task or IPSEC SA task, but does not limit protection scope of the present invention.
S2: newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest.
Preferably, further comprising the steps of after step S2:
S3: if current time arrives the triggered time of described timer, then process (in present embodiment to the corresponding task of described present node, after the complete described present node of timer processing, in seconds, judge whether next node now also needs process, if 1 second creates 20 nodes, so now just there will be the situation of process 20 nodes continuously, processing node is all in seconds), and the present node deleted in described overtime chained list, return step S2, until there is no node in described overtime chained list, then process ends.
Because some task needs to carry out circular treatment, preferably, after the corresponding task of described present node being processed in step S3, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
Preferably, described overtime chained list is doubly linked list, and the node put in order as linked list head of described overtime chained list is node that the nearest time-out time of distance current time is corresponding and the node of chained list tail is the node that distance current time time-out time is farthest corresponding.
Preferably, when needing when there being new task to insert described overtime chained list, comprise the following steps:
Obtain the time-out time of described new task, according to the time-out time of described new task using described new task as in chained list overtime described in node city.
In present embodiment, suppose that consulting to generate IKE SA task is point in the morning 10, when needing to insert described IKE SA task, the time-out time first obtaining described IKE SA task is point in the morning 10, search the node of time-out time before 10 o'clock on chained list again, generally have following three kinds of situations:
1, there is no node in described overtime chained list, then IKE SA task is inserted in described overtime chained list, and newly-built timer, using the triggered time of the time-out time of described IKE SA task as described timer.
2, total m node on described overtime chained list, had n node (n<m) time-out time before 10 o'clock, then using described IKE SA task after node city n-th node.
3, total m node on described overtime chained list, but time-out time does not have the node before 10, then described IKE SA task is added on first node of described overtime chained list, and described timer is cancelled, set up new timer, using the triggered time of the time-out time of described IKE SA task as new timer.
Preferably, if the time-out time of described new task is nearer than the triggered time distance current time of described timer, then described timer is cancelled, set up new timer, and using the triggered time of the time-out time of described new task as new timer.
Fig. 2 is the flow chart of the timer processing system according to one embodiment of the present invention; With reference to Fig. 2, the invention also discloses a kind of timer processing system, described system comprises:
Chained list sets up module, and for setting up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time;
Time block, for newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest.
Preferably, described system also comprises:
Processing module, if the triggered time arriving described timer for current time, then processes the corresponding task of described present node, and deletes the present node in described overtime chained list.
Preferably, after the corresponding task of described present node being processed in described processing module, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
Above execution mode is only for illustration of the present invention; and be not limitation of the present invention; the those of ordinary skill of relevant technical field; without departing from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all equivalent technical schemes also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.

Claims (8)

1. a timer processing method, is characterized in that, said method comprising the steps of:
S1: set up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time;
S2: newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest;
S3: if current time arrives the triggered time of described timer, then process the corresponding task of described present node, and delete the present node in described overtime chained list, returns step S2, until there is no node in described overtime chained list, then process ends.
2. the method for claim 1, it is characterized in that, after the corresponding task of described present node being processed in step S3, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
3. the method for claim 1, is characterized in that, described task is IKE SA task or IPSEC SA task.
4. the method according to any one of claims 1 to 3, it is characterized in that, described overtime chained list is doubly linked list, and the node put in order as linked list head of described overtime chained list is node that the nearest time-out time of distance current time is corresponding and the node of chained list tail is the node that distance current time time-out time is farthest corresponding.
5. method as claimed in claim 4, is characterized in that, when needing when there being new task to insert described overtime chained list, comprising the following steps:
Obtain the time-out time of described new task, according to the time-out time of described new task using described new task as in chained list overtime described in node city.
6. method as claimed in claim 5, it is characterized in that, if the time-out time of described new task is nearer than the triggered time distance current time of described timer, then described timer is cancelled, set up new timer, and using the triggered time of the time-out time of described new task as new timer.
7. a timer processing system, is characterized in that, described system comprises:
Chained list sets up module, and for setting up overtime chained list, in described overtime chained list, each node is need carry out the task of processing and arrange by time-out time;
Time block, for newly-built timer, using the triggered time of the time-out time of present node in described overtime chained list as described timer, described present node is at node corresponding to the time-out time that described overtime chained list middle distance current time is nearest;
Processing module, if the triggered time arriving described timer for current time, then processes the corresponding task of described present node, and deletes the present node in described overtime chained list.
8. system as claimed in claim 7, it is characterized in that, after the corresponding task of described present node being processed in described processing module, if the corresponding task of described present node needs again to process, then the time-out time again processed is needed to be inserted in described overtime chained list by described present node according to described present node.
CN201210178477.XA 2012-05-31 2012-05-31 timer processing method and system Expired - Fee Related CN102761541B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210178477.XA CN102761541B (en) 2012-05-31 2012-05-31 timer processing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210178477.XA CN102761541B (en) 2012-05-31 2012-05-31 timer processing method and system

Publications (2)

Publication Number Publication Date
CN102761541A CN102761541A (en) 2012-10-31
CN102761541B true CN102761541B (en) 2015-08-19

Family

ID=47055862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210178477.XA Expired - Fee Related CN102761541B (en) 2012-05-31 2012-05-31 timer processing method and system

Country Status (1)

Country Link
CN (1) CN102761541B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103312713B (en) * 2013-06-13 2016-08-10 北京星网锐捷网络技术有限公司 Security association negotiation method, device and the network equipment
CN104683136B (en) * 2013-11-29 2018-02-09 杭州迪普科技股份有限公司 DHCP delay event-handling methods and device
CN104035786B (en) * 2014-07-01 2017-11-24 上海斐讯数据通信技术有限公司 The optimization method and system of a kind of software timer
CN104166585A (en) * 2014-08-19 2014-11-26 Tcl通讯(宁波)有限公司 Terminal timer control method and system
CN105162946B (en) * 2015-06-30 2018-05-08 Tcl移动通信科技(宁波)有限公司 A kind of alarm clock processing method and mobile terminal based on mobile terminal
CN111026526B (en) * 2019-11-12 2024-01-30 珠海格力电器股份有限公司 Timer configuration method and device for program, storage medium and terminal equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870767A (en) * 2005-12-14 2006-11-29 华为技术有限公司 Method for managing timer task
CN101359294A (en) * 2008-10-09 2009-02-04 北京佳讯飞鸿电气股份有限公司 Management method for embedded system timer
CN102270156A (en) * 2011-05-30 2011-12-07 北京华源格林科技有限公司 Method for managing real-time embedded system timers

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870767A (en) * 2005-12-14 2006-11-29 华为技术有限公司 Method for managing timer task
CN101359294A (en) * 2008-10-09 2009-02-04 北京佳讯飞鸿电气股份有限公司 Management method for embedded system timer
CN102270156A (en) * 2011-05-30 2011-12-07 北京华源格林科技有限公司 Method for managing real-time embedded system timers

Also Published As

Publication number Publication date
CN102761541A (en) 2012-10-31

Similar Documents

Publication Publication Date Title
CN102761541B (en) timer processing method and system
US9568989B2 (en) Method for acting as service agent, modem, and terminal by establishing a heartbeat connection with an application server
JP2014526862A5 (en)
WO2014209866A3 (en) Updating rich communication suite capability information over a communications network
PH12015502475A1 (en) A wireless device, network nodes and methods therein for handling a device-to-device (d2d) communication during handover in a wireless telecommunications network
WO2012064459A3 (en) Reduction of message and computational overhead in networks
TW200705899A (en) System and method for synchronizing components in a mesh network
WO2012096490A3 (en) Method for restricting the cell access of a terminal in a wireless communication system, and apparatus therefor
NZ600995A (en) High priority data reads for acquisition of real-time data in wireless mesh network
MY169615A (en) Method and apparatus for securing wireless relay nodes
IN2015DN03017A (en)
MX2017011620A (en) Communication protocols for electronic locks.
RU2015137789A (en) METHOD FOR IMPROVING MANAGEMENT PERFORMANCE IN 802.11ah
MX2020005132A (en) Secure protection method and device.
WO2013051848A3 (en) Method and apparatus for updating an area in a wireless communication system
CN103095590B (en) Suppress Link State Packet periodic refresh and aging method and the network equipment
MX359701B (en) Method and device for managing instant message.
PH12019501679A1 (en) Method for random access, and terminal device and network device
GB201209266D0 (en) Method and system for communicating between devices
CN103152263B (en) Link State Protocol Data Unit burst update method and router
CN103384280A (en) Method and system for managing network address translation port resources
SG11201810807YA (en) Anchor master am management method and node
MY175285A (en) Method for controlling network element to join network, and network element thereof
WO2015020588A3 (en) A network node and mobile device for use in a communication network, and methods of operating the same and computer program products
CN103034480A (en) Embedded system timer realizing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150819

Termination date: 20180531