CN103995736B - A kind of method and apparatus for transmitting shared drive - Google Patents

A kind of method and apparatus for transmitting shared drive Download PDF

Info

Publication number
CN103995736B
CN103995736B CN201310446221.7A CN201310446221A CN103995736B CN 103995736 B CN103995736 B CN 103995736B CN 201310446221 A CN201310446221 A CN 201310446221A CN 103995736 B CN103995736 B CN 103995736B
Authority
CN
China
Prior art keywords
shared drive
keyword
local memory
callee
function
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
CN201310446221.7A
Other languages
Chinese (zh)
Other versions
CN103995736A (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.)
Beijing Sursen Electronic Technology Co., Ltd.
Original Assignee
TIANJIN SCHOLAR SOFTWARE 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 TIANJIN SCHOLAR SOFTWARE TECHNOLOGY Co Ltd filed Critical TIANJIN SCHOLAR SOFTWARE TECHNOLOGY Co Ltd
Priority to CN201310446221.7A priority Critical patent/CN103995736B/en
Priority claimed from CN201110164503.9A external-priority patent/CN102253855B/en
Publication of CN103995736A publication Critical patent/CN103995736A/en
Application granted granted Critical
Publication of CN103995736B publication Critical patent/CN103995736B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)
  • Multi Processors (AREA)

Abstract

The embodiment of the invention discloses a kind of method and apparatus for transmitting shared drive.Wherein, the method for the transmission shared drive includes:Call function creates shared drive using the local memory address of caller process as keyword and using described shared drive keyword as parameter constructor call statement;Described function call sentence is sent to callee process, so that callee process analytical function call statement obtains shared drive, data exchange is realized.Using method and apparatus provided in an embodiment of the present invention, it is possible to achieve the unification of local memory both data exchange ways in the shared drive and process between process, the synchronism of data exchange is improved.

Description

