CN106980551A - A kind of Way of Process Communication and device - Google Patents

A kind of Way of Process Communication and device Download PDF

Info

Publication number
CN106980551A
CN106980551A CN201710181610.XA CN201710181610A CN106980551A CN 106980551 A CN106980551 A CN 106980551A CN 201710181610 A CN201710181610 A CN 201710181610A CN 106980551 A CN106980551 A CN 106980551A
Authority
CN
China
Prior art keywords
data
written
shared drive
write
reading
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
CN201710181610.XA
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.)
Shandong Inspur Business System Co Ltd
Original Assignee
Shandong Inspur Business System 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 Shandong Inspur Business System Co Ltd filed Critical Shandong Inspur Business System Co Ltd
Priority to CN201710181610.XA priority Critical patent/CN106980551A/en
Publication of CN106980551A publication Critical patent/CN106980551A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)

Abstract

The invention provides a kind of Way of Process Communication and device, this method includes:It is pre-created the shared drive of fixed size;Receive at least one and write into the data to be written that journey is sent respectively;By the data storage to be written into the shared drive;Receive the reading instruction that at least one reading process is sent respectively;According to the reading instruction, data needed for being obtained in the shared drive;The required data are sent to corresponding reading process, so that the reading process reads the required data;Wherein, when by the data storage to be written to the shared drive, if the residual memory space coexisted is not enough, the required data read using the data to be written to the reading process are covered.This programme can save memory headroom.

Description

