Memory resource allocation method, resource isolation and reservation system and related device

By distinguishing memory areas and cache groups on the bank bit and set bit of the memory address, the isolation of memory and cache resources between processes is solved, and the problem of memory and cache resource contention in multi-process environments is improved, and the system performance and predictability are improved. sex.

CN119065825APending Publication Date: 2024-12-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310653810.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-02
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In a multi-process running environment, the contention of memory and cache resource between processes leads to unpredictable performance, and the existing technology cannot effectively isolate physical memory and cache resources, resulting in cache line conflicts and frequent exchanges.

Method used

By distinguishing and shading on the bank bit and set bit of the memory address, multiple memory areas and cache groups are formed. The process group module controls the process to uniquely access specific memory colors and cache resources, realizing the isolation of memory and cache resources.

Benefits of technology

It effectively reduces memory replacement and cache contention between processes, improves system performance prediction, and improves process isolation from memory and cache resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065825A_ABST
    Figure CN119065825A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a memory resource allocation method, a resource isolation and reservation system and a related device.The method comprises the steps that in response to an idle page application request for a process received by a memory allocation module, a process group bound with the process is determined through a process group module, and a memory color corresponding to the process group is determined; a target free page corresponding to the memory color is determined through a memory allocation module, cache resources and a memory area are allocated for the process according to the memory color, the target free page is returned, the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area. By adopting the embodiment of the invention, the conditions of memory replacement and cache contention between processes can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory resource allocation method, a resource isolation and reservation system, and related devices. Background Art

[0002] In order to alleviate the huge speed difference between the central processing unit (CPU) and the hard disk, computer system designers were forced to insert large-capacity memory and small-capacity SRAM cache between the hard disk and the CPU in turn to utilize the spatial locality of the program and optimize the program's memory access performance.

[0003] Generally, the memory size used by the process is configured through the memory cgroup. However, in the actual multi-process running process, it is possible that the page to be accessed during the address mapping process is not in the memory, causing contention for memory between processes, which will have an unpredictable impact on program performance. Summary of the invention

[0004] The embodiments of the present application provide a memory resource allocation method, a resource isolation and reservation system, and related devices, which improve the success rate of receiving MT text messages by electronic devices, and are conducive to improving user experience.

[0005] In a first aspect, an embodiment of the present application provides a memory resource allocation method, which is applied to a resource isolation and reservation system, wherein the resource isolation and reservation system includes a process group module and a memory allocation module, and the method includes:

[0006] In response to a free page application request for a process received by the memory allocation module, determining a process group bound to the process through the process group module, and determining a memory color corresponding to the process group;

[0007] The target free page corresponding to the memory color is determined by the memory allocation module, and cache resources and memory areas are allocated to the process according to the memory color, and the target free page is returned, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

[0008] In a second aspect, an embodiment of the present application provides a resource isolation and reservation system, wherein the resource isolation and reservation system includes a process group module and a memory allocation module, wherein:

[0009] The memory allocation module is used to distinguish and color each of the at least one free page according to the memory bank bit and the set bit in advance, so as to isolate the memory resources into multiple memory areas, wherein one free page corresponds to one memory color;

[0010] The process group module is used to control a process in any process group to uniquely access an idle page of any memory color;

[0011] The memory allocation module is further used to allocate target free pages to processes in the process group and reclaim released physical pages, wherein the target free page is any one of the at least one free page.

[0012] In a third aspect, an embodiment of the present application provides a memory resource allocation device, which is applied to a resource isolation and reservation system, wherein the resource isolation and reservation system includes a process group module and a memory allocation module, and the device includes: a determination unit and a processing unit, wherein:

[0013] The determining unit is used to determine the process group bound to the process through the process group module in response to the free page application request for the process received by the memory allocation module, and determine the memory color corresponding to the process group;

