CN104731735A - Method for achieving high-performance loopback device through reference counting - Google Patents

Method for achieving high-performance loopback device through reference counting Download PDF

Info

Publication number
CN104731735A
CN104731735A CN201510131122.9A CN201510131122A CN104731735A CN 104731735 A CN104731735 A CN 104731735A CN 201510131122 A CN201510131122 A CN 201510131122A CN 104731735 A CN104731735 A CN 104731735A
Authority
CN
China
Prior art keywords
reference count
loop back
back device
internal memory
ref
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.)
Pending
Application number
CN201510131122.9A
Other languages
Chinese (zh)
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.)
Inspur Group Co Ltd
Original Assignee
Inspur Group 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 Inspur Group Co Ltd filed Critical Inspur Group Co Ltd
Priority to CN201510131122.9A priority Critical patent/CN104731735A/en
Publication of CN104731735A publication Critical patent/CN104731735A/en
Pending legal-status Critical Current

Links

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method for achieving a high-performance loopback device through reference counting, and relates to the field of computer data transmission technologies and communication. A reference counting technology is adopted, releasing of data internal storage used by a sender is postponed, a receiver is made to directly use the internal storage applied by the sender, and then the internal storage is released. The main implementation processes include the steps that the sender sends the data, a retrieving device transmits the data, and the receiver receives the data. By means of the method, multiple times of data copying in the data transmitting process are avoided, the computer processing time is saved, the speed of data transmission from the sender to the receiver is increased, and the performance of a whole software system is improved.

Description

