CN102819497A - Method, device and system for memory allocation - Google Patents

Method, device and system for memory allocation Download PDF

Info

Publication number
CN102819497A
CN102819497A CN201210176906XA CN201210176906A CN102819497A CN 102819497 A CN102819497 A CN 102819497A CN 201210176906X A CN201210176906X A CN 201210176906XA CN 201210176906 A CN201210176906 A CN 201210176906A CN 102819497 A CN102819497 A CN 102819497A
Authority
CN
China
Prior art keywords
memory
user
thread
attitude
allocation
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
CN201210176906XA
Other languages
Chinese (zh)
Other versions
CN102819497B (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.)
Tsinghua University
Huawei Technologies Co Ltd
Original Assignee
Tsinghua University
Huawei 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 Tsinghua University, Huawei Technologies Co Ltd filed Critical Tsinghua University
Priority to CN201210176906.XA priority Critical patent/CN102819497B/en
Publication of CN102819497A publication Critical patent/CN102819497A/en
Application granted granted Critical
Publication of CN102819497B publication Critical patent/CN102819497B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention discloses a method, device and system for memory allocation, which relates to the field of computers and is used to avoid competitions of operating systems and application programs for cache, thus improving system performances and data processing efficiency. The memory allocation method comprises the following steps: when a thread needs to allocate a memory, identifying the type of the thread, wherein the memory comprises a plurality of physical memory pages, the memory of the plurality of physical memory pages is divided into a user mode memory area and a kernel state memory area, physical memory pages in the user mode memory area are used for storing user mode data and instructions, and physical memory page in the kernel mode memory area are used for storing kernel mode data and instructions; if the thread is a user mode thread, allocating memory for the user mode thread from the user mode memory area; and if the thread is a kernel mode thread, allocating memory for the kernel mode thread from the kernel mode memory area.

Description

A kind of memory allocation method, Apparatus and system
Technical field
The present invention relates to computer realm, relate in particular to a kind of memory allocation method, Apparatus and system.
Background technology
In computer organization, processor and storer are the assemblies of two cores wherein.Processor is mainly used in computing, and storer is mainly used in the storage data.The hierarchical classification of storer is a kind of tissue that is pyramid structure; The pinnacle of a pagoda is the hardware cache storer that cost is expensive, but the less access speed of capacity is exceedingly fast; The centre exists also that cost is controlled, the comparatively faster internal memory of memory access speed, but column foot is with low cost, the very big very slow hardware disk of access speed of capacity.
Current; The arithmetic speed of computer CPU will be higher than the speed of access data from internal memory far away; And the hardware cache memory bit is between CPU and internal memory, and its memory access speed falls between, like the L1 in the current main-stream server (one-level) high-speed cache; L2 (secondary) high-speed cache, some in addition L3 (three grades) high-speed cache is arranged.In general, LLC (Last Level Cache, afterbody high-speed cache) is shared use of all logic CPU on the current physical cpu.
When the CPU deal with data, at first in cache memory, search required data, if there are these data, be called cache hit, then directly return, carry out data processing by CPU; If this data processing is not present in high-speed cache, be called cache miss, then access memory is searched desired data, return CPU again and carry out data processing, and with this metadata cache in cache memory.
When new data need be cached to cache memory, the data that must have been friends in the past need be replaced away.The data that are replaced out might be user's attitude data, also might be the kernel state data.In the process of data replacement, the inventor finds that operating system and application program must be competed to high-speed cache under Limited resources, thereby causes system performance to descend.
Summary of the invention
Embodiments of the invention provide a kind of memory allocation method, Apparatus and system, in order to avoiding the competition to high-speed cache of operating system and application program to a certain extent, thereby improve system performance and data-handling efficiency.
Embodiments of the invention adopt following technical scheme:
On the one hand, the invention provides a kind of memory allocation method, comprising:
When a thread needs storage allocation, discern the type of said thread; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
If said thread is user's attitude thread, then be this user's attitude thread storage allocation from said user's attitude memory field;
If said thread is the kernel state thread, then be this kernel state thread storage allocation from said kernel state memory field.
Another aspect, the present invention also provides a kind of memory allocation method, comprising:
From the kernel state memory field is the kernel code storage allocation, and kernel code is copied in the internal memory of distribution; From user's attitude memory field is the global data storage allocation, and global data is copied in the internal memory of distribution; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
Static modification is about the mapping relations of the virtual memory and the physical memory of kernel code and global data.
Another aspect, the present invention also provides a kind of Memory Allocation device, comprising:
First recognition unit is used for when a thread needs storage allocation, discerning the type of said thread; And identifying said thread under the situation of user's attitude thread; Trigger first allocation units,, trigger second allocation units identifying under the situation that said thread is the kernel state thread; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
Said first allocation units, being used for from said user's attitude memory field is this user's attitude thread storage allocation;
Said second allocation units, being used for from said kernel state memory field is this kernel state thread storage allocation.
Another aspect, the present invention also provides a kind of Memory Allocation device, comprising:
First allocation units, being used for from the kernel state memory field is the kernel code storage allocation, and kernel code is copied in the internal memory of distribution;
Second allocation units, being used for from user's attitude memory field is the global data storage allocation, and global data is copied in the internal memory of distribution;
Revise map unit, be used for the mapping relations of static modification about the virtual memory and the physical memory of kernel code and global data; Wherein,
Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
On the one hand; The present invention also provides a kind of internal memory; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field, and the physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
On the one hand, the present invention also provides a kind of computer system, comprising:
Bus;
The processor that links to each other with said bus;
The internal memory that links to each other with said bus;
Wherein, comprise above-mentioned any Memory Allocation device in the said processor; Save as above-mentioned internal memory in said; There are mapping relations between said buffer memory and the said internal memory.
On the other hand, the present invention also provides a kind of computer system, comprising:
Bus;
The processor that links to each other with said bus;
The internal memory that links to each other with said bus;
Wherein, Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction; Said processor calls the code of storing in the said internal memory through said bus, to be used for: when a thread needs storage allocation, discern the type of said thread; If said thread is user's attitude thread, then be this user's attitude thread storage allocation from said user's attitude memory field; If said thread is the kernel state thread, then be this kernel state thread storage allocation from said kernel state memory field.
Memory allocation method provided by the invention, Apparatus and system through internal memory being divided into user's attitude memory field and kernel state memory field, and are user's attitude thread storage allocation from user's attitude memory field, are kernel state thread storage allocation from the kernel state memory field; Owing to there are fixing mapping relations between internal memory and the buffer memory; So just accordingly high-speed cache is divided into the two parts that are respectively applied for storage user's attitude data and kernel state data; Thereby avoid the competition of operating system and application program to a certain extent, thereby improve system performance and data-handling efficiency high-speed cache.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art; To do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below; Obviously, the accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
A kind of memory allocation method process flow diagram that Fig. 1 provides for the embodiment of the invention;
Fig. 2 is the mapping relations of internal memory physical address and buffer address;
The another kind of memory allocation method process flow diagram that Fig. 3 provides for the embodiment of the invention;
Another memory allocation method process flow diagram that Fig. 4 provides for the embodiment of the invention;
Fig. 5 is the chain hoist pennants;
Another memory allocation method process flow diagram that Fig. 6 provides for the embodiment of the invention;
A kind of Memory Allocation device synoptic diagram that Fig. 7 provides for the embodiment of the invention;
The another kind of Memory Allocation device synoptic diagram that Fig. 8 provides for the embodiment of the invention;
The synoptic diagram of a kind of computer system that Fig. 9 provides for the embodiment of the invention;
The synoptic diagram of the another kind of computer system that Figure 10 provides for the embodiment of the invention.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
As shown in Figure 1, the embodiment of the invention provides a kind of memory allocation method, comprising:
S101, when a thread needs storage allocation, discern the type of said thread.
Wherein, the type of thread comprises: user's attitude thread and kernel state thread; Generally, user's attitude thread is that user application provides the thread of creating when serving, and mainly be in the operation of user's state space, and the kernel state thread is that operating system nucleus provides the thread of creating when serving.
In addition; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
Preferably; The said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and the kernel state memory field comprises: the page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical.
The physical address of the internal memory that following reference is shown in Figure 2 and the mapping relations of buffer address, briefly introduce the page or leaf color bits.The physical address of internal memory comprises: physical memory page number and page or leaf bias internal amount; Wherein, the physical memory page number is used for the current physical address of index and belongs to which physical memory page, and page or leaf bias internal amount is used for the side-play amount of the current physical address of mark at current physical memory page.Buffer address comprises: buffer tag, buffer memory group # and group bias internal amount; Wherein, the buffer memory group # is used for the index current cache address and belongs to which buffer memory group, and group bias internal amount is used for the side-play amount of mark current cache address in the current cache group.
Because hardware has determined to have intrinsic mapping relations between physical memory and the buffer memory, so the physical address of data in internal memory just determined data buffer memory group # and group bias internal amount in buffer memory.The position that the high position of page or leaf bias internal amount and the low level of buffer memory group # overlap is for software can not control bit; The position that the high position of the low level of physical memory page number and buffer memory group # overlaps is software-controllable system position, be called the page or leaf color bits.Have same page so and the shared same buffer memory group set of physical memory page of color bits, this buffer memory group set comprises at least one buffer memory group.Like this according to page or leaf color bits internal memory is divided into a plurality of memory group, and the same buffer memory group in the page of same memory group and the buffer memory is gathered corresponding.
In the above-mentioned preferred version, the page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Can know that by the physical address of above-mentioned internal memory and the mapping relations of buffer address buffer memory is also corresponding in fact is divided into two types, can be called user's attitude buffer area and kernel state buffer area in addition, and all include a plurality of buffer memory group set in two types of buffer areas; Wherein, user's attitude buffer area supplies user's attitude to use, and the kernel state buffer area supplies kernel state to use.
Optional; Before the type of the said thread of said identification, can also comprise: when said thread needs storage allocation; If operating system skips leaf unusually; Then distribute the behavior modifier for the Memory Allocation behavior of said thread is provided with user memory, the concrete user memory that can in the required call function of said thread, be provided with distributes the behavior modifier; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread.
At this moment, the type of the said thread of identification among the S101 is specially: whether the Memory Allocation behavior of discerning said thread is provided with user memory is distributed the behavior modifier; Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
Wherein, above-mentioned Memory Allocation behavior is the idiom commonly used of computer realm, and so-called Memory Allocation behavior is meant by processor to be the behavior of thread storage allocation, and the Memory Allocation behavior can be triggered by user's attitude thread, perhaps, can be triggered by the kernel state thread.
If identifying said thread among the S101 is user's attitude thread, then carry out S102; If identifying said thread among the S101 is the kernel state thread, then carry out S103.
Further, before carrying out S102 or S103, can also utilize the combination in any of any or following method in the following method, to obtain the scope of user's attitude memory field and kernel state memory field:
Method one, when os starting, obtain the group number of the memory group of said user's attitude memory field set in the said os starting parameter and/or kernel state memory field.
Wherein, be certain because the group of all memory group is counted summation, so if get access to the group number of the memory group that user's attitude memory field comprised, just can obtain the group number of the memory group that the kernel state memory field comprised accordingly; Same if get access to the group number of the memory group that the kernel state memory field comprised, just can obtain the group number of the memory group that user's attitude memory field comprised accordingly; Certainly, the group number that obtains two memory group that the memory field comprised respectively also is fine.
If adopt this method, in operating system, had better not do change more so.
Method two, in the operating system process, obtain the group number of the memory group of said user's attitude memory field that the kernel interactive interface through said operating system is provided with and/or kernel state memory field.
Example, under linux operating system, the kernel interactive interface of operating system can be procfs interface or sysfs interface, the user can revise the group number of the memory group that at least one memory field comprises in the operating system process.
Method three, in the operating system process, obtain the group number of the memory group of said user's attitude memory field that the system call interfaces that provides through said operating system is provided with and/or kernel state memory field.
As adopt this method, user in the operating system process, can revise the group number of the memory group that at least one memory field comprises.
S102, be this user's attitude thread storage allocation from said user's attitude memory field.
Optional, the group number of the memory group that is comprised according to user's attitude memory field is user's attitude thread storage allocation in the scope of user's attitude memory field.
S103, be this kernel state thread storage allocation from said kernel state memory field.
Optional, the group number of the memory group that is comprised according to the kernel state memory field is a kernel state thread storage allocation in the scope of kernel state memory field.
Memory allocation method provided by the invention through internal memory being divided into user's attitude memory field and kernel state memory field, and is user's attitude thread storage allocation from user's attitude memory field, is kernel state thread storage allocation from the kernel state memory field; Owing to there are fixing mapping relations between internal memory and the buffer memory; So just accordingly high-speed cache is divided into the two parts that are respectively applied for storage user's attitude data and kernel state data; Thereby can avoid the competition of operating system and application program to a certain extent, thereby improve system performance and data-handling efficiency high-speed cache.
Based on the embodiment of above-mentioned any memory allocation method, as shown in Figure 3, when a thread needs storage allocation, can also further comprise:
S100, judging whether can be according to the said thread storage allocation of being divided into of internal memory;
If not, even judged result is for can not then carrying out step S104 according to the said thread storage allocation of being divided into of internal memory;
If even judged result is for can then according to the said thread storage allocation of being divided into of internal memory, promptly turning to S101 to accomplish the distribution of internal memory according to the said thread storage allocation of being divided into of internal memory.
S104, the memory allocation method of giving tacit consent to according to operating system are said thread storage allocation; Example, the memory allocation method of operating system acquiescence can be the buddy algorithm memory allocation method.
The embodiment of the invention also provides a kind of memory allocation method based on every CPU chained list, and is as shown in Figure 4, and said method comprises:
S401, when a thread need be from every CPU chained list storage allocation, discern the type of said thread.
At first introduce the structure of chained list; Example as shown in Figure 5; Chained list comprises a plurality of nodes, stores the entry address of the start address in one section memory space, the size in this memory space (the perhaps termination address in this memory space) and next node in each node.
In embodiments of the present invention, said every CPU chained list is divided into user chain table and kernel chained list; Wherein, the structure of user chain table and kernel chained list all can be with reference to the structure among Fig. 5.The physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to.The division of internal memory still can be with reference to the foregoing description, does not add at this and gives unnecessary details.
Similar with S101; Optional; Before the type of the said thread of said identification, can also comprise: when said thread needs storage allocation,, then distribute the behavior modifier for the Memory Allocation behavior of said thread is provided with user memory if operating system skips leaf unusually; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread.
At this moment, among the S401 process of type of identification thread can adopt with S401 in identical mode: whether the Memory Allocation behavior of discerning said thread is provided with user memory is distributed the behavior modifier; Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
In S401, identify said thread under the situation of user's attitude thread, carry out S402; Identify under the situation that said thread is the kernel state thread at S401, carry out S405.
Whether S402, judges chained list exist idle physical memory page;
If there is idle physical memory page in user chain table, then carry out step S403;
If there is not idle physical memory page in said user chain table, then carry out step S404.
S403, be said thread storage allocation from said user chain table.
Concrete, the idle physical memory page that is in user's attitude memory field that node is pointed from said user chain table is said thread storage allocation.
S404, being the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field, is said user's attitude thread storage allocation from said user chain table again;
S405, judge whether the kernel chained list exists idle physical memory page.
If there is idle physical memory page in said kernel chained list, carry out step S406 this moment;
If there is not idle physical memory page in said kernel chained list, carry out step S407 this moment.
S406, be said thread storage allocation from said kernel chained list.
Concrete, the idle physical memory page that is in the kernel state memory field that node is pointed from said kernel chained list is said thread storage allocation.
S407, being the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, is said kernel state thread storage allocation from said kernel chained list again.
Further; Among the above-mentioned S404; Be after said user chain table is distributed the physical memory page of predetermined number from said user's attitude memory field; Can also comprise: in the page descriptor of the physical memory page that distributes for said user chain table, first mark is set, is used to identify current physical memory page and is used for user's attitude thread; Example, in the member variable flag of the page descriptor structure of current physical memory page, first mark is set;
Same; Among the above-mentioned S407; Be after said kernel chained list distributes the physical memory page of predetermined number from said kernel state memory field; Can also comprise: in the page descriptor of the physical memory page that distributes for said kernel chained list, second mark is set, is used to identify current physical memory page and is used for the kernel state thread; Example, in the member variable flag of the page descriptor structure of current physical memory page, second mark is set.
Further; Above-mentioned memory allocation method can also comprise: when physical memory page discharges; Remove mark set in the page descriptor of said physical memory page (first mark or second mark), and this physical memory page is joined in the free page chained list of operating system default memory distribution method.Specific as follows, when physical memory page discharges, judge in the page descriptor whether be provided with and mark, if be provided with mark then remove this mark, and the physical memory page that will remove mark joins in the free page chained list of operating system default memory distribution method.Wherein, operating system default memory distribution method example can be the buddy algorithm memory allocation method; The free page chained list of operating system default memory distribution method, example can be buddy algorithm free page chained list.
Like this can be so that computer system when realizing memory allocation method that the embodiment of the invention provides, also can be good at supporting existing memory allocation method, better compatible.
Further, discern at S401 before the type of said thread, also comprise:
Judging whether can be according to the said thread storage allocation of being divided into of internal memory;
If judged result is not, even can not be according to the said thread storage allocation of being divided into of internal memory, then the memory allocation method according to the operating system acquiescence is said thread storage allocation; If judged result is for being, even can then begin execution, with according to the said thread storage allocation of being divided into of internal memory according to the said thread storage allocation of being divided into of internal memory from S401.
The embodiment of the invention is accomplished user's attitude thread and the distribution of kernel state thread in different memory fields based on being provided with of every CPU chained list; Thereby can avoid the competition of operating system and application program to a certain extent, thereby improve system performance and data-handling efficiency high-speed cache.
Division based on above-mentioned internal memory; Be that said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field, and the physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction; In order to reduce the competition of kernel code and global data for buffer memory; As shown in Figure 6, the embodiment of the invention also provides a kind of memory allocation method, comprising:
S601, be the kernel code storage allocation, and kernel code is copied in the internal memory of distribution from the kernel state memory field;
S602, be the global data storage allocation, and global data is copied in the internal memory of distribution from user's attitude memory field;
Need to prove out-of-order relation between above-mentioned S601 and the S602.
S603, static modification are about the mapping relations of the virtual memory and the physical memory of kernel code and global data.
So just make virtual memory address to get access to the physical memory addresses of kernel code or global data through amended mapping relations.
Memory allocation method provided by the invention through internal memory being divided into user's attitude memory field and kernel state memory field, and copying to kernel code the kernel state memory field and global data is copied to user's attitude memory field; Owing to have fixing mapping relations between internal memory and the buffer memory, can reduce the competition of kernel code and global data so to a certain extent to buffer memory.
The following embodiment of the invention also provides and the corresponding Memory Allocation device of above-mentioned memory allocation method, to the explanation of each unit in the internal memory distributor, can in lower device embodiment, will not add and give unnecessary details with reference to the description in each step of said method.
Memory Allocation device as shown in Figure 7, that the embodiment of the invention provides comprises:
Recognition unit 71 is used for when a thread needs storage allocation, discerning the type of said thread; And identifying said thread under the situation of user's attitude thread; Trigger first allocation units 72, identifying under the situation that said thread is the kernel state thread, trigger second allocation units 73; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
Said first allocation units 72, being used for from said user's attitude memory field is this user's attitude thread storage allocation;
Said second allocation units 73, being used for from said kernel state memory field is this kernel state thread storage allocation.
Further, as shown in Figure 7, also comprise: modifier unit 74 is set, is used for when said thread needs storage allocation,, then distribute the behavior modifier for the Memory Allocation behavior of said thread is provided with user memory if operating system skips leaf unusually; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread;
Said recognition unit 71, whether the Memory Allocation behavior that specifically is used to discern said thread is provided with user memory is distributed the behavior modifier; Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
Preferably, user's attitude memory field and said kernel state memory field can be divided in such a way: said user's attitude memory field and said kernel state memory field comprise at least one memory group respectively, and same memory group only belongs to one of them memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical;
Like this, as shown in Figure 7, above-mentioned Memory Allocation device also comprises:
Acquiring unit 75 is used for when os starting, obtains the group number of the memory group of said user's attitude memory field set in the said os starting parameter and/or kernel state memory field; And/or, in the operating system process, obtain the group number of the memory group of said user's attitude memory field that the kernel interactive interface through said operating system is provided with and/or kernel state memory field; And/or, in the operating system process, the group number of the said user's attitude memory field that the system call interfaces that obtaining provides through said operating system is provided with and/or the memory group of kernel state memory field.
The group number that win allocation units 72 and second allocation units 73 can be obtained through acquiring unit 75 is the thread storage allocation of different type in different memory fields.
On the basis of above-mentioned Memory Allocation device, can also further comprise: judging unit 76 and system default allocation units 77;
Said system default allocation units 77, the memory allocation method that is used for according to the operating system acquiescence is said thread storage allocation;
Said judging unit 76 is used for when a thread needs storage allocation, and judging whether can be according to the said thread storage allocation of being divided into of internal memory;
Can not be if the judged result of said judging unit 76 is according to the said thread storage allocation of being divided into of internal memory; Then trigger said system default allocation units 77; If judged result is for can then triggering said recognition unit 71 according to the said thread storage allocation of being divided into of internal memory.
Further, based on the allocative decision of every CPU chained list, above-mentioned providing in the either memory distributor,
Said recognition unit 71 specifically is used for when a thread need be from CPU chained list storage allocation, discerning the type of said thread; Said CPU chained list is divided into user chain table and kernel chained list, the physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to;
Said first allocation units 72 specifically are used for existing under the situation of idle physical memory page in said user chain table, are said user's attitude thread storage allocation from said user chain table; In said user chain table is not exist under the situation of idle physical memory page, is the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field, is said user's attitude thread storage allocation from said user chain table again;
Said second allocation units 73 specifically are used for existing under the situation of idle physical memory page at said kernel chained list, are said kernel state thread storage allocation from said kernel chained list; Not existing at said kernel chained list under the situation of idle physical memory page, is the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, is said kernel state thread storage allocation from said kernel chained list again.
Further, said first allocation units 72 also are used for, and in the page descriptor of the physical memory page that distributes for said user chain table, first mark are set, and are used to identify current physical memory page and are used for user's attitude thread;
Said second allocation units 73 also are used for, and in the page descriptor of the physical memory page that distributes for said kernel chained list, second mark are set, and are used to identify current physical memory page and are used for the kernel state thread.
Further, said device also comprises: remove indexing unit 78 and add linked list units 79;
Said removing identify unit 78 is used for when physical memory page discharges, removing mark set in the page descriptor of said physical memory page;
Said adding linked list units 79 is used for removing the free page chained list that physical memory page behind the mark joins operating system default memory distribution method.
Above-mentioned Memory Allocation device is based on the division of internal memory, just accordingly high-speed cache is divided into the two parts that are respectively applied for storage user's attitude data and kernel state data, thereby can avoid the competition to high-speed cache of operating system and application program to a certain extent.
As shown in Figure 8, the invention provides a kind of Memory Allocation device, comprising:
First allocation units 81, being used for from the kernel state memory field is the kernel code storage allocation, and kernel code is copied in the internal memory of distribution;
Second allocation units 82, being used for from user's attitude memory field is the global data storage allocation, and global data is copied in the internal memory of distribution;
Revise map unit 83, be used for the mapping relations of static modification about the virtual memory and the physical memory of kernel code and global data; Wherein,
Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
Based on the division of internal memory, can avoid the competition of kernel code and global data to a certain extent like this to buffer memory.
The embodiment of the invention also provides a kind of internal memory; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
Preferably; The said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and the kernel state memory field comprises: the page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical.
The embodiment of the invention also provides a kind of computer system, comprising:
Bus 91;
The processor 92 that links to each other with said bus 91;
The internal memory 93 that links to each other with said bus 91;
Wherein, comprise above-mentioned either memory distributor in the said processor; Save as above-mentioned either memory in said.
Aforementioned calculation machine system can further include the user interface 94 that is connected with bus 91.
The embodiment of the invention also provides a kind of computer system, comprising:
Bus 101;
The processor 102 that links to each other with said bus 101;
The internal memory 103 that links to each other with said bus 101;
Wherein, Said internal memory 103 comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction; Said processor 102 calls the code of storing in the said internal memory through said bus, to be used for: when a thread needs storage allocation, discern the type of said thread; If said thread is user's attitude thread, then be this user's attitude thread storage allocation from said user's attitude memory field; If said thread is the kernel state thread, then be this kernel state thread storage allocation from said kernel state memory field.
Aforementioned calculation machine system can further include the user interface 104 that is connected with bus 101.
Optional, said processor 102 also is used for when said thread needs storage allocation, if operating system skips leaf unusually, then distributes the behavior modifier for the Memory Allocation behavior of said thread is provided with user memory; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread.
Whether the function of the type of the said thread of above-mentioned processor 102 identifications this moment can be provided with user memory for the Memory Allocation behavior of discerning said thread and distribute the behavior modifier; Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
Optional; The said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and the kernel state memory field comprises: the page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical.
At this moment, said processor 102 also is used for: when os starting, obtain the group number of the memory group of said user's attitude memory field set in the said os starting parameter and/or kernel state memory field; And/or,
In the operating system process, obtain the group number of the memory group of said user's attitude memory field that the kernel interactive interface through said operating system is provided with and/or kernel state memory field; And/or,
In the operating system process, the group number of the said user's attitude memory field that the system call interfaces that obtaining provides through said operating system is provided with and/or the memory group of kernel state memory field.
Optional, said processor 102 also is used for: when a thread needed storage allocation, judging whether can be according to the said thread storage allocation of being divided into of internal memory;
If judged result is can not be according to the said thread storage allocation of being divided into of internal memory, then the memory allocation method according to the operating system acquiescence is said thread storage allocation;
Can be if judged result is according to the said thread storage allocation of being divided into of internal memory, then according to the said thread storage allocation of being divided into of internal memory.
Optional, said processor 102 storage allocations are from every CPU chained list storage allocation; Wherein, said every CPU chained list is divided into user chain table and kernel chained list, the physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to;
At this moment, said processor 102 is used for: under the situation of user's attitude thread, if there is idle physical memory page in said user chain table, is said user's attitude thread storage allocation from said user chain table then at said thread; If said user chain table then is the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field for there not being idle physical memory page, is said user's attitude thread storage allocation from said user chain table again;
At said thread is under the situation of kernel state thread, if there is idle physical memory page in said kernel chained list, is said kernel state thread storage allocation from said kernel chained list then; If there is not idle physical memory page in said kernel chained list, then be the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, be said kernel state thread storage allocation from said kernel chained list again.
Further optional; Said processor 102 also is used for: be after said user chain table is distributed the physical memory page of predetermined number from said user's attitude memory field; In the page descriptor of the physical memory page that distributes for said user chain table, first mark is set, is used to identify current physical memory page and is used for user's attitude thread;
Being after said kernel chained list distributes the physical memory page of predetermined number, in the page descriptor of the physical memory page that distributes for said kernel chained list, second mark to be set from said kernel state memory field, be used to identify current physical memory page and be used for the kernel state thread.
Further; Optional; Said processor 102 also is used for: when physical memory page discharges, remove mark set in the page descriptor of said physical memory page, and this physical memory page is joined in the free page chained list of operating system default memory distribution method.
Above-mentioned arbitrary computer system can also comprise buffer memory, and this buffer memory can be arranged in the processor, as the shared buffer memory of a plurality of processor cores in this processor.Need to prove that the buffer memory in the embodiment of the invention can be a hardware cache usually, but is not limited to the afterbody high-speed cache, and can be any one buffer memory of being shared by a plurality of processor cores.Aforementioned calculation machine system is not limited to the multi-core computer system, and can be any system of being shared same buffer memory by a plurality of processor cores.
Memory Allocation device provided by the invention, internal memory and computer system through internal memory being divided into user's attitude memory field and kernel state memory field, and are user's attitude thread storage allocation in user's attitude memory field, are kernel state thread storage allocation in the kernel state memory field; Owing to there are fixing mapping relations between internal memory and the buffer memory, so just accordingly high-speed cache are divided into and are respectively applied for two parts of storing user's attitude data and kernel state data, thereby avoid the competition of operating system and application program high-speed cache; In addition,, the competition of kernel code and global data be can also avoid to a certain extent, thereby system performance and data-handling efficiency improved high-speed cache based on the division of above-mentioned internal memory.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be accomplished through the relevant hardware of programmed instruction; Aforesaid program can be stored in the computer read/write memory medium; This program the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
The above; Be merely embodiment of the present invention, but protection scope of the present invention is not limited thereto, any technician who is familiar with the present technique field is in the technical scope that the present invention discloses; Can expect easily changing or replacement, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of said claim.

Claims (23)

1. a memory allocation method is characterized in that, comprising:
When a thread needs storage allocation, discern the type of said thread; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
If said thread is user's attitude thread, then be this user's attitude thread storage allocation from said user's attitude memory field;
If said thread is the kernel state thread, then be this kernel state thread storage allocation from said kernel state memory field.
2. memory allocation method according to claim 1 is characterized in that, before the type of the said thread of said identification, also comprises:
When said thread needs storage allocation,, then, the Memory Allocation behavior of said thread distributes the behavior modifier for being provided with user memory if operating system skips leaf unusually; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread;
The type of the said thread of said identification comprises:
Whether the Memory Allocation behavior of discerning said thread is provided with user memory is distributed the behavior modifier;
Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
3. memory allocation method according to claim 1 and 2 is characterized in that, the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and the kernel state memory field comprises:
Page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical;
Said method also comprises:
When os starting, obtain the group number of the memory group of said user's attitude memory field set in the said os starting parameter and/or kernel state memory field; And/or,
In the operating system process, obtain the group number of the memory group of said user's attitude memory field that the kernel interactive interface through said operating system is provided with and/or kernel state memory field; And/or,
In the operating system process, the group number of the said user's attitude memory field that the system call interfaces that obtaining provides through said operating system is provided with and/or the memory group of kernel state memory field.
4. according to each described memory allocation method of claim 1-3, it is characterized in that before the type of the said thread of identification, said method also comprises:
When a thread needed storage allocation, judging whether can be according to the said thread storage allocation of being divided into of internal memory;
If judged result is can not be according to the said thread storage allocation of being divided into of internal memory, then the memory allocation method according to the operating system acquiescence is said thread storage allocation;
Can be if judged result is according to the said thread storage allocation of being divided into of internal memory, then according to the said thread storage allocation of being divided into of internal memory.
5. according to each described memory allocation method of claim 1-4, it is characterized in that said storage allocation is from every CPU chained list storage allocation; Wherein, said every CPU chained list is divided into user chain table and kernel chained list, the physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to;
Said if said thread is user's attitude thread, then comprise for this user's attitude thread storage allocation from said user's attitude memory field:
At said thread is under the situation of user's attitude thread, if there is idle physical memory page in said user chain table, is said user's attitude thread storage allocation from said user chain table then; If said user chain table then is the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field for there not being idle physical memory page, is said user's attitude thread storage allocation from said user chain table again;
Said if said thread is the kernel state thread, then comprise for this kernel state thread storage allocation from said kernel state memory field:
At said thread is under the situation of kernel state thread, if there is idle physical memory page in said kernel chained list, is said kernel state thread storage allocation from said kernel chained list then; If there is not idle physical memory page in said kernel chained list, then be the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, be said kernel state thread storage allocation from said kernel chained list again.
6. memory allocation method according to claim 5; It is characterized in that; Be after said user chain table is distributed the physical memory page of predetermined number from said user's attitude memory field; Also comprise: in the page descriptor of the physical memory page that distributes for said user chain table, first mark is set, is used to identify current physical memory page and is used for user's attitude thread;
Be after said kernel chained list distributes the physical memory page of predetermined number from said kernel state memory field; Also comprise: in the page descriptor of the physical memory page that distributes for said kernel chained list, second mark is set, is used to identify current physical memory page and is used for the kernel state thread.
7. memory allocation method according to claim 6; It is characterized in that; Also comprise: when physical memory page discharges, remove mark set in the page descriptor of said physical memory page, and this physical memory page is joined in the free page chained list of operating system default memory distribution method.
8. a memory allocation method is characterized in that, comprising:
From the kernel state memory field is the kernel code storage allocation, and kernel code is copied in the internal memory of distribution; From user's attitude memory field is the global data storage allocation, and global data is copied in the internal memory of distribution; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
Static modification is about the mapping relations of the virtual memory and the physical memory of kernel code and global data.
9. a Memory Allocation device is characterized in that, comprising:
Recognition unit is used for when a thread needs storage allocation, discerning the type of said thread; And identifying said thread under the situation of user's attitude thread; Trigger first allocation units,, trigger second allocation units identifying under the situation that said thread is the kernel state thread; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction;
Said first allocation units, being used for from said user's attitude memory field is this user's attitude thread storage allocation;
Said second allocation units, being used for from said kernel state memory field is this kernel state thread storage allocation.
10. Memory Allocation device according to claim 9; It is characterized in that, also comprise: the modifier unit is set, is used for when said thread needs storage allocation; If operating system skips leaf unusually, then, the Memory Allocation behavior of said thread distributes the behavior modifier for being provided with user memory; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread;
Said recognition unit, whether the Memory Allocation behavior that specifically is used to discern said thread is provided with user memory is distributed the behavior modifier; Distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is user's attitude thread; Do not distribute the behavior modifier if the Memory Allocation behavior of said thread is provided with user memory, confirm that then said thread is the kernel state thread.
11., it is characterized in that said user's attitude memory field and said kernel state memory field comprise at least one memory group respectively, and same memory group only belongs to one of them memory field according to claim 9 or 10 described Memory Allocation devices; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical;
Said device also comprises:
Acquiring unit is used for when os starting, obtains the group number of the memory group of said user's attitude memory field set in the said os starting parameter and/or kernel state memory field; And/or,
In the operating system process, obtain the group number of the memory group of said user's attitude memory field that the kernel interactive interface through said operating system is provided with and/or kernel state memory field; And/or,
In the operating system process, the group number of the said user's attitude memory field that the system call interfaces that obtaining provides through said operating system is provided with and/or the memory group of kernel state memory field.
12. according to each described Memory Allocation device of claim 9-11, it is characterized in that, also comprise: judging unit and system default allocation units;
Said system default allocation units, the memory allocation method that is used for according to the operating system acquiescence is said thread storage allocation;
Said judging unit is used for when a thread needs storage allocation, and judging whether can be according to the said thread storage allocation of being divided into of internal memory; If the judged result of said judging unit is for can not then triggering said system default allocation units according to the said thread storage allocation of being divided into of internal memory, if judged result is for can then triggering said recognition unit according to the said thread storage allocation of being divided into of internal memory.
13. according to each described Memory Allocation device of claim 9-12, it is characterized in that,
Said recognition unit is used for when a thread need be from every CPU chained list storage allocation, discerning the type of said thread; Said every CPU chained list is divided into user chain table and kernel chained list, the physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to;
Said first allocation units are used for existing under the situation of idle physical memory page in said user chain table, are said user's attitude thread storage allocation from said user chain table; In said user chain table is not exist under the situation of idle physical memory page, is the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field, is said user's attitude thread storage allocation from said user chain table again;
Said second allocation units are used for existing under the situation of idle physical memory page at said kernel chained list, are said kernel state thread storage allocation from said kernel chained list; Not existing at said kernel chained list under the situation of idle physical memory page, is the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, is said kernel state thread storage allocation from said kernel chained list again.
14. device according to claim 13 is characterized in that, said first allocation units also are used for, and in the page descriptor of the physical memory page that distributes for said user chain table, first mark are set, and are used to identify current physical memory page and are used for user's attitude thread;
Said second allocation units also are used for, and in the page descriptor of the physical memory page that distributes for said kernel chained list, second mark are set, and are used to identify current physical memory page and are used for the kernel state thread.
15. device according to claim 14 is characterized in that, said device also comprises: remove indexing unit and add linked list units;
Said removing identify unit is used for when physical memory page discharges, removing mark set in the page descriptor of said physical memory page;
Said adding linked list units is used for removing the free page chained list that physical memory page behind the mark joins operating system default memory distribution method.
16. a Memory Allocation device is characterized in that, comprising:
First allocation units, being used for from the kernel state memory field is the kernel code storage allocation, and kernel code is copied in the internal memory of distribution;
Second allocation units, being used for from user's attitude memory field is the global data storage allocation, and global data is copied in the internal memory of distribution;
Revise map unit, be used for the mapping relations of static modification about the virtual memory and the physical memory of kernel code and global data; Wherein,
Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
17. internal memory; It is characterized in that; Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field, and the physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction.
18. internal memory according to claim 17 is characterized in that, the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and the kernel state memory field comprises:
Page or leaf through physical address color bits said a plurality of physical memory pages are divided at least two memory group, and said at least two memory group are divided into user's attitude memory field and kernel state memory field; Wherein, the page or leaf of each physical address of all physical memory pages in the same memory group color bits identical.
19. a computer system is characterized in that, comprising:
Bus;
The processor that links to each other with said bus;
The internal memory that links to each other with said bus;
Wherein, comprise in the said processor like each described Memory Allocation device of claim 9 to claim 16; Save as claim 17 or 18 described internal memories in said.
20. a computer system is characterized in that, comprising:
Bus;
The processor that links to each other with said bus;
The internal memory that links to each other with said bus;
Wherein, Said internal memory comprises a plurality of physical memory pages; And the said internal memory that comprises a plurality of physical memory pages is divided into user's attitude memory field and kernel state memory field; The physical memory page of said user's attitude memory field is used to store user's attitude data and instruction, and the physical memory page of said kernel state memory field is used to store kernel state data and instruction; Said processor calls the code of storing in the said internal memory through said bus, to be used for: when a thread needs storage allocation, discern the type of said thread; If said thread is user's attitude thread, then be this user's attitude thread storage allocation from said user's attitude memory field; If said thread is the kernel state thread, then be this kernel state thread storage allocation from said kernel state memory field.
21. computer system according to claim 20; It is characterized in that; Said processor also is used for when said thread needs storage allocation, if operating system skips leaf unusually, then distributes the behavior modifier for the Memory Allocation behavior of said thread is provided with user memory; Said user memory distribution behavior modifier is used for the current Memory Allocation behavior of mark to be triggered by user's attitude thread.
22. according to claim 20 or 21 described computer systems; It is characterized in that; Said processor also is used for when said thread needs storage allocation, and before the type of the said thread of identification, judging whether can be according to the said thread storage allocation of being divided into of internal memory;
If judged result is can not be according to the said thread storage allocation of being divided into of internal memory, then the memory allocation method according to the operating system acquiescence is said thread storage allocation;
Can be if judged result is according to the said thread storage allocation of being divided into of internal memory, then according to the said thread storage allocation of being divided into of internal memory.
23., it is characterized in that said storage allocation is from every CPU chained list storage allocation according to each described computer system of claim 20-22; Wherein, said every CPU chained list is divided into user chain table and kernel chained list, the physical memory page of said user's attitude memory field that each node of said user chain table points to, the physical memory page of the said kernel state memory field that each node of said user chain table points to;
Said processor is used for: under the situation of user's attitude thread, if there is idle physical memory page in said user chain table, is said user's attitude thread storage allocation from said user chain table then at said thread; If said user chain table then is the physical memory page that said user chain table is distributed predetermined number from said user's attitude memory field for there not being idle physical memory page, is said user's attitude thread storage allocation from said user chain table again;
At said thread is under the situation of kernel state thread, if there is idle physical memory page in said kernel chained list, is said kernel state thread storage allocation from said kernel chained list then; If there is not idle physical memory page in said kernel chained list, then be the physical memory page that said kernel chained list distributes predetermined number from said kernel state memory field, be said kernel state thread storage allocation from said kernel chained list again.
CN201210176906.XA 2012-05-31 2012-05-31 A kind of memory allocation method, Apparatus and system Expired - Fee Related CN102819497B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210176906.XA CN102819497B (en) 2012-05-31 2012-05-31 A kind of memory allocation method, Apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210176906.XA CN102819497B (en) 2012-05-31 2012-05-31 A kind of memory allocation method, Apparatus and system