[0014] The processing unit is used to determine the target free page corresponding to the memory color through the memory allocation module, allocate cache resources and memory areas to the process according to the memory color, and return the target free page, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

[0015] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method of the first aspect of the embodiment of the present application.

[0016] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.

[0017] In a sixth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.

[0018] It can be seen that in the embodiment of the present application, in response to the free page application request for the process received by the memory allocation module, the process group bound to the process is determined by the process group module, and the memory color corresponding to the process group is determined; the target free page corresponding to the memory color is determined by the memory allocation module, and cache resources and memory areas are allocated to the process according to the memory color, and the target free page is returned, wherein the memory color is determined by the memory bank bit and the set bit, and the target free page uniquely accesses the memory area. In this way, when the process needs to apply for a free page, the memory color can be determined by the process group, and the target free page in the memory allocation module can be located by the memory color, and the corresponding cache resources can be uniquely determined for the process. In this way, when one or more processes need to allocate memory resources, it is beneficial to isolate the cache resources and memory resources corresponding to each process. The isolated memory resources and cache isolation are beneficial to reduce memory replacement and cache contention between processes. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1A It is a schematic diagram of the architecture of a resource isolation and reservation system provided in an embodiment of the present application;

[0021] Figure 1B It is a schematic diagram of the architecture of a resource isolation and reservation system provided in an embodiment of the present application;

[0022] Figure 2 It is a flowchart of a memory resource allocation method provided in an embodiment of the present application;

[0023] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0024] Figure 4 It is a block diagram of the functional units of a memory resource allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0027] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0028] The electronic device may be a portable electronic device that also includes other functions such as a personal digital assistant and / or a music player function, such as a mobile phone, a tablet computer, a terminal device, a wearable electronic device with a wireless communication function (such as a smart watch, smart glasses), a vehicle-mounted device, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with an IOS system, an Android system, a Microsoft system, or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer (Laptop), etc. It should also be understood that in some other embodiments, the above-mentioned electronic device may not be a portable electronic device, but a desktop computer.

[0029] Currently, the memory size used by a process is generally configured through the memory cgroup. The memory cgroup cannot isolate physical memory or cache resources for the process.

[0030] Furthermore, in the common set-associative cache structure, the cache is divided into a series of cache sets according to the set bits in the memory address space. Each set contains multiple cache lines. Different lines in each set are uniquely distinguished by tags, and each set is uniquely distinguished by a set number. As the speed difference between the CPU and the main memory system continues to widen, the cache hierarchy between the CPU and the main memory is also gradually increasing. Modern CPUs usually have three levels of cache, namely L1cache, L2cache, and L3cache. Cache can store both data and instructions. Modern CPUs use separate instruction caches (i-cache) and data caches (dcache) to ensure that data access and instruction access do not interfere with each other and cause cache line conflicts. Currently, on multi-core processor systems, the memory and cache system are shared by processors, and the last level cache (LLC) can often be accessed by multiple processors. Such an architecture can effectively improve the efficiency of data transmission between cores, and at the same time, it also allows LLC resources of memory and cache to be dynamically allocated between cores.

[0031] However, in the actual multi-process operation, it is possible that the page to be accessed during the address mapping process is not in the memory, causing memory contention between processes; at the same time, the physical pages belonging to two processes may be mapped to the same cache line, causing cache contention, which will lead to frequent swapping of the cache line. The above two situations will have an unpredictable impact on program performance.

[0032] In response to the above problems, the present application proposes a memory resource allocation method, a resource isolation and reservation system and related devices, which are described in detail below.

[0033] like Figure 1A As shown, it is a schematic diagram of the architecture of a resource isolation and reservation system, which can be loaded or applied to an electronic device. As shown in the figure, the memory resource allocation system may include: a process group module and a memory allocation module.

[0034] The memory allocation module is used to distinguish and color each of the at least one free page according to the memory bank bit and the set bit in advance, so as to isolate the memory resources into multiple memory areas, wherein one free page corresponds to one memory color;

