CN102325091B - Memory release method and routing system - Google Patents

Memory release method and routing system Download PDF

Info

Publication number
CN102325091B
CN102325091B CN201110314529.7A CN201110314529A CN102325091B CN 102325091 B CN102325091 B CN 102325091B CN 201110314529 A CN201110314529 A CN 201110314529A CN 102325091 B CN102325091 B CN 102325091B
Authority
CN
China
Prior art keywords
resource
core
forwarding
forwarding core
needs
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
CN201110314529.7A
Other languages
Chinese (zh)
Other versions
CN102325091A (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.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication 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 Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201110314529.7A priority Critical patent/CN102325091B/en
Publication of CN102325091A publication Critical patent/CN102325091A/en
Application granted granted Critical
Publication of CN102325091B publication Critical patent/CN102325091B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a memory release method and a routing system. The method comprises that: all forwarding cores in the routing system are sequentially organized according to set rules; after updating resources pointed by a resource pointer, each forwarding core stores the resources pointed by the resource pointer before the updating into a resource release queue allocated to the next forwarding core as resources to be released; and each forwarding core checks whether own allocated resource release queue comprises the resources to be released, sequentially takes each resource to be released out and judges whether the resources are the resources, determined by updating the resources pointed by the resource pointer, to be released if own allocated resource release queue comprises the resources to be released, releases the resources if the resources are the resources, determined by updating the resources pointed by the resource pointer, to be released, otherwise continues storing the resources into the resource release queue allocated to the next forwarding core as the resources to be released.

Description

Memory release method and route system
Technical field
The present invention relates to data communication technology, particularly memory release method and route system.
Background technology
Along with the continuous lifting of physical interface speed, in route system, the forwarding core (core) of CPU number also increases thereupon.In route system, each of CPU forwards core by concurrent working mode parallel processing message repeating, to improving message forwarding performance.But, when a plurality of forwarding core is accessed identical code district (being designated as shared resource) simultaneously, for avoiding conflict, need to realize the exclusive reference that shared resource is checked in a plurality of forwardings, this exclusive reference can not embody the advantage that multi-core parallel concurrent is carried out.
In order to embody the advantage of multi-core parallel concurrent execution, just need to avoid the exclusive reference of shared resource.Prior art provides following methods to replace the exclusive reference of shared resource: by resource pointer, control the access of shared resource.During this access specific implementation by resource pointer control shared resource, can be: when reading shared resource, without mutual exclusion, can directly access by resource pointer; And when writing shared resource also without mutual exclusion, first copy a shared resource, then on the shared resource of copy, carry out write operation, new resources pointer more after write operation completes, allows it point to the shared resource of new copy.
As for original shared resource, it needs to discharge.Wherein, this releasing resource is time-based delay memory method for releasing, from the time point of above-mentioned more new resources pointer, counts, and after postponing a period of time, discharges original shared resource.The time of this delay is static appointment, as 1 second or 10 seconds etc.
But, this time-based delay memory method for releasing is poor efficiency or even insecure, because the time postponing is static appointment, if the time of delay of appointment is too short, so when arrive in this time of delay, also can exist this resource to be discharged to also have accessed possibility, this affects resource access; If the time of delay of appointment is long, will certainly within a period of time, reduce so the quantity of the available free memory of system, cause the waste of resource.
Summary of the invention
The invention provides memory release method and route system, with the poor efficiency of avoiding time-based delay memory method for releasing to be brought, even not reliable defect.
Technical scheme provided by the invention comprises:
A memory release method, comprising:
All forwarding cores in route system are organized successively according to the rule of setting;
Each forwards core after the resource of new resources pointed more, and the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs is deposited and to the next one, forwarded the resource that core is assigned with and discharge in queue;
The resource that each forwarding nuclear inspection self is assigned with discharges queue and whether has the resource that needs release, if, take out successively the resource that each need to discharge, and judge that whether this resource is due to self the more resource of new resources pointed and resource that definite needs discharge, if, discharge this resource, otherwise the resource that this resource is continued to discharge as needs is deposited the resource being assigned with to next one forwarding core and is discharged in queue.
A route system, comprising: organizational unit, dispensing unit and a plurality of forwarding core, wherein,
Described organizational unit, for organizing according to the rule of setting all forwarding cores of route system;
Described dispensing unit, is used to each to forward core and distributes independently resource to discharge queue;
Each forwards core and comprises: the first processing unit and the second processing unit, wherein,
Described the first processing unit, for at its residing forwarding core more after the resource of new resources pointed, the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs, deposits the resource being assigned with to the next one forwarding core of this forwarding core and discharges in queue;
Described the second processing unit, for checking whether the resource release queue that its residing forwarding core is assigned with exists the resource that needs release, if, take out successively the resource that each need to discharge, and judge that whether this resource is due to its residing forwarding core more resource of new resources pointed and resource that definite needs discharge, if, discharge this resource, otherwise the resource that this resource is continued to discharge as needs is deposited the resource being assigned with to the next one forwarding core of this forwarding core and is discharged in queue.
As can be seen from the above technical solutions, in the present invention, each forwards core and through after all forwarding core, just discharges this resource in its resource that definite needs discharge due to the resource of new resources pointed more, when not accessing this resource, all forwarding core just discharges in time this resource, this can not affect resource access on the one hand, also releasing resource in time on the other hand, can not cause the waste of resource, the poor efficiency of avoiding time-based delay memory method for releasing to bring, even not reliable defect, the poor efficiency of having avoided time-based delay memory method for releasing to bring completely, even not reliable defect.
Accompanying drawing explanation
The basic flow sheet that Fig. 1 provides for the embodiment of the present invention;
The ring structure schematic diagram that Fig. 2 provides for the embodiment of the present invention;
Another schematic diagram of ring structure that Fig. 3 provides for the embodiment of the present invention;
The route system structure chart that Fig. 4 provides for the embodiment of the present invention.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearer, below in conjunction with the drawings and specific embodiments, describe the present invention.
Referring to Fig. 1, the basic flow sheet that Fig. 1 provides for the embodiment of the present invention.As shown in Figure 1, this flow process can comprise the following steps:
Step 101, organizes according to the rule of setting successively to all forwarding cores in route system.
During this step 101 specific implementation, can be all forwarding core is formed to a ring successively according to the order of setting.
Wherein, all forwarding core is formed to a ring successively according to the order of setting specifically be can be: all forwarding cores in route system are numbered in order, if all forwarding cores in route system are: core-1, core-2, ... core-N, can to this all forwarding core, number in order since a predefined initial value such as 1, such as, be numbered from 1 to N, afterwards all forwarding core formed to a ring successively according to numbering size.Wherein, all forwarding core is formed to a ring successively according to numbering size and can comprise following arbitrary situation:
Situation 1: the order ascending according to the numbering that forwards core forms a ring by all forwarding core clockwise.All forwarding cores of take in route system are core-1, core-2 ... core-N, this each forward core be numbered 1,2 ... N, based on this, according to the ascending order of numbering, clockwise all forwarding core being formed to a ring can be as shown in Figure 2.
Situation 2: the order descending according to the numbering that forwards core forms a ring by all forwarding core clockwise.All forwarding cores of take in route system are core-1, core-2 ... core-N, this each forward core be numbered 1,2 ... N, based on this, according to the descending order of numbering, clockwise all forwarding core being formed to a ring can be as shown in Figure 3.
Step 102, each forwards core after the resource of new resources pointed more, and the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs is deposited and to the next one, is forwarded the resource that core is assigned with and discharge in queue.
Based on above-described, all forwarding cores in route system are organized according to the rule of setting, that all forwarding core is formed to a ring successively according to the order of setting, can obtain, the next one in this step 102 forward core be current forwarding core in ring along clockwise direction or anticlockwise adjacent forwarding core.
In addition, in this step 102, the resource release queue that forwarding core is assigned with is pre-assigned, and resource discharges queue for depositing the resource that needs release, and the resource of the needs that it is deposited according to first in first out (FIFO:First In First Out) tissue release.Wherein, it is separate that the resource that each forwarding core is assigned with discharges queue.
Take Fig. 2 as example, if in this step 102, core-1 is the resource of new resources pointed more, and the resource that the resource that this core-1 pointed to this resource pointer before upgrading discharges as needs is deposited the resource being assigned with to the core-2 shown in Fig. 2 and discharged in queue.
Step 103, the resource that each forwarding nuclear inspection self is assigned with discharges queue and whether has the resource that needs release, if, take out successively the resource that each need to discharge, and judge this resource be whether due to self more new resources pointed resource and resource that definite needs discharge if so, discharges this resource, otherwise the resource that this resource is continued to discharge as needs is deposited the resource being assigned with to next one forwarding core and is discharged in queue.
In this step 103, the resource that each forwarding nuclear inspection self is assigned with discharges the operation whether queue exists the resource that needs release, is to carry out before processing message or after processing message, and the present invention does not specifically limit.
So far, complete the flow process shown in Fig. 1.
From the flow process shown in Fig. 1, can find out, in the present invention, each forwards core and through after all forwarding core, just discharges this resource in its resource that definite needs discharge due to the resource of new resources pointed more, when not accessing this resource, all forwarding core just discharges in time this resource, this can not affect resource access on the one hand, also releasing resource in time on the other hand, can not cause the waste of resource, poor efficiency, the even not reliable defect of avoiding time-based delay memory method for releasing to bring.
So far, complete method provided by the invention and describe, below route system provided by the invention is described:
Referring to Fig. 4, the route system structure chart that Fig. 4 provides for the embodiment of the present invention.As shown in Figure 4, this route system comprises: organizational unit, dispensing unit and a plurality of forwarding core, wherein,
Described organizational unit, for organizing according to the rule of setting all forwarding cores of route system;
Described dispensing unit, is used to each to forward core and distributes independently resource to discharge queue; Particularly, each resource release queue is the resource discharging according to the needs of the mode organize of FIFO.
Each forwards core and comprises: the first processing unit and the second processing unit, wherein,
Described the first processing unit, for at its residing forwarding core more after the resource of new resources pointed, the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs, deposits the resource being assigned with to the next one forwarding core of this forwarding core and discharges in queue;
Described the second processing unit, for checking whether the resource release queue that its residing forwarding core is assigned with exists the resource that needs release, if, take out successively the resource that each need to discharge, and judge that whether this resource is due to its residing forwarding core more resource of new resources pointed and resource that definite needs discharge, if, discharge this resource, otherwise, the resource that this resource is continued to discharge as needs deposit to this forwardings core the next one forward in the resource release queue that core is assigned with.Wherein, described the second processing unit is before processing message or after processing message, to check whether the resource release queue that its residing forwarding core is assigned with exists the resource that needs release.
Particularly, in the present invention, described organizational unit is organized according to the rule of setting all forwarding cores in route system, is that all forwarding core is formed to a ring successively according to the order of setting; Correspondingly, described next forward core be current forwarding core in ring along clockwise direction or anticlockwise adjacent forwarding core.
Preferably, in the present invention, described organizational unit is organized according to the rule of setting all forwarding cores in route system, refers to:
The order ascending according to the numbering that forwards core forms a ring by all forwarding core clockwise; Or,
The order descending according to the numbering that forwards core forms a ring by all forwarding core clockwise.
So far, completing route system structure provided by the invention describes.
As can be seen from the above technical solutions, in the present invention, each in ring forwards core and through after all forwarding cores of whole ring, just discharges this resource in its resource that definite needs discharge due to the resource of new resources pointed more, when not accessing this resource, all forwarding core just discharges in time this resource, this can not affect resource access on the one hand, also releasing resource in time on the other hand, can not cause the waste of resource, poor efficiency, the even not reliable defect of avoiding time-based delay memory method for releasing to bring.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.

Claims (6)

1. a memory release method, is characterized in that, the method comprises:
All forwarding cores in route system are organized successively according to the rule of setting;
Each forwards core after the resource of new resources pointed more, and the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs is deposited and to the next one, forwarded the resource that core is assigned with and discharge in queue;
The resource that each forwarding nuclear inspection self is assigned with discharges the resource whether queue exists the needs release self not visiting again, if, take out successively the resource that each needs that self do not visit again discharges, and judge that whether this resource is due to self the more resource of new resources pointed and resource that definite needs discharge, if, discharge this resource, if not due to self the more resource of new resources pointed and resource that definite needs discharge, the resource that this resource is continued to discharge as needs is deposited the resource being assigned with to next one forwarding core and is discharged in queue,
Wherein, described all forwarding cores in route system being organized according to the rule of setting, is that all forwarding core is formed to a ring successively according to the order of setting; Described next forward core be current forwarding core in ring along clockwise direction or anticlockwise adjacent forwarding core.
2. method according to claim 1, is characterized in that, describedly all forwarding core is formed to a ring successively according to the order of setting comprises:
The order ascending according to the numbering that forwards core forms a ring by all forwarding core clockwise; Or,
The order descending according to the numbering that forwards core forms a ring by all forwarding core clockwise.
3. method according to claim 1, it is characterized in that, the resource that described each forwarding nuclear inspection self is assigned with discharges the operation whether queue exists the resource of the needs release self not visiting again, and is before processing message or execution after processing message.
4. a route system, is characterized in that, this route system comprises: organizational unit, dispensing unit and a plurality of forwarding core, wherein,
Described organizational unit, for all forwarding cores of route system are organized according to the rule of setting, wherein, described organizational unit is organized according to the rule of setting all forwarding cores in route system, is that all forwarding core is formed to a ring successively according to the order of setting; Wherein, next forward core be current forwarding core in ring along clockwise direction or anticlockwise adjacent forwarding core;
Described dispensing unit, is used to each to forward core and distributes independently resource to discharge queue;
Each forwards core and comprises: the first processing unit and the second processing unit, wherein,
Described the first processing unit, for at its residing forwarding core more after the resource of new resources pointed, the resource that the resource that this resource pointer was pointed to before upgrading discharges as needs, deposits the resource being assigned with to the next one forwarding core of this forwarding core and discharges in queue;
Described the second processing unit, for checking that resource that its residing forwarding core is assigned with discharges the resource whether queue exists needs that its residing forwarding core does not visit again to discharge, if, take out successively the resource that the needs that do not visit again described in each discharge, and judge that whether this resource is due to its residing forwarding core more resource of new resources pointed and resource that definite needs discharge, if, discharge this resource, if not due to its residing forwarding core more resource of new resources pointed and resource that definite needs discharge, the resource that this resource is continued to discharge as needs is deposited the resource being assigned with to the next one forwarding core of this forwarding core and is discharged in queue.
5. route system according to claim 4, it is characterized in that, described the second processing unit is before processing message or processes and check that resource that its residing forwarding core is assigned with discharges the resource whether queue exists the needs release that its residing forwarding core do not visit again after message.
6. route system according to claim 4, is characterized in that, described organizational unit forms successively a ring by all forwarding core according to the order of setting and comprises:
The order ascending according to the numbering that forwards core forms a ring by all forwarding core clockwise; Or,
The order descending according to the numbering that forwards core forms a ring by all forwarding core clockwise.
CN201110314529.7A 2011-10-17 2011-10-17 Memory release method and routing system Active CN102325091B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110314529.7A CN102325091B (en) 2011-10-17 2011-10-17 Memory release method and routing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110314529.7A CN102325091B (en) 2011-10-17 2011-10-17 Memory release method and routing system

Publications (2)

Publication Number Publication Date
CN102325091A CN102325091A (en) 2012-01-18
CN102325091B true CN102325091B (en) 2014-09-17

Family

ID=45452763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110314529.7A Active CN102325091B (en) 2011-10-17 2011-10-17 Memory release method and routing system

Country Status (1)

Country Link
CN (1) CN102325091B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108259369B (en) * 2018-01-26 2022-04-05 迈普通信技术股份有限公司 Method and device for forwarding data message

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093450A (en) * 2006-06-19 2007-12-26 迈普(四川)通信技术有限公司 Mutual exclusion method for multiple CPUs
CN101350010A (en) * 2007-07-20 2009-01-21 迈普(四川)通信技术有限公司 Operation method of hash table
CN101789959A (en) * 2009-12-30 2010-07-28 北京天融信科技有限公司 SKB reusing method and device in multinuclear system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2881241B1 (en) * 2005-01-24 2007-05-04 Meiosys Soc Par Actions Simpli METHOD FOR OPTIMIZING JOURNALIZATION AND MULTI-TASK APPLICATION REJECTION IN A MONO-PROCESSOR OR MULTI-PROCESSOR COMPUTER SYSTEM

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093450A (en) * 2006-06-19 2007-12-26 迈普(四川)通信技术有限公司 Mutual exclusion method for multiple CPUs
CN101350010A (en) * 2007-07-20 2009-01-21 迈普(四川)通信技术有限公司 Operation method of hash table
CN101789959A (en) * 2009-12-30 2010-07-28 北京天融信科技有限公司 SKB reusing method and device in multinuclear system

Also Published As

Publication number Publication date
CN102325091A (en) 2012-01-18

Similar Documents

Publication Publication Date Title
CN104216767B (en) The method and device of accessing shared data between multithreading
US9569291B1 (en) Systems and methods for inter-process messaging
CN103218176B (en) Data processing method and device
CN106547612A (en) A kind of multi-task processing method and device
CN105573711B (en) A kind of data cache method and device
CN108139882B (en) Implement the system and method for stratum's distribution lists of links for network equipment
US7111289B2 (en) Method for implementing dual link list structure to enable fast link-list pointer updates
CN106775493B (en) A kind of storage control and I/O Request processing method
CN109684099A (en) Message treatment method and device
CN107391279A (en) A kind of message queue container creation method, device and message queue container
US20030056073A1 (en) Queue management method and system for a shared memory switch
CN106528893A (en) Data synchronization method and device
CN103455371A (en) Mechanism for optimized intra-die inter-nodelet messaging communication
CN104252386B (en) The locking method and equipment of data renewal
CN109298888B (en) Queue data access method and device
CN102325091B (en) Memory release method and routing system
CN103677971B (en) Multithreaded processing system and method
CN104063271A (en) Transaction Capable Queuing
CN104125169B (en) Chained list processing unit, chained list processing method and related network switch
JP5776813B2 (en) Multi-core processor system, control method and control program for multi-core processor system
US9338219B2 (en) Direct push operations and gather operations
US9811403B1 (en) Method, apparatus and system for performing matching operations in a computing system
CN108595270A (en) A kind of recovery method and device of memory source
CN111566626A (en) Replication and forwarding of concurrent replication garbage collection
US10228852B1 (en) Multi-stage counters

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
CP02 Change in the address of a patent holder

Address after: 610041 15-24 floor, 1 1 Tianfu street, Chengdu high tech Zone, Sichuan

Patentee after: MAIPU COMMUNICATION TECHNOLOGY Co.,Ltd.

Address before: 610041 Sichuan city of Chengdu province high tech Zone nine Hing Road No. 16 building, Maipu

Patentee before: MAIPU COMMUNICATION TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 610041 nine Xing Xing Road 16, hi tech Zone, Sichuan, Chengdu

Patentee after: MAIPU COMMUNICATION TECHNOLOGY Co.,Ltd.

Address before: 610041 15-24 floor, 1 1 Tianfu street, Chengdu high tech Zone, Sichuan

Patentee before: MAIPU COMMUNICATION TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder