CN103034544A - Management method and device for user mode and kernel mode to share memory - Google Patents

Management method and device for user mode and kernel mode to share memory Download PDF

Info

Publication number
CN103034544A
CN103034544A CN2012105238515A CN201210523851A CN103034544A CN 103034544 A CN103034544 A CN 103034544A CN 2012105238515 A CN2012105238515 A CN 2012105238515A CN 201210523851 A CN201210523851 A CN 201210523851A CN 103034544 A CN103034544 A CN 103034544A
Authority
CN
China
Prior art keywords
pseudo
list
chained list
chained
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012105238515A
Other languages
Chinese (zh)
Other versions
CN103034544B (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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201210523851.5A priority Critical patent/CN103034544B/en
Publication of CN103034544A publication Critical patent/CN103034544A/en
Application granted granted Critical
Publication of CN103034544B publication Critical patent/CN103034544B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Record Information Processing For Printing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a management method and a management device for a user mode and a kernel mode to share memory. The method comprises the following steps that physical memory with a preset length serves as shared memory and is mapped to a user mode address space and a kernel mode address space respectively; the head nodes of a plurality of pseudo lists are saved to the last area of the shared memory; the size of the memory is applied according to the need of a user, one pseudo list is selected from the pseudo lists, one or more nodes are selected from the selected pseudo list, memory objects which correspond to the selected one or more nodes are distributed to the user, and the selected one or more nodes are removed from the selected pseudo list. According to the management method and the management device for the user mode and the kernel mode to share memory, the data interaction efficiency can be improved and meanwhile the memory is saved.

Description

Management method and the device of a kind of user's attitude and kernel state shared drive
Technical field
The present invention relates to Data Interchange Technology, relate in particular to management method and the device of a kind of user's attitude and kernel state shared drive.
Background technology
Along with the fast development of internet (Internet), the data interaction between kernel state process and the user's attitude process is more and more frequent, and mutual data volume is increasing.Kernel state process and user's attitude process are used the address space of oneself separately, and the virtual address space that two states are seen separates, the data interaction between kernel state process and the user's attitude process need special mechanism for example shared drive mechanism realize.
In shared drive mechanism, by one section physical memory being mapped to simultaneously kernel state address space and user's attitude address space, realize the data communication between kernel state process and the user's attitude process.After memory-mapped was finished, kernel state process and user's attitude process can obtain respectively base address (virtual address) and the length of shared drive.Because the kernel state process is different with the base address that user's attitude process is obtained, if so use the method for preserving the start address (virtual address) of memory object in the shared drive in traditional chained list to come the dynamic management shared drive, just can't solve user's attitude process and the general problem of kernel state process.
Particularly, mainly provide following two schemes to carry out the management of shared drive in the prior art.
Scheme one
The a bulk of shared drive of disposable mapping, then static state is that user's (kernel state process or user's attitude process) distributes shared memory space, namely no matter the user finally uses How much memory, unification distributes the internal memory of some to the user.
The shortcoming of this scheme is: if the final internal memory that uses of 1 user can be wasted internal memory less than being the internal memory of its distribution; If the final internal memory that uses of 2 users will cause memory overwriting greater than the internal memory that is its distribution, destroy other internal memories user canned data; 3, be unfavorable for the recovery of internal memory and reusing.
Scheme two
Different users's (kernel state process or user's attitude process) is shone upon required shared drive separately, and with its release, use and remap next time after the use.
The shortcoming of this scheme is: each kernel state process and user's attitude process interaction data all need to carry out the mapping of shared drive, have increased like this expense of system, have reduced data interaction efficient between kernel state process and the user's attitude process.
Summary of the invention
In view of this, the purpose of this invention is to provide management method and the device of a kind of user's attitude and kernel state shared drive, can improve the interactive efficiency of data, simultaneously save memory.
For achieving the above object, the invention provides technical scheme as follows:
The management method of a kind of user's attitude and kernel state shared drive comprises:
The physical memory of predetermined length is mapped to respectively user's attitude address space and kernel state address space as shared drive, and after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
The head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
Size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
The management devices of a kind of user's attitude and kernel state shared drive comprises:
The memory-mapped unit, be used for the physical memory of predetermined length is mapped to respectively user's attitude address space and kernel state address space as shared drive, after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
Pseudo-chained list is set up the unit, be used for the head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
The Memory Allocation unit, be used for the size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
Compared with prior art, the Managed Solution of kernel state provided by the invention and user's attitude shared drive when being applied to exist between kernel state process and the user's attitude process the mutual occasion of mass data, can improve the interactive efficiency of data, simultaneously save memory.
Description of drawings
Fig. 1 is user's attitude of the embodiment of the invention and the management method process flow diagram of kernel state shared drive;
Fig. 2 is the formation schematic diagram of shared drive in the embodiment of the invention;
Fig. 3 is the internal storage structure figure that common object is corresponding in the embodiment of the invention;
Fig. 4 is the internal storage structure figure that special object is corresponding in the embodiment of the invention.
Embodiment
In user's attitude that the embodiment of the invention provides and the management method of kernel state shared drive and the device, in chained list, to preserve the start address of memory object to the skew of the base address of shared drive, like this no matter can add at user's attitude or kernel state that by base address separately skew obtains the start address of memory object, and then realize the management of user's attitude process and kernel state process shared drive.
The technical scheme of the embodiment of the invention can solve at least one in the following technical matters:
1, carries out mass data between kernel state process and the user's attitude process when mutual, repeatedly carry out the shared drive mapping, cause the low problem of data transmission efficiency;
2, the internal memory waste that brings of user's attitude process and kernel state process shared drive static allocation, with and the memory overwriting problem brought;
3, come the dynamic management shared drive with the method for preserving the memory object start address in traditional chained list, just can't solve user's attitude process and the general problem of kernel state process.
Describe the present invention below in conjunction with accompanying drawing.
With reference to Fig. 1, user's attitude of the embodiment of the invention and the management method of kernel state shared drive can comprise the steps:
Step 101 is mapped to respectively user's attitude address space and kernel state address space with the physical memory of predetermined length as shared drive, and after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
Step 102, the head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
Step 103, size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
Said method comes shared drive is managed by pseudo-chained list, what user's (user's attitude process and kernel state process) got access to is that the start address of memory object is to the skew of the base address of shared drive, like this no matter can add at user's attitude or kernel state that by base address separately skew obtains the start address of memory object, and then realize the management of user's attitude process and kernel state process shared drive.
Further, be save memory, above-mentioned management method can also comprise:
Step 104 in the time of need to discharging memory object, is obtained start offset and the size for the treatment of the releasing memory object, adds in the respective nodes in the corresponding pseudo-chained list according to described start offset and large young pathbreaker's memory object.
Need to prove, above-mentioned steps 104 arranges for save memory, and those skilled in the art can accept or reject according to concrete needs.
Wherein, described a plurality of pseudo-chained list comprises: the length of the memory object that node is corresponding is 16 bytes, 32 bytes, 64 bytes, 128 bytes, 256 bytes, 512 bytes, 1024 bytes and 2k the byte respectively pseudo-chained list of 16_list, the pseudo-chained list of 32_list, the pseudo-chained list of 64_list, the pseudo-chained list of 128_list, 256_list puppet chained list, the pseudo-chained list of 512_list, the pseudo-chained list of 1024_list and the pseudo-chained list of free_list of correspondence.
In the step 103, the process of Memory Allocation can for:
When the size of internal memory of application during greater than (1024-4) byte, then choose a continuous n node from the pseudo-chained list of free_list, n is integer, particularly, rounds on the size of the internal memory that n equals to apply for is backward divided by 2k;
When the size of the internal memory of applying for is less than or equal to (1024-4) byte, then from other the pseudo-chained lists except the pseudo-chained list of free_list, choose 1 node, when described other pseudo-chained lists are sky, after then also needing first from the pseudo-chained list of free_list, to choose 1 2k object and cutting apart, add in described other pseudo-chained lists cutting apart a plurality of objects that obtain, and then choose 1 node.Wherein, the pseudo-chained list of choosing is the minimum pseudo-chained list length of the memory object that its node is corresponding (refer to minimum) of the size of the internal memory that can satisfy application, for example, if apply for the internal memory of 10 bytes, then choose the pseudo-chained list of 16_list, if apply for the internal memory of 500 bytes, then choose the pseudo-chained list of 512_list.
Alternatively, in step 104, after in the respective nodes of adding to according to described start offset and large young pathbreaker's memory object in the corresponding pseudo-chained list, if it is 2k that a plurality of continuous memory object size sums corresponding to node are arranged in the corresponding pseudo-chained list, and the start offset of first node in these a plurality of continuous nodes can be divided exactly by 2k, after then these a plurality of continuous nodes can also being extractd from corresponding pseudo-chained list, corresponding 2k memory object is added in the pseudo-chained list of free_list.Need to prove, the excision here refers to node is removed from pseudo-chained list, and the address of node in pseudo-chained list skew revised accordingly, and, the 2k memory object is added in the pseudo-chained list of free_list, comprise that the address offset to the respective nodes in the pseudo-chained list of free_list carries out corresponding modify.
Below provide an application example of the present invention, specifically describe as follows:
At first, a bulk of continuous physical memory (as shared drive) is mapped to respectively user's attitude address space and kernel state address space, the length of physical memory is set as required, after mapping is finished, can obtain a base address (virtual address) at user's attitude address space and kernel state address space respectively.
Secondly, the present invention has used a kind of chain data structure to carry out distribution and the recovery of shared drive, and in order to be different from traditional chained list, we are called pseudo-chained list here.There is the difference of an essence in both: traditional chained list is to use pointer directly to point to next node, and pseudo-chained list then is to use a skew to calculate the position of next node.
Pseudo-chained list node structure is very succinct, and it comprises two data members: the type of (1) object, the start address of (2) next pseudo-chained list node structure is with respect to the skew of shared drive base address.Pseudo-chained list node structure is as follows:
Figure BDA00002523450300061
After having defined above-mentioned pseudo-list structure, just can be according to user's application, the memory object that corresponding node is corresponding is distributed to the user, and described user can be kernel state process or user's attitude process.In the present invention, the user can according to the start offset (the offset thresholding in the upper node of the node that distributes) of the memory object that will distribute and the base address addition of shared drive, obtain the start address of memory object.
The 3rd, reserve at last the head node that 32 bytes are preserved free_list, 16_list, 32_list, 64_list, 128_list, 256_list, 512_list, eight pseudo-chained lists of 1024_list at shared drive, after carrying out memory-mapped, user's attitude process and kernel state process have got access to respectively the virtual address of the head node of each pseudo-chained list, can navigate to this head node according to this virtual address, the formation of shared drive specifically as shown in Figure 2.
Node in the pseudo-chained list of free_list is deposited the memory object (comprising 8 byte management information) of 2k byte, 16_list ... node in the pseudo-chained list of 1024_list is deposited respectively 16 bytes ... the memory object of 1024 bytes (comprising 4 bytes or 8 byte management information), and the node in the pseudo-chained list is according to from small to large tactic of address offset (being the offset thresholding).Please note the management information (flags territory and offset territory) that comprises 4 bytes in the common object, special object (the object of address offset 2k alignment, be that address offset can be divided exactly by 2k) in comprise the management information (flags territory, offset territory and size territory) of 8 bytes, as shown in Figure 3 and Figure 4.
The type of object is come mark by the flags territory, the concrete meaning in flags territory such as following table, and this mark can be used for the release of memory object, and the back can continue in concrete letter; The length of the internal memory that the size domain identifier distributes (can be the length sum of internal memory corresponding to continuous one or more nodes).Wherein, comprise several continuous 2k objects greater than the object of 2k, namely several continuous 2k objects consist of the object greater than 2k.
Figure BDA00002523450300071
The 4th, distribution object
The size that needs the application internal memory according to user's (user's attitude process or kernel state process) selects to get memory object from which pseudo-chained list.
(1) size of application internal memory is greater than (1024-4) byte, then directly from free_list, distribute n continuous memory object, and the size territory of revising first object, size=n*2k and flags territory, flags=15 extracts the object that distributes from free-list.After one skilled in the art will appreciate that excision, need to do corresponding processing to free-list, namely revise the offset in the object in the front of first object in chained list in n the object, make it point to extract the next node in the chained list behind n the node.Those skilled in the art can apply for that the size reasonable of internal memory determines the size of n, for example, apply for 1200 bytes, and then n=1 applies for 2000 bytes, then n=2.
(2) apply for that memory size is less than or equal to (16-4) byte and then uses pseudo-chained list 16_list, if the pseudo-chained list of 16_list this moment is not empty (namely except head node, also comprise other nodes), just select first node object behind the head node, if the skew 2k of this object alignment, also need to revise the size territory of this object, size=16, then, no matter whether 2k aligns, all this object is extractd from 16_list, after the excision, need to do corresponding processing to the pseudo-chained list of 16_list, namely revise the offset territory of head node, make it point to the next node object.
If the pseudo-chained list of 16_list this moment is empty, need from the pseudo-chained list of free_list, to distribute first the object of a 2k, then this 2k object is divided into the object of 128 16 bytes, simultaneously these 128 objects are added in the pseudo-chained list of 16_list according to address offset order from small to large, by above-mentioned steps first memory object in the pseudo-chained list of 16_list is distributed to the user again.
By that analogy, also similar to the operation of other pseudo-chained lists.
The 5th, releasing object
(1) calculate the start offset for the treatment of releasing object (memory object), start offset equals to treat that the offset of releasing object deducts the size of this object, i.e. the off-set value corresponding to first byte of this object;
(2) whether 2k aligns to judge the start offset for the treatment of releasing object;
(3) processing of the object of start offset 2k alignment:
Start offset 2k alignment illustrates that this is to liking a special object.If, then directly being divided into this special object the object of several 2k greater than 1k, adds in the pseudo-chained list of free_list object size.If size is less than or equal to 1k, suppose for convenience of description size=1024, first this special object is added in the pseudo-chained list of 1024_list, particularly, that the off-set value of this special object and the off-set value of other objects in the pseudo-chained list are compared, add this special object in the pseudo-chained list relevant position according to comparative result, and revise a upper object of this object and the off-set value of this object, the off-set value that is about to an object is revised as points to this object, the off-set value of this object is revised as the next object of sensing, travel through simultaneously the follow-up object of this special object until the offset of certain general object cuts the start offset that 2k equals this special object, the big or small sum of the general object that traveled through is added to the size territory of this special object.If size=2k, then explanation has the object of a free_list all to be released back the pseudo-chained list of 1024_list, at this moment we can return to free_list with whole 2k space and have shown, and are re-used as a special object and add to the free_list table so all objects in the 2k space from this special object are shifted out 1024_list; Be not equal to then and do not process.
(4) processing of the object that do not line up of start offset 2k:
Start offset 2k does not line up, illustrate that this object is general object, value by the flags territory, can judge the size of current object, equally for convenience of description, whether the size of supposing this object is 1024, first this object is added in the pseudo-chained list of 1024_list according to the bias size order, travel through the special object that the head node of the pseudo-chained list of 1024_list searches the free_list object at this object place to the object between this object again and exist.If special object exists, need the size territory of this special object is added 1024, if the size=2k of this moment just can shift out all objects in the 2k space from this special object 1024_list and be re-used as a special object and join free_list and show.If special object does not exist, just do not need to do anything.
The release flow process of the object of other length is similar to the above, here no longer explanation.
Corresponding to said method, the embodiment of the invention also provides the management devices of a kind of user's attitude and kernel state shared drive, and described management devices can comprise:
The memory-mapped unit, be used for the physical memory of predetermined length is mapped to respectively user's attitude address space and kernel state address space as shared drive, after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
Pseudo-chained list is set up the unit, be used for the head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
The Memory Allocation unit, be used for the size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
Be save memory, described management devices can also comprise:
The internal memory releasing unit when being used for discharging memory object, obtains start offset and the size for the treatment of the releasing memory object, adds in the respective nodes in the corresponding pseudo-chained list according to described start offset and large young pathbreaker's memory object.
Wherein, described a plurality of pseudo-chained list comprises: the length of the memory object that node is corresponding is 16 bytes, 32 bytes, 64 bytes, 128 bytes, 256 bytes, 512 bytes, 1024 bytes and 2k the byte respectively pseudo-chained list of 16_list, the pseudo-chained list of 32_list, the pseudo-chained list of 64_list, the pseudo-chained list of 128_list, 256_list puppet chained list, the pseudo-chained list of 512_list, the pseudo-chained list of 1024_list and the pseudo-chained list of free_list of correspondence.
Particularly, described Memory Allocation unit can carry out Memory Allocation in the following manner:
When the size of internal memory of application during greater than (1024-4) byte, then choose a continuous n node from the pseudo-chained list of free_list, n is integer;
When the size of the internal memory of applying for is less than or equal to (1024-4) byte, then from other the pseudo-chained lists except the pseudo-chained list of free_list, choose 1 node, when described other pseudo-chained lists are empty, after then from the pseudo-chained list of free_list, choosing 1 2k object first and cutting apart, add in described other pseudo-chained lists cutting apart a plurality of objects that obtain.
Further, described internal memory releasing unit can also be used for: after in the respective nodes of adding corresponding pseudo-chained list according to described start offset and large young pathbreaker's memory object to, if it is 2k that a plurality of continuous memory object size sums corresponding to node are arranged in the corresponding pseudo-chained list, the start offset of first node in its this a plurality of continuous nodes can be divided exactly by 2k, after then these a plurality of continuous nodes being extractd from corresponding pseudo-chained list, corresponding 2k memory object is added in the pseudo-chained list of free_list.
In sum, the invention solves the kernel state process and user's attitude process shared drive uses traditional chained list can't realize the problem of dynamic assignment, and improved the interactive efficiency of data between kernel state process and the user's attitude process, saved simultaneously physical memory.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.

Claims (10)

1. the management method of user's attitude and kernel state shared drive is characterized in that, comprising:
The physical memory of predetermined length is mapped to respectively user's attitude address space and kernel state address space as shared drive, and after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
The head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
Size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
2. management method as claimed in claim 1 is characterized in that, also comprises:
In the time of need to discharging memory object, obtain start offset and the size for the treatment of the releasing memory object, add in the respective nodes in the corresponding pseudo-chained list according to described start offset and large young pathbreaker's memory object.
3. management method as claimed in claim 2 is characterized in that:
Described a plurality of pseudo-chained list comprises: the length of the memory object that node is corresponding is 16 bytes, 32 bytes, 64 bytes, 128 bytes, 256 bytes, 512 bytes, 1024 bytes and 2k the byte respectively pseudo-chained list of 16_list, the pseudo-chained list of 32_list, the pseudo-chained list of 64_list, the pseudo-chained list of 128_list, 256_list puppet chained list, the pseudo-chained list of 512_list, the pseudo-chained list of 1024_list and the pseudo-chained list of free_list of correspondence.
4. management method as claimed in claim 3 is characterized in that, described size according to user's needs application internal memory is chosen a pseudo-chained list from described a plurality of pseudo-chained lists, choose one or more nodes from selected pseudo-chained list, comprising:
When the size of internal memory of application during greater than (1024-4) byte, then choose a continuous n node from the pseudo-chained list of free_list, n is integer;
When the size of the internal memory of applying for is less than or equal to (1024-4) byte, then from other the pseudo-chained lists except the pseudo-chained list of free_list, choose 1 node, when described other pseudo-chained lists are empty, after then from the pseudo-chained list of free_list, choosing 1 2k object first and cutting apart, add in described other pseudo-chained lists cutting apart a plurality of objects that obtain.
5. management method as claimed in claim 3 is characterized in that, also comprises:
After in the respective nodes of adding to according to described start offset and large young pathbreaker's memory object in the corresponding pseudo-chained list, if it is 2k that a plurality of continuous memory object size sums corresponding to node are arranged in the corresponding pseudo-chained list, the start offset of first node in its this a plurality of continuous nodes can be divided exactly by 2k, after then these a plurality of continuous nodes being extractd from corresponding pseudo-chained list, corresponding 2k memory object is added in the pseudo-chained list of free_list.
6. the management devices of user's attitude and kernel state shared drive is characterized in that, comprising:
The memory-mapped unit, be used for the physical memory of predetermined length is mapped to respectively user's attitude address space and kernel state address space as shared drive, after mapping was finished, user's attitude process and kernel state process obtained respectively the base address of shared drive at address space separately;
Pseudo-chained list is set up the unit, be used for the head node of a plurality of pseudo-chained lists is saved in the final area of shared drive, wherein, the structure of the node of pseudo-chained list comprises the start address of next node in object type and the pseudo-chained list with respect to the skew of base address, and the memory object of every kind of corresponding a kind of length of object type;
The Memory Allocation unit, be used for the size according to user's needs application internal memory, from described a plurality of pseudo-chained lists, choose a pseudo-chained list, from selected pseudo-chained list, choose one or more nodes, memory object corresponding to one or more nodes of choosing distributed to this user, and the one or more nodes that will choose are extractd from selected pseudo-chained list, wherein, described user is kernel state process or user's attitude process, described user can add the base address of oneself that the start offset of the memory object that distributes obtains the start address of memory object, and according to described start address described memory object is operated.
7. management devices as claimed in claim 6 is characterized in that, also comprises:
The internal memory releasing unit when being used for discharging memory object, obtains start offset and the size for the treatment of the releasing memory object, adds in the respective nodes in the corresponding pseudo-chained list according to described start offset and large young pathbreaker's memory object.
8. management devices as claimed in claim 7 is characterized in that:
Described a plurality of pseudo-chained list comprises: the length of the memory object that node is corresponding is 16 bytes, 32 bytes, 64 bytes, 128 bytes, 256 bytes, 512 bytes, 1024 bytes and 2k the byte respectively pseudo-chained list of 16_list, the pseudo-chained list of 32_list, the pseudo-chained list of 64_list, the pseudo-chained list of 128_list, 256_list puppet chained list, the pseudo-chained list of 512_list, the pseudo-chained list of 1024_list and the pseudo-chained list of free_list of correspondence.
9. management devices as claimed in claim 8 is characterized in that, described Memory Allocation unit is further used for:
When the size of internal memory of application during greater than (1024-4) byte, then choose a continuous n node from the pseudo-chained list of free_list, n is integer;
When the size of the internal memory of applying for is less than or equal to (1024-4) byte, then from other the pseudo-chained lists except the pseudo-chained list of free_list, choose 1 node, when described other pseudo-chained lists are empty, after then from the pseudo-chained list of free_list, choosing 1 2k object first and cutting apart, add in described other pseudo-chained lists cutting apart a plurality of objects that obtain.
10. management devices as claimed in claim 8 is characterized in that, described internal memory releasing unit also is used for:
After in the respective nodes of adding to according to described start offset and large young pathbreaker's memory object in the corresponding pseudo-chained list, if it is 2k that a plurality of continuous memory object size sums corresponding to node are arranged in the corresponding pseudo-chained list, the start offset of first node in its this a plurality of continuous nodes can be divided exactly by 2k, after then these a plurality of continuous nodes being extractd from corresponding pseudo-chained list, corresponding 2k memory object is added in the pseudo-chained list of free_list.
CN201210523851.5A 2012-12-04 2012-12-04 The management method of a kind of User space and kernel state shared drive and device Active CN103034544B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210523851.5A CN103034544B (en) 2012-12-04 2012-12-04 The management method of a kind of User space and kernel state shared drive and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210523851.5A CN103034544B (en) 2012-12-04 2012-12-04 The management method of a kind of User space and kernel state shared drive and device

Publications (2)

Publication Number Publication Date
CN103034544A true CN103034544A (en) 2013-04-10
CN103034544B CN103034544B (en) 2015-08-05

Family

ID=48021467

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210523851.5A Active CN103034544B (en) 2012-12-04 2012-12-04 The management method of a kind of User space and kernel state shared drive and device

Country Status (1)

Country Link
CN (1) CN103034544B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440203A (en) * 2013-08-26 2013-12-11 上海斐讯数据通信技术有限公司 Method for allocating shared memory
CN103530241A (en) * 2013-09-24 2014-01-22 创新科存储技术(深圳)有限公司 User state double-control memory mirroring implement method
CN103761175A (en) * 2013-11-25 2014-04-30 中国科学院计算技术研究所 System and method for monitoring program execution paths under Linux system
CN107102900A (en) * 2016-02-22 2017-08-29 上海大唐移动通信设备有限公司 A kind of management method of shared memory space
CN107577539A (en) * 2016-07-05 2018-01-12 阿里巴巴集团控股有限公司 The shared drive structure communicated for kernel state and User space and its application
CN107733837A (en) * 2016-08-11 2018-02-23 杭州迪普科技股份有限公司 Method for detecting abnormality and device based on application layer Network Abnormal message
CN107908365A (en) * 2017-11-14 2018-04-13 郑州云海信息技术有限公司 The method, apparatus and equipment of User space memory system data interaction
CN108062252A (en) * 2016-11-08 2018-05-22 阿里巴巴集团控股有限公司 A kind of information interacting method, method for managing object and device and system
CN109408226A (en) * 2018-09-19 2019-03-01 深圳传音通讯有限公司 Data processing method, device and terminal device
CN109800190A (en) * 2019-01-22 2019-05-24 星辰天合(北京)数据科技有限公司 Memory accelerated processing method and device, storage medium and processor
CN110618883A (en) * 2019-09-26 2019-12-27 迈普通信技术股份有限公司 Method, device, equipment and storage medium for sharing memory linked list
CN112306702A (en) * 2019-07-26 2021-02-02 龙芯中科技术股份有限公司 Data sharing method and device, electronic equipment and storage medium
CN114048502A (en) * 2021-10-15 2022-02-15 中国科学院信息工程研究所 Lightweight trusted channel and communication control method thereof

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729159B (en) * 2017-09-29 2021-01-15 华为技术有限公司 Address mapping method and device for shared memory

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5148527A (en) * 1988-12-23 1992-09-15 International Business Machines Corporation Interface for independently establishing a link and transmitting high level commands including logical addresses from dedicated microprocessor to shared intelligent memory
EP0747827A1 (en) * 1995-06-07 1996-12-11 International Business Machines Corporation System and method for providing shared memory using shared virtual segment identification in a computer system
US20040268363A1 (en) * 2003-06-30 2004-12-30 Eric Nace System and method for interprocess communication
CN101819564A (en) * 2009-02-26 2010-09-01 国际商业机器公司 Method and device for assisting communication between virtual machines
CN102063385A (en) * 2010-12-23 2011-05-18 深圳市金宏威实业发展有限公司 Memory management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5148527A (en) * 1988-12-23 1992-09-15 International Business Machines Corporation Interface for independently establishing a link and transmitting high level commands including logical addresses from dedicated microprocessor to shared intelligent memory
EP0747827A1 (en) * 1995-06-07 1996-12-11 International Business Machines Corporation System and method for providing shared memory using shared virtual segment identification in a computer system
US20040268363A1 (en) * 2003-06-30 2004-12-30 Eric Nace System and method for interprocess communication
CN101819564A (en) * 2009-02-26 2010-09-01 国际商业机器公司 Method and device for assisting communication between virtual machines
CN102063385A (en) * 2010-12-23 2011-05-18 深圳市金宏威实业发展有限公司 Memory management method and system

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440203B (en) * 2013-08-26 2017-07-25 上海斐讯数据通信技术有限公司 A kind of shared drive distribution method
CN103440203A (en) * 2013-08-26 2013-12-11 上海斐讯数据通信技术有限公司 Method for allocating shared memory
CN103530241A (en) * 2013-09-24 2014-01-22 创新科存储技术(深圳)有限公司 User state double-control memory mirroring implement method
CN103530241B (en) * 2013-09-24 2016-04-13 创新科存储技术(深圳)有限公司 A kind of dual control memory mirror implementation method of User space
CN103761175A (en) * 2013-11-25 2014-04-30 中国科学院计算技术研究所 System and method for monitoring program execution paths under Linux system
CN103761175B (en) * 2013-11-25 2016-08-17 中国科学院计算技术研究所 Program execution path monitoring system and method under a kind of linux system
CN107102900B (en) * 2016-02-22 2020-02-07 上海大唐移动通信设备有限公司 Management method of shared memory space
CN107102900A (en) * 2016-02-22 2017-08-29 上海大唐移动通信设备有限公司 A kind of management method of shared memory space
CN107577539A (en) * 2016-07-05 2018-01-12 阿里巴巴集团控股有限公司 The shared drive structure communicated for kernel state and User space and its application
CN107577539B (en) * 2016-07-05 2021-03-16 阿里巴巴集团控股有限公司 Shared memory structure for communication between kernel mode and user mode and application thereof
CN107733837A (en) * 2016-08-11 2018-02-23 杭州迪普科技股份有限公司 Method for detecting abnormality and device based on application layer Network Abnormal message
CN108062252A (en) * 2016-11-08 2018-05-22 阿里巴巴集团控股有限公司 A kind of information interacting method, method for managing object and device and system
CN108062252B (en) * 2016-11-08 2022-02-01 斑马智行网络(香港)有限公司 Information interaction method, object management method, device and system
CN107908365A (en) * 2017-11-14 2018-04-13 郑州云海信息技术有限公司 The method, apparatus and equipment of User space memory system data interaction
CN109408226A (en) * 2018-09-19 2019-03-01 深圳传音通讯有限公司 Data processing method, device and terminal device
CN109800190A (en) * 2019-01-22 2019-05-24 星辰天合(北京)数据科技有限公司 Memory accelerated processing method and device, storage medium and processor
CN112306702A (en) * 2019-07-26 2021-02-02 龙芯中科技术股份有限公司 Data sharing method and device, electronic equipment and storage medium
CN112306702B (en) * 2019-07-26 2023-07-14 龙芯中科技术股份有限公司 Data sharing method and device, electronic equipment and storage medium
CN110618883A (en) * 2019-09-26 2019-12-27 迈普通信技术股份有限公司 Method, device, equipment and storage medium for sharing memory linked list
CN114048502A (en) * 2021-10-15 2022-02-15 中国科学院信息工程研究所 Lightweight trusted channel and communication control method thereof
CN114048502B (en) * 2021-10-15 2023-08-15 中国科学院信息工程研究所 Lightweight trusted channel and communication control method thereof

Also Published As

Publication number Publication date
CN103034544B (en) 2015-08-05

Similar Documents

Publication Publication Date Title
CN103034544A (en) Management method and device for user mode and kernel mode to share memory
CN105528372B (en) A kind of address search method and equipment
CN105718319B (en) Memory pool layout analysis method and memory pool device
CN104572983B (en) Construction method, String searching method and the related device of hash table based on internal memory
CN104407935A (en) Snapshot rollback method and storage equipment
CN104794177A (en) Data storing method and device
CN106547644A (en) Incremental backup method and equipment
CN104079613A (en) Method and system for multiple tenants to share application program objects
CN104424030A (en) Sharing memory multi-process operation method and device
CN104517044A (en) Method and device for protecting binary file from being decompiled
CN105159616A (en) Disk space management method and device
CN103914483A (en) File storage method and device and file reading method and device
CN105991282B (en) Password generated method and device
CN102799660A (en) JAVA card object management method
CN103714013A (en) Method and device for allocating storage space of file system
CN106202224B (en) Search processing method and device
CN110618883B (en) Method, device, equipment and storage medium for sharing memory linked list
CN110020272A (en) Caching method, device and computer storage medium
CN106156049A (en) A kind of method and system of digital independent
CN103905310A (en) Message processing method and forwarding device
CN103064794A (en) Method for realizing efficient multiple protocol label switching (MPLS) label management
CN104156393A (en) Method for creating virtual block device and distributed file system
CN111163060B (en) Application group-based forwarding method, device and system
CN104375949A (en) Smart card storage space arrangement method and system
CN103425829A (en) Method for rapidly reading layout

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Patentee after: Hangzhou Dipu Polytron Technologies Inc

Address before: Binjiang District and Hangzhou city in Zhejiang Province Road 310051 No. 68 in the 6 storey building

Patentee before: Hangzhou Dipu Technology Co., Ltd.