[0035] The process group module is used to control a process in any process group to uniquely access an idle page of any memory color;

[0036] The memory allocation module is further used to allocate target free pages to processes in the process group and reclaim released physical pages, wherein the target free page is any one of the at least one free page.

[0037] The configuration process of the process group module includes creating a process subsystem, specifying the memory color that the process group can access, and binding the process to the process group.

[0038] The above-mentioned idle page may refer to a physical page in an idle state.

[0039] The configuration of the process group module can be configured by simulating a mount operation, creating a directory (mkdir) operation, etc.

[0040] Among them, in the system startup phase, the idle pages are pre-marked according to the memory bank bit and the set bit. In the memory address, the bank bit is usually at the 12th-15th bit, and the set bit is usually at the 13th-14th bit. In this embodiment, for the bank bit, the 15th bit is used for coloring; for the set bit, the 14th bit is used for coloring, so in the isolated memory resources, the memory is divided into four parts that do not interfere with each other, that is, the 15th and 14th bit combinations of the memory address are (0,0), (0,1), (1,0), (1,1) respectively. These four parts are isolated from each other, and we call them four memory colors. Then, for the set-connected cache structure, since the memory uses the set bit to determine the cache resources it can access, the memory resources combined as (0,0) and (1,0) can only access the 0th group of cache resources, and the memory resources combined as (0,1) and (1,1) can only access the 1st group of cache resources. The cache is divided into two parts that do not interfere with each other and are isolated from each other.

[0041] For example, in a memory address, since the bank bit and the set bit occupy multiple bits, when m (a positive integer greater than 1) bits are used to pre-color the free pages, the memory resources can be isolated into 2 m memory area.

[0042] For example, the memory allocation module can assign a unique color to each physical page (including free pages) by distinguishing different combinations of bank bits and set bits of the memory address.

[0043] Among them, the process group module enables the physical page of the fixed memory color applied by the process group to only access the memory area corresponding to the fixed memory color, so that the memory resources to be accessed by different process groups can be isolated from each other.

[0044] The released physical page may refer to an idle page that has been used up or an unavailable physical page, which may be released to the system.

[0045] Among them, after the above-mentioned memory allocation module has pre-differentiated and colored each free page in at least one free page according to the memory bank bit and the set bit, it can isolate the memory resources into multiple memory areas, and maintain several free pages of different memory colors in a linked list array, and each free page can correspond to a unique memory color.

[0046] For example, the system can create a path for the folder experiment for mounting, and mount the subprocess system to it. We mount the process subsystem to the dir_path path; then, we create four specific process groups under the dir_name path. These four process groups correspond to four memory colors, and are named "load1", "load2", "load3", and "load4" for management; then, color numbers are assigned to the four process groups, and the color number is 1 for " / experiment / load1", 2 for " / experiment / load2", 3 for " / experiment / load3", and 4 for " / experiment / load4"; finally, the processes are bound to different process groups through the process PID. At this point, a complete configuration of the process group module is completed.

[0047] Furthermore, after the process group module is configured, the isolation of memory resources can be achieved by controlling the processes in a process group to only access the memory area of ​​a unique memory color. After the process group module is configured, the memory resources corresponding to "load1" and "load3" can only access the 0th group of cache resources (for example, cache group), and the memory resources corresponding to "load2" and "load4" can only access the 1st group of cache resources, thereby achieving the isolation of cache resources.

[0048] It can be seen that after the process group in the process group module accesses the memory resource of the unique memory color, since the memory resource distinguished by the set bit only corresponds to a unique combined cache group, the memory resource corresponding to the process group can only access the combined cache group, thereby isolating the cache resources between different process groups, thereby realizing the isolation of the resource and the isolation of the cache resources in the reserved system.

