CN108920276A - Linux system memory allocation method, system and equipment and storage medium - Google Patents
Linux system memory allocation method, system and equipment and storage medium Download PDFInfo
- Publication number
- CN108920276A CN108920276A CN201810679069.XA CN201810679069A CN108920276A CN 108920276 A CN108920276 A CN 108920276A CN 201810679069 A CN201810679069 A CN 201810679069A CN 108920276 A CN108920276 A CN 108920276A
- Authority
- CN
- China
- Prior art keywords
- memory
- cutting unit
- target
- allocated
- size
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System (AREA)
Abstract
This application discloses a kind of linux system memory allocation method, system and equipment and computer readable storage medium, this method to include:Receive distribution order;Wherein, the distribution order includes at least target memory size;Determine that target cuts unit in memory to be allocated according to the target memory size;Wherein, the physical address of the memory to be allocated is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;It orders corresponding requesting party to distribute the target for the distribution and cuts unit.Linux system memory allocation method provided by the present application, memory to be allocated is divided into the identical or different cutting unit of size, memory distributes to requesting party in a manner of cutting unit, each cutting unit is relatively independent and isolation region of memory, each requesting party can only operate allocated respective region of memory, ensure that the independence of memory application and release between each requesting party.
Description
Technical field
This application involves technical field of memory, more specifically to a kind of linux system memory allocation method, system
And equipment and a kind of computer readable storage medium.
Background technique
In (SuSE) Linux OS, the management of memory and share out the work be influence system stable operation an important factor for.It is existing
Distribution method in technology is based on buddy algorithm, and buddy algorithm reduces the fragment of memory, data structure to greatest extent
In include chained list and bitmap, chained list organizes together the memory block of same rank, and it is corresponding that bitmap denotes each memory block
Partner's block state, in Memory Allocation will according to the state determine memory how to distribute.
Memory allocation method based on buddy algorithm, without specific region division, there is no the memories of relatively independent isolation
Region, memory application and release is not independent between each consumer, is unfavorable for the real-time statistics and management of memory.
Therefore, how to realize that the division in the independent memory region of linux system is user's problem to be solved.
Summary of the invention
The application's is designed to provide a kind of linux system memory allocation method, system and equipment and a kind of computer
Readable storage medium storing program for executing realizes the division in the independent memory region of linux system.
To achieve the above object, this application provides a kind of linux system memory allocation methods, including:
Receive distribution order;Wherein, the distribution order includes at least target memory size;
Determine that target cuts unit in memory to be allocated according to the target memory size;Wherein, described to be allocated interior
The physical address deposited is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;
It orders corresponding requesting party to distribute the target for the distribution and cuts unit.
Wherein, before the reception distribution order, further include:
It determines memory to be allocated, and is described wait divide according to the virtual memory address of the memory to be allocated and physical address
Promiscuous device is created with memory;
The memory to be allocated is cut into cutting unit by preset cutting mode;
Correspondingly, described order corresponding requesting party to distribute the target cutting unit for the distribution, including:
It is that the distribution orders corresponding requesting party to distribute the target cutting unit using the promiscuous device.
Wherein, the memory to be allocated is cut into cutting unit by preset cutting mode, including:
The memory to be allocated is averagely cut into preset quantity cutting unit.
Wherein, after the memory to be allocated being cut into cutting unit by preset cutting mode, further include:
Sort operation is carried out by memory size to the cutting unit, and is every one kind cutting unit creation chained list.
Wherein, determine that target cuts unit in memory to be allocated according to the target memory size in the distribution order,
Including:
Judge single with the presence or absence of memory size and target memory target cutting of the same size in all chained lists
Position;
If it is not, then choose cutting unit to be allocated from all chained lists according to the target memory size, and by institute
It states cutting unit to be allocated and is cut into first part and second part;Wherein, the memory size of the first part and the mesh
It is consistent to mark memory size;
The first part is determined as the target cutting unit, and the second part is articulated in corresponding chained list
In.
Wherein, described that cutting unit to be allocated is chosen from all chained lists according to the target memory size, including:
The cutting unit that memory size in all chained lists is greater than the target memory size is determined as candidate cutting
Unit;
The smallest cutting unit of memory size in all candidate cutting units is determined as cutting unit to be allocated.
Wherein, further include:
When memory release, judge whether there is and the continuous cutting unit to be combined of releasing memory physical address;
If so, merging the releasing memory and the cutting unit to be combined, and hang the region of memory completed is merged
It connects in corresponding chained list.
To achieve the above object, this application provides a kind of linux system Memory Allocation systems, including:
Receiving module, for receiving distribution order;Wherein, the distribution order includes at least target memory size;
Determining module, for determining that target cuts unit in memory to be allocated according to the target memory size;Wherein,
The physical address of the memory to be allocated is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;
Distribution module cuts unit for ordering corresponding requesting party to distribute the target for the distribution.
To achieve the above object, this application provides a kind of linux system Memory Allocation equipment, including:
Memory, for storing computer program;
Processor is realized when for executing the computer program such as the step of above-mentioned linux system memory allocation method.
To achieve the above object, this application provides a kind of computer readable storage medium, the computer-readable storages
It is stored with computer program on medium, realizes when the computer program is executed by processor such as above-mentioned linux system memory point
The step of method of completing the square.
By above scheme it is found that a kind of linux system memory allocation method provided by the present application, including:Receive distribution
Order;Wherein, the distribution order includes at least target memory size;According to the target memory size in memory to be allocated
Determine that target cuts unit;Wherein, the physical address of the memory to be allocated is continuous, memory size is greater than preset value and including N
A cutting unit, N are positive integer;It orders corresponding requesting party to distribute the target for the distribution and cuts unit.
It is identical or different to be divided into size by linux system memory allocation method provided by the present application for memory to be allocated
Unit is cut, memory distributes to requesting party in a manner of cutting unit, and each cutting unit is relatively independent and isolation memory
Region, each requesting party can only operate allocated respective region of memory, ensure that between each requesting party memory application with
The independence of release, i.e., the internal memory operation of each requesting party by mutual interference, are not convenient for real-time statistics and management.
Disclosed herein as well is a kind of linux system Memory Allocation system and equipment and a kind of computer readable storage medium, same energy
Realize above-mentioned technical effect.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow chart of linux system memory allocation method disclosed in the embodiment of the present application;
Fig. 2 is the flow chart of another kind linux system memory allocation method disclosed in the embodiment of the present application;
Fig. 3 is a kind of structure chart of linux system Memory Allocation system disclosed in the embodiment of the present application;
Fig. 4 is a kind of structure chart of linux system Memory Allocation equipment disclosed in the embodiment of the present application;
Fig. 5 is the structure chart of another kind linux system Memory Allocation equipment disclosed in the embodiment of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
The embodiment of the present application discloses a kind of linux system memory allocation method, realizes the independent memory of linux system
The division in region.The present embodiment can be divided into kernel state and User space two parts in software architecture, and the two responsibility is clear, kernel state
Driving is mainly responsible for bulk contiguous memory distribution management role, while needing to create the standby user state mapping of corresponding promiscuous device
It uses;User space, which drives, to be responsible for memory sections, linked list maintenance, the cutting for cutting unit and merging, random memory etc. and appoints
Business.
Referring to Fig. 1, a kind of flow chart of linux system memory allocation method disclosed in the embodiment of the present application, such as Fig. 1 institute
Show, including:
S101:Receive distribution order;Wherein, the distribution order includes at least target memory size;
In specific implementation, which includes at least the target memory size of request, certainly can also include other
Information, herein without specifically limiting.
S102:Determine that target cuts unit in memory to be allocated according to the target memory size;Wherein, described wait divide
Physical address with memory is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;
In specific implementation, determine that target cuts unit according to target memory size, the present embodiment is not determined to specific
Mode is defined, for example, can by the memory size for cutting unit with target memory size is immediate is determined as the target
Cut unit.
It is understood that this step defaults the minimum memory unit of memory to be allocated for cutting unit, therefore in S101
Need to do memory to be allocated according to the characteristics of storing data the division of cutting unit before.Determine memory to be allocated, and root
Virtual memory address and physical address according to the memory to be allocated are that the memory to be allocated creates promiscuous device, and provides it
The memory to be allocated is cut into cutting unit by preset cutting mode by mmap method and vma_fault method.Creation is mixed
It using the promiscuous device is that distribution orders corresponding requesting party to distribute cutting unit that the purpose of miscellaneous equipment, which is convenient for subsequent step,.
It should be noted that saving as the memory that physical address is continuous, memory size is greater than preset value in be allocated.Determine to
The strategy of storage allocation is to apply enough 4M (at present using kmalloc (a kind of function name of computer language, storage allocation)
Kmalloc once runs the maximum memory of application) memory block, the contiguous memory of meet demand is then searched using sort algorithm.
The specific division mode that the present embodiment does not treat storage allocation is defined, and user can according to the actual situation flexibly
Selection.Memory to be allocated is averagely cut into preset quantity cutting unit as a preferred implementation manner,.For example, one
If the memory to be allocated that total memory capacity is 100G is used to, storage volume is smaller but a fairly large number of data file, then can be with
The size of suitable minimum memory unit is set according to the mean size of the data file, because every layer between GB and MB and KB
Conversion multiple be all 1024.For example, the mean size of the data file is all in 450K or so, and is no more than 512K, then just
The minimum memory unit can be sized to 512K, in order to the write-in to file and reduced in each minimum memory unit
Remaining space proportion, then the preset quantity of equal part is exactly 100*1024*2=in the memory to be allocated of 100G
204800, i.e., the memory space of the 100G is divided by 204800 minimum memory lists according to the mean size of storage file
Member, the size of each storage unit are 512K.
Certainly, the mode specifically how divided to a memory to be allocated is varied, simplest to be classified as
Two kinds, i.e., serially divide or parallel patition, serial division mode be one by one divide, divided one it is subdivided
It is next;Parallel division mode is the division being completed at the same time to all quantity minimum memory units.Both modes respectively have respectively
The advantages of and suitable usage scenario.
For example, the mean size when data file is larger, that is, the size of the minimum memory unit divided is also larger, corresponding
The quantity of minimum memory unit will be less, serial division mode can be used in the case where division numbers are less,
Because time required for partition process and the size marked off are substantially proportional, consumed using parallel division mode
Time can't be fewer than serial, and if once occurring abnormal, also only can damage a storage unit, will not draw as parallel
Point mode is likely to result in whole scrap;When the mean size of data file is smaller, that is, the size of the minimum memory unit divided
Also smaller, the quantity of corresponding minimum memory unit will be more, can be using simultaneously in the case where division numbers are more
Capable division mode can be completed to divide with higher efficiency, it is contemplated that safety and unusual condition can carry out in batches simultaneously
Row divides, without once completing total amount of division.
Only two kinds of simplest division modes above-mentioned, there is also many other division modes, based on various
Principle and method can achieve certain special effects, not make specific restriction herein, should regard actual conditions in conjunction with various shadows
The factor of sound makes the selection for being best suitable for number one.
S103:It orders corresponding requesting party to distribute the target for the distribution and cuts unit.
In specific implementation, distribute the distribution order corresponding requesting party the target cutting unit that above-mentioned steps determine,
For requesting party's use.
Linux system memory allocation method provided by the embodiments of the present application, by memory to be allocated be divided into size it is identical or
Different cutting units, memory distribute to requesting party in a manner of cutting unit, and each cutting unit is relatively independent and isolation
Region of memory, each requesting party can only operate allocated respective region of memory, ensure that memory between each requesting party
The independence of application and release, i.e., the internal memory operation of each requesting party by mutual interference, are not convenient for real-time statistics
And management.
The embodiment of the present application discloses a kind of linux system memory allocation method, relative to a upper embodiment, the present embodiment
Further instruction and optimization have been made to technical solution.Specifically:
Referring to fig. 2, the flow chart of another linux system memory allocation method provided by the embodiments of the present application, such as Fig. 2 institute
Show, including:
S211:It determines memory to be allocated, and is institute according to the virtual memory address of the memory to be allocated and physical address
State memory creation promiscuous device to be allocated;
S212:The memory to be allocated is averagely cut into preset quantity cutting unit;
S213:Sort operation is carried out by memory size to the cutting unit, and is every one kind cutting unit creation
Chained list;
In this embodiment, cutting unit can be safeguarded in the form of chained list, i.e., memory size is same or similar cutting
Unit is divided into one kind, and is one chained list of every a kind of creation, and the same or similar cutting unit of each memory size is articulated in together
On one chained list.For example, 0-2 can be created8、28-210... chained list.
S202:Receive distribution order;Wherein, the distribution order includes at least target memory size;
S231:Judge to cut with the presence or absence of memory size with target memory target of the same size in all chained lists
Cut unit;If so, into S204;If it is not, then entering S232;
In specific implementation, Memory Allocation demand (i.e. target memory size) and practical cutting unit under normal circumstances is interior
The probability for depositing size exact matching is not high, therefore needs to carry out element segmentation.Memory size and target memory size one if it exists
The target of cause cuts unit, then is directly entered S204, if it does not exist, then enters the segmentation that S232 carries out cutting unit.
S232:Cutting unit to be allocated is chosen from all chained lists according to the target memory size, and will be described
Cutting unit to be allocated is cut into first part and second part;Wherein, the memory size of the first part and the target
Memory size is consistent;
S233:The first part is determined as the target cutting unit, and the second part is articulated in correspondence
Chained list in;
In specific implementation, cutting unit to be allocated is determined according to target memory size, i.e., according to the demand of distribution order
Search matched chained list.The cutting unit that memory size in all chained lists is greater than the target memory size is determined as waiting
Choosing cutting unit, and the smallest cutting unit of memory size in all candidate cutting units is determined as cutting list to be allocated
Position.For example, it is 2 that target memory size, which is the chained list that 4k is found,8-210, then from the chained list select memory size be greater than target
The minimum cut unit of memory size is as cutting unit to be allocated.
Need to be cut into size and target memory part of the same size (i.e. first after determining cutting unit to be allocated
Part) and remainder (i.e. second part), the first address of first part is returned to after the completion of segmentation, while again by second part
It is encapsulated as new cutting unit and is articulated on matched chained list.
S204:It orders corresponding requesting party to distribute the target for the distribution and cuts unit.
It is understood that needing to judge whether there is and discharge when memory discharges as a preferred implementation manner,
The continuous cutting unit to be combined of memory physical address, judges whether there is and releasing memory physical address is continuous to be combined cuts
Cut unit, if so, merge releasing memory and cutting unit to be combined, and will merge the region of memory completed be articulated in it is corresponding
In chained list, if it is not, then directly releasing memory is articulated on matched chained list.
A kind of linux system Memory Allocation system provided by the embodiments of the present application is introduced below, it is described below
A kind of linux system Memory Allocation system can be cross-referenced with a kind of above-described linux system memory allocation method.
Referring to Fig. 3, a kind of structure chart of linux system Memory Allocation system provided by the embodiments of the present application, such as Fig. 3 institute
Show, including:
Receiving module 301, for receiving distribution order;Wherein, the distribution order includes at least target memory size;
Determining module 302, for determining that target cuts unit in memory to be allocated according to the target memory size;Its
In, the physical address of the memory to be allocated is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive whole
Number;
Distribution module 303 cuts unit for ordering corresponding requesting party to distribute the target for the distribution.
Linux system Memory Allocation system provided by the embodiments of the present application, by memory to be allocated be divided into size it is identical or
Different cutting units, memory distribute to requesting party in a manner of cutting unit, and each cutting unit is relatively independent and isolation
Region of memory, each requesting party can only operate allocated respective region of memory, ensure that memory between each requesting party
The independence of application and release, i.e., the internal memory operation of each requesting party by mutual interference, are not convenient for real-time statistics
And management.
On the basis of the above embodiments, further include as a preferred implementation manner,:
Creation module, for determining memory to be allocated, and according to the virtual memory address and physics of the memory to be allocated
Address is that the memory to be allocated creates promiscuous device;
Cutting module, for the memory to be allocated to be cut into cutting unit by preset cutting mode;
Correspondingly, it is that corresponding request is ordered in the distribution that the distribution module 303, which is specially using the promiscuous device,
Side distributes the module of the target cutting unit.
On the basis of the above embodiments, as a preferred implementation manner, the cutting module be specially will it is described to
Storage allocation is averagely cut into the module of preset quantity cutting unit.
On the basis of the above embodiments, further include as a preferred implementation manner,:
Categorization module for carrying out sort operation by memory size to the cutting unit, and is every one kind cutting
Unit creation chained list.
On the basis of the above embodiments, the determining module 302 includes as a preferred implementation manner,:
Judging unit, it is in the same size with the presence or absence of memory size and the target memory in all chained lists for judging
Target cut unit;If it is not, then starting the workflow of the selection unit;
The selection unit, it is single for choosing cutting to be allocated from all chained lists according to the target memory size
Position, and the cutting unit to be allocated is cut into first part and second part;Wherein, the memory size of the first part
It is in the same size with the target memory;
Determination unit cuts unit for the first part to be determined as the target, and the second part is hung
It connects in corresponding chained list.
On the basis of the above embodiments, the selection unit includes as a preferred implementation manner,:
First determines subelement, for memory size in all chained lists to be greater than to the cutting of the target memory size
Unit is determined as candidate cutting unit;
Second determines subelement, for determining the smallest cutting unit of memory size in all candidate cutting units
For cutting unit to be allocated.
On the basis of the above embodiments, further include as a preferred implementation manner,:
Release module, for judging whether there is continuously to be combined with releasing memory physical address when memory release
Cut unit;If so, merging the releasing memory and the cutting unit to be combined, and hang the region of memory completed is merged
It connects in corresponding chained list.
Present invention also provides a kind of linux system Memory Allocation equipment, referring to fig. 4, provided by the embodiments of the present application one
The structure chart of kind linux system Memory Allocation equipment, as shown in figure 4, including:
Memory 100, for storing computer program;
Linux provided by any of the above-described embodiment may be implemented in processor 200 when for executing the computer program
The step of Installed System Memory distribution method.
Specifically, memory 100 includes non-volatile memory medium, built-in storage.Non-volatile memory medium storage
There are operating system and computer-readable instruction, which is that the operating system and computer in non-volatile memory medium can
The operation of reading instruction provides environment.Processor 200 provides calculating and control ability for linux system Memory Allocation equipment, executes
When the computer program saved in the memory 100, linux system memory provided by any of the above-described embodiment may be implemented
The step of distribution method.
Linux system Memory Allocation equipment provided by the embodiments of the present application, by memory to be allocated be divided into size it is identical or
Different cutting units, memory distribute to requesting party in a manner of cutting unit, and each cutting unit is relatively independent and isolation
Region of memory, each requesting party can only operate allocated respective region of memory, ensure that memory between each requesting party
The independence of application and release, i.e., the internal memory operation of each requesting party by mutual interference, are not convenient for real-time statistics
And management.
On the basis of the above embodiments, preferably, referring to Fig. 5, the linux system Memory Allocation is set
It is standby to further include:
Input interface 300 is connected with processor 200, for obtaining computer program, parameter and the instruction of external importing,
It saves through the control of processor 200 into memory 100.The input interface 300 can be connected with input unit, and it is manual to receive user
The parameter or instruction of input.The input unit can be the touch layer covered on display screen, be also possible to be arranged in terminal enclosure
Key, trace ball or Trackpad, be also possible to keyboard, Trackpad or mouse etc..
Display unit 400 is connected with processor 200, the data sent for video-stream processor 200.The display unit 400
It can be display screen, liquid crystal display or the electric ink display screen etc. in PC machine.It, can be with specifically, in the present embodiment
By the distribution of display unit 400 order whether successful execution etc..
The network port 500 is connected with processor 200, for being communicatively coupled with external each terminal device.The communication link
The communication technology used by connecing can be cable communicating technology or wireless communication technique, and such as mobile high definition chained technology (MHL) leads to
It is blue with universal serial bus (USB), high-definition media interface (HDMI), adopting wireless fidelity technology (WiFi), Bluetooth Communication Technology, low-power consumption
The tooth communication technology, communication technology based on IEEE802.11s etc..Specifically, in the present embodiment, the network port can be passed through
500 import cutting unit chained list etc. to processor 200.
Present invention also provides a kind of computer readable storage medium, which may include:USB flash disk, mobile hard disk,
Read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic
The various media that can store program code such as dish or CD.Computer program, the calculating are stored on the storage medium
Machine program realizes the step of linux system memory allocation method provided by any of the above-described embodiment when being executed by processor.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other
The difference of embodiment, the same or similar parts in each embodiment may refer to each other.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application.
Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.
Each embodiment is described in a progressive manner in specification, the highlights of each of the examples are with other realities
The difference of example is applied, the same or similar parts in each embodiment may refer to each other.For system disclosed in embodiment
Speech, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is referring to method part illustration
?.It should be pointed out that for those skilled in the art, under the premise of not departing from the application principle, also
Can to the application, some improvement and modification can also be carried out, these improvement and modification also fall into the protection scope of the claim of this application
It is interior.
It should also be noted that, in the present specification, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that
A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except there is also other identical elements in the process, method, article or apparatus that includes the element.
Claims (10)
1. a kind of linux system memory allocation method, which is characterized in that including:
Receive distribution order;Wherein, the distribution order includes at least target memory size;
Determine that target cuts unit in memory to be allocated according to the target memory size;Wherein, the memory to be allocated
Physical address is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;
It orders corresponding requesting party to distribute the target for the distribution and cuts unit.
2. linux system memory allocation method according to claim 1, which is characterized in that before the reception distribution order,
Further include:
It determines memory to be allocated, and is described to be allocated interior according to the virtual memory address of the memory to be allocated and physical address
Deposit creation promiscuous device;
The memory to be allocated is cut into cutting unit by preset cutting mode;
Correspondingly, described order corresponding requesting party to distribute the target cutting unit for the distribution, including:
It is that the distribution orders corresponding requesting party to distribute the target cutting unit using the promiscuous device.
3. linux system memory allocation method according to claim 2, which is characterized in that by the memory to be allocated by pre-
If cutting mode be cut into cutting unit, including:
The memory to be allocated is averagely cut into preset quantity cutting unit.
4. linux system memory allocation method according to claim 2, which is characterized in that by the memory to be allocated by pre-
If cutting mode be cut into cutting unit after, further include:
Sort operation is carried out by memory size to the cutting unit, and is every one kind cutting unit creation chained list.
5. linux system memory allocation method according to claim 4, which is characterized in that according in distribution order
Target memory size determines that target cuts unit in memory to be allocated, including:
Judge in all chained lists with the presence or absence of memory size and target memory target cutting unit of the same size;
If it is not, then choose cutting unit to be allocated from all chained lists according to the target memory size, and will it is described to
Distribution cutting unit is cut into first part and second part;Wherein, in the memory size of the first part and the target
It deposits in the same size;
The first part is determined as the target cutting unit, and the second part is articulated in corresponding chained list.
6. linux system memory allocation method according to claim 5, which is characterized in that described according to the target memory
Size chooses cutting unit to be allocated from all chained lists, including:
The cutting unit that memory size in all chained lists is greater than the target memory size is determined as candidate cutting unit;
The smallest cutting unit of memory size in all candidate cutting units is determined as cutting unit to be allocated.
7. according to any one of the claim 4-6 linux system memory allocation method, which is characterized in that further include:
When memory release, judge whether there is and the continuous cutting unit to be combined of releasing memory physical address;
If so, merging the releasing memory and the cutting unit to be combined, and be articulated in the region of memory completed is merged
In corresponding chained list.
8. a kind of linux system Memory Allocation system, which is characterized in that including:
Receiving module, for receiving distribution order;Wherein, the distribution order includes at least target memory size;
Determining module, for determining that target cuts unit in memory to be allocated according to the target memory size;Wherein, described
The physical address of memory to be allocated is continuous, memory size is greater than preset value and including N number of cutting unit, and N is positive integer;
Distribution module cuts unit for ordering corresponding requesting party to distribute the target for the distribution.
9. a kind of linux system Memory Allocation equipment, which is characterized in that including:
Memory, for storing computer program;
Processor realizes the linux system memory as described in any one of claim 1 to 7 when for executing the computer program
The step of distribution method.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program realizes the linux system memory point as described in any one of claim 1 to 7 when the computer program is executed by processor
The step of method of completing the square.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810679069.XA CN108920276A (en) | 2018-06-27 | 2018-06-27 | Linux system memory allocation method, system and equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810679069.XA CN108920276A (en) | 2018-06-27 | 2018-06-27 | Linux system memory allocation method, system and equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108920276A true CN108920276A (en) | 2018-11-30 |
Family
ID=64422707
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810679069.XA Pending CN108920276A (en) | 2018-06-27 | 2018-06-27 | Linux system memory allocation method, system and equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108920276A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110674051A (en) * | 2019-09-24 | 2020-01-10 | 中国科学院微电子研究所 | Data storage method and device |
CN111078410A (en) * | 2019-12-11 | 2020-04-28 | Oppo(重庆)智能科技有限公司 | Memory allocation method and device, storage medium and electronic equipment |
CN111078408A (en) * | 2019-12-10 | 2020-04-28 | Oppo(重庆)智能科技有限公司 | Memory allocation method and device, storage medium and electronic equipment |
WO2021077917A1 (en) * | 2019-10-24 | 2021-04-29 | 华为技术有限公司 | Memory configuration method and device, and storage medium |
CN113010453A (en) * | 2021-04-12 | 2021-06-22 | 杭州和利时自动化有限公司 | Memory management method, system, equipment and readable storage medium |
CN113076266A (en) * | 2021-06-04 | 2021-07-06 | 深圳华云信息系统有限公司 | Memory management method and device, electronic equipment and storage medium |
Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030028739A1 (en) * | 2001-07-18 | 2003-02-06 | Li Richard Chi Leung | Method and apparatus of storage allocation/de-allocation in object-oriented programming environment |
US20060150195A1 (en) * | 2003-06-30 | 2006-07-06 | Microsoft Corporation | System and method for interprocess communication |
CN101122883A (en) * | 2006-08-09 | 2008-02-13 | 中兴通讯股份有限公司 | Memory allocation method for avoiding RAM fragmentation |
CN101227341A (en) * | 2007-12-18 | 2008-07-23 | 浪潮电子信息产业股份有限公司 | Method for fast catching Ethernet card on Linux system |
CN101320351A (en) * | 2008-06-27 | 2008-12-10 | 华中科技大学 | Internal memory distribution, cleaning and releasing method, and internal memory management apparatus |
CN102968378A (en) * | 2012-10-23 | 2013-03-13 | 深圳市融创天下科技股份有限公司 | Method, device and system for allocating and releasing memory |
CN103106147A (en) * | 2013-03-08 | 2013-05-15 | 中国科学院上海微系统与信息技术研究所 | Memory allocation method and system |
CN103150265A (en) * | 2013-02-04 | 2013-06-12 | 山东大学 | Fine grit data distributing method orienting to embedded on-chip heterogeneous memory |
CN103500145A (en) * | 2013-09-17 | 2014-01-08 | 首都师范大学 | Method for improving utilization ratio of Linux idle memory blocks |
CN103593243A (en) * | 2013-11-01 | 2014-02-19 | 浪潮电子信息产业股份有限公司 | Dynamic extensible method for increasing virtual machine resources |
CN105302737A (en) * | 2015-11-24 | 2016-02-03 | 浪潮(北京)电子信息产业有限公司 | Memory allocation management method and memory allocation management system |
CN105404590A (en) * | 2015-11-10 | 2016-03-16 | 浪潮(北京)电子信息产业有限公司 | Memory block combination method and system |
CN106201910A (en) * | 2016-08-27 | 2016-12-07 | 浪潮(北京)电子信息产业有限公司 | The management method of a kind of fritter internal memory and device |
CN106294198A (en) * | 2016-08-05 | 2017-01-04 | 浪潮(北京)电子信息产业有限公司 | The memory allocation method of a kind of (SuSE) Linux OS and method for releasing |
CN106844041A (en) * | 2016-12-29 | 2017-06-13 | 华为技术有限公司 | The method and internal storage management system of memory management |
-
2018
- 2018-06-27 CN CN201810679069.XA patent/CN108920276A/en active Pending
Patent Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030028739A1 (en) * | 2001-07-18 | 2003-02-06 | Li Richard Chi Leung | Method and apparatus of storage allocation/de-allocation in object-oriented programming environment |
US20060150195A1 (en) * | 2003-06-30 | 2006-07-06 | Microsoft Corporation | System and method for interprocess communication |
CN101122883A (en) * | 2006-08-09 | 2008-02-13 | 中兴通讯股份有限公司 | Memory allocation method for avoiding RAM fragmentation |
CN101227341A (en) * | 2007-12-18 | 2008-07-23 | 浪潮电子信息产业股份有限公司 | Method for fast catching Ethernet card on Linux system |
CN101320351A (en) * | 2008-06-27 | 2008-12-10 | 华中科技大学 | Internal memory distribution, cleaning and releasing method, and internal memory management apparatus |
CN102968378A (en) * | 2012-10-23 | 2013-03-13 | 深圳市融创天下科技股份有限公司 | Method, device and system for allocating and releasing memory |
CN103150265A (en) * | 2013-02-04 | 2013-06-12 | 山东大学 | Fine grit data distributing method orienting to embedded on-chip heterogeneous memory |
CN103106147A (en) * | 2013-03-08 | 2013-05-15 | 中国科学院上海微系统与信息技术研究所 | Memory allocation method and system |
CN103500145A (en) * | 2013-09-17 | 2014-01-08 | 首都师范大学 | Method for improving utilization ratio of Linux idle memory blocks |
CN103593243A (en) * | 2013-11-01 | 2014-02-19 | 浪潮电子信息产业股份有限公司 | Dynamic extensible method for increasing virtual machine resources |
CN105404590A (en) * | 2015-11-10 | 2016-03-16 | 浪潮(北京)电子信息产业有限公司 | Memory block combination method and system |
CN105302737A (en) * | 2015-11-24 | 2016-02-03 | 浪潮(北京)电子信息产业有限公司 | Memory allocation management method and memory allocation management system |
CN106294198A (en) * | 2016-08-05 | 2017-01-04 | 浪潮(北京)电子信息产业有限公司 | The memory allocation method of a kind of (SuSE) Linux OS and method for releasing |
CN106201910A (en) * | 2016-08-27 | 2016-12-07 | 浪潮(北京)电子信息产业有限公司 | The management method of a kind of fritter internal memory and device |
CN106844041A (en) * | 2016-12-29 | 2017-06-13 | 华为技术有限公司 | The method and internal storage management system of memory management |
Non-Patent Citations (5)
Title |
---|
JOHN MEIER .ETAL: "Towards More Effective Spectrum Use Based on Memory Allocation Models", 《IEEE》 * |
孙钟秀 等: "《面向21世纪课程教材:操作系统教程 (第3版)》", 31 August 2003, 高等教育出版社 * |
李毅: "集中式三层交换机设备软件模块的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
胡元义 等: "《操作系统原理教程》", 31 July 2014, 西安电子科技大学出版社 * |
谢文娣 等: "一种Linux内存管理机制", 《新乡学院学报》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110674051A (en) * | 2019-09-24 | 2020-01-10 | 中国科学院微电子研究所 | Data storage method and device |
WO2021077917A1 (en) * | 2019-10-24 | 2021-04-29 | 华为技术有限公司 | Memory configuration method and device, and storage medium |
CN111078408A (en) * | 2019-12-10 | 2020-04-28 | Oppo(重庆)智能科技有限公司 | Memory allocation method and device, storage medium and electronic equipment |
CN111078408B (en) * | 2019-12-10 | 2022-10-21 | Oppo(重庆)智能科技有限公司 | Memory allocation method and device, storage medium and electronic equipment |
CN111078410A (en) * | 2019-12-11 | 2020-04-28 | Oppo(重庆)智能科技有限公司 | Memory allocation method and device, storage medium and electronic equipment |
CN113010453A (en) * | 2021-04-12 | 2021-06-22 | 杭州和利时自动化有限公司 | Memory management method, system, equipment and readable storage medium |
CN113076266A (en) * | 2021-06-04 | 2021-07-06 | 深圳华云信息系统有限公司 | Memory management method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108920276A (en) | Linux system memory allocation method, system and equipment and storage medium | |
US11681754B2 (en) | Technologies for managing connected data on persistent memory-based systems | |
CN109815162A (en) | EMS memory management process, device, mobile terminal and storage medium | |
EP2738664B1 (en) | Method and system for configuring storage devices under hybrid storage environment | |
CN103425538B (en) | Process communication method and system | |
CN103927261A (en) | Efficient Allocation And Reclamation Method For Thin-provisioned Storage And System Thereof | |
CN107026877A (en) | The method and apparatus that resource is managed in cloud platform | |
CN110928803B (en) | Memory management method and device | |
CN109491606B (en) | Full flash memory space management method, system, equipment and computer medium | |
CN110674052B (en) | Memory management method, server and readable storage medium | |
CN103399781A (en) | Cloud server and virtual machine management method thereof | |
CN109783283A (en) | A kind of processing method, device and the terminal device of hardware detection information | |
CN108880898A (en) | Active and standby containment system switching method and device | |
CN112988383A (en) | Resource allocation method, device, equipment and storage medium | |
CN112148226A (en) | Data storage method and related device | |
CN104050193A (en) | Message generating method and data processing system for realizing method | |
GB2497172A (en) | Reserving space on a storage device for new data based on predicted changes in access frequencies of storage devices | |
CN116483740B (en) | Memory data migration method and device, storage medium and electronic device | |
CN107111549B (en) | File system management method and device | |
CN114995770B (en) | Data processing method, device, equipment, system and readable storage medium | |
CN115658326B (en) | Device and method for managing storage space, computing device and chip | |
CN105868023B (en) | Data processing method and calculate node in a kind of distributed system | |
CN109597565A (en) | Virtual Plane management | |
CN115484187B (en) | Method, equipment and storage medium for testing container network interface in container environment | |
CN109002258A (en) | NameSpace distribution method, system and equipment and storage medium in solid state hard disk |
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: 20181130 |