Publications (2)

Publication Number Publication Date
CN102819497A true CN102819497A (en) 2012-12-12
CN102819497B CN102819497B (en) 2015-09-30

Family

ID=47303619

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210176906.XA Expired - Fee Related CN102819497B (en) 2012-05-31 2012-05-31 A kind of memory allocation method, Apparatus and system

Country Status (1)

Country Link
CN (1) CN102819497B (en)

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365797A (en) * 2013-07-05 2013-10-23 华为技术有限公司 Physical memory page distribution method and computer system
CN103544324A (en) * 2013-11-11 2014-01-29 北京搜狐新媒体信息技术有限公司 Kernel-mode data access method, device and system
CN104850502A (en) * 2015-05-05 2015-08-19 华为技术有限公司 Method, apparatus and device for accessing data
CN104899159A (en) * 2014-03-06 2015-09-09 华为技术有限公司 High-speed Cache address mapping processing method and apparatus
CN103927145B (en) * 2014-04-28 2017-02-15 中国科学院微电子研究所 System hibernating and awakening method and device based on hybrid memory
CN107179949A (en) * 2016-12-16 2017-09-19 重庆大学 It is a kind of to be used for the quantization method that operating system memory in mobile device distributes fluency
CN107203477A (en) * 2017-06-16 2017-09-26 深圳市万普拉斯科技有限公司 Memory allocation method, device, electronic equipment and readable storage medium storing program for executing
CN108132841A (en) * 2017-12-11 2018-06-08 杭州迪普科技股份有限公司 A kind of memory allocation method and device of the equipment based on linux system
CN108958911A (en) * 2018-05-30 2018-12-07 北京小米移动软件有限公司 The control method and device of process
CN109062693A (en) * 2018-07-26 2018-12-21 郑州云海信息技术有限公司 A kind of EMS memory management process and relevant device
CN109240621A (en) * 2018-09-25 2019-01-18 郑州云海信息技术有限公司 A kind of Nonvolatile memory reservoir management method and device
CN109688058A (en) * 2018-12-19 2019-04-26 迈普通信技术股份有限公司 Message processing method, device and the network equipment
WO2019091244A1 (en) * 2017-11-07 2019-05-16 晶晨半导体(上海)股份有限公司 Linux kernel-based memory leakage detection method
CN110109761A (en) * 2019-05-11 2019-08-09 肖银皓 A kind of User space management operating system nucleus memory method and system
CN110121114A (en) * 2018-02-07 2019-08-13 华为技术有限公司 Send the method and data transmitting equipment of flow data
WO2019237862A1 (en) * 2018-06-12 2019-12-19 杨力祥 Layout method for linear address space, and computing device
CN111177019A (en) * 2019-08-05 2020-05-19 腾讯科技(深圳)有限公司 Memory allocation management method, device, equipment and storage medium
CN111309644A (en) * 2020-02-14 2020-06-19 苏州浪潮智能科技有限公司 Memory allocation method and device and computer readable storage medium
CN113296703A (en) * 2021-05-27 2021-08-24 山东云海国创云计算装备产业创新中心有限公司 Heap memory management method, device, equipment and medium
CN113312322A (en) * 2021-04-21 2021-08-27 厦门芯泰达集成电路有限公司 STDF file reading and writing method, medium, equipment and device
CN113849238A (en) * 2021-09-29 2021-12-28 浪潮电子信息产业股份有限公司 Data communication method, device, electronic equipment and readable storage medium
CN115344507A (en) * 2021-05-14 2022-11-15 华为技术有限公司 Memory allocation method, device and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63200251A (en) * 1987-02-16 1988-08-18 Matsushita Electric Ind Co Ltd Cache memory control method
US6226725B1 (en) * 1998-04-21 2001-05-01 Ibm Method and system in a data processing system for the dedication of memory storage locations
US6732237B1 (en) * 2000-08-29 2004-05-04 Oracle International Corporation Multi-tier caching system
CN1617113A (en) * 2003-11-13 2005-05-18 国际商业机器公司 Method of assigning virtual memory to physical memory, storage controller and computer system
CN1791862A (en) * 2003-04-09 2006-06-21 扎鲁纳股份有限公司 Operating systems
CN101510176A (en) * 2009-03-26 2009-08-19 浙江大学 Control method of general-purpose operating system for accessing CPU two stage caching

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63200251A (en) * 1987-02-16 1988-08-18 Matsushita Electric Ind Co Ltd Cache memory control method
US6226725B1 (en) * 1998-04-21 2001-05-01 Ibm Method and system in a data processing system for the dedication of memory storage locations
US6732237B1 (en) * 2000-08-29 2004-05-04 Oracle International Corporation Multi-tier caching system
CN1791862A (en) * 2003-04-09 2006-06-21 扎鲁纳股份有限公司 Operating systems
CN1617113A (en) * 2003-11-13 2005-05-18 国际商业机器公司 Method of assigning virtual memory to physical memory, storage controller and computer system
CN101510176A (en) * 2009-03-26 2009-08-19 浙江大学 Control method of general-purpose operating system for accessing CPU two stage caching