[0049] It should be noted that, in the present application, the memory color corresponding to each free page can be set through the bank bit and the set bit to distinguish the free pages by color, thereby isolating the memory resources to be accessed from each other; the above isolation is only for memory resources, that is, the reserved memory resources will also be memory resources; cache resources, as a higher or faster storage device in the storage hierarchy, can be mapped to it through the set bit of the memory resources, thereby achieving the isolation and reservation of cache resources.

[0050] In a possible example, the process group module is further used to:

[0051] The corresponding process is bound to the process group through the process PID, and the process group is configured to limit any one of the processes in the process group to only access the cache resource corresponding to the unique memory color.

[0052] Each time an electronic device or system opens a program, it will assign a process code, namely, a process PID (Process Identification). The process PID is temporary and unique, corresponding to the process.

[0053] Among them, the process group module in the resource isolation and reservation system binds the specified process to the corresponding process group through the process PID number. After certain configuration of the process group, the processes in the process group can be restricted to access only memory resources of a unique memory color, that is, cache resources.

[0054] It can be seen that in this example, memory resources are isolated between different process groups, thereby achieving the isolation of the resource and the isolation of memory resources in the reserved system.

[0055] In a possible example, the memory allocation module includes a Linux partner system and a linked list array, wherein each of the memory colors corresponds to a linked list in the linked list array, and the linked list in the linked list array stores at least one of the free pages.

[0056] For example, Figure 1B As shown, a resource isolation and reservation system is shown, which includes a process group module and a memory allocation module.

[0057] The process group module includes two process groups, namely group-1 and group-2. Group-1 includes two processes, and group-2 includes four processes.

[0058] The memory allocation module includes a Linux partner system and a linked list array. The linked list array (color-list) includes multiple linked lists, for example, color-0, color-1, color-2, ..., color-n, where n is a positive integer greater than 1; each linked list includes one or more physical pages, and the physical page includes a free page. For example, for the color-0 linked list, it includes 3 free pages.

[0059] The Linux partner system is used to manage system memory block resources, and the free memory blocks can be organized according to the splitting rules of the Linux partner system, and the free memory blocks are used to configure free pages.

[0060] Among them, Figure 1B As shown, the memory allocation module is outside the Linux partner system and maintains a linked list array color_list. Each memory color in the system corresponds to a linked list in the linked list array, and each linked list stores a certain number of free pages corresponding to the memory color.

[0061] It can be seen that in this example, at least one or more free pages can be stored through a linked list array, and a memory color and a free page corresponding to the memory color can be allocated to each linked list in the linked list array, so that when a process requests a free page, the corresponding target free page can be located through the linked list array, which is conducive to the reservation and use of free pages.

[0062] In a possible example, the process group module is further used to:

[0063] Apply for a free page corresponding to the memory color from the linked list array, and return the free page when the free page is successfully applied for.

[0064] In a possible example, the process group module is further used to:

[0065] When the application for the free page fails, apply for a free memory block from the Linux partner system, insert the free memory block into the linked list array, and repeat the step of applying for a free page corresponding to the memory color from the linked list array until the application for the free page is successful.

[0066] Among them, the process group module can apply for a free page (target free page) for any process through a linked list array.

[0067] The free memory block is used to configure the free memory, and the free memory block is organized and applied for according to the splitting rule of the Linux partner system.

[0068] In the specific implementation, when a process in the process group module applies for a free page through the process group, it can only apply for a free page of the corresponding memory color from the above-mentioned linked list array, and the free page will be returned if the application is successful; if the application fails, it may be due to the lack of free pages of the corresponding memory color in the linked list array, network delay, etc., then a free memory block can be applied from the Linux partner system, and the free page corresponding to the free memory block can be inserted into the linked list array. Then, the process group module can re-apply for a free page of the corresponding memory color from the linked list array repeatedly until the application is successful or the free page is obtained successfully.

[0069] It can be seen that in this example, the process group module can apply for free pages through the linked list array, and when the application fails, it can apply for free memory blocks through the Linux partner system, and repeat the operation of obtaining free pages, and return the free pages after the application is successful. This is conducive to ensuring the success rate of free page applications.