A kind of method utilizing reference count to realize high-performance loop back device
Technical field
The present invention relates to data transfer of computer technology and the communications field, is exactly a kind of method utilizing reference count to realize high-performance loop back device specifically.
Background technology
In data transfer of computer technology and the communications field, the communication process of the transmission data in system in conventional same system and reception data.Such as: when upper layer communication software development, loop back device first can be utilized to carry out data communication, can determine it is not that hardware net equipment is introduced when testing and finding defect, thus reduce scope to location defective locations, accelerate the speed of process defect.
Loop back device is used for the communication of data transmission in same system, data copy process in internal memory, more consuming time in computer system, tradition loop back device is when connecting data communication between sender and recipient, adopt first copies data in the buffer memory of loop back device, sender just completes process of transmitting, when recipient receives data from loop back device, data are needed to copy away from the buffer memory of loop back device, this processing mode needs repeatedly data copy, it is more consuming time for carrying out repeatedly data copy in computer systems, which, hydraulic performance decline can be caused obvious.
Summary of the invention
In order to reach the object realizing high-performance loop back device, propose a kind of method utilizing reference count to realize high-performance loop back device.
A kind of method utilizing reference count to realize high-performance loop back device of the present invention, the technical scheme solving the problems of the technologies described above employing is as follows: the method adopts reference counting technique, postpone the datarams that release sender uses, the internal memory allowing recipient directly use sender to apply for, and then releasing memory; Its main implementation process comprises sender and sends data, gains equipment transmission data and recipient receives data three steps.
Preferably, the method adopts reference counting technique, suppose that agreement reference count ref variable represents, often increase by one use internal memory person then reference count ref add 1, often reduce user then reference count ref subtract 1, represent when reference count ref is 0 and do not had user to continue to employ, then releasing memory when reference count ref is 0.
Preferably, sender uses the internal memory application function application internal memory containing reference count management, and sender uses this internal memory to deposit the data that will send, and now arranging reference count ref is 1.
Preferably, sender calls the transmission function transmission data that loop back device provides.
Preferably, reference count ref is added 1 by the transmission function of loop back device; Represent that loop back device is using this block internal memory as an internal memory user, now the value of reference count ref equals 2.
Preferably, loop back device sends function complete operate reference count ref in transmission function after, and the sender calling loop back device transmission function learns and sends successfully, then call the internal memory release function containing reference count management.
Preferably, the treatment step in internal memory release function: first reference count ref is subtracted 1, then judge whether reference count ref is 0, if reference count ref equals 0, discharges internal memory, if reference count ref is not equal to 0, inreal releasing memory.
Preferably, loop back device notification receiver receives data, and reference count ref is added 1 by recipient, and now the value of reference count ref equals 2; Then recipient receives data, usage data, and call the internal memory release function releasing memory containing reference count management after recipient finishes using, now the value of reference count ref equals 1, and recipient notifies that loop back device is disposed simultaneously.
Preferably, after recipient is disposed, loop back device does not re-use this block internal memory, then call the internal memory release function releasing memory containing reference count management; In the current internal memory release function operation process containing reference count management, after reference count ref is subtracted 1, the value of reference count ref equals 0, shows that internal memory really discharges.
The beneficial effect that a kind of method utilizing reference count to realize high-performance loop back device of the present invention compared with prior art has is: the method considers that loop back device is applied on same hardware system, adopt the dispose procedure of the mode managing internal memory of reference count, the internal memory that sender is applied for postpones release, avoid the repeatedly data copy in data transmission procedure, reduce repeatedly data copy and save computer processing time, improve the data rate between sender to recipient, improve the performance of whole software systems.
Accompanying drawing explanation
The schematic diagram of accompanying drawing 1 for utilizing reference count to realize the method for high-performance loop back device.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, below in conjunction with specific embodiment, and with reference to accompanying drawing, a kind of method utilizing reference count to realize high-performance loop back device of the present invention is further described.
A kind of method utilizing reference count to realize high-performance loop back device of the present invention, main consideration reduces repeatedly data copy and saves computer processing time, the internal memory adopting reference counting technique to make sender store data postpones release, the internal memory allowing recipient directly use sender to apply for, avoid the repeatedly data copy of traditional loop back device data transmission procedure, which reduce repeatedly the time of data copy, substantially increase software system performance.
Embodiment:
A kind of method utilizing reference count to realize high-performance loop back device described in the present embodiment, adopt reference counting technique, postpone the datarams that release sender uses, the internal memory allowing recipient directly use sender to apply for, and then releasing memory, which reduce repeatedly the time of data copy, greatly improve the handling property of loop back device.
This utilizes reference count to realize the method for high-performance loop back device, mainly comprises sender and sends data, gains equipment transmission data and recipient receives data three steps; Suppose that agreement reference count ref variable represents, often increase by one use internal memory person then reference count ref add 1, often reduce user then reference count ref subtract 1, represent when reference count ref is 0 and do not had user to continue to employ, then releasing memory when reference count ref is 0.
Utilize reference count to realize the method for high-performance loop back device described in the present embodiment, as shown in Figure 1, its concrete implementing procedure is as follows:
Sender uses the internal memory application function application internal memory containing reference count management, and sender uses this internal memory to deposit the data that will send, and now arranging reference count ref is 1, represents in this to have a user;
Sender calls the transmission function that loop back device provides, and sends data;
Reference count ref is added 1 by the transmission function of loop back device, and represent that loop back device is using this block internal memory as an internal memory user, reference count ref is added 1 and also just identifies current memory and can not be released, now the value of reference count ref equals 2.
Loop back device sends function complete operate reference count ref in transmission function after, and the sender calling loop back device transmission function learns and sends successfully, then call the internal memory release function containing reference count management.Treatment step in this internal memory release function first reference count ref is subtracted 1, then judges whether reference count ref is 0, if reference count ref equals 0, discharges internal memory, if reference count ref is not equal to 0, and inreal releasing memory.So the transmission function calling loop back device as sender is sent, then after calling the internal memory release function containing reference count management, now the value of reference count ref equals 1.
Loop back device notification receiver receives data, reference count ref is added 1 by recipient, now the value of reference count ref equals 2, then recipient receives data, usage data, call the internal memory release function releasing memory containing reference count management after recipient finishes using, now the value of reference count ref equals 1.Recipient is disposed after reception data described above and usage data, and notice loop back device is disposed.
After recipient is disposed, loop back device will not need to re-use this block internal memory yet, then call the internal memory release function releasing memory containing reference count management, in the current internal memory release function operation process containing reference count management, find that the value of reference count ref equals 0, so just internal memory has really been discharged after reference count ref is subtracted 1.
Comprehensive above flow process describes, from sender to loop back device, then from loop back device to recipient, whole data transmission procedure does not relate to data copy, also reach the data transmission object from sender to recipient, reduce repeatedly data copy and save computer processing time.
Above-mentioned embodiment is only concrete case of the present invention; scope of patent protection of the present invention includes but not limited to above-mentioned embodiment; any claims according to the invention and any person of an ordinary skill in the technical field to its suitable change done or replacement, all should fall into scope of patent protection of the present invention.