A kind of Way of Process Communication and device
Technical field
The present invention relates to communication technical field, more particularly to a kind of Way of Process Communication and device.
Background technology
Nowadays, for the speed of service of the terminals such as raising mobile phone, computer, the operating system in terminal need to be run simultaneously Multiple processes.But, different processes is operated in different memory headrooms, is mutually independent, so to make different processes Can co-ordination, need that data are transmitted or exchanged by communicating between different processes.Shared drive is different interprocess communications Shi Changyong medium.
At present, when being communicated between different processes using shared drive, reading process has been read out from shared drive Data can be also retained in shared drive.So, when the data volume for needing to transmit is larger, the number read due to reading process According to that can be retained in shared drive, so being initially required the shared drive of establishment larger space.It can be seen that, existing process communication Method will take larger memory headroom.
The content of the invention
The embodiments of the invention provide a kind of Way of Process Communication and device, memory headroom can be saved.
In a first aspect, the embodiments of the invention provide a kind of Way of Process Communication, being pre-created the shared interior of fixed size Deposit;Also include:
Receive at least one and write into the data to be written that journey is sent respectively;
By the data storage to be written into the shared drive;
Receive the reading instruction that at least one reading process is sent respectively;
According to the reading instruction, data needed for being obtained in the shared drive;
The required data are sent to corresponding reading process, so that the reading process reads the required data;
Wherein, when by the data storage to be written to the shared drive, if the remaining storage coexisted Insufficient space, the required data read using the data to be written to the reading process are covered.
Preferably,
Further comprise:Create a mutual exclusion lock;Wherein, the mutual exclusion lock is used to authorize the reading process and described write into The read right and write permission of journey respectively to the shared drive;
It is described by the data storage to be written into the shared drive, including:
From it is described at least one write into journey in determine to have got the first process of the mutual exclusion lock;
The data storage to be written that first process received is sent reclaims described into the shared drive Mutual exclusion lock;
It is described that required data are obtained in the shared drive according to the reading instruction, including:
Determine to have got the second process of the mutual exclusion lock from least one described reading process;
The reading instruction sent according to second process received, data needed for being obtained in the shared drive, and After second process reads the required data, the mutual exclusion lock is reclaimed.
Preferably,
It is described from it is described at least one write into journey in determine to have got the first process of the mutual exclusion lock before, enter one Step includes:
Time point is received it is determined that receiving and the first of the data to be written that journey is sent respectively being write into described in each;
It is determined that receive the reading instruction that each described reading process is sent respectively second receives time point;
Determine that each described first minimum received in time point and the second reception time point receives time point;
The mutual exclusion lock is distributed into the minimum time point corresponding reading process/write into journey of receiving.
Preferably,
Further comprise:The data initial address and data termination address of the shared drive are set;
The required data read using the data to be written to the reading process are covered, including:
Obtain the current write pointer and current read pointer of the shared drive;
, to the circular order of the data termination address, judge the current write pointer according to from the data initial address Whether the size to the region between the current read pointer is not less than the size of the data to be written, if it is, by institute State data to be written to be written in the region, and the required data read in the region are covered.
Preferably,
The data to be written are written in the region described, and it is described required to what is read in the region After data are covered, further comprise:
According to the size of the data to be written, the current write pointer of the shared drive is updated.
Second aspect, the embodiments of the invention provide a kind of process communication device, including:
First creating unit, the shared drive for being pre-created fixed size;
Data write unit, the data to be written that journey is sent respectively are write into for receiving at least one, and will be described to be written Enter data storage into the shared drive;
Data-reading unit, for receiving the reading instruction that at least one reading process is sent respectively, according to the reading instruction, Data needed for being obtained in the shared drive, and the required data are sent to corresponding reading process, so that the reading process Read the required data;
Data cover unit, for when by the data storage to be written to the shared drive, if described shared common The residual memory space deposited is not enough, and the required data read using the data to be written to the reading process are covered Lid.
Preferably,
Further comprise:Second creating unit, for creating a mutual exclusion lock;Wherein, the mutual exclusion lock is used to authorize institute State reading process and the read right and write permission for writing into journey respectively to the shared drive;
The data write unit, specifically for from it is described at least one write into journey in determine to have got the mutual exclusion lock The first process;The data storage to be written that first process received is sent is reclaimed into the shared drive The mutual exclusion lock;
The data-reading unit, specifically for determining to have got the mutual exclusion lock from least one described reading process The second process;The reading instruction sent according to second process received, data needed for being obtained in the shared drive, And after second process reads the required data, reclaim the mutual exclusion lock.
Preferably,
Further comprise:Mutual exclusion lock allocation unit, write into that journey sends respectively described in each for determining to receive treats Write data first receives time point;It is determined that receive the reading instruction that each described reading process is sent respectively second receives Time point;Determine that each described first minimum received in time point and the second reception time point receives time point;By institute State mutual exclusion lock and distribute to the minimum time point corresponding reading process/write into journey of receiving.
Preferably,
Further comprise:Setting unit, data initial address and data termination address for setting the shared drive;
The data cover unit, current write pointer and current read pointer specifically for obtaining the shared drive;Press According to, to the circular order of the data termination address, judging the current write pointer to described current from the data initial address Whether the size in the region between read pointer is not less than the size of the data to be written, if it is, by the number to be written According to being written in the region, and to read in the region it is described needed for data cover.
Preferably,
Further comprise:Pointer updating block, for the size according to the data to be written, to the shared drive Current write pointer is updated.
The embodiments of the invention provide a kind of Way of Process Communication and device, the shared drive of fixed size is pre-created, Wherein, to save memory headroom, the shared drive can be more relatively small, afterwards for every time depositing the data to be written for writing into journey When storage is to shared drive, if the residue in the shared drive in addition to the data that reading process has been read and the data not read also During memory space inadequate, data storage can be written into residual memory space and using remaining data to be written to having read The data taken are covered, and so as to recycle the shared drive of the fixed size, save memory headroom.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the accompanying drawing used required in technology description to be briefly described, it should be apparent that, drawings in the following description are the present invention Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 is a kind of flow chart for Way of Process Communication that one embodiment of the invention is provided;
Fig. 2 is a kind of flow chart for Way of Process Communication that another embodiment of the present invention is provided;
Fig. 3 is a kind of structural representation for shared drive that one embodiment of the invention is provided;
Fig. 4 is a kind of structural representation for shared drive that another embodiment of the present invention is provided;
Fig. 5 is the hardware architecture diagram of equipment where process communication device provided in an embodiment of the present invention;
Fig. 6 is a kind of structural representation for process communication device that one embodiment of the invention is provided;
Fig. 7 is a kind of structural representation for process communication device that another embodiment of the present invention is provided;
Fig. 8 is a kind of structural representation for process communication device that another embodiment of the invention is provided;
Fig. 9 is a kind of structural representation for process communication device that further embodiment of the present invention is provided;
Figure 10 is a kind of structural representation for process communication device that further embodiment of the present invention is provided.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is A part of embodiment of the present invention, rather than whole embodiments, based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained on the premise of creative work is not made, belongs to the scope of protection of the invention.
As shown in figure 1, the embodiments of the invention provide a kind of Way of Process Communication, this method may comprise steps of:
Step 101:It is pre-created the shared drive of fixed size.
Step 102:Receive at least one and write into the data to be written that journey is sent respectively.
Step 103:By the data storage to be written into the shared drive, if the remaining storage coexisted Insufficient space, the required data read using the data to be written to the reading process are covered.
Step 104:Receive the reading instruction that at least one reading process is sent respectively.
Step 105:According to the reading instruction, data needed for being obtained in the shared drive.
Step 106:The required data are sent to corresponding reading process, so that the reading process reads the required number According to.
In embodiments of the present invention, the shared drive of fixed size is pre-created, wherein, to save memory headroom, this is total to Enjoying internal memory can be more relatively small, afterwards for every time by data storage to be written to the shared drive for writing into journey when, if this is common Enjoy in internal memory residual memory space in addition to the data that reading process has been read and the data not read also it is not enough when, can will be to be written Enter data storage to cover the data read to residual memory space and using remaining data to be written, so as to To recycle the shared drive of the fixed size, memory headroom is saved.
In an embodiment of the invention, further comprise:Create a mutual exclusion lock;Wherein, the mutual exclusion lock is used to award Give the reading process and the read right and write permission for writing into journey respectively to the shared drive;The step 103 it is specific Embodiment, including:From it is described at least one write into journey in determine to have got the first process of the mutual exclusion lock;It will receive The data storage to be written that sends of first process into the shared drive, and reclaim the mutual exclusion lock;The step 105 embodiment, including:Determine that got the mutual exclusion lock second enters from least one described reading process Journey;The reading instruction sent according to second process received, data needed for being obtained in the shared drive, and described Second process is read after the required data, reclaims the mutual exclusion lock.
For example, there are 3 to write into journey (journey a is write into, journey b is write into and writes into journey c) and 1 is read process (d), it is assumed that journey b is write into Get mutual exclusion lock, then writing into journey a, writing into journey c and reading process d just can enter blocked state, until getting mutual exclusion lock It can just unblock, that is, can only there is a process to carry out read operation or write operation every time, it is further assumed that journey b acquisitions are write into recovery After the mutual exclusion lock arrived, the mutual exclusion lock is got by reading process d, is now write into journey a, is write into journey c still in blocked state, and read into Journey d is unblocked, and the data in shared drive can be read.
In an embodiment of the invention, it is described from it is described at least one write into journey in determine to have got the mutual exclusion Before first process of lock, further comprise:The data to be written that journey is sent respectively are write into described in each it is determined that receiving First receives time point;It is determined that receive the reading instruction that each described reading process is sent respectively second receives time point;Really Each fixed described first minimum received in time point and the second reception time point receives time point;By the mutual exclusion lock point Minimum reception time point corresponding reading process described in dispensing/write into journey.
For example, determine write into journey a, write into journey b it is corresponding with journey c is write into first reception time point be followed successively by 2017/1/1/ 08:01:41、2017/1/1/08:01:00、2017/1/1/08:02:01, it is determined that the process of reading d corresponding second receives time point For 2017/1/1/08:01:30, it is seen then that 2017/1/1/08:01:00 is that this four minimums (morning) received in time point are received Time point, therefore mutual exclusion lock is distributed to write into journey b, then after process b completes write operation and reclaims mutual exclusion lock, then by mutual exclusion Lock distributes to remaining receive minimum 2017/1/1/08 in time point:01:30 corresponding reading process d, other the like.
In an embodiment of the invention, further comprise:The data initial address and data of the shared drive are set Termination address;The embodiment of the step 103 includes:The current write pointer and current reading for obtaining the shared drive refer to Pin;, to the circular order of the data termination address, judge the current write pointer to institute according to from the data initial address Whether the size for stating the region between current read pointer is not less than the size of the data to be written, if it is, being treated described Write-in data are written in the region, and the required data read in the region are covered.
For example, by taking the shared drive shown in Fig. 2 as an example, including:Data initial address 201, data termination address 202, reading Pointer 203, write pointer 204, read data area 205 and do not read data area 206, wherein, the corresponding address of write pointer 204 is high It is shared drive in the corresponding address of read pointer 203, and from write pointer 204 to the region 207 between data termination address 202 Residual memory space, this time domain 207 is not enough to store data to be written, then can determine whether since write pointer 204 down to Data termination address 202, is turning back to data initial address 201 and down to region (namely the area between read pointer 203 Domain 207 and read the region that data area 205 is constituted) whether be enough to store data to be written, if it is satisfied, then from write pointer 204 position starts to write data, after data termination address 202 is write, and continues in the position for returning to data initial address 201 Data are write, the data being read with the data cover newly write.
If current region 207 and having read the region that data area 205 constituted and being not enough to store data to be written, etc. 100ms is treated, to control reading process to read after a part of data, in write-in data.Process is so read when reading data, is referred to from reading The position of pin 203 starts down to read data, up to the position of write pointer 204 or more than the position of write pointer 204, namely Read the data do not read in data area 206.
For example, by taking the shared drive shown in Fig. 3 as an example, including:Data initial address 301, data termination address 302, write Pointer 303, read pointer 304, read data area 305 and do not read data area 306, wherein, the corresponding address of write pointer 303 is low In the corresponding address of read pointer 304, and there is no residual memory space in current shared internal memory, then can determine whether from write pointer 303 Start whether to be enough to store data to be written down to the region (namely having read data area 305) between read pointer 304, if Meet, then write data downwards since the position of write pointer 303, read with the data cover newly write in data area 305 The data being read.
If having read data area 305 to be not enough to store data to be written, 100ms is waited, to control reading process to read After a part of data, in write-in data.Process is so read when reading data, is down read since the position of read pointer 304 Data, until data termination address 302, continues to read data, until write pointer turning back to the position of data initial address 301 303 position or in the position of write pointer 303 up, namely read Fig. 3 in up and down two parts do not read in data area 306 Data.
In an embodiment of the invention, the data to be written are written in the region described, and to described After the required data read in region are covered, further comprise:It is right according to the size of the data to be written The current write pointer of the shared drive is updated.
For example, the corresponding address of current write pointer in Fig. 2 shown in shared drive is 7Ah, then after write-in data, write Pointer be located at read pointer top, wherein, according to the size of data of write-in, it may be determined that write-in data after write pointer correspondingly Location, such as 62h, then situations such as loss of data occur when writing data to avoid next time, need to be by the current write pointer of shared drive Corresponding address 7Ah is updated to 62h, similarly, after the process of reading reads data, the size of data according to reading is also needed, it is determined that reading Access corresponding address of read pointer after, and be updated.
Journey will be write into 3 below (to write into journey x, write into journey y and write into journey z) and 1 and read process (progress between reading process w) Exemplified by communication, expansion explanation a kind of Way of Process Communication provided in an embodiment of the present invention, as shown in figure 4, this method can include Following steps:
Step 401:The shared drive of fixed size is pre-created, and the data initial address and data of shared drive are set Termination address.
In embodiments of the present invention, a shared drive identifier can be returned when shared drive is created successfully, will be shared Memory mark symbol, which is passed to, needs what is communicated to write into journey x, y, z and reading process w, for example, for Android operation system, can pass through category Shared drive identifier is passed to 4 processes by property value, then this 4 different processes can pass through the shared drive identifier Shared drive is connected to, so as to complete data transfer by shared drive.
After the completion of shared drive establishment, shared drive is initialized, and can add one in the beginning of shared drive Individual structure, for storing the essential information of shared drive, e.g., data initial address, data termination address, current read pointer, The information such as current write pointer.Wherein, the structure may be provided at the top of the data initial address marked in Fig. 2 and Fig. 3.
Step 402:It is pre-created a mutual exclusion lock.
The mutual exclusion lock is storable in the structure of step 401, and the mutual exclusion lock is initialized.
For that to being protected in shared drive, can only there is a process to get mutual exclusion lock every time, and only get The process of mutual exclusion lock could carry out corresponding read or write.
Step 403:The data to be written that journey x, y and z are sent respectively are write into reception.
Step 404:From this 3 write into journey in determine to have got mutual exclusion lock write into journey.
For example, this is to write into journey x to get mutual exclusion lock.
Step 405:Obtain the current write pointer and current read pointer of shared drive.
For example, the corresponding address of the current write pointer got is 61h, the corresponding address of current read pointer is 68h.
Step 406:According to, to the circular order of data termination address, judge from data initial address current write pointer to work as Whether the region D sizes between preceding read pointer are not less than the size for the data to be written for writing into journey transmission for getting mutual exclusion lock, If it is, performing step 407, otherwise, terminate current process.
According to Fig. 3, the region D between current write pointer and current read pointer is (68h-61h), if region D size (68h-61h) is not less than the size of data to be written for writing into journey x transmissions for getting mutual exclusion lock, then can will write into journey x transmissions Data to be written write shared drive.
If not being enough to store the data to be written for writing into journey x transmissions, reading process can be waited to read out after a part of data, Data are write again.
Step 407:The data to be written for writing into journey transmission for getting mutual exclusion lock received are write into region D, And the data read in the D of region are covered.
In embodiments of the present invention, can be from write pointer when writing into the data to be written of journey x transmissions to shared drive Position 61h start down to write, final write pointer farthest points to 68h, or between address 61h and 68h.Wherein, 61h is extremely It is the data read between 68h, by the way that the data cover newly write is fallen into the data read, it is possible to achieve shared drive Recycle, save memory headroom.
Step 408:According to the data to be written for writing into journey transmission for getting mutual exclusion lock, current write pointer is updated.
For example, after step 407 writes data, the corresponding address of write pointer is 67h, then needs in shared drive structure The corresponding address 61h of last write pointer of storage is updated to 67h.
Step 409:Receive the reading instruction that reading process w is sent.
Step 410:After it is determined that reading process w gets mutual exclusion lock, according to reading instruction, according to from data initial address to number According to the circular order of termination address, data are read since current read pointer position.
Reading process reads the data in shared drive, need to could also be carried out after mutual exclusion lock is got.According to step 405, when reading process w reading data, down read data from 68h at current read pointer position, it is assumed that read after data, read pointer Do not reach data termination address 72h, but the 71h above data termination address 72h.
Step 411:According to the data that process w is read are read, current read pointer is updated.
By step 410, the last reading address stored in shared drive structure by 68h need to be updated to 71h.
After writing into journey x, writing into journey y and writing into data transfers completions all between journey z and reading process w, releasably Fall mutual exclusion lock, and disconnect this 4 connections between process and shared drive, finally delete shared drive.
As shown in Figure 5, Figure 6, the embodiments of the invention provide a kind of process communication device.Device embodiment can be by soft Part is realized, can also be realized by way of hardware or software and hardware combining.For hardware view, as shown in figure 5, being this hair A kind of hardware structure diagram of equipment where the process communication device that bright embodiment is provided, except the processor shown in Fig. 5, internal memory, Outside network interface and nonvolatile memory, the equipment in embodiment where device can also generally include other hardware, Such as it is responsible for the forwarding chip of processing message.Exemplified by implemented in software, as shown in fig. 6, being used as the dress on a logical meaning Put, be to read corresponding computer program instructions in nonvolatile memory in internal memory by the CPU of equipment where it to transport What row was formed.A kind of process communication device that the present embodiment is provided, including:
First creating unit 601, the shared drive for being pre-created fixed size;
Data write unit 602, writes into the data to be written that journey is sent respectively, and treat described for receiving at least one Data storage is write into the shared drive;
Data-reading unit 603, for receiving the reading instruction that at least one reading process is sent respectively, refers to according to the reading Order, data needed for being obtained in the shared drive, and the required data are sent to corresponding reading process, so that described read Process reads the required data;
Data cover unit 604, for when by the data storage to be written to the shared drive, if described shared The residual memory space coexisted is not enough, and the required data read using the data to be written to the reading process are carried out Covering.
As shown in fig. 7, in an embodiment of the invention, further comprising:Second creating unit 701, for creating one Individual mutual exclusion lock;Wherein, the mutual exclusion lock is used to authorize the reading process and the reading for writing into journey respectively to the shared drive Authority and write permission;
The data write unit 602, specifically for from it is described at least one write into journey in determine to have got it is described mutually Denounce the first process of lock;By the data storage to be written of first process received transmission into the shared drive, and Reclaim the mutual exclusion lock;
The data-reading unit 603, specifically for determine to have got from least one described reading process it is described mutually Denounce the second process of lock;The reading instruction sent according to second process received, needed for being obtained in the shared drive Data, and after second process reads the required data, reclaim the mutual exclusion lock.
As shown in figure 8, in an embodiment of the invention, further comprising:Mutual exclusion lock allocation unit 801, for determining Receive the first reception time point that the data to be written that journey is sent respectively are write into described in each;It is determined that receiving each institute State the reading instruction that reading process is sent respectively second receives time point;Determine each first reception time point and described second Receive the minimum reception time point in time point;By the mutual exclusion lock distribute to it is described it is minimum receive time point it is corresponding read into Journey/write into journey.
As shown in figure 9, in an embodiment of the invention, further comprising:Setting unit 901, it is described common for setting Enjoy the data initial address and data termination address of internal memory;
The data cover unit 604, current write pointer and current read pointer specifically for obtaining the shared drive; According to, to the circular order of the data termination address, judge from the data initial address current write pointer to it is described work as Whether the size in the region between preceding read pointer is not less than the size of the data to be written, if it is, will be described to be written Data are written in the region, and the required data read in the region are covered.
As shown in Figure 10, in an embodiment of the invention, further comprise:Pointer updating block 1001, for basis The size of the data to be written, is updated to the current write pointer of the shared drive.
The embodiments of the invention provide a kind of computer-readable recording medium, including execute instruction, when the computing device of storage control During the execute instruction, the storage control performs any one method in each above-mentioned embodiment.
The embodiments of the invention provide a kind of storage control, including:Processor, memory and bus;
The memory is used to store execute instruction, and the processor is connected with the memory by the bus, when During the storage control operation, the execute instruction of memory storage described in the computing device, so that the storage Controller performs any one method in each above-mentioned embodiment.
The contents such as the information exchange between each unit, implementation procedure in said apparatus, due to implementing with the inventive method Example is based on same design, and particular content can be found in the narration in the inventive method embodiment, and here is omitted.
To sum up, each embodiment of the invention at least has the advantages that:
1st, in embodiments of the present invention, the shared drive of fixed size is pre-created, wherein, should to save memory headroom Shared drive can be more relatively small, afterwards for every time by data storage to be written to the shared drive for writing into journey when, if should When residual memory space in shared drive in addition to the data that reading process has been read and the data not read also is not enough, it will can treat Write-in data storage is covered to residual memory space and using remaining data to be written to the data read, so that The shared drive of the fixed size can be recycled, memory headroom is saved.
2nd, in embodiments of the present invention, by creating a mutual exclusion lock, it can be controlled by the mutual exclusion lock same between process Step and mutual exclusion, it is not necessary to be further added by peripheral control program when in use to control the synchronization and mutual exclusion between process, simplify control The complexity of synchronous and mutual exclusion, improves the efficiency of process communication.
3rd, in embodiments of the present invention, by recycling shared drive, very big memory headroom is saved, so that indirectly CPU treatment effeciency is improved, nor additionally consumes CPU time.
It should be noted that herein, such as first and second etc relational terms are used merely to an entity Or operation makes a distinction with another entity or operation, and not necessarily require or imply exist between these entities or operation Any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant be intended to it is non- It is exclusive to include, so that process, method, article or equipment including a series of key elements not only include those key elements, But also other key elements including being not expressly set out, or also include solid by this process, method, article or equipment Some key elements.In the absence of more restrictions, by sentence, " including the key element that a 〃 " is limited is not arranged Except also there is other identical factor in the process including the key element, method, article or equipment.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above method embodiment can pass through Programmed instruction related hardware is completed, and foregoing program can be stored in the storage medium of embodied on computer readable, the program Upon execution, the step of including above method embodiment is performed;And foregoing storage medium includes:ROM, RAM, magnetic disc or light Disk etc. is various can be with the medium of store program codes.
It is last it should be noted that:Presently preferred embodiments of the present invention is the foregoing is only, the skill of the present invention is merely to illustrate Art scheme, is not intended to limit the scope of the present invention.Any modification for being made within the spirit and principles of the invention, Equivalent substitution, improvement etc., are all contained in protection scope of the present invention.