[0070] It should be noted that when the process groups in the above process group module apply for free pages and release physical pages, the objects they interact with are all memory allocation modules. That is, the process groups in the process group module only apply for free pages from the memory allocation module, and when they release physical pages, they only release them to the memory allocation module, so that the subsequent Linux partner system can allocate new free pages to the linked list array.

[0071] Optionally, when releasing physical pages, the process group in the process group module gives priority to releasing the physical pages that need to be released into the linked list array; when the number of free pages of the corresponding memory color in the linked list array reaches a threshold (the threshold of each linked list can be set differently, and the specific value is not limited here), the free page can also be released to the Linux partner system to facilitate the subsequent Linux partner system to allocate new free pages to the linked list array.

[0072] In a possible example, the memory allocation module is further used to:

[0073] Regularly checking the number of free pages of each memory color in the linked list array;

[0074] If the number is less than or equal to a preset threshold, the Linux partner system is controlled to allocate free pages corresponding to the memory color to the linked list data, so as to reserve memory resources for the process group in the process group module, so as to further reserve cache resources for the process group.

[0075] The above preset threshold can be set by the user or by the system default, which is not limited here. In addition, the threshold of the maximum number of free pages corresponding to each linked list can also be preset; the sum of the thresholds corresponding to each linked list is the preset threshold corresponding to the above linked list data.

[0076] For example, Figure 1A or Figure 1B The memory allocation module shown can periodically check the number of free pages in the linked list array. When the number of physical pages in the linked list array is less than 32, the Linux partner system allocates a corresponding number (missing number) of pages to the linked list array, which can be allocated according to the threshold of each linked list.

[0077] It can be seen that in this example, the system can reserve memory resources by ensuring that there is always a corresponding free page for each memory color in the linked list array.

[0078] In addition, because the process group in the process group module can only apply for the free page of the corresponding memory color from the linked list array when applying for the memory page, and the memory color is distinguished and marked by the memory bank bit and the set bit, the set bit corresponding to this part of the memory resource is unique, so for the memory resources reserved by the process group in the process group module, the corresponding cache resources are also unique, so by ensuring that there are always free physical pages for each color in the linked list array, the above process group in the process group module realizes the reservation of memory resources and cache resources. This is conducive to protecting specific processes and improving the predictability of the system.

[0079] It can be seen that the resource isolation and reservation system described in the embodiment of the present application may include a resource isolation and reservation system including a process group module and a memory allocation module, wherein the memory allocation module is used to pre-distinguish and color each free page in at least one free page according to the memory bank bit and the set bit, so as to isolate the memory resources into multiple memory areas, wherein one free page corresponds to a memory color; the process group module is used to control the process in any process group to uniquely access the free page of any memory color; the memory allocation module is also used to allocate target free pages to the processes in the process group and recycle the released physical pages, wherein the target free page is any one of the at least one free page. In this way, the memory color can be distinguished and marked by the bank bit and the set bit, and the cache resources can be isolated when the set bit corresponding to the memory resource is unique; and different process groups use different memory colors, and the isolated memory resources and cache resources can reduce memory replacement and cache contention between processes.

[0080] It should be noted that in the embodiments of the present application, only one electronic device is used for illustration, and the others are not described in detail here; the multiple in the embodiments of the present application may refer to two or more, which will not be described in detail later.

[0081] See also Figure 2 , Figure 2 It is a flow chart of a memory resource allocation method provided in an embodiment of the present application, which is applied to a resource isolation and reservation system. The resource isolation and reservation system includes a process group module and a memory allocation module. As shown in the figure, the memory resource allocation method includes the following operations.

[0082] S201. In response to a free page application request for a process received by the memory allocation module, determine a process group bound to the process through the process group module, and determine a memory color corresponding to the process group.

