CN102868635A - Multi-core and multi-thread method and system for preserving order of messages - Google Patents

Multi-core and multi-thread method and system for preserving order of messages Download PDF

Info

Publication number
CN102868635A
CN102868635A CN2012103055825A CN201210305582A CN102868635A CN 102868635 A CN102868635 A CN 102868635A CN 2012103055825 A CN2012103055825 A CN 2012103055825A CN 201210305582 A CN201210305582 A CN 201210305582A CN 102868635 A CN102868635 A CN 102868635A
Authority
CN
China
Prior art keywords
message
forwarded
current
node
thread
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
CN2012103055825A
Other languages
Chinese (zh)
Other versions
CN102868635B (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 CN201210305582.5A priority Critical patent/CN102868635B/en
Publication of CN102868635A publication Critical patent/CN102868635A/en
Application granted granted Critical
Publication of CN102868635B publication Critical patent/CN102868635B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a multi-core and multi-thread method and a multi-core and multi-thread system for preserving order of messages, and relates to the technical field of network communication. The method comprises the following steps of: 1, receiving the messages which are acquired by a network card, and labeling the messages according to the receiving order of the messages; 2, acquiring a respective message by each central processing unit (CPU), ordering the messages by a corresponding thread, and processing the messages; and 3, after the current message is processed, judging whether a prior message is forwarded, if so, forwarding the processed current message, otherwise, waiting and forwarding the processed current message until the prior message is forwarded. According to the method and the system, the order of global messages can be preserved by judging whether the prior message is forwarded, and the out-of-order phenomenon during message transmission is avoided.

Description

The message order-preserving method of Multi-core and system
Technical field
The present invention relates to network communications technology field, particularly a kind of message order-preserving method of Multi-core and system.
Background technology
In a program, the program segment of these independent operatings is called " thread " (Thread), utilizes the concept of its programming just to be called " multithreading processing ".It is exactly user interface that multithreading is processed a common example.Utilize thread, the user can be by next button, and then program can be made response immediately, rather than allow user's wait routine finished current task just begin later on the response.Current high end network equipment adopts the hardware structure of multi-core CPU to improve processing and the forwarding performance of message mostly, and multi-core CPU is created respectively corresponding thread and described multi-core CPU carries out man-to-man binding.
Application number is: 201010289667.X, denomination of invention is: in a kind of message forwarding method and the Chinese patent of system based on multi-core architecture, put down in writing a kind of method that hash formation (being the zone that the hash table in the literary composition is divided) and thread are bound mutually, realized the lock design of exempting from of shared resource, but the message that occurs several data flow at the network equipment, when all having dropped in the hash formation after calculating by hash, will cause like this thread corresponding with this hash formation very busy, the situation that the thread corresponding with other hash formations all is in idle state occurs, thereby the service efficiency of multi-core CPU is lower, causes the waste of resource.
In order to improve the service efficiency of multi-core CPU in the network equipment, available technology adopting RMI chip is averagely allocated to each CPU with the message that receives, because message is averagely allocated to each CPU, and there is situation about varying in size in message, therefore, each CPU processes the speed of message and understands some difference, after message is finished dealing with, out of order phenomenon (3/1000ths out of order probability is arranged in the test) in the time of can producing the message transmission, enough for general demand, but for IPSEC message and video message etc., if there is out of order will packet loss or video mosaic so that network service is subject to comparatively serious retardance.
Summary of the invention
The technical problem that (one) will solve
The technical problem to be solved in the present invention is: how to prevent the out of order phenomenon that message occurs when sending.
(2) technical scheme
For solving the problems of the technologies described above, the invention provides a kind of message order-preserving method of Multi-core, described method comprises:
S1: receive message that network interface card obtains and carry out mark according to received ordered pair message of message;
S2: each CPU obtains respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
S3: after current message is processed, judge whether previous message is forwarded, if then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
Wherein, also comprise before the step S1:
S0: multi-core CPU is the corresponding generation thread identical with described multi-core CPU quantity respectively.
The step of wherein, among the described step S1 message being carried out mark is specially: the direct marking serial numbers of Single NIC equipment adds 1 since 0 each test serial number; Many network card equipments mark current time stamp.
Wherein, among the described step S2, the thread by correspondence is specially the step that message sorts: to Single NIC equipment, corresponding thread sorts to message according to the sequence number of message; To many network card equipments, corresponding thread sorts to message according to timestamp.
Wherein, among the described step S2, the step that message is sorted is specially: S21:
If message be labeled as sequence number, then directly message is put into n node T on the corresponding global loops chained list n, n-1 node T on the corresponding described global loops chained list of previous message N-1
If message be labeled as timestamp, then message is inserted on the global loops chained list more Zao than current message timestamp and with the node back of the immediate message of current message timestamp.
Wherein, specifically comprise among the step S3: S31: after current message is processed, judge the node T on the described global loops chained list N-1Whether corresponding message is forwarded, if then the current message after the described processing is transmitted, otherwise waited for described node T N-1After corresponding message is forwarded, the more current message after the described processing is transmitted.
Wherein, each node all has state flag bit in the described global loops chained list, and described state flag bit is used for the state whether corresponding message of reflection node has been forwarded;
Among the step S31, judge described node T by described state flag bit N-1Whether corresponding message is forwarded.
On the other hand, the present invention also provides a kind of packet order preserving system of Multi-core, and described system comprises:
The message receiver module be used for to receive message that network interface card obtains and carries out mark according to received ordered pair message of message;
Multi-core CPU comprises some CPU, is used for obtaining respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
Forwarding module is used for judging whether previous message is forwarded after current message is processed, if, then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
(3) beneficial effect
The present invention has prevented the out of order phenomenon that message occurs when sending by judging whether previous message is forwarded, and realizes the order-preserving of overall message.
Description of drawings
Fig. 1 is the flow chart according to the message order-preserving method of the Multi-core of one embodiment of the present invention;
Fig. 2 is the structured flowchart according to the packet order preserving system of the Multi-core of 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 are used for explanation the present invention, but are not used for limiting the scope of the invention.
Fig. 1 is the flow chart according to the message order-preserving method of the Multi-core of one embodiment of the present invention; With reference to Fig. 1, described method comprises:
S1: receive message that network interface card obtains and carry out mark according to received ordered pair message of message;
The mode of wherein, message being carried out mark is specifically as follows:
The direct marking serial numbers of Single NIC equipment adds 1 since 0 each test serial number;
Many network card equipments mark current time stamp;
S2: each CPU obtains respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
Wherein, the thread by correspondence is specially the step that message sorts:
To Single NIC equipment, corresponding thread sorts to message according to the sequence number of message;
To many network card equipments, corresponding thread sorts to message according to timestamp.
S3: after current message is processed, judge that (described previous message is according to received order to previous message, previous received message at current message) whether is forwarded, if, then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
Preferably, also comprise before the step S1:
S0: multi-core CPU (in the present embodiment, being provided with 8 hardware CPU) is the corresponding generation thread identical with described multi-core CPU quantity respectively.
Preferably, among the described step S2, the step that message is sorted is specially: S21:
If message be labeled as sequence number, then directly message is put into n node T on the corresponding global loops chained list n, n-1 node T on the corresponding described global loops chained list of previous message N-1Be specially: with the ordering sequence number of message divided by chained list length, with the remainder that obtains as this message corresponding node location on chained list; As the sequence number of establishing message is M, and the length of chained list is L, and then the node location of message on chained list namely got M divided by the remainder of L for=M mod L(); Concrete hypothesis M is that 23, L is 20, M mod L=3 then, and sequence number is the 3rd node location that 23 message is articulated in the global loops chained list.
If message be labeled as timestamp, then message is inserted on the global loops chained list more Zao than current message timestamp and with the node back of the immediate message of current message timestamp.
Preferably, specifically comprise among the step S3:
S31: after current message is processed, judge the node T on the described global loops chained list N-1Whether corresponding message is forwarded, if then the current message after the described processing is transmitted, otherwise waited for described node T N-1After corresponding message is forwarded, the more current message after the described processing is transmitted.
Preferably, each node all has state flag bit in the described global loops chained list, and described state flag bit is used for the state whether corresponding message of reflection node has been forwarded;
Among the step S31, judge described node T by described state flag bit N-1Whether corresponding message is forwarded.
The invention also discloses a kind of packet order preserving system of Multi-core, with reference to Fig. 2, described system comprises:
Message receiver module 201 be used for to receive message that network interface card obtains and message is carried out mark;
Multi-core CPU 202 comprises some CPU, is used for obtaining respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
Forwarding module 203 is used for judging whether previous message is forwarded after current message is processed, if, then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
Above execution mode only is used for explanation the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; in the situation that does not break away from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all technical schemes that are equal to 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. the message order-preserving method of a Multi-core is characterized in that, described method comprises:
S1: receive message that network interface card obtains and carry out mark according to received ordered pair message of message;
S2: each CPU obtains respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
S3: after current message is processed, judge whether previous message is forwarded, if then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
2. the method for claim 1 is characterized in that, also comprises before the step S1:
S0: multi-core CPU is the corresponding generation thread identical with described multi-core CPU quantity respectively.
3. the method for claim 1 is characterized in that, the step of among the described step S1 message being carried out mark is specially: the direct marking serial numbers of Single NIC equipment adds 1 since 0 each test serial number; Many network card equipments mark current time stamp.
4. method as claimed in claim 3 is characterized in that, among the described step S2, the thread by correspondence is specially the step that message sorts: to Single NIC equipment, corresponding thread sorts to message according to the sequence number of message; To many network card equipments, corresponding thread sorts to message according to timestamp.
5. method as claimed in claim 4 is characterized in that, among the described step S2, the step that message is sorted is specially: S21:
If message be labeled as sequence number, then directly message is put into n node T on the corresponding global loops chained list n, n-1 node T on the corresponding described global loops chained list of previous message N-1
If message be labeled as timestamp, then message is inserted on the global loops chained list more Zao than current message timestamp and with the node back of the immediate message of current message timestamp.
6. method as claimed in claim 5 is characterized in that, specifically comprises among the step S3: S31: after current message is processed, judge the node T on the described global loops chained list N-1Whether corresponding message is forwarded, if then the current message after the described processing is transmitted, otherwise waited for described node T N-1After corresponding message is forwarded, the more current message after the described processing is transmitted.
7. method as claimed in claim 6 is characterized in that, each node all has state flag bit in the described global loops chained list, and described state flag bit is used for the state whether corresponding message of reflection node has been forwarded;
Among the step S31, judge described node T by described state flag bit N-1Whether corresponding message is forwarded.
8. the packet order preserving system of a Multi-core is characterized in that, described system comprises:
The message receiver module be used for to receive message that network interface card obtains and carries out mark according to received ordered pair message of message;
Multi-core CPU comprises some CPU, is used for obtaining respectively message separately, and the thread by correspondence is to the message described message of reprocessing that sorts;
Forwarding module is used for judging whether previous message is forwarded after current message is processed, if, then the current message after the described processing is transmitted, otherwise after waiting for that described previous message is forwarded, the more current message after the described processing is transmitted.
CN201210305582.5A 2012-08-24 2012-08-24 The message order-preserving method of Multi-core and system Expired - Fee Related CN102868635B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210305582.5A CN102868635B (en) 2012-08-24 2012-08-24 The message order-preserving method of Multi-core and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210305582.5A CN102868635B (en) 2012-08-24 2012-08-24 The message order-preserving method of Multi-core and system

Publications (2)

Publication Number Publication Date
CN102868635A true CN102868635A (en) 2013-01-09
CN102868635B CN102868635B (en) 2016-02-17

Family

ID=47447235

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210305582.5A Expired - Fee Related CN102868635B (en) 2012-08-24 2012-08-24 The message order-preserving method of Multi-core and system

Country Status (1)

Country Link
CN (1) CN102868635B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103108256A (en) * 2013-03-08 2013-05-15 苏州工业园区云视信息技术有限公司 Method for removing jitter, disorder and repeated packets when receiving RTP packets
CN105227493A (en) * 2015-10-15 2016-01-06 上海斐讯数据通信技术有限公司 The method of data message forwarding performance is improved under multi-core platform
CN105827535A (en) * 2015-01-06 2016-08-03 普天信息技术有限公司 Packet forwarding method and device for hard-thread multi-core central processing unit
CN106130891A (en) * 2016-07-07 2016-11-16 汉柏科技有限公司 A kind of multi-core network device sends the method and device of message
WO2017198108A1 (en) * 2016-05-19 2017-11-23 中兴通讯股份有限公司 Method and device for processing fragment messages
CN107979535A (en) * 2017-10-31 2018-05-01 新华三技术有限公司 Message forwarding method and device
CN111083075A (en) * 2019-12-20 2020-04-28 盛科网络(苏州)有限公司 Method for processing message by multi-core SoC and SoC applying same
CN111143065A (en) * 2019-12-25 2020-05-12 杭州安恒信息技术股份有限公司 Data processing method, device, equipment and medium
CN111143088A (en) * 2019-12-18 2020-05-12 北京浩瀚深度信息技术股份有限公司 Method, device, equipment and storage medium for processing message disorder problem
CN111158911A (en) * 2019-12-27 2020-05-15 迈普通信技术股份有限公司 Processor configuration method and device, processor and network equipment
CN113053380A (en) * 2021-03-29 2021-06-29 海信电子科技(武汉)有限公司 Server and voice recognition method
CN113259274A (en) * 2021-06-11 2021-08-13 深圳市网是科技有限公司 Method for processing network message out-of-order and load balancing in multi-core mode and storage medium
CN114731334A (en) * 2020-02-14 2022-07-08 华为技术有限公司 Message order preserving method and device
CN116155828A (en) * 2022-12-21 2023-05-23 北京云豹创芯智能科技有限公司 Message order keeping method and device for multiple virtual queues, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101014001A (en) * 2006-11-13 2007-08-08 陈哲 RTP packet mending apparatus, RTP packet sorting method and complementing method
CN101175033A (en) * 2007-11-27 2008-05-07 中兴通讯股份有限公司 Message order-preserving method and device thereof
CN101291194A (en) * 2008-05-20 2008-10-22 华为技术有限公司 Method and system for keeping sequence of report
CN102546617A (en) * 2011-12-29 2012-07-04 汉柏科技有限公司 Method for forwarding internet protocol security (IP Sec) in multi-core multi-thread system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101014001A (en) * 2006-11-13 2007-08-08 陈哲 RTP packet mending apparatus, RTP packet sorting method and complementing method
CN101175033A (en) * 2007-11-27 2008-05-07 中兴通讯股份有限公司 Message order-preserving method and device thereof
CN101291194A (en) * 2008-05-20 2008-10-22 华为技术有限公司 Method and system for keeping sequence of report
CN102546617A (en) * 2011-12-29 2012-07-04 汉柏科技有限公司 Method for forwarding internet protocol security (IP Sec) in multi-core multi-thread system

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103108256A (en) * 2013-03-08 2013-05-15 苏州工业园区云视信息技术有限公司 Method for removing jitter, disorder and repeated packets when receiving RTP packets
CN105827535A (en) * 2015-01-06 2016-08-03 普天信息技术有限公司 Packet forwarding method and device for hard-thread multi-core central processing unit
CN105227493A (en) * 2015-10-15 2016-01-06 上海斐讯数据通信技术有限公司 The method of data message forwarding performance is improved under multi-core platform
WO2017198108A1 (en) * 2016-05-19 2017-11-23 中兴通讯股份有限公司 Method and device for processing fragment messages
CN107404446A (en) * 2016-05-19 2017-11-28 中兴通讯股份有限公司 A kind of method and device for handling fragment message
CN106130891A (en) * 2016-07-07 2016-11-16 汉柏科技有限公司 A kind of multi-core network device sends the method and device of message
CN107979535A (en) * 2017-10-31 2018-05-01 新华三技术有限公司 Message forwarding method and device
CN107979535B (en) * 2017-10-31 2021-03-02 新华三技术有限公司 Message forwarding method and device
CN111143088A (en) * 2019-12-18 2020-05-12 北京浩瀚深度信息技术股份有限公司 Method, device, equipment and storage medium for processing message disorder problem
CN111143088B (en) * 2019-12-18 2023-06-20 北京浩瀚深度信息技术股份有限公司 Message disorder problem processing method, device, equipment and storage medium
CN111083075A (en) * 2019-12-20 2020-04-28 盛科网络(苏州)有限公司 Method for processing message by multi-core SoC and SoC applying same
CN111143065A (en) * 2019-12-25 2020-05-12 杭州安恒信息技术股份有限公司 Data processing method, device, equipment and medium
CN111143065B (en) * 2019-12-25 2023-08-22 杭州安恒信息技术股份有限公司 Data processing method, device, equipment and medium
CN111158911A (en) * 2019-12-27 2020-05-15 迈普通信技术股份有限公司 Processor configuration method and device, processor and network equipment
CN114731334A (en) * 2020-02-14 2022-07-08 华为技术有限公司 Message order preserving method and device
CN114731334B (en) * 2020-02-14 2023-10-20 华为技术有限公司 Message order preserving method and device
CN113053380A (en) * 2021-03-29 2021-06-29 海信电子科技(武汉)有限公司 Server and voice recognition method
CN113053380B (en) * 2021-03-29 2023-12-01 海信电子科技(武汉)有限公司 Server and voice recognition method
CN113259274B (en) * 2021-06-11 2022-05-31 深圳市网是科技有限公司 Method for processing network message out-of-order and load balancing in multi-core mode and storage medium
CN113259274A (en) * 2021-06-11 2021-08-13 深圳市网是科技有限公司 Method for processing network message out-of-order and load balancing in multi-core mode and storage medium
CN116155828A (en) * 2022-12-21 2023-05-23 北京云豹创芯智能科技有限公司 Message order keeping method and device for multiple virtual queues, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN102868635B (en) 2016-02-17

Similar Documents

Publication Publication Date Title
CN102868635A (en) Multi-core and multi-thread method and system for preserving order of messages
CN102891809B (en) Multi-core network device message presses interface order-preserving method and system
CN102546424B (en) Message order-preserving method and device adopting same
US8949578B2 (en) Sharing of internal pipeline resources of a network processor with external devices
CN102710497A (en) Method and system for processing messages of multi-core and multi-thread network equipment
WO2021120374A1 (en) Message processing method, processing unit, and a virtual private network server
CN107733813B (en) Message forwarding method and device
CN102811176B (en) A kind of data flow control method and device
CN102932141A (en) Order-preserving method and system for encrypting and decrypting messages by multiple encryption and decryption chips in parallel
CN103532876A (en) Processing method and system of data stream
CN108768667B (en) Method for inter-chip network communication of multi-core processor
CN102801635A (en) Packet ordering method used in multi-core processor system
CN102970244A (en) Network message processing method of multi-CPU (Central Processing Unit) inter-core load balance
CN102868636A (en) Method and system for stream-based order preservation of multi-core network equipment packet
US9164771B2 (en) Method for thread reduction in a multi-thread packet processor
CN106941457B (en) The method and device of IP packet frament reassembling based on multi-core processor
CN101072224A (en) Method for realizing data sending based on binding link
CN102916902A (en) Method and device for storing data
WO2010072122A1 (en) Method, port and system for transmitting messages
CN104536928A (en) Data sorting method through multi-core PCIE accelerating daughter card
CN105763375A (en) Data packet transmission method, receiving method and microwave station
WO2008106879A1 (en) Data transfer process device and method
CN105871747B (en) Communication system downlink data transmission method and system
Dumazet Busy polling: Past, present, future
US20170046306A1 (en) Data processing method, processor, and data processing device

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
PP01 Preservation of patent right
PP01 Preservation of patent right

Effective date of registration: 20180823

Granted publication date: 20160217

PD01 Discharge of preservation of patent
PD01 Discharge of preservation of patent

Date of cancellation: 20210823

Granted publication date: 20160217

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: 20160217

Termination date: 20180824