Claims (10)

1. a kind of Way of Process Communication, it is characterised in that be pre-created the shared drive of fixed size;Also include:
Receive at least one and write into the data to be written that journey is sent respectively;
By the data storage to be written into the shared drive;
Receive the reading instruction that at least one reading process is sent respectively;
According to the reading instruction, data needed for being obtained in the shared drive;
The required data are sent to corresponding reading process, so that the reading process reads the required data;
Wherein, when by the data storage to be written to the shared drive, if the residual memory space coexisted Deficiency, the required data read using the data to be written to the reading process are covered.
2. Way of Process Communication according to claim 1, it is characterised in that
Further comprise:Create a mutual exclusion lock;Wherein, the mutual exclusion lock is used to authorize the reading process and the journey of writing into is divided Other read right and write permission to the shared drive;
It is described by the data storage to be written into the shared drive, including:
From it is described at least one write into journey in determine to have got the first process of the mutual exclusion lock;
The data storage to be written that first process received is sent reclaims the mutual exclusion into the shared drive Lock;
It is described that required data are obtained in the shared drive according to the reading instruction, including:
Determine to have got the second process of the mutual exclusion lock from least one described reading process;
The reading instruction sent according to second process received, data needed for being obtained in the shared drive, and in institute State the second process to read after the required data, reclaim the mutual exclusion lock.
3. Way of Process Communication according to claim 2, it is characterised in that
It is described from it is described at least one write into journey in determine to have got the first process of the mutual exclusion lock before, further bag Include:
Time point is received it is determined that receiving and the first of the data to be written that journey is sent respectively being write into described in each;
It is determined that receive the reading instruction that each described reading process is sent respectively second receives time point;
Determine that each described first minimum received in time point and the second reception time point receives time point;
The mutual exclusion lock is distributed into the minimum time point corresponding reading process/write into journey of receiving.
4. Way of Process Communication according to claim 1, it is characterised in that
Further comprise:The data initial address and data termination address of the shared drive are set;
The required data read using the data to be written to the reading process are covered, including:
Obtain the current write pointer and current read pointer of the shared drive;
, to the circular order of the data termination address, judge the current write pointer to institute according to from the data initial address Whether the size for stating the region between current read pointer is not less than the size of the data to be written, if it is, being treated described Write-in data are written in the region, and the required data read in the region are covered.
5. Way of Process Communication according to claim 4, it is characterised in that
The data to be written are written in the region described, and the required data to having been read in the region After being covered, further comprise:
According to the size of the data to be written, the current write pointer of the shared drive is updated.
6. a kind of process communication device, it is characterised in that including:
First creating unit, the shared drive for being pre-created fixed size;
Data write unit, the data to be written that journey is sent respectively are write into for receiving at least one, and by the number to be written According to storing into the shared drive;
Data-reading unit, for receiving the reading instruction that at least one reading process is sent respectively, according to the reading instruction, described Data needed for being obtained in shared drive, and the required data are sent to corresponding reading process, so that the reading process is read Data needed for described;
Data cover unit, for when by the data storage to be written to the shared drive, coexists if described Residual memory space is not enough, and the required data read using the data to be written to the reading process are covered.
7. process communication device according to claim 6, it is characterised in that
Further comprise:Second creating unit, for creating a mutual exclusion lock;Wherein, the mutual exclusion lock is used to authorize the reading Process and the read right and write permission for writing into journey respectively to the shared drive;
The data write unit, specifically for from it is described at least one write into journey in determine to have got the of the mutual exclusion lock One process;The data storage to be written that first process received is sent reclaims described into the shared drive Mutual exclusion lock;
The data-reading unit, specifically for determining to have got the of the mutual exclusion lock from least one described reading process Two processes;The reading instruction sent according to second process received, data needed for being obtained in the shared drive, and Second process is read after the required data, reclaims the mutual exclusion lock.
8. process communication device according to claim 7, it is characterised in that
Further comprise:Mutual exclusion lock allocation unit, write into that journey sends respectively described in each for determining to receive is to be written The first of data receives time point;It is determined that receiving the second reception time of the reading instruction that each described reading process is sent respectively Point;Determine that each described first minimum received in time point and the second reception time point receives time point;Will be described mutual Reprimand lock distributes to the minimum time point corresponding reading process/write into journey of receiving.
9. process communication device according to claim 6, it is characterised in that
Further comprise:Setting unit, data initial address and data termination address for setting the shared drive;
The data cover unit, current write pointer and current read pointer specifically for obtaining the shared drive;According to from The data initial address judges that the current write pointer to the current reading refers to the circular order of the data termination address Whether the size in the region between pin is not less than the size of the data to be written, if it is, the data to be written are write Enter into the region, and the required data read in the region are covered.
10. process communication device according to claim 9, it is characterised in that
Further comprise:Pointer updating block, for the size according to the data to be written, to the current of the shared drive Write pointer is updated.
CN201710181610.XA 2017-03-24 2017-03-24 A kind of Way of Process Communication and device Pending CN106980551A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710181610.XA CN106980551A (en) 2017-03-24 2017-03-24 A kind of Way of Process Communication and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710181610.XA CN106980551A (en) 2017-03-24 2017-03-24 A kind of Way of Process Communication and device