[0083] S202. Determine the target free page corresponding to the memory color through the memory allocation module, allocate cache resources and memory area to the process according to the memory color, and return the target free page, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

[0084] Among them, the above-mentioned memory allocation module and memory allocation module are as follows Figure 1A or Figure 1B The description of the related steps of the above steps S201-S202 can also be found in Figure 1A In the description shown.

[0085] Among them, in this application, the memory resource allocation method is only described for one process. This method is applicable to any process in multiple process groups and will not be repeated here.

[0086] Different memory groups correspond to different memory colors.

[0087] It can be seen that the memory resource allocation method described in the embodiment of the present application, in response to the free page application request for the process received by the memory allocation module, determines the process group bound to the process through the process group module, and determines the memory color corresponding to the process group; determines the target free page corresponding to the memory color through the memory allocation module, and allocates cache resources and memory areas to the process according to the memory color, and returns the target free page, wherein the memory color is determined by the memory bank bit and the set bit, and the target free page uniquely accesses the memory area. In this way, when the process needs to apply for a free page, the memory color can be determined by the process group, and the target free page in the memory allocation module can be located by the memory color, and the corresponding cache resources can be uniquely determined for the process. In this way, when one or more processes need to allocate memory resources, it is beneficial to isolate the cache resources and memory resources corresponding to each process, and the isolated memory resources and cache isolation are beneficial to reduce memory replacement and cache contention between processes.

[0088] In a possible example, determining the process group bound to the process through the process group module may include the following steps: determining the process PID corresponding to the process through the process group module; and determining the process group bound to the process based on the process PID.

[0089] The process PID is used to uniquely identify the process, and the process group corresponding to each process can be determined through the process group module.

[0090] It can be seen that in this example, the process group module can be used to determine the process group corresponding to the process, so as to facilitate the later determination of the unique memory color corresponding to the process group and facilitate the rapid positioning of the free page.

[0091] In a possible example, allocating cache resources to the process according to the memory color may include the following steps: determining the cache resources corresponding to the process according to the set bit corresponding to the memory color, and allocating the cache resources to the process, wherein the process has exclusive access to the cache resources.

[0092] Among them, for the set-connected cache structure, the cache is divided into a series of cache groups according to the set bit in the memory address space, and then the physical page (including the free page) can find its corresponding cache group through the set bit. Each group contains multiple cache lines, and then the physical page finds its corresponding cache line through the tag mark, and the data is transmitted thereby.

[0093] Among them, the resource isolation and reservation system or electronic device can isolate cache resources to be accessed by different process groups from each other.

[0094] Specifically, the resource isolation and reservation system or electronic device can distinguish different situations of memory set bits so that the physical pages applied for by the process group corresponding to the process can only access the cache group (i.e., cache resources) with fixed set bits, thereby realizing the isolation of cache resources and determining the cache resources that are uniquely accessed by the process.

[0095] It can be seen that in this example, after the process group in the process group module accesses the memory resource of the unique memory color, since the memory resource distinguished by the set bit only corresponds to the unique combined cache group, the memory resource corresponding to the process group can only access the combined cache group, thereby isolating the cache resources between different process groups, realizing the isolation of the resource and the isolation of the cache resources in the reserved system, and therefore, the cache resources uniquely accessed by the process can be obtained.

[0096] See also Figure 3 , Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface and one or more programs, which are applied to the electronic device. The electronic device includes a resource isolation and reservation system, and the resource isolation and reservation system includes a process group module and a memory allocation module, wherein the one or more programs are stored in the memory, and the one or more programs are configured to execute the following steps by the processor:

[0097] In response to a free page application request for a process received by the memory allocation module, determining a process group bound to the process through the process group module, and determining a memory color corresponding to the process group;

[0098] The target free page corresponding to the memory color is determined by the memory allocation module, and cache resources and memory areas are allocated to the process according to the memory color, and the target free page is returned, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