Claims (9)

1. utilize reference count to realize a method for high-performance loop back device, it is characterized in that, adopt reference counting technique, postpone the datarams that release sender uses, the internal memory allowing recipient directly use sender to apply for, and then releasing memory; Its main implementation process comprises sender and sends data, gains equipment transmission data and recipient receives data three steps.
2. a kind of method utilizing reference count to realize high-performance loop back device according to claim 1, it is characterized in that, the method adopts reference counting technique, suppose that agreement reference count ref variable represents, often increase by one use internal memory person then reference count ref add 1, often reduce user then reference count ref subtract 1, represent when reference count ref is 0 and do not had user to continue to employ, then releasing memory when reference count ref is 0.
3. a kind of method utilizing reference count to realize high-performance loop back device according to claim 2, it is characterized in that, sender uses the internal memory application function application internal memory containing reference count management, and sender uses this internal memory to deposit the data that will send, and now arranging reference count ref is 1.
4. a kind of method utilizing reference count to realize high-performance loop back device according to claim 3, is characterized in that, the transmission function that sender calls loop back device to be provided sends data.
5. a kind of method utilizing reference count to realize high-performance loop back device according to claim 4, it is characterized in that, reference count ref is added 1 by the transmission function of loop back device.
6. a kind of method utilizing reference count to realize high-performance loop back device according to claim 5, it is characterized in that, after loop back device operates reference count ref in transmission function, transmission function is complete, sender learns and sends successfully, then call the internal memory release function containing reference count management.
7. a kind of method utilizing reference count to realize high-performance loop back device according to claim 6, it is characterized in that, treatment step in internal memory release function: first reference count ref is subtracted 1, judge whether reference count ref is 0 again, if reference count ref equals 0, discharge internal memory, if reference count ref is not equal to 0, inreal releasing memory.
8. a kind of method utilizing reference count to realize high-performance loop back device according to claim 7, it is characterized in that, loop back device notification receiver receives data, reference count ref is added 1 by recipient, then recipient receives data, usage data, call the internal memory release function releasing memory containing reference count management after recipient finishes using, now the value of reference count ref equals 1, and recipient notifies that loop back device is disposed simultaneously.
9. a kind of method utilizing reference count to realize high-performance loop back device according to claim 8, it is characterized in that, after recipient is disposed, loop back device does not re-use this block internal memory, then call the internal memory release function releasing memory containing reference count management, after reference count ref is subtracted 1, the value of reference count ref equals 0, and internal memory really discharges.
CN201510131122.9A 2015-03-24 2015-03-24 Method for achieving high-performance loopback device through reference counting Pending CN104731735A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510131122.9A CN104731735A (en) 2015-03-24 2015-03-24 Method for achieving high-performance loopback device through reference counting

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510131122.9A CN104731735A (en) 2015-03-24 2015-03-24 Method for achieving high-performance loopback device through reference counting

Publications (1)

Publication Number Publication Date
CN104731735A true CN104731735A (en) 2015-06-24