Publications (1)

Publication Number Publication Date
CN106980551A true CN106980551A (en) 2017-07-25

Family

ID=59339608

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710181610.XA Pending CN106980551A (en) 2017-03-24 2017-03-24 A kind of Way of Process Communication and device

Country Status (1)

Country Link
CN (1) CN106980551A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255674A (en) * 2017-12-31 2018-07-06 广东欧珀移动通信有限公司 multi-process browser process log collecting method, device and mobile terminal
WO2019028682A1 (en) * 2017-08-08 2019-02-14 深圳前海达闼云端智能科技有限公司 Multi-system shared memory management method and device
WO2019072260A1 (en) * 2017-10-13 2019-04-18 华为技术有限公司 Method and system for inter-process communication
CN109739670A (en) * 2019-02-01 2019-05-10 中国人民解放军国防科技大学 Intra-node process communication method and device, computer equipment and storage medium
CN110221923A (en) * 2019-06-06 2019-09-10 北京字节跳动网络技术有限公司 Data access method, device and equipment
CN110597640A (en) * 2019-08-29 2019-12-20 深圳市优必选科技股份有限公司 Inter-process data transmission method and device, terminal and computer storage medium
CN112764946A (en) * 2021-01-08 2021-05-07 重庆创通联智物联网有限公司 Cross-process data transmission method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176852A (en) * 2011-12-22 2013-06-26 腾讯科技(深圳)有限公司 Method and device for inter-progress communication
CN103514053A (en) * 2013-09-22 2014-01-15 中国科学院信息工程研究所 Shared-memory-based method for conducting communication among multiple processes
CN104424030A (en) * 2013-08-22 2015-03-18 腾讯科技(深圳)有限公司 Sharing memory multi-process operation method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176852A (en) * 2011-12-22 2013-06-26 腾讯科技(深圳)有限公司 Method and device for inter-progress communication
CN104424030A (en) * 2013-08-22 2015-03-18 腾讯科技(深圳)有限公司 Sharing memory multi-process operation method and device
CN103514053A (en) * 2013-09-22 2014-01-15 中国科学院信息工程研究所 Shared-memory-based method for conducting communication among multiple processes

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019028682A1 (en) * 2017-08-08 2019-02-14 深圳前海达闼云端智能科技有限公司 Multi-system shared memory management method and device
US11281388B2 (en) 2017-08-08 2022-03-22 Cloudminds (Shenzhen) Robotics Systems Co., Ltd. Method for managing a multi-system shared memory, electronic device and non-volatile computer-readable storage medium
WO2019072260A1 (en) * 2017-10-13 2019-04-18 华为技术有限公司 Method and system for inter-process communication
US11892953B2 (en) 2017-10-13 2024-02-06 Huawei Technologies Co., Ltd. Interprocess communication method and interprocess communications system
CN108255674A (en) * 2017-12-31 2018-07-06 广东欧珀移动通信有限公司 multi-process browser process log collecting method, device and mobile terminal
CN109739670A (en) * 2019-02-01 2019-05-10 中国人民解放军国防科技大学 Intra-node process communication method and device, computer equipment and storage medium
CN110221923A (en) * 2019-06-06 2019-09-10 北京字节跳动网络技术有限公司 Data access method, device and equipment
CN110221923B (en) * 2019-06-06 2021-06-08 北京字节跳动网络技术有限公司 Data access method, device and equipment
CN110597640A (en) * 2019-08-29 2019-12-20 深圳市优必选科技股份有限公司 Inter-process data transmission method and device, terminal and computer storage medium
CN112764946A (en) * 2021-01-08 2021-05-07 重庆创通联智物联网有限公司 Cross-process data transmission method and device, electronic equipment and storage medium
CN112764946B (en) * 2021-01-08 2024-02-02 重庆创通联智物联网有限公司 Cross-process data transmission method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106980551A (en) A kind of Way of Process Communication and device
CA2920748C (en) Ascertaining command completion in flash memories
CN106231090A (en) The analog card changing method of a kind of NFC mobile terminal and device
CN108351836A (en) With the multi-stage non-volatile caching selectively stored
CN104216745A (en) Online upgrading system and method for semi-active suspension ECU (Electronic Control Unit) controller software
CN102023843B (en) Function calling method and device as well as smart card
CN105511806B (en) The method and mobile terminal of processing write requests
CN107562659A (en) A kind of data-moving device and method
CN108572876A (en) A kind of implementation method and device of Read-Write Locks
US20150346795A1 (en) Multi-host power controller (mhpc) of a flash-memory-based storage device
CN107480554A (en) A kind of right management method, rights management device and intelligent terminal
CN105787392B (en) A kind of data read-write control method and control device
CN106372898B (en) Mobile communication device and cloud computer system
CN103812739B (en) FPGA and DSP communicator and communication means
CN110138662A (en) Session entry processing method, device and multiple nucleus system in multiple nucleus system
CN104216834B (en) A kind of method of internal storage access, buffer scheduling device and memory modules
CN107346257A (en) A kind of implementation method and device for turning JTAG renewal FPGA programs based on Shen prestige server USB
CN106658117A (en) Method and device for processing audio/video data
CN103020535B (en) A kind of data encrypting and deciphering system with comparing function
CN106527900A (en) Terminal control method and terminal
CN105653490B (en) A kind of data processing method and device based on address control
CN106708779A (en) Server and method for processing data thereof
CN111386513A (en) Data processing method, device and system chip
CN107678987A (en) The method, apparatus and equipment of a kind of DMA transfer
CN110058947A (en) The exclusive release method and relevant apparatus of spatial cache

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170725