CN107247673A - A kind of memory allocation method and device - Google Patents
A kind of memory allocation method and device Download PDFInfo
- Publication number
- CN107247673A CN107247673A CN201710422776.6A CN201710422776A CN107247673A CN 107247673 A CN107247673 A CN 107247673A CN 201710422776 A CN201710422776 A CN 201710422776A CN 107247673 A CN107247673 A CN 107247673A
- Authority
- CN
- China
- Prior art keywords
- memory
- system member
- hardware information
- total amount
- members
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000004364 calculation method Methods 0.000 claims description 20
- 238000010586 diagram Methods 0.000 description 4
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Memory System (AREA)
Abstract
本发明公开了一种内存分配方法和装置,其中该方法包括:获取预先基于存储系统中每个系统成员的软件架构为其设置的第一内存数量,其中每个所述系统成员的软件架构相同;采集每个所述系统成员的硬件信息,并基于所述硬件信息计算出每个所述系统成员的第二内存数量;将每个所述系统成员的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个所述系统成员的内存总数量。本发明公开的内存分配方法使得存储系统为每个系统成员分配的内存总数量基本等于其实际需要的内存总数量,解决了存储系统如何为每个系统成员分配合理的内存数量的技术问题。
The present invention discloses a method and device for allocating memory, wherein the method includes: obtaining the first memory amount set for each system member in a storage system based on the software architecture of each system member in advance, wherein the software architecture of each system member is the same ; collect the hardware information of each of the system members, and calculate the second memory quantity of each of the system members based on the hardware information; combine the first memory quantity of each of the system members with the first memory quantity of the system member The two memory quantities are added together to obtain the total memory quantity that needs to be allocated to each of the system members. The memory allocation method disclosed by the invention makes the total amount of memory allocated by the storage system to each system member substantially equal to the total amount of memory actually needed, and solves the technical problem of how the storage system allocates a reasonable amount of memory to each system member.
Description
技术领域technical field
本发明涉及内存分配领域,特别涉及一种内存分配方法和装置。The invention relates to the field of memory allocation, in particular to a memory allocation method and device.
背景技术Background technique
在存储系统启动过程中,各个系统成员需要初始化,在这个过程中,存储系统会为系统成员分配内存,以便于后期系统对其进行访问操作。如果有多种存储硬件平台,那么存储系统需要为每个硬件平台分配内存,而每个硬件平台所需要的内存可能各不相同,例如不同的存储硬件平台能够插入不同的HBA卡数量,从而导致在HBA卡初始化过程中所需要的内存会因硬件平台的不同而不同。During the startup process of the storage system, each system member needs to be initialized. During this process, the storage system will allocate memory for the system member so that the system can access it later. If there are multiple storage hardware platforms, the storage system needs to allocate memory for each hardware platform, and the memory required by each hardware platform may be different. For example, different storage hardware platforms can be inserted with different numbers of HBA cards, resulting in The memory required during the HBA card initialization process varies with different hardware platforms.
而在存储系统初始化过程之前,需要为每一个系统成员预留一定的内存用于此成员初始化过程,一旦预留成功,那么这个成员的初始化所需内存必须在预留内存范围内,这样可以保证避免某一个成员无限制的预留内存的情况。Before the storage system initialization process, it is necessary to reserve a certain amount of memory for each system member for the member initialization process. Once the reservation is successful, the memory required for the initialization of this member must be within the reserved memory range, which can ensure Avoid situations where a member reserves unlimited memory.
现有技术中的内存分配方法是,在一套软件架构中,预留一个公共的memreq(memory require)配置值用于配置所有系统成员在初始化的时候需要的内存数量。由于所有的硬件平台都会分享这一公共的memreq的值,那么这个memreq的值必须以系统成员所需要的最大内存的数量作为memreq的值。比如存储系统有三个硬件平台共享这个memreq的值,第一个硬件平台需要memreq的值为10,第二个硬件平台需要的memreq的值为20,第三个硬件平台需要的memreq的值为30,那么这个存储系统的公共的memreq的值需要取三个平台中的最大值30。The memory allocation method in the prior art is to reserve a common memreq (memory require) configuration value in a set of software architecture for configuring the amount of memory required by all system members during initialization. Since all hardware platforms will share the value of this common memreq, the value of this memreq must be the maximum amount of memory required by system members as the value of memreq. For example, the storage system has three hardware platforms that share the memreq value. The first hardware platform requires a memreq value of 10, the second hardware platform requires a memreq value of 20, and the third hardware platform requires a memreq value of 30. , then the value of the common memreq of this storage system needs to take the maximum value of 30 among the three platforms.
然而,在用上述方法为系统成员初始化分配内存时,会出现为所需memreq值较小的硬件平台预留了较多内存的情况,相应的,会有较少的内存用于系统cache,这导致系统存储性能差。However, when using the above method to initialize memory allocation for system members, more memory will be reserved for hardware platforms with smaller memreq values, and correspondingly, less memory will be used for system cache. Resulting in poor system storage performance.
综上所述,存储系统如何为每个系统成员分配合理的内存数量是本领域技术人员目前需要解决的技术问题。To sum up, how the storage system allocates a reasonable amount of memory for each system member is a technical problem that those skilled in the art need to solve.
发明内容Contents of the invention
本发明所要解决的技术问题是提供一种内存分配方法,其能够为每个系统成员分配合理的内存数量。本发明还提供了一种内存分配装置。The technical problem to be solved by the present invention is to provide a memory allocation method, which can allocate a reasonable amount of memory to each system member. The invention also provides a memory allocation device.
为解决上述技术问题,本发明提供一种内存分配方法,包括:In order to solve the above technical problems, the present invention provides a memory allocation method, comprising:
获取预先基于存储系统中每个系统成员的软件架构为其设置的第一内存数量,其中每个所述系统成员的软件架构相同;Acquiring the first amount of memory pre-set for each system member in the storage system based on its software architecture, wherein each of the system members has the same software architecture;
采集每个所述系统成员的硬件信息,并基于所述硬件信息计算出每个所述系统成员的第二内存数量;collecting hardware information of each of the system members, and calculating a second memory quantity of each of the system members based on the hardware information;
将每个所述系统成员的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个所述系统成员的内存总数量。The first memory quantity of each system member is added to the second memory quantity of the system member to obtain the total memory quantity that needs to be allocated to each system member.
优选的,所述采集每个所述系统成员的硬件信息,包括:Preferably, the collecting hardware information of each system member includes:
采集每个所述系统成员自身的硬件信息和外接设备的硬件信息。The hardware information of each system member and the hardware information of external devices are collected.
优选的,所述基于所述硬件信息计算出每个所述系统成员的第二内存数量,包括:Preferably, the calculation of the second memory quantity of each of the system members based on the hardware information includes:
基于每个所述系统成员自身RAM的大小计算自身硬件信息对应的第一内存值;基于每个系统成员外接设备的类型和数量计算外接设备硬件信息对应的第二内存值;将每个所述系统成员的第一内存值和该系统成员的第二内存值相加,得到每个所述系统成员的第二内存数量。Calculate the first memory value corresponding to its own hardware information based on the size of each system member's own RAM; calculate the second memory value corresponding to the hardware information of the external device based on the type and quantity of each system member's external device; The first memory value of the system member is added to the second memory value of the system member to obtain the second memory quantity of each system member.
优选的,在得到需要分别分配给每个所述系统成员的内存总数量之后还包括:Preferably, after obtaining the total amount of memory that needs to be allocated to each of the system members, it also includes:
判断每个所述系统成员的所述内存总数量是否大于预先设定的最大内存数量,若大于则报错。Judging whether the total amount of memory of each system member is greater than a preset maximum amount of memory, and reporting an error if greater.
优选的,在得到需要分别分配给每个所述系统成员的内存总数量之后还包括:Preferably, after obtaining the total amount of memory that needs to be allocated to each of the system members, it also includes:
存储每个所述系统成员的所述内存总数量。The total amount of memory for each of the system members is stored.
本发明还提供一种内存分配装置,包括:The present invention also provides a memory allocation device, including:
获取模块,用于获取预先基于存储系统中每个系统成员的软件架构为其设置的第一内存数量;An acquisition module, configured to acquire the first memory quantity pre-set for each system member in the storage system based on its software architecture;
采集模块,用于采集每个所述系统成员的硬件信息;A collection module, configured to collect hardware information of each system member;
计算模块,用于基于所述硬件信息计算出每个所述系统成员的第二内存数量;将每个所述系统成员的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个所述系统成员的内存总数量。A calculation module, configured to calculate the second memory quantity of each of the system members based on the hardware information; add the first memory quantity of each of the system members to the second memory quantity of the system member to obtain the required The total amount of memory allocated separately to each described system member.
优选的,所述采集模块包括:Preferably, the collection module includes:
采集单元,用于采集每个所述系统成员自身的硬件信息和外接设备的硬件信息。The collecting unit is used to collect the hardware information of each system member itself and the hardware information of the external device.
优选的,所述计算模块包括:Preferably, the calculation module includes:
计算单元,用于基于每个所述系统成员自身RAM的大小计算自身硬件信息对应的第一内存值;基于每个所述系统成员外接设备的类型和数量计算外接设备硬件信息对应的第二内存值;将每个所述系统成员的第一内存值和该系统成员的第二内存值相加,得到每个所述系统成员的第二内存数量。A calculation unit, configured to calculate the first memory value corresponding to the hardware information of each system member based on the size of its own RAM; calculate the second memory value corresponding to the hardware information of the external device based on the type and quantity of the external device of each system member value; add the first memory value of each system member to the second memory value of the system member to obtain the second memory quantity of each system member.
优选的,还包括:Preferably, it also includes:
判断模块,用于在计算模块得到每个所述系统成员的内存总数量之后,判断每个所述系统成员的所述内存总数量是否大于预先设定的最大内存数量,若大于则报错。The judging module is used for judging whether the total amount of memory of each system member is greater than a preset maximum amount of memory after the calculation module obtains the total amount of memory of each system member, and reporting an error if it is greater.
优选的,还包括:Preferably, it also includes:
存储模块,用于在计算模块得到每个所述系统成员的内存总数量之后,存储每个所述系统成员的所述内存总数量。A storage module, configured to store the total memory quantity of each system member after the calculation module obtains the total memory quantity of each system member.
本发明所提供的内存分配方法将存储系统中每个系统成员需要的内存总数量分为两部分,第一部分是每个系统成员统一的软件架构对应的第一内存数量,第二部分是基于每个系统成员的硬件信息计算出的该系统成员的第二内存数量;将每个系统成员对应的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个系统成员各自的内存总数量。通过本发明提供的内存分配方法,利用每个系统成员统一的软件架构和各自的硬件信息,得到每个系统成员实际所需要的内存总数量,从而使得存储系统为每个系统成员分配的内存总数量基本等于其实际需要的内存总数量,避免出现现有技术中每个系统成员实际需要的内存总数量跟存储系统为其分配的内存总数量相差太大的情况。本发明提供的内存分配方法有效解决了存储系统如何为每个系统成员分配合理的内存数量的技术问题。本发明所提供的一种内存分配装置也相应的解决了如何为每个系统成员分配合理的内存数量的技术问题。The memory allocation method provided by the present invention divides the total amount of memory required by each system member in the storage system into two parts, the first part is the first memory amount corresponding to the unified software architecture of each system member, and the second part is based on each The second memory amount of the system member calculated from the hardware information of each system member; add the first memory amount corresponding to each system member and the second memory amount of the system member, and obtain the number that needs to be allocated to each system member The total amount of memory for each. Through the memory allocation method provided by the present invention, the total amount of memory actually required by each system member is obtained by using the unified software architecture and respective hardware information of each system member, so that the total amount of memory allocated by the storage system for each system member The quantity is basically equal to the total amount of memory actually required by it, so as to avoid the situation in the prior art that the total amount of memory actually required by each system member is too different from the total amount of memory allocated to it by the storage system. The memory allocation method provided by the invention effectively solves the technical problem of how the storage system allocates a reasonable amount of memory for each system member. The memory allocation device provided by the present invention also correspondingly solves the technical problem of how to allocate a reasonable amount of memory for each system member.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明一种具体实施方式所提供内存分配方法的流程图;Fig. 1 is the flowchart of the memory allocation method provided by a specific embodiment of the present invention;
图2为本发明另一具体实施方式所提供内存分配方法的流程图;FIG. 2 is a flowchart of a memory allocation method provided by another embodiment of the present invention;
图3为本发明一种具体实施方式所提供内存分配装置的结构示意图;3 is a schematic structural diagram of a memory allocation device provided in a specific embodiment of the present invention;
图4为本发明另一具体实施方式所提供内存分配装置的结构示意图。FIG. 4 is a schematic structural diagram of a memory allocation device provided by another specific embodiment of the present invention.
具体实施方式detailed description
本发明的核心是提供一种内存分配方法,其解决了如何为每个系统成员分配合理的内存数量的技术问题。本发明的另一核心是提供一种内存分配装置。The core of the invention is to provide a memory allocation method, which solves the technical problem of how to allocate a reasonable amount of memory for each system member. Another core of the present invention is to provide a memory allocation device.
为了使本技术领域的人员更好的理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
请参阅图1,图1为本发明一种具体实施方式所提供内存分配方法的流程图。在对应第一种具体实施方式中,本发明实施例所提供的内存分配方法可以包括以下步骤:Please refer to FIG. 1 . FIG. 1 is a flowchart of a memory allocation method provided by a specific embodiment of the present invention. In corresponding to the first specific implementation manner, the memory allocation method provided by the embodiment of the present invention may include the following steps:
步骤S1:获取预先基于存储系统中每个系统成员的软件架构为其设置的第一内存数量,其中每个系统成员的软件架构相同。Step S1: Acquiring the first memory quantity pre-set for each system member in the storage system based on its software architecture, where the software architecture of each system member is the same.
由于每个系统成员的软件架构相同,所以每个系统成员软件架构对应第一内存数量均相同。每个系统成员的软件架构及对应第一内存数量可以由工作人员根据实际需要预先进行设定,具体来说,第一内存数量可以由具体的软件模块的工作人员根据设置的软件架构给出:软件模块中具体的部分有PLFC、PLISCSI、PLSA、PLPA等等,由工作人员确定出每部分所需分配的内存值,然后将每部分所需分配的内存值进行加和可得到软件模块所需分配的内存值,并确定该内存值为系统成员软件架构对应的第一内存数量。比如PLISCSI这一部分的预留内存数量为两个内存page,也就是8k,工作人员统计这个软件模块中所有PLISCSI对应部分的数量,将所统计数量与8k相乘便得到PLISCSI的预留内存数量,其他部分预留内存的计算方式与此原理相同;工作人员将软件模块中每部分的预留内存数量相加便得到为软件架构设置的第一内存数量。Since the software architecture of each system member is the same, the first memory quantity corresponding to the software architecture of each system member is the same. The software architecture of each system member and the corresponding first memory quantity can be pre-set by the staff according to the actual needs. Specifically, the first memory quantity can be given by the staff of the specific software module according to the set software architecture: The specific parts of the software module include PLFC, PLISCSI, PLSA, PLPA, etc. The staff determines the memory value to be allocated for each part, and then sums up the memory values to be allocated for each part to obtain the required memory value for the software module. The allocated memory value, and determine that the memory value is the first memory quantity corresponding to the system member software architecture. For example, the amount of reserved memory for PLISCSI is two memory pages, that is, 8k. The staff counts the number of all corresponding parts of PLISCSI in this software module, and multiplies the counted amount by 8k to get the amount of reserved memory for PLISCSI. The calculation method of the reserved memory of other parts is the same as this principle; the staff adds up the reserved memory quantity of each part in the software module to obtain the first memory quantity set for the software architecture.
步骤S2:采集每个系统成员的硬件信息,并基于硬件信息计算出每个系统成员的第二内存数量。Step S2: Collect hardware information of each system member, and calculate the second memory quantity of each system member based on the hardware information.
步骤S3:将每个系统成员的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个系统成员的内存总数量。Step S3: adding the first memory quantity of each system member and the second memory quantity of the system member to obtain the total memory quantity to be allocated to each system member.
在本实施例中,本发明利用每个系统成员自身统一的软件架构和软件架构之外的硬件信息,将每个系统成员所需要的内存总数量分为:软件架构对应的第一内存数量和硬件部分对应的第二内存数量;将获取的第一内存数量和计算得到的第二内存数量相加,便得到每个系统成员各自需要的内存总数量。本发明利用每个系统成员统一的软件架构和各自不同的硬件部分,得到每个系统成员各自的内存总数量,其基本等于实际需要的内存数量,避免出现每个系统成员实际需要的内存总数量跟理论上为其分配的内存总数量相差太大的情况。本发明提供的内存分配方法解决了存储系统如何为每个系统成员分配合理的内存数量的技术问题。In this embodiment, the present invention uses the unified software architecture of each system member and hardware information other than the software architecture to divide the total amount of memory required by each system member into: the first memory amount corresponding to the software architecture and the first memory amount corresponding to the software architecture The second memory quantity corresponding to the hardware part; the total quantity of memory required by each system member is obtained by adding the obtained first memory quantity and the calculated second memory quantity. The present invention utilizes the unified software architecture and different hardware parts of each system member to obtain the total amount of memory of each system member, which is basically equal to the actual amount of memory required, and avoids the total amount of memory actually required by each system member The situation where the total amount of memory allocated for it is too different from the theoretical one. The memory allocation method provided by the invention solves the technical problem of how the storage system allocates a reasonable amount of memory for each system member.
应当指出,这里并不限制步骤S1和步骤S2这两个步骤的先后顺序。可以先执行步骤S1,也可以先执行步骤S2,还可以两个步骤同时进行。It should be noted that the sequence of the two steps of step S1 and step S2 is not limited here. Step S1 may be performed first, or step S2 may be performed first, or both steps may be performed simultaneously.
本发明实施例提供的一种内存分配方法中,采集每个系统成员的硬件信息可以包括:采集每个系统成员自身的硬件信息和其外接设备的硬件信息。In a memory allocation method provided by an embodiment of the present invention, collecting hardware information of each system member may include: collecting hardware information of each system member itself and hardware information of its external devices.
在采集每个系统成员的硬件信息时,对于那些没有外接设备的系统成员,只需要采集系统成员自身的硬件信息即可;而对于那些有外接设备的系统成员,不仅要采集系统成员自身的硬件信息,还要采集系统成员外接设备的硬件信息。这样使分配给具有外接设备的系统成员的内存总数量更加准确。When collecting the hardware information of each system member, for those system members without external devices, it is only necessary to collect the hardware information of the system members themselves; for those system members with external devices, it is not only necessary to collect the hardware information of the system members themselves Information, but also collect the hardware information of the external devices of the system members. This makes the total amount of memory allocated to system members with external devices more accurate.
本发明实施例提供的一种内存分配方法中,基于硬件信息计算出每个系统成员的第二内存数量可以包括:In a memory allocation method provided by an embodiment of the present invention, calculating the second memory amount of each system member based on hardware information may include:
基于每个系统成员自身RAM的大小计算自身硬件信息对应的第一内存值;基于每个系统成员外接设备的类型和数量计算外接设备硬件信息对应的第二内存值;将每个系统成员的第一内存值和该系统成员的第二内存值相加,得到每个系统成员的第二内存数量。Calculate the first memory value corresponding to its own hardware information based on the size of each system member's own RAM; calculate the second memory value corresponding to the hardware information of the external device based on the type and quantity of each system member's external device; The first memory value is added to the second memory value of the system member to obtain the second memory quantity of each system member.
因为系统成员自身的硬件信息基本由其RAM的大小决定,所以这里重点依据系统成员自身RAM的大小来计算其硬件信息对应的第一内存值。Since the hardware information of a system member is basically determined by the size of its RAM, here the first memory value corresponding to the hardware information of the system member is mainly calculated according to the size of the system member's own RAM.
在根据系统成员自身RAM的大小来计算其相应的第一内存值时,可以由工作人员根据实际需要设置一个比例,从而将RAM大小与该比例的乘积作为其对应的第一内存值。具体来说,可以采用下述方法。对于RAM来说,8G内存RAM对应的预留内存为10988个page,而每个page是4k,这样8G内存RAM对应的预留内存为42.9M,然后根据这个对应关系具体计算这一部分的值。比如,系统成员自身的RAM的大小为4G,由于4G是8G一半,所以4G内存RAM对应的预留内存为42.9M的一半,即21.45M。当然,根据8G内存RAM对应42.9M的预留内存的对应关系,还可以延伸出其他的对应关系,比如2G内存RAM对应10.725M的预留内存,应用这些对应关系均能够计算出系统成员自身RAM对应的第一内存值。When calculating the corresponding first memory value according to the RAM size of the system member itself, a ratio can be set by the staff according to actual needs, so that the product of the RAM size and the ratio can be used as the corresponding first memory value. Specifically, the following methods can be employed. For RAM, the reserved memory corresponding to 8G memory RAM is 10988 pages, and each page is 4k, so the reserved memory corresponding to 8G memory RAM is 42.9M, and then calculate the value of this part according to this corresponding relationship. For example, the RAM size of the system member itself is 4G. Since 4G is half of 8G, the reserved memory corresponding to 4G memory RAM is half of 42.9M, that is, 21.45M. Of course, according to the corresponding relationship between 8G memory RAM and 42.9M reserved memory, other corresponding relationships can also be extended. The corresponding first memory value.
在计算系统成员外接设备的硬件信息对应的第二内存值时,一般先根据外接设备的类型,确定每一类每个外接设备对应的内存值;然后再确定每一类外接设备的个数;将同一类的每个外接设备的内存值与该类的外接设备的个数相乘,得到每一类外接设备所对应的内存值;最后,将不同种类外接设备对应的内存值相加,得到系统成员外接设备对应的第二内存值。这里以计算外接设备为外接HBA卡的预留内存值为例来进行说明。首先,确定系统成员外接HBA卡的类型,得知外接HBA卡的类型后,便能够查阅得到这一类每个HBA卡所对应的预留内存值;然后确定每类HBA卡的数量;将每类HBA卡所对应的预留内存值乘以每类HBA卡的数量,便得到每类HBA卡所对应的预留内存值;最后,将不同类HBA卡所对应的预留内存值相加,便得到系统成员外接设备硬件信息所对应的第二内存数量。其他外接设备硬件信息对应的第二内存值的计算方法与此原理相同。When calculating the second memory value corresponding to the hardware information of the external device of the system member, generally according to the type of the external device, first determine the corresponding memory value of each type of external device; and then determine the number of each type of external device; Multiply the memory value of each external device of the same type by the number of external devices of this type to obtain the memory value corresponding to each type of external device; finally, add the memory values corresponding to different types of external devices to obtain The second memory value corresponding to the external device of the system member. Here, the calculation of the reserved memory value of an external HBA card as an external device is used as an example for illustration. First, determine the type of external HBA card of the system member. After knowing the type of external HBA card, you can check the reserved memory value corresponding to each HBA card of this type; then determine the number of each type of HBA card; Multiply the reserved memory value corresponding to each type of HBA card by the number of each type of HBA card to obtain the reserved memory value corresponding to each type of HBA card; finally, add the reserved memory values corresponding to different types of HBA cards, Then, the second memory quantity corresponding to the hardware information of the external device of the system member is obtained. The calculation method of the second memory value corresponding to the hardware information of other external devices is the same as this principle.
本发明实施例提供的一种内存分配方法中,得到需要分别分配给每个系统成员的内存总数量之后还可以包括:In a memory allocation method provided by an embodiment of the present invention, after obtaining the total amount of memory that needs to be allocated to each system member, it may further include:
判断每个系统成员的内存总数量是否大于预先设定的最大内存数量,如果是,则执行报错操作。Determine whether the total amount of memory of each system member is greater than the preset maximum amount of memory, and if so, perform an error reporting operation.
其中,最大内存数量可以为工作人员根据实际需要设定的;在上述判断操作中,如果每个系统成员的内存总数量不大于预先设定的最大内存数量,即如果否,则可以将每个系统成员的内存总数量发送给该系统成员,当然,也可以进行其他操作,比如存储内存总数量等等。另外报错操作具体可以是向与工作人员对应的指定终端发送对应的信息,也可以是指示显示屏对对应信息进行显示等,而上述报错操作对应的信息可以包括内存总数量大于最大内存数量的系统成员的编号及其内存总数量等,当然上述技术方案均可以根据实际需要进行其他设定,均在本发明的保护范围之内。Among them, the maximum amount of memory can be set by the staff according to actual needs; in the above judgment operation, if the total amount of memory of each system member is not greater than the preset maximum amount of memory, that is, if not, each The total amount of memory of a system member is sent to the system member. Of course, other operations can also be performed, such as storing the total amount of memory and so on. In addition, the error reporting operation can specifically send corresponding information to the designated terminal corresponding to the staff, or instruct the display screen to display the corresponding information, etc., and the information corresponding to the above error reporting operation can include the system whose total memory is greater than the maximum memory The number of members and the total number of memory, etc., of course, the above technical solutions can be set according to actual needs, all within the protection scope of the present invention.
增加上述判断操作的好处是,能够避免系统成员所需的内存总数量大于预先根据实际需要设定的最大内存数量,可以解决为一个系统成员无限制的分配内存等不合法的问题。The advantage of adding the above judgment operation is that it can prevent the total amount of memory required by system members from being greater than the maximum amount of memory set in advance according to actual needs, and can solve illegal problems such as unlimited memory allocation for a system member.
本发明实施例提供的一种内存分配方法中,得到需要分别分配给每个系统成员的内存总数量之后还可以包括:In a memory allocation method provided by an embodiment of the present invention, after obtaining the total amount of memory that needs to be allocated to each system member, it may further include:
存储每个系统成员的内存总数量。Stores the total amount of memory for each system member.
增加上述存储操作的好处是,在需要重复得知系统成员所需内存总数量的时候,可以直接由存储的数据中获取,从而节约计算内存总数量的过程。The advantage of adding the above storage operations is that when it is necessary to repeatedly know the total amount of memory required by system members, it can be directly obtained from the stored data, thereby saving the process of calculating the total amount of memory.
在实际应用中,可以增加上述判断操作或者存储操作中的任意一个操作;也可以两个操作均增加,在这里并不限制增加两种操作的顺序,优选的增加顺序如下实施例所述。In practical applications, any one of the above judgment operation or storage operation can be added; both operations can also be added, and the order of adding the two operations is not limited here, and the preferred order of addition is described in the following embodiments.
请参阅图2,图2为本发明另一具体实施方式所提供内存分配方法的流程图。在这一具体实施方式中,增加了判断操作和存储操作,并将两者结合起来:在得到每个系统成员的内存总数量后,先执行步骤S4:判断每个系统成员的内存总数量是否大于预先设定的最大内存值,若果是,则执行步骤S6:报错;若果否,则执行步骤S5:存储每个系统成员的内存总数量。这一实施例不仅能为系统成员分配合理的内存总数量;而且能够避免无限制为系统成员分配内存数量的情况;还能够在需要重复得知系统成员所需内存数量的情况下,节省计算过程。Please refer to FIG. 2 . FIG. 2 is a flowchart of a memory allocation method provided by another specific embodiment of the present invention. In this specific implementation, a judgment operation and a storage operation are added, and the two are combined: after obtaining the total amount of memory of each system member, step S4 is first performed: judging whether the total amount of memory of each system member is greater than the preset maximum memory value, if yes, execute step S6: report an error; if no, execute step S5: store the total amount of memory of each system member. This embodiment can not only allocate a reasonable total amount of memory for the system members; but also avoid the situation of unlimited memory allocation for the system members; it can also save the calculation process when it is necessary to repeatedly know the amount of memory required by the system members .
本发明还提供了一种内存分配装置,其具有本发明方法具有的所有有益效果。请参阅图3,图3为本发明一种具体实施方式所提供内存分配装置的结构示意图,可以包括以下模块:The present invention also provides a memory allocation device, which has all the beneficial effects of the method of the present invention. Please refer to FIG. 3. FIG. 3 is a schematic structural diagram of a memory allocation device provided in a specific embodiment of the present invention, which may include the following modules:
获取模块A1,用于获取预先基于存储系统中每个系统成员的软件架构为其设置的第一内存数量。The acquiring module A1 is configured to acquire the first memory quantity pre-set for each system member in the storage system based on its software architecture.
采集模块A2,用于采集每个系统成员的硬件信息。The collection module A2 is used to collect hardware information of each system member.
计算模块A3,用于基于采集模块A2采集的硬件信息计算出每个系统成员的第二内存数量;将每个系统成员的第一内存数量和该系统成员的第二内存数量相加,得到需要分别分配给每个系统成员的内存总数量。The calculation module A3 is used to calculate the second memory quantity of each system member based on the hardware information collected by the collection module A2; add the first memory quantity of each system member and the second memory quantity of the system member to obtain the required The total amount of memory allocated to each system member separately.
本发明实施例提供的一种内存分配装置中,采集模块可以包括:In a memory allocation device provided by an embodiment of the present invention, the acquisition module may include:
采集单元,用于采集每个系统成员自身的硬件信息和外接设备的硬件信息。The collection unit is used to collect the hardware information of each system member itself and the hardware information of external devices.
本发明实施例提供的一种内存分配装置中,计算模块可以包括:In a memory allocation device provided by an embodiment of the present invention, the calculation module may include:
计算单元,用于基于每个系统成员自身RAM的大小计算自身硬件信息对应的第一内存值;基于每个系统成员外接设备的类型和数量计算其外接设备硬件信息对应的第二内存值;将每个系统成员的第一内存值和该系统成员的第二内存值相加,得到每个系统成员的第二内存数量。The calculation unit is used to calculate the first memory value corresponding to the hardware information of each system member based on the size of its own RAM; calculate the second memory value corresponding to the hardware information of the external device based on the type and quantity of the external device of each system member; The first memory value of each system member is added to the second memory value of the system member to obtain the second memory quantity of each system member.
本发明实施例提供的一种内存分配装置中,还可以包括:In a memory allocation device provided in an embodiment of the present invention, it may also include:
判断模块,用于在计算模块得到内存总数量后,判断每个系统成员的内存总数量是否大于预先设定的最大内存数量,若大于则报错。The judging module is used for judging whether the total amount of memory of each system member is greater than the preset maximum amount of memory after the calculation module obtains the total amount of memory, and reporting an error if it is greater.
本发明实施例提供的一种内存分配装置中,还可以包括:In a memory allocation device provided in an embodiment of the present invention, it may also include:
存储模块,用于在计算模块得到内存总数量后,存储每个系统成员的内存总数量。The storage module is used to store the total amount of memory of each system member after the calculation module obtains the total amount of memory.
在实际的装置应用中,可以增加上述判断模块或者存储模块中的任意一个模块;也可以两个模块均增加,这里并不限制增加两个模块的顺序,优选的增加顺序如下所述:In the actual device application, any one of the above judgment modules or storage modules can be added; both modules can also be added, and the order of adding the two modules is not limited here, and the preferred order of addition is as follows:
请参阅图4,图4为本发明另一具体实施方式的结构示意图。在这一具体实施方式中,增加了判断模块A4、存储模块A5,并将两者结合起来:在计算模块得到内存总数量后,判断模块先判断每个系统成员的内存总数量是否大于预先设定的最大内存值,如果是,则报错;如果否,则将内存总数量发送给存储模块,存储模块将内存总数量进行存储。Please refer to FIG. 4 . FIG. 4 is a schematic structural diagram of another specific embodiment of the present invention. In this specific embodiment, the judging module A4 and the storage module A5 are added, and the two are combined: after the computing module obtains the total amount of memory, the judging module first judges whether the total amount of memory of each system member is greater than the preset If yes, an error will be reported; if not, the total amount of memory will be sent to the storage module, and the storage module will store the total amount of memory.
本发明实施例提供的一种内存分配装置中相关部分的说明请参见本发明实施例提供的一种内存分配方法中对应部分的详细说明,在此不再赘述。For the description of the relevant parts of the memory allocation device provided by the embodiment of the present invention, please refer to the detailed description of the corresponding part of the memory allocation method provided by the embodiment of the present invention, which will not be repeated here.
本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。In this paper, specific examples are used to illustrate the principle and implementation of the present invention, and the descriptions of the above embodiments are only used to help understand the method and core idea of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710422776.6A CN107247673B (en) | 2017-06-07 | 2017-06-07 | Memory allocation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710422776.6A CN107247673B (en) | 2017-06-07 | 2017-06-07 | Memory allocation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107247673A true CN107247673A (en) | 2017-10-13 |
CN107247673B CN107247673B (en) | 2020-05-26 |
Family
ID=60018001
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710422776.6A Active CN107247673B (en) | 2017-06-07 | 2017-06-07 | Memory allocation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107247673B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110503771A (en) * | 2019-07-25 | 2019-11-26 | 福建巨昂信息技术有限公司 | A high-safety picking device for coconut vending machines |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5594903A (en) * | 1991-02-26 | 1997-01-14 | Lynx Real-Time Systems, Inc. | Operating System architecture with reserved memory space resident program code identified in file system name space |
CN1430150A (en) * | 2001-12-29 | 2003-07-16 | 深圳市中兴通讯股份有限公司上海第二研究所 | Virtual internal storage allocating and managing method of subsystem in communication system |
CN101221536A (en) * | 2008-01-25 | 2008-07-16 | 中兴通讯股份有限公司 | Internal memory managing method and device of embedded system |
CN101546292A (en) * | 2008-03-25 | 2009-09-30 | 北京恒光创新科技股份有限公司 | Memory access method and device |
CN101661436A (en) * | 2009-09-30 | 2010-03-03 | 中兴通讯股份有限公司 | Dynamic allocation method and device of embedded system memory |
CN103136105A (en) * | 2011-11-28 | 2013-06-05 | 广东新岸线计算机系统芯片有限公司 | Memory management method, embedded type system and video data processing system |
CN103914400A (en) * | 2012-12-31 | 2014-07-09 | 联想(北京)有限公司 | Memory allocation method and electronic device |
US20150293841A1 (en) * | 2014-04-14 | 2015-10-15 | International Business Machines Corporation | Efficient reclamation of pre-allocated direct memory access (dma) memory |
CN106354661A (en) * | 2016-09-13 | 2017-01-25 | 郑州云海信息技术有限公司 | Internal storage distribution method and device for storage software |
-
2017
- 2017-06-07 CN CN201710422776.6A patent/CN107247673B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5594903A (en) * | 1991-02-26 | 1997-01-14 | Lynx Real-Time Systems, Inc. | Operating System architecture with reserved memory space resident program code identified in file system name space |
CN1430150A (en) * | 2001-12-29 | 2003-07-16 | 深圳市中兴通讯股份有限公司上海第二研究所 | Virtual internal storage allocating and managing method of subsystem in communication system |
CN101221536A (en) * | 2008-01-25 | 2008-07-16 | 中兴通讯股份有限公司 | Internal memory managing method and device of embedded system |
CN101546292A (en) * | 2008-03-25 | 2009-09-30 | 北京恒光创新科技股份有限公司 | Memory access method and device |
CN101661436A (en) * | 2009-09-30 | 2010-03-03 | 中兴通讯股份有限公司 | Dynamic allocation method and device of embedded system memory |
CN103136105A (en) * | 2011-11-28 | 2013-06-05 | 广东新岸线计算机系统芯片有限公司 | Memory management method, embedded type system and video data processing system |
CN103914400A (en) * | 2012-12-31 | 2014-07-09 | 联想(北京)有限公司 | Memory allocation method and electronic device |
US20150293841A1 (en) * | 2014-04-14 | 2015-10-15 | International Business Machines Corporation | Efficient reclamation of pre-allocated direct memory access (dma) memory |
CN106354661A (en) * | 2016-09-13 | 2017-01-25 | 郑州云海信息技术有限公司 | Internal storage distribution method and device for storage software |
Non-Patent Citations (2)
Title |
---|
周本海: "基于预留的信息物理融合系统动态内存分配方法研究", 《科学技术与工程》 * |
阚运奇 等: "云计算系统虚拟机内存资源预留方法", 《国防科技大学学报》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110503771A (en) * | 2019-07-25 | 2019-11-26 | 福建巨昂信息技术有限公司 | A high-safety picking device for coconut vending machines |
Also Published As
Publication number | Publication date |
---|---|
CN107247673B (en) | 2020-05-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9489409B2 (en) | Rollover strategies in a N-bit dictionary compressed column store | |
CN108845877B (en) | Method, device and system for managing memory | |
CN102866954B (en) | The method of Memory Allocation and device | |
CN113590329A (en) | Resource processing method and device | |
CN106844050A (en) | A kind of memory allocation method and device | |
CN111104219A (en) | Binding method, device, equipment and storage medium of virtual core and physical core | |
US9218198B2 (en) | Method and system for specifying the layout of computer system resources | |
US10803109B2 (en) | Method and device for reading and writing video data in NAS device | |
CN115470156A (en) | RDMA-based memory use method, system, electronic device and storage medium | |
CN117539807A (en) | Data transmission method, related equipment and storage medium | |
CN114327862B (en) | A memory allocation method, device, electronic equipment and storage medium | |
CN105279029B (en) | A kind of local storage dynamic allocation method based on Activity Calculation resource | |
WO2017166997A1 (en) | Inic-side exception handling method and device | |
CN107247673A (en) | A kind of memory allocation method and device | |
CN104657216A (en) | Resource allocation method and device for resource pool | |
CN103678151A (en) | Configuration method and configuration device of block storage device of virtual machine | |
US20180267714A1 (en) | Managing data in a storage array | |
CN109542622A (en) | A kind of data processing method and device | |
CN110231983A (en) | Data Concurrent processing method, apparatus and system, computer equipment and readable medium | |
CN111047124A (en) | Resource allocation method, system, electronic equipment and computer storage medium | |
CN113204382B (en) | Data processing method, device, electronic equipment and storage medium | |
CN117762604A (en) | Kernel object allocation method and device, electronic equipment and storage medium | |
CN103294560A (en) | Method and device for character string across process transmission | |
CN114968579B (en) | Haiguang platform IO resource allocation method, system, terminal and storage medium | |
CN105404545B (en) | The method and device of virtual machine distribution |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20200426 Address after: 215100 No. 1 Guanpu Road, Guoxiang Street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province Applicant after: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Address before: 450018 Henan province Zheng Dong New District of Zhengzhou City Xinyi Road No. 278 16 floor room 1601 Applicant before: ZHENGZHOU YUNHAI INFORMATION TECHNOLOGY Co.,Ltd. |
|
TA01 | Transfer of patent application right | ||
GR01 | Patent grant | ||
GR01 | Patent grant |