Cited By (36)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365797B (en) * 2013-07-05 2017-05-31 华为技术有限公司 Physical memory page distribution method and computer system
CN103365797A (en) * 2013-07-05 2013-10-23 华为技术有限公司 Physical memory page distribution method and computer system
CN103544324A (en) * 2013-11-11 2014-01-29 北京搜狐新媒体信息技术有限公司 Kernel-mode data access method, device and system
CN103544324B (en) * 2013-11-11 2017-09-08 北京搜狐新媒体信息技术有限公司 A kind of data access method of kernel state, apparatus and system
CN104899159A (en) * 2014-03-06 2015-09-09 华为技术有限公司 High-speed Cache address mapping processing method and apparatus
CN103927145B (en) * 2014-04-28 2017-02-15 中国科学院微电子研究所 System hibernating and awakening method and device based on hybrid memory
CN104850502B (en) * 2015-05-05 2018-03-09 华为技术有限公司 A kind of access method of data, device and equipment
CN104850502A (en) * 2015-05-05 2015-08-19 华为技术有限公司 Method, apparatus and device for accessing data
CN107179949A (en) * 2016-12-16 2017-09-19 重庆大学 It is a kind of to be used for the quantization method that operating system memory in mobile device distributes fluency
CN107179949B (en) * 2016-12-16 2020-11-24 重庆大学 Quantification method for operating system memory distribution fluency in mobile equipment
CN107203477A (en) * 2017-06-16 2017-09-26 深圳市万普拉斯科技有限公司 Memory allocation method, device, electronic equipment and readable storage medium storing program for executing
US11106574B2 (en) 2017-06-16 2021-08-31 Oneplus Technology (Shenzhen) Co., Ltd. Memory allocation method, apparatus, electronic device, and computer storage medium
WO2019091244A1 (en) * 2017-11-07 2019-05-16 晶晨半导体(上海)股份有限公司 Linux kernel-based memory leakage detection method
US11157389B1 (en) 2017-11-07 2021-10-26 Amlogic (Shanghai) Co., Ltd. Method for detecting memory leak based on linux kernel
CN108132841A (en) * 2017-12-11 2018-06-08 杭州迪普科技股份有限公司 A kind of memory allocation method and device of the equipment based on linux system
WO2019154221A1 (en) * 2018-02-07 2019-08-15 华为技术有限公司 Method for sending streaming data and data sending device
CN110121114A (en) * 2018-02-07 2019-08-13 华为技术有限公司 Send the method and data transmitting equipment of flow data
CN110121114B (en) * 2018-02-07 2021-08-27 华为技术有限公司 Method for transmitting stream data and data transmitting apparatus
CN108958911A (en) * 2018-05-30 2018-12-07 北京小米移动软件有限公司 The control method and device of process
WO2019237862A1 (en) * 2018-06-12 2019-12-19 杨力祥 Layout method for linear address space, and computing device
CN109062693A (en) * 2018-07-26 2018-12-21 郑州云海信息技术有限公司 A kind of EMS memory management process and relevant device
CN109240621A (en) * 2018-09-25 2019-01-18 郑州云海信息技术有限公司 A kind of Nonvolatile memory reservoir management method and device
CN109240621B (en) * 2018-09-25 2021-12-24 郑州云海信息技术有限公司 Nonvolatile internal memory management method and device
CN109688058B (en) * 2018-12-19 2021-03-02 迈普通信技术股份有限公司 Message processing method and device and network equipment
CN109688058A (en) * 2018-12-19 2019-04-26 迈普通信技术股份有限公司 Message processing method, device and the network equipment
CN110109761A (en) * 2019-05-11 2019-08-09 肖银皓 A kind of User space management operating system nucleus memory method and system
CN110109761B (en) * 2019-05-11 2021-06-04 广东财经大学 Method and system for managing kernel memory of operating system in user mode
CN111177019B (en) * 2019-08-05 2021-07-16 腾讯科技(深圳)有限公司 Memory allocation management method, device, equipment and storage medium
CN111177019A (en) * 2019-08-05 2020-05-19 腾讯科技(深圳)有限公司 Memory allocation management method, device, equipment and storage medium
CN111309644A (en) * 2020-02-14 2020-06-19 苏州浪潮智能科技有限公司 Memory allocation method and device and computer readable storage medium
CN113312322A (en) * 2021-04-21 2021-08-27 厦门芯泰达集成电路有限公司 STDF file reading and writing method, medium, equipment and device
CN113312322B (en) * 2021-04-21 2022-04-01 厦门芯泰达集成电路有限公司 STDF file reading and writing method, medium, equipment and device
CN115344507A (en) * 2021-05-14 2022-11-15 华为技术有限公司 Memory allocation method, device and system
CN113296703A (en) * 2021-05-27 2021-08-24 山东云海国创云计算装备产业创新中心有限公司 Heap memory management method, device, equipment and medium
CN113849238A (en) * 2021-09-29 2021-12-28 浪潮电子信息产业股份有限公司 Data communication method, device, electronic equipment and readable storage medium
CN113849238B (en) * 2021-09-29 2024-02-09 浪潮电子信息产业股份有限公司 Data communication method, device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN102819497B (en) 2015-09-30