A kind of method and apparatus for transmitting shared drive
This case is Application No. 201110164503.9(A kind of method and apparatus for transmitting shared drive), the applying date is 2011.6.17 Chinese patent application divisional application.
Technical field
The present invention relates to Data Interchange Technology, more particularly to a kind of method and apparatus for transmitting shared drive.
Background technology
Traditional local memory transfer mode is generally limited only to the inside of a process, is because operating system To run on the virtual memory space that process therein provides be identical by each, and between virtual memory and physical memory Mapping completely by operating system control, program process can only access actual storage in physics by virtual memory address Data in depositing.As can be seen here, even identical virtual memory address, the corresponding physical memory in different processes Can also be entirely different, therefore data can not be transmitted by local memory between different processes.
In order to improve the efficiency of Data Exchange, simplify the flow of interprocess communication, most of operating systems all can The inter-process communication mechanisms of shared drive are provided.Described shared drive is not to mark off what is come from the internal memory of a certain process, But one piece of region of memory that can be shared for multiple processes is opened up in the physical memory of system, because the internal memory of each process Always privately owned, the purpose for setting up shared drive is desirable to each process for accessing it and connects it, and this connection procedure is referred to as Mapping.System distributes the local memory address of each process when setting up shared drive to shared drive, each process it is local Memory address may be connected to corresponding shared drive.Shared drive is respectively mapped to each process respective local Memory headroom, so as to realize the data exchange based on shared drive between multiple processes.
Fig. 1 is transmits the schematic diagram of shared drive in the prior art, as shown in Figure 1:There are two processes in same system (Process A and process B)It is currently running, wherein process A is expected that by access shared drive and process B information is called to realize, In this case, process A can be referred to as caller process, and process B can be referred to as callee process.Specifically, process A Calling process B method is as follows:
Step 1:Process A applies for a shared drive;
Step 2:System specifies a shared drive keyword according to process A application(0X00)Set up shared drive (0X00), and process A and process B are informed by certain mode;
In this step, shared drive keyword can be informed process A and process B by system in the following way:
When A, system use special file with anonymous way establishment shared drive, operating system will be shared by special file Internal memory keyword(0X00)Process A and process B are informed, still, this mode is typically only applicable to have akin process Between.For example, first calling mmap functions in parent process, fork functions are recalled, then after parent process calls fork functions, Subprocess inherits the local memory address after parent process anonymity mapping;
B, system can also specify same public head file, the public head file in the command line parameter of compiler Include shared drive keyword(0X00), and process A and process B are informed simultaneously, it is still, shared interior with one in keyword Deposit in the case of being combined, any operation for attempting to create shared drive of the same name can all fail, and now, system must handle this Failure, deletes existing shared drive, then again attempts to create so that flow is more complicated, and may need repeatedly to taste Examination;
In order to solve the problems, such as shared drive of the same name, process A and process B arrange a pathname and item id(One between 0 Character value between to 255), process A calls fork functions, and the two values are transformed into a keyword, and system is closed according to this Key word creates shared drive;But, this mode is typically only capable to be applied to class UNIX operating system, and is only limitted to the road of system Footpath and item id are known;
Step 3:Process A is shared drive(0X00)Connection(Map)To the local memory address of oneself(That is process A's Local memory address 0X003D2C8);Process B is shared drive(0X00)Mapping(Connect)To the local memory address of oneself (That is process B local memory address 0X0024C28), shared drive is based between process A and process B so as to realize(0X00)'s Data exchange.
From technical scheme disclosed in above-mentioned prior art, it can be seen that system not only needs when creating shared drive Rely on special file system, it is possible to there is the situation that shared drive creates failure, meanwhile, process A and process B must lead to Cross shared drive keyword to merge with shared drive, then shared drive is mapped to respective local memory address, process CIMS Complexity, is easily caused the asynchronism of shared drive data exchange between process.And the asynchronism of this Data Exchange It is because the disunity of local memory data exchanged form is caused in shared drive data exchange and process between process.
The content of the invention
In view of this, the embodiments of the invention provide a kind of method and apparatus for transmitting shared drive, process can be realized Between in shared drive and process both data exchange ways of local memory unification, shared drive data exchange between raising process Synchronism.
To achieve the above object, the embodiment of the present invention is adopted the following technical scheme that.
A kind of method for transmitting shared drive, including:
Call function is created shared drive using the local memory address of caller process as keyword and is total to described Internal memory keyword is enjoyed for parameter constructor call statement;
Described function call sentence is sent to callee process, so that callee process analytical function calls language Sentence obtains shared drive.
The embodiment of the present invention additionally provides a kind of device for realizing transmission shared drive method, applied to caller process Side, including:
First module, shared drive is created using the local memory address of caller process as keyword for call function And using described shared drive keyword as parameter constructor call statement;
Second module, for described function call sentence to be sent into callee process, for callee process Analytical function call statement obtains shared drive.
The embodiment of the present invention additionally provides a kind of device for realizing transmission shared drive method, applied to callee process Side, including:
First module, for receiving the function call sentence from caller process, wherein the function call sentence Building mode is:Call function creates shared drive using the local memory address of caller process as keyword and with described Shared drive keyword builds for parameter;
Second module, shared drive is obtained for analytical function call statement.
The embodiment of the present invention is created in shared by call function directly by shared drive keyword of local memory address Deposit, the uniformity of shared drive keyword and local memory address is kept in this way, makes created shared drive can It is connected with the local memory directly with caller process, caller process need not be according to shared drive keyword and shared drive It can merge and shared drive is mapped to local memory, so that it is transparent between caller process local memory and shared drive, this Ground internal storage data content can be copied directly to shared drive;
Meanwhile, the embodiment of the present invention calls language further through call function using shared drive keyword as parameter constructor Sentence, and function call sentence is sent to callee process for its acquisition shared drive so that callee process is locally interior Deposit access and be subject to unification in function interface aspect with shared internal storage access;
Therefore, technical scheme provided in an embodiment of the present invention can ensure between process the transmission data mode of shared drive and The unification of the transmission data mode of local memory, simplifies the flow of data exchange in process, improves the synchronization of data exchange Property.
Brief description of the drawings
Fig. 1 is the schematic diagram for transmitting shared drive in the prior art;
Fig. 2 is the method flow diagram of transmission shared drive in the embodiment of the present invention;
Fig. 3 is the schematic diagram of transmission shared drive in the embodiment of the present invention;
Fig. 4 is the method flow diagram of transmission shared drive in the embodiment of the present invention.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, the present invention is done further below in conjunction with the accompanying drawings Detailed description.
In order to realize the unification of the data mode of local memory in shared drive and process between process, the embodiment of the present invention is carried A kind of method of the transmission shared drive supplied, is specifically included:The local memory address of call function using caller process is used as pass Keyword creates shared drive and using described shared drive keyword as parameter constructor call statement;Described function is adjusted Callee process is sent to sentence, so that callee process analytical function call statement obtains shared drive, so that real Data exchange between existing process.
Fig. 2 is a kind of method flow diagram for transmitting shared drive provided in an embodiment of the present invention;As shown in Fig. 2 this method Including:
Step 201:Caller process call function creates shared drive using local memory address as keyword;
Described function includes shmat, and shmdt, shmget, shmctl etc. can create the function of shared drive;It is described Local memory address can be caller process textual form local memory address;Described shared drive is to be An application heap that can be shared for multiple processes is set up in system physical memory;
In this step, caller process creates shared drive by keyword of local memory address using function, is created The shared drive built can be directly with caller process local memory be connected, caller process need not be closed according to shared drive Keyword can merge with shared drive is mapped to local memory by shared drive, so that caller process local memory is interior with sharing It is transparent between depositing.
Step 202:Caller process call function calls language using described shared drive keyword as parameter constructor Sentence, and it is sent to callee process by inter-process communication mechanisms;
Here, it is pointed out that:Goal of the invention just because of the present invention is to ensure that shared drive and local memory The uniformity of address, so that the data directly invoked by function in shared drive are realized, and local memory data is handed in process Change is directly to be realized by the data of function call local memory, then only by call function with caller process Local memory address creates shared drive as keyword, just can guarantee that local memory data is exchanged between process altogether in process Enjoy the unification of internal storage data exchanged form.If caller process sets up shared drive using non-functional mode, although Ke Yishi The establishment of existing shared drive, but be due to that follow-up shared drive keyword can not be transmitted directly to be called by functional form Person's process, but caller process must inform callee process by other pipelines, so cause caller process in wound Build that shared drive is asynchronous with transmission shared drive keyword, so cause that callee process and shared drive merge it is stagnant Afterwards.
Step 203:The shared drive keyword that callee process is provided according to function call statement parameter with it is shared in Congregation is deposited, the information of shared drive is obtained(Described information includes shared drive name and/or address), pass through shared drive information Obtain shared drive.
Step 204:Shared drive is mapped to the local memory address of callee process by callee process.
Step 205:Callee process performs the letter that callee process is locally called according to function call sentence Number, and implementing result is write into shared drive and function return statement, function return statement is returned by inter-process communication mechanisms Return to caller process.
Step 206:Caller process will be returned in shared drive by the data content direct copying that callee process updates Local memory.
Above-mentioned steps constitute once shared drive data exchange process between complete process, and citing below further illustrates this The embodiment of invention, Fig. 3 is the schematic diagram of transmission shared drive in the embodiment of the present invention, as shown in figure 3, caller enters Journey is in order that the part of functions provided with callee process, first calls a local function, the function is with local memory Address 01AA0314 is that keyword sets up shared drive 01AA0314, and local memory data content is copied into shared drive, Meanwhile, the function passes through interprocess communication machine again using shared drive keyword 01AA0314 as parameter constructor call statement System passes to callee process, and callee process analytical function call statement therefrom obtains shared drive name, and will altogether Enjoy internal memory and be mapped to callee process local memory address, hereafter will access to enter with caller as accessing local memory The shared memory headroom of journey.
Specifically, the implementation process of this method is as shown in Figure 4:
Step 401:Caller process calls local shmat functions;
Step 402:The character string 01AA0314 of described shmat functions using caller process local memory address is used as pass Key word creates shared drive 01AA0314, and caller process directly can copy to the data content in local memory in shared In depositing;
Step 403:Described shmat functions are adjusted by parameter constructor of described shared drive keyword 01AA0314 With sentence, described function call sentence is sent to callee process by inter-process communication mechanisms;
Step 404:Callee process receives the function call sentence from caller process, is adjusted according to described function The keyword 01AA0314 of shared drive is parsed with statement parameter 01AA0314;
Step 405:Callee process is merged by described shared drive keyword 01AA0314 and shared drive, is obtained To shared drive name 01AA0314;
Step 406:Shared drive 01AA0314 with being mapped to the local memory of callee process by callee process Location 0001E98;
Step 407:The locally called function of callee process is performed, the called function enters with caller The function that journey is called is corresponding, can include shmat functions or other corresponding functions;
Step 408:Implementing result is write shared drive 01AA0314 by the called function, and constructor is returned Sentence, caller process is passed to by inter-process communication mechanisms;
Step 409:Caller process will be returned in shared drive by the data content direct copying that callee process updates Local memory.
The technical scheme that the present invention is provided is compared to the method tool that data are transmitted between other processes by Sharing Memory Realization There is significant advantage:
Caller process establishment shared drive directly by shared drive keyword of local memory address using function, can be with The uniformity of shared drive keyword and local memory address is kept, created shared drive is directly entered with caller The local memory connection of journey, caller process need not can merge shared drive according to shared drive keyword with shared drive Local memory is mapped to, so that transparent between caller process local memory and shared drive, local memory data content can To be copied directly to shared drive;
Meanwhile, caller process uses function that shared drive keyword is concurrent as parameter constructor call statement again Callee process is given, the keyword of shared drive is transmitted by function call sentence so that local memory is accessed with sharing Internal storage access is subject to unification in function interface aspect.
As can be seen here, the technical scheme that provides of the present invention can ensure between process the transmission data mode of shared drive and enter The unification of the transmission data mode of local memory, simplifies the flow of data exchange in journey, improves the synchronism of data exchange.
The embodiment of the present invention additionally provides a kind of device for transmitting shared drive, applied to caller process side, including:
First module, shared drive is created using the local memory address of caller process as keyword for call function And using described shared drive keyword as parameter constructor call statement;
Second module, for described function call sentence to be sent into callee process, for callee process Analytical function call statement obtains shared drive.
The device further comprises:
3rd module, for user will to be adjusted back by the data content direct copying that callee process updates in shared drive The local memory address of process.
The embodiment of the present invention additionally provides a kind of device for transmitting shared drive, applied to callee process side, including:
First module, for receiving the function call sentence from caller process, wherein the function call sentence Building mode is:Call function creates shared drive using the local memory address of caller process as keyword and with described Shared drive keyword builds for parameter;
Second module, shared drive is obtained for analytical function call statement.
Second module includes:
First module:Parameter for analytical function call statement therefrom obtains shared drive keyword;
Second unit:For shared drive keyword and shared drive to be merged, and shared drive is mapped to called The local memory address of person's process.
The device further comprises:
3rd module:Called for function implementing result to be write into shared drive, and returned to by function return statement Person's process.
Presently preferred embodiments of the present invention is these are only, is not intended to limit the scope of the present invention.It is all the present invention Within spirit and principle, any modification, equivalent substitution and improvements done etc. should be included in the scope of the protection.

Claims (6)

1. a kind of method for transmitting shared drive, it is characterised in that:
Call function is created shared drive using the local memory address of caller process as keyword and shares interior with described Keyword is deposited for parameter constructor call statement, the local memory address of the caller process is the internal memory of textual form Address;
Described function call sentence is sent to callee process, so that callee process analytical function call statement is obtained Take shared drive;
Callee process performs the function that callee process is locally called, and will perform knot according to function call sentence Fruit write-in shared drive, caller process is returned to by function return statement;
Caller process will adjust back user's process in shared drive by the data content direct copying that callee process updates Local memory address.
2. according to the method described in claim 1, it is characterised in that the callee process analytical function call statement is obtained Shared drive includes:
The parameter of callee process analytical function call statement therefrom obtains shared drive keyword;
Shared drive keyword and shared drive are merged, and shared drive is mapped to the local memory of callee process Location.
3. a kind of device for transmitting shared drive, it is characterised in that applied to caller process side, including:
First module, created for call function using the local memory address of caller process as keyword shared drive and with Described shared drive keyword is parameter constructor call statement, and the local memory address of the caller process is text The memory address of change form;
Second module, for described function call sentence to be sent into callee process, so that callee process is parsed Function call sentence obtains shared drive;
3rd module, for user's process will to be adjusted back by the data content direct copying that callee process updates in shared drive Local memory address.
4. a kind of device for transmitting shared drive, it is characterised in that applied to callee process side, including:
First module, for receiving the function call sentence from caller process, wherein the structure of the function call sentence Mode is:Call function is created shared drive using the local memory address of caller process as keyword and shared with described Internal memory keyword builds for parameter, and the local memory address of the caller process is the memory address of textual form;
Second module, shared drive is obtained for analytical function call statement.
5. device according to claim 4, it is characterised in that second module includes:
First module:Parameter for analytical function call statement therefrom obtains shared drive keyword;
Second unit:For shared drive keyword and shared drive to be merged, and shared drive is mapped into callee to enter The local memory address of journey.
6. the device according to claim 4 or 5, it is characterised in that further comprise:
3rd module:For function implementing result to be write into shared drive, and caller is returned to by function return statement to enter Journey.
CN201310446221.7A 2011-06-17 2011-06-17 A kind of method and apparatus for transmitting shared drive Active CN103995736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310446221.7A CN103995736B (en) 2011-06-17 2011-06-17 A kind of method and apparatus for transmitting shared drive

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310446221.7A CN103995736B (en) 2011-06-17 2011-06-17 A kind of method and apparatus for transmitting shared drive
CN201110164503.9A CN102253855B (en) 2011-06-17 2011-06-17 A kind of method and apparatus transmitting shared drive

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201110164503.9A Division CN102253855B (en) 2011-06-17 2011-06-17 A kind of method and apparatus transmitting shared drive

Publications (2)

Publication Number Publication Date
CN103995736A CN103995736A (en) 2014-08-20
CN103995736B true CN103995736B (en) 2017-09-22

Family

ID=51309912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310446221.7A Active CN103995736B (en) 2011-06-17 2011-06-17 A kind of method and apparatus for transmitting shared drive

Country Status (1)

Country Link
CN (1) CN103995736B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104318476B (en) * 2014-11-06 2019-04-26 中国建设银行股份有限公司 A kind of information processing method and device
CN109426571B (en) * 2017-08-28 2022-05-13 阿里巴巴集团控股有限公司 Method, system, storage medium, processor and apparatus for function call and data access
CN115119048B (en) * 2019-08-10 2024-02-23 荣耀终端有限公司 Video stream processing method and electronic equipment
CN111125070A (en) * 2019-11-19 2020-05-08 华迪计算机集团有限公司 Data exchange method and platform

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (en) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 Universal interprocess communication achieving method
JP2009065713A (en) * 2008-12-08 2009-03-26 Ricoh Co Ltd Image forming apparatus, shared memory arbitrating method, program and recording medium
CN102004675A (en) * 2010-11-11 2011-04-06 福建星网锐捷网络有限公司 Cross-process data transmission method, device and network equipment
CN102253855B (en) * 2011-06-17 2016-04-13 天津书生软件技术有限公司 A kind of method and apparatus transmitting shared drive

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7376860B2 (en) * 2004-12-16 2008-05-20 International Business Machines Corporation Checkpoint/resume/restart safe methods in a data processing system to establish, to restore and to release shared memory regions

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (en) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 Universal interprocess communication achieving method
JP2009065713A (en) * 2008-12-08 2009-03-26 Ricoh Co Ltd Image forming apparatus, shared memory arbitrating method, program and recording medium
CN102004675A (en) * 2010-11-11 2011-04-06 福建星网锐捷网络有限公司 Cross-process data transmission method, device and network equipment
CN102253855B (en) * 2011-06-17 2016-04-13 天津书生软件技术有限公司 A kind of method and apparatus transmitting shared drive

Also Published As

Publication number Publication date
CN103995736A (en) 2014-08-20

Similar Documents

Publication Publication Date Title
CN102253855B (en) A kind of method and apparatus transmitting shared drive
CN109324787A (en) A kind of business software development approach, device and terminal device
CN103761082A (en) Componential research and development mode and domain driving model combined application development system and platform
CN103995736B (en) A kind of method and apparatus for transmitting shared drive
CN107426152B (en) Multitask security isolation system and method under cloud platform actual situation Interconnection Environment
CN105956444A (en) Private application display method and device and terminal equipment
EP1830261B1 (en) Method and apparatus for data transfer between isolated execution contexts
CN108322307A (en) Communication system and method between container based on kernel memory sharing
CN108319849A (en) Equipment strategy management system based on Android twin containers system and management domain implementation method
US20070250419A1 (en) Invoice adjustment data object for a common data object format
CN103678163B (en) Switching method, the apparatus and system of data flow
CN107368336A (en) A kind of cloud data center deployed with devices and the method and apparatus of management
CN101315657A (en) Safe input method in Windows system
CN107370623A (en) A kind of method and device for realizing system installation
CN101071373A (en) Software interface processing method and device
CN106776063A (en) Mobile terminal, container telephonic communication function realizing method and across container communication means
CN103546527B (en) A kind of extendible industrial configuration or simulation software communication method
CN108429770A (en) A kind of server and client data shielding system and data transmission method
JPH09507595A (en) Home banking system
CN115622878A (en) Method and device for realizing k8s network bridge plug-in, electronic equipment and readable storage medium
CN109560969A (en) Configuration method, ONU terminal and the storage medium of the ONU network port
CN110581848B (en) Cloud desktop multi-network isolation system and method
CN108052315A (en) Medical software communication means and device
CN104079628B (en) Power grid service system integrated remote adjusting and control information interaction method
Abadi et al. Computational secrecy by typing for the pi calculus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20181207

Address after: 100029 Changxin Building 408-409, 39 Anding Road, Chaoyang District, Beijing

Patentee after: Beijing Sursen Electronic Technology Co., Ltd.

Address before: 300308 Tianjin Binhai New Area Airport Economic Zone

Patentee before: Tianjin Scholar Software Technology Co., Ltd.

TR01 Transfer of patent right