Family

ID=53455640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510131122.9A Pending CN104731735A (en) 2015-03-24 2015-03-24 Method for achieving high-performance loopback device through reference counting

Country Status (1)

Country Link
CN (1) CN104731735A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330887A (en) * 2016-08-22 2017-01-11 苏州华兴源创电子科技有限公司 Data transmission method for multimedia transfer service

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178694A (en) * 2006-11-07 2008-05-14 莱克斯信息技术(北京)有限公司 Intel e1000 zero copy method
CN103617142A (en) * 2013-09-09 2014-03-05 南京邮电大学 High-speed network data collection method based on pf_ring
CN104239249A (en) * 2014-09-16 2014-12-24 国家计算机网络与信息安全管理中心 PCI-E (peripheral component interconnect-express) zero-copy DMA (direct memory access) data transmission method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178694A (en) * 2006-11-07 2008-05-14 莱克斯信息技术(北京)有限公司 Intel e1000 zero copy method
CN103617142A (en) * 2013-09-09 2014-03-05 南京邮电大学 High-speed network data collection method based on pf_ring
CN104239249A (en) * 2014-09-16 2014-12-24 国家计算机网络与信息安全管理中心 PCI-E (peripheral component interconnect-express) zero-copy DMA (direct memory access) data transmission method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
刘乐廷 等: ""IOS内存开发管理机制的研究"", 《计算机与现代化》 *
胡慧兰: ""基于嵌入式linux的设备管理研究及I2C驱动程序应用"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
蒋雪垠: ""基于ARM架构的IPv6数字视频服务器的研究与实现"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
鲁旭: ""通信领域中嵌入式操作系统平台相关算法研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330887A (en) * 2016-08-22 2017-01-11 苏州华兴源创电子科技有限公司 Data transmission method for multimedia transfer service
CN106330887B (en) * 2016-08-22 2019-10-29 苏州华兴源创科技股份有限公司 A kind of data transmission method for multimedia transfer service

Similar Documents

Publication Publication Date Title
CN104092717B (en) Message treatment method and system, message destination equipment
EP3852419A1 (en) Latency-sensitive network communication method and apparatus thereof
CN105682255B (en) It is a kind of based on without commander machine mode Beidou communication terminal ad hoc network method
JP6953401B2 (en) Methods and devices for sending and receiving paging messages in mobile communication systems
CN104581219A (en) Control method of stream media forwarding server
CN106407031A (en) Memory leak positioning method and electronic equipment
CN109002363A (en) A kind of event-handling method, device, equipment and readable storage medium storing program for executing
CN102014021A (en) Method and device for controlling connection/disconnection of data link
EP3584978B1 (en) Technique for storing softbits
CN101599987A (en) message queue management method and device
CN110022577A (en) Honeycomb IOT downlink business sending method, device and computer readable storage medium
CN101771718A (en) Clipboard synchronous method and system
CN104731735A (en) Method for achieving high-performance loopback device through reference counting
CN106874123A (en) The method and system of multiple line distance management WAP
WO2016123875A1 (en) Call management method for multi-system terminal, and multi-system terminal
CN106027419B (en) A kind of management method and device of data structure
CN102984739A (en) Breakdown information processing method and processing device
US11700189B2 (en) Method for performing task processing on common service entity, common service entity, apparatus and medium for task processing
CN101835274B (en) Loader establishing method, loader establishing target entity and loader establishing source entity
CN102299861B (en) A kind of message flux control method
CN101855839A (en) Method for doubly backing up files asynchronously
CN108243397B (en) Short message sending method and short message gateway equipment
KR101758337B1 (en) Method for preventing overlap notice of message, storing medium and user device implementing the same
CN103944875A (en) Data exchanging method and data exchanging system
CN103984544A (en) Method for preventing tasks from being simultaneously executed

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150624

WD01 Invention patent application deemed withdrawn after publication