[0099] It can be seen that the electronic device described in the embodiment of the present application, in response to the free page application request for the process received by the memory allocation module, determines the process group bound to the process through the process group module, and determines the memory color corresponding to the process group; determines the target free page corresponding to the memory color through the memory allocation module, and allocates cache resources and memory areas to the process according to the memory color, and returns the target free page, wherein the memory color is determined by the memory bank bit and the set bit, and the target free page uniquely accesses the memory area. In this way, when the process needs to apply for a free page, the memory color can be determined by the process group, and the target free page in the memory allocation module can be located by the memory color, and the corresponding cache resources can be uniquely determined for the process. In this way, when one or more processes need to allocate memory resources, it is beneficial to isolate the cache resources and memory resources corresponding to each process, and the isolated memory resources and cache isolation are beneficial to reduce memory replacement and cache contention between processes.

[0100] In a possible example, the process group bound to the process is determined by the process group module, and the program further includes instructions for executing the following steps:

[0101] Determine the process PID corresponding to the process by the process group module;

[0102] The process group bound to the process is determined according to the process PID.

[0103] In a possible example, the cache resource is allocated to the process according to the memory color, and the program further includes instructions for executing the following steps:

[0104] According to the set bit corresponding to the memory color, the cache resource corresponding to the process is determined, and the cache resource is allocated to the process, wherein the process has exclusive access to the cache resource.

[0105] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0106] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0107] In the case of dividing each functional module into corresponding functional modules, Figure 4 A schematic diagram of a memory resource allocation device is shown, Figure 4 As shown, the device is applied to a resource isolation and reservation system, the resource isolation and reservation system includes a process group module and a memory allocation module, and the memory resource allocation device 400 may include: a determination unit 401 and a processing unit 402, wherein:

[0108] The determining unit 401 is used to determine the process group bound to the process through the process group module in response to the free page application request for the process received by the memory allocation module, and determine the memory color corresponding to the process group;

[0109] The processing unit 402 is used to determine the target free page corresponding to the memory color through the memory allocation module, allocate cache resources and memory areas to the process according to the memory color, and return the target free page, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

[0110] It can be seen that the memory resource allocation device provided in the embodiment of the present application, in response to the free page application request for the process received by the memory allocation module, determines the process group bound to the process through the process group module, and determines the memory color corresponding to the process group; determines the target free page corresponding to the memory color through the memory allocation module, and allocates cache resources and memory areas to the process according to the memory color, and returns the target free page, wherein the memory color is determined by the memory bank bit and the set bit, and the target free page uniquely accesses the memory area. In this way, when the process needs to apply for a free page, the memory color can be determined by the process group, and the target free page in the memory allocation module can be located by the memory color, and the corresponding cache resources can be uniquely determined for the process. In this way, when one or more processes need to allocate memory resources, it is beneficial to isolate the cache resources and memory resources corresponding to each process, and the isolated memory resources and cache isolation are beneficial to reduce memory replacement and cache contention between processes.

[0111] In a possible example, the process group bound to the process is determined by the process group module, and the determining unit 401 is specifically used to:

[0112] Determine the process PID corresponding to the process by the process group module;

[0113] The process group bound to the process is determined according to the process PID.

[0114] In a possible example, the cache resource is allocated to the process according to the memory color, and the processing unit 402 is specifically configured to:

[0115] According to the set bit corresponding to the memory color, the cache resource corresponding to the process is determined, and the cache resource is allocated to the process, wherein the process has exclusive access to the cache resource.

[0116] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0117] The electronic device provided in this embodiment is used to execute the above-mentioned memory resource allocation method, and thus can achieve the same effect as the above-mentioned implementation method.

[0118] In the case of using integrated units, the electronic device may include a processing module, a storage module and a communication module. Among them, the processing module can be used to control and manage the actions of the electronic device, for example, it can be used to support the electronic device to execute the steps performed by the above-mentioned determination unit 401 and the processing unit 402. The storage module can be used to support the electronic device to execute stored program codes and data, etc. The communication module can be used to support the communication between the electronic device and other devices.