Similar Documents

Publication Publication Date Title
CN102819497B (en) A kind of memory allocation method, Apparatus and system
US8595463B2 (en) Memory architecture with policy based data storage
US11720993B2 (en) Dynamic kernel memory space allocation
US20100262738A1 (en) Command and interrupt grouping for a data storage device
US9507731B1 (en) Virtualized cache memory
EP3475809A1 (en) System and method for using virtual vector register files
CN102985910A (en) GPU support for garbage collection
CN102667714B (en) Support the method and system that the function provided by the resource outside operating system environment is provided
CN101369245A (en) System and method for implementing a memory defect map
US9817754B2 (en) Flash memory management
CN108733324B (en) Data reading and writing method, device and equipment of solid state disk and storage medium
US9727465B2 (en) Self-disabling working set cache
CN111930643B (en) Data processing method and related equipment
CN105988875B (en) Method and device for running process
US11061676B2 (en) Scatter gather using key-value store
US20130346714A1 (en) Hardware-Based Accelerator For Managing Copy-On-Write
CN103140834A (en) Processor support for filling memory regions
CN110447019B (en) Memory allocation manager and method for managing memory allocation performed thereby
US20140149691A1 (en) Data processing system and data processing method
US20130318302A1 (en) Cache controller based on quality of service and method of operating the same
CN101470668B (en) Computer and method for configuring high speed caching control policy on computer
US11307999B2 (en) Data cache segregation for spectre mitigation
CN104298471A (en) High-speed cache data writing method and device
CN110569122A (en) Multiprocessor system, multi-core processing device, and method of operating the same
KR102334237B1 (en) Methods and apparatuses for managing page cache for multiple foreground application

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150930

Termination date: 20160531