[0119] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, etc.

[0120] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0121] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.

[0122] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0123] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0124] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0125] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0127] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.

[0128] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which can include: a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.

[0129] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A memory resource allocation method, applied to a resource isolation and reservation system, characterized in that: The resource isolation and reservation system includes a process group module and a memory allocation module, and the method includes: In response to a free page application request for a process received by the memory allocation module, determining a process group bound to the process through the process group module, and determining a memory color corresponding to the process group; The target free page corresponding to the memory color is determined by the memory allocation module, and cache resources and memory areas are allocated to the process according to the memory color, and the target free page is returned, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

2. The method according to claim 1, characterized in that The determining the process group bound to the process by the process group module includes: Determine the process PID corresponding to the process by the process group module; The process group bound to the process is determined according to the process PID.

3. The method according to claim 1, characterized in that The allocating cache resources to the process according to the memory color comprises: According to the set bit corresponding to the memory color, the cache resource corresponding to the process is determined, and the cache resource is allocated to the process, wherein the process has exclusive access to the cache resource.

4. A resource isolation and reservation system, characterized in that: The resource isolation and reservation system includes a process group module and a memory allocation module, wherein: The memory allocation module is used to distinguish and color each of the at least one free page according to the memory bank bit and the set bit in advance, so as to isolate the memory resources into multiple memory areas, wherein one free page corresponds to one memory color; The process group module is used to control a process in any process group to uniquely access a free page of a unique memory color; The memory allocation module is further used to allocate target free pages to processes in the process group and reclaim released physical pages, wherein the target free page is any one of the at least one free page.

5. The resource isolation and reservation system according to claim 4, characterized in that: The process group module is also used to: The corresponding process is bound to the process group through the process PID, and the process group is configured to limit any one of the processes in the process group to only access the cache resource corresponding to the unique memory color.

6. The resource isolation and reservation system according to claim 4, characterized in that: The memory allocation module includes a Linux partner system and a linked list array, wherein each of the memory colors corresponds to a linked list in the linked list array, and the linked list in the linked list array stores at least one of the free pages.

7. The resource isolation and reservation system according to claim 6, characterized in that: The process group module is also used to: Apply for a free page corresponding to the memory color from the linked list array, and return the free page when the free page is successfully applied for.

8. The resource isolation and reservation system according to claim 7, characterized in that: The process group module is also used to: When the application for the free page fails, apply for a free memory block from the Linux partner system, insert the free memory block into the linked list array, and repeat the step of applying for a free page corresponding to the memory color from the linked list array until the application for the free page is successful.

9. The resource isolation and reservation system according to claim 6 or 8, characterized in that: The memory allocation module is also used for: Regularly checking the number of free pages of each memory color in the linked list array; If the number is less than or equal to a preset threshold, the Linux partner system is controlled to allocate free pages corresponding to the memory color to the linked list data, so as to reserve memory resources for the process group in the process group module, so as to further reserve cache resources for the process group.

10. A memory resource allocation device, characterized in that: Applied to a resource isolation and reservation system, the resource isolation and reservation system includes a process group module and a memory allocation module, the device includes: a determination unit and a processing unit, wherein: The determining unit is used to determine the process group bound to the process through the process group module in response to the free page application request for the process received by the memory allocation module, and determine the memory color corresponding to the process group; The processing unit is used to determine the target free page corresponding to the memory color through the memory allocation module, allocate cache resources and memory areas to the process according to the memory color, and return the target free page, wherein the memory color is determined by a memory bank bit and a set bit, and the target free page uniquely accesses the memory area.

11. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 3.

12. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 3.

Citation Information

Cited By

  • Page allocation method, product, equipment and medium

    CN119357082A