Memory allocation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210172933.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-24
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-02-24
AI Technical Summary
[0005]本公开的目的在于提供一种内存分配方法、内存分配装置、电子设备以及计算机可读存储介质,进而至少在一定程度上克服在多核平台上进行DDR测试时由于内存分配方式不合理,使得个别运行核的处理速度慢于其他运行核从而导致总体测试时间变长,测试效率低下的问题
[0037] The memory allocation method in the exemplary embodiments of this disclosure allocates a first capacity memory segment (smaller memory segment) to different running cores one by one until the first capacity memory segment is allocated. Then, the remaining running cores can divide memory from the second capacity memory segment (larger memory segment) to complete the memory allocation of the running cores. This memory allocation method can allocate a certain number of segmented memory to each running core. Compared with the memory allocation scheme of the existing DDR system-level test, it can shorten the test time and improve the test efficiency.
Smart Images

Figure CN116701068B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of memory system-level testing technology, and more specifically, to a memory allocation method, a memory allocation device, an electronic device, and a computer-readable storage medium. Background Technology
[0002] Double Data Rate (DDR) synchronous dynamic random-access memory is a type of memory; synchronous dynamic random-access memory (SDRAM) has a synchronous interface. DDR memory was initially used in laptops, computers, and mobile devices, and is now being used in high-end servers, automobiles, and cloud computing applications.
[0003] DDR testing can include chip-level testing, memory module testing, and system-level testing. DDR system-level testing is usually performed in specific environments, such as in a Uified Exteile Firmware Interface (UEFI) environment.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this disclosure is to provide a memory allocation method, a memory allocation device, an electronic device, and a computer-readable storage medium, thereby overcoming, to at least a certain extent, the problem that when performing DDR testing on a multi-core platform, due to unreasonable memory allocation methods, the processing speed of some running cores is slower than that of other running cores, resulting in longer overall test time and low test efficiency.
[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part by practice of the invention.
[0007] According to a first aspect of this disclosure, a memory allocation method is provided, comprising: acquiring multiple memory segments corresponding to a task to be processed; determining multiple running cores included in a running platform executing the task to be processed; determining a first capacity memory segment and a second capacity memory segment among the multiple memory segments according to the multiple running cores; wherein the memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment; allocating the first capacity memory segment to each of the running cores one by one, and determining the remaining memory capacity corresponding to each of the running cores; and allocating the second capacity memory segment to each of the running cores according to the remaining memory capacity, so as to obtain a memory allocation result.
[0008] In one exemplary embodiment of this disclosure, before obtaining the multiple memory segments corresponding to the task to be processed, the method further includes: obtaining the task to be processed and determining the task execution requirements of the task to be processed; determining a specified execution environment corresponding to the task to be processed based on the task execution requirements; and determining the multiple memory segments corresponding to the task to be processed in the specified execution environment.
[0009] In one exemplary embodiment of this disclosure, determining the plurality of memory segments corresponding to the task to be processed in the specified operating environment includes: obtaining a memory configuration file corresponding to the specified operating environment; determining the corresponding memory type according to the memory configuration file; the memory type having corresponding segmented memory; configuring the memory capacity corresponding to the segmented memory to generate memory segments corresponding to each segmented memory.
[0010] In one exemplary embodiment of this disclosure, obtaining the memory configuration file corresponding to the specified runtime environment includes: responding to the boot-up command of the runtime platform, entering the specified runtime environment according to the task execution requirements; obtaining the system runtime file in the specified runtime environment, and obtaining the memory configuration file from the system runtime file.
[0011] In one exemplary embodiment of this disclosure, determining a first capacity memory segment and a second capacity memory segment among the plurality of memory segments based on the plurality of running cores includes: determining the total memory capacity corresponding to the plurality of memory segments; determining the number of running cores included in the running platform; determining a memory partitioning reference value based on the total memory capacity and the number of running cores, wherein the memory partitioning reference value = the total memory capacity / the number of running cores; and determining the first capacity memory segment and the second capacity memory segment based on the memory partitioning reference value.
[0012] In one exemplary embodiment of this disclosure, determining the first capacity memory segment and the second capacity memory segment based on the memory partitioning reference value includes: determining the memory segment with a memory capacity smaller than the memory partitioning reference value as the first capacity memory segment; and determining the memory segment with a memory capacity greater than or equal to the memory partitioning reference value as the second capacity memory segment.
[0013] In one exemplary embodiment of this disclosure, there are multiple first-capacity memory segments, and allocating the first-capacity memory segments one by one to each of the running cores includes:
[0014] The preset sequential order of the multiple first-capacity memory segments is used as the memory segment arrangement order of the multiple first-capacity memory segments; the running core arrangement order of the multiple running cores is obtained, and the multiple first-capacity memory segments are allocated to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
[0015] In one exemplary embodiment of this disclosure, allocating multiple first-capacity memory segments to the running cores one by one according to the memory segment arrangement order and the running core arrangement order includes: determining the memory segment number corresponding to each first-capacity memory segment according to the memory segment arrangement order; determining the running core number corresponding to each running core according to the running core arrangement order; obtaining the number of running cores; determining a memory allocation number according to the number of running cores and the memory segment number; and allocating the first-capacity memory segments to the corresponding memory cores according to the memory allocation number and the running core number.
[0016] In one exemplary embodiment of this disclosure, determining the remaining memory capacity corresponding to each of the running cores includes: determining a first capacity memory segment allocated in the running core, determining the occupied memory capacity of the running core based on the allocated first capacity memory segment; obtaining the memory partitioning reference value, and determining the remaining memory capacity based on the memory partitioning reference value and the occupied memory capacity.
[0017] In one exemplary embodiment of this disclosure, allocating the second capacity memory segment to each of the running cores according to the remaining memory capacity includes: obtaining the running core arrangement order of the plurality of running cores; and performing a remaining memory allocation step on each of the running cores one by one according to the remaining memory capacity and the running core order, so as to allocate the second capacity memory segment to each of the running cores.
[0018] In one exemplary embodiment of this disclosure, the remaining memory allocation step includes: obtaining the currently running core and the remaining memory capacity of the current core corresponding to the currently running core; determining the remaining memory segment corresponding to the current running core from the second capacity memory segment; the remaining memory segment is a portion of the second capacity memory segment that has the same remaining memory capacity as the current core; and allocating the remaining memory segment to the current running core.
[0019] In one exemplary embodiment of this disclosure, allocating the remaining memory segment to the currently running core includes: obtaining the occupied memory capacity and memory start address of the currently running core; determining the memory intermediate address corresponding to the currently running core based on the memory start address and the occupied memory capacity; and determining the start address corresponding to the remaining memory segment based on the memory intermediate address.
[0020] In one exemplary embodiment of this disclosure, the method further includes: executing the task to be processed in the specified operating environment according to the memory allocation result.
[0021] According to a second aspect of this disclosure, a memory allocation apparatus is provided, comprising: an acquisition module, configured to acquire multiple memory segments corresponding to a task to be processed, and determine multiple running cores included in a running platform executing the task to be processed; a memory determination module, configured to determine a first capacity memory segment and a second capacity memory segment among the multiple memory segments based on the multiple running cores; wherein the memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment; a first memory allocation module, configured to allocate the first capacity memory segments one by one to each of the running cores, and determine the remaining memory capacity corresponding to each of the running cores; and a second memory allocation module, configured to allocate the second capacity memory segments to each of the running cores based on the remaining memory capacity, so as to obtain a memory allocation result.
[0022] In one exemplary embodiment of this disclosure, the memory allocation device further includes a memory segment determination module, configured to acquire the task to be processed, determine the task execution requirements of the task to be processed, determine a specified execution environment corresponding to the task to be processed based on the task execution requirements, and determine the plurality of memory segments corresponding to the task to be processed in the specified execution environment.
[0023] In one exemplary embodiment of this disclosure, the memory segment determination module includes a memory segment determination unit, configured to obtain a memory configuration file corresponding to the specified operating environment, determine the corresponding memory type according to the memory configuration file; the memory type has corresponding segmented memory; configure the memory capacity corresponding to the segmented memory to generate memory segments corresponding to each segmented memory.
[0024] In one exemplary embodiment of this disclosure, the memory segment determination unit includes a file acquisition subunit, which is used to respond to the boot-up command of the running platform, enter the specified running environment according to the task running requirements, acquire the system running file in the specified running environment, and acquire the memory configuration file from the system running file.
[0025] In one exemplary embodiment of this disclosure, the memory determination module includes a memory partitioning unit, configured to: determine the total memory capacity corresponding to the plurality of memory segments; determine the number of running cores included in the running platform; determine a memory partitioning reference value based on the total memory capacity and the number of running cores, wherein the memory partitioning reference value = total memory capacity / number of running cores; and determine the first capacity memory segment and the second capacity memory segment based on the memory partitioning reference value.
[0026] In one exemplary embodiment of this disclosure, the memory partitioning unit includes a memory partitioning subunit, which is used to determine memory segments with memory capacity less than the memory partitioning reference value as the first capacity memory segment; and to determine memory segments with memory capacity greater than or equal to the memory partitioning reference value as the second capacity memory segment.
[0027] In one exemplary embodiment of this disclosure, there are multiple first capacity memory segments, and the first memory allocation module includes a first memory allocation unit, which is used to use a preset sequential arrangement order of the multiple first capacity memory segments as the memory segment arrangement order of the multiple first capacity memory segments; obtain the running core arrangement order of the multiple running cores, and allocate the multiple first capacity memory segments to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
[0028] In one exemplary embodiment of this disclosure, the first memory allocation unit includes a first memory allocation subunit, configured to: determine the memory segment number corresponding to each first capacity memory segment according to the memory segment arrangement order; determine the running core number corresponding to each running core according to the running core arrangement order; obtain the number of running cores; determine the memory allocation number according to the number of running cores and the memory segment number; and allocate the first capacity memory segment to the corresponding memory core according to the memory allocation number and the running core number.
[0029] In one exemplary embodiment of this disclosure, the first memory allocation module further includes a remaining memory capacity determination unit, configured to determine a first capacity memory segment already allocated in the running core, determine the occupied memory capacity of the running core based on the allocated first capacity memory segment, obtain the memory partitioning reference value, and determine the remaining memory capacity based on the memory partitioning reference value and the occupied memory capacity.
[0030] In one exemplary embodiment of this disclosure, the second memory allocation module includes a second memory allocation unit, configured to obtain the running core arrangement order of the plurality of running cores; and to perform a remaining memory allocation step on each of the running cores one by one according to the remaining memory capacity and the running core order, so as to allocate the second capacity memory segment to each of the running cores.
[0031] In one exemplary embodiment of this disclosure, the second memory allocation unit includes a second memory allocation subunit, configured to obtain the currently running core and the remaining memory capacity of the current running core; determine the remaining memory segment corresponding to the current running core from the second capacity memory segment; the remaining memory segment is a portion of the second capacity memory segment that has the same remaining memory capacity as the current core; and allocate the remaining memory segment to the current running core.
[0032] In one exemplary embodiment of this disclosure, the second memory allocation subunit is configured to perform: obtaining the occupied memory capacity and memory start address of the currently running core; determining the memory intermediate address corresponding to the currently running core based on the memory start address and the occupied memory capacity; and determining the start address corresponding to the remaining memory segment based on the memory intermediate address.
[0033] In one exemplary embodiment of this disclosure, the memory allocation device further includes a task execution module for executing the task to be processed in the specified operating environment according to the memory allocation result.
[0034] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory storing computer-readable instructions that, when executed by the processor, implement the memory allocation method according to any one of the preceding claims.
[0035] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the memory allocation method according to any one of the preceding claims.
[0036] The technical solution provided in this disclosure may include the following beneficial effects:
[0037] The memory allocation method in the exemplary embodiments of this disclosure allocates a first capacity memory segment (smaller memory segment) to different running cores one by one until the first capacity memory segment is allocated. Then, the remaining running cores can divide memory from the second capacity memory segment (larger memory segment) to complete the memory allocation of the running cores. This memory allocation method can allocate a certain number of segmented memory to each running core. Compared with the memory allocation scheme of the existing DDR system-level test, it can shorten the test time and improve the test efficiency.
[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0040] Figure 1 A flowchart illustrating an exemplary embodiment of a memory allocation method according to the present disclosure is shown schematically;
[0041] Figure 2 A flowchart illustrating the determination of a first capacity memory segment and a second capacity memory segment according to an exemplary embodiment of the present disclosure is shown.
[0042] Figure 3 A schematic diagram illustrating the memory capacity corresponding to each of the plurality of memory segments according to an exemplary embodiment of the present disclosure is shown.
[0043] Figure 4 This illustration schematically shows a diagram of allocating multiple memory segments to multiple running cores according to an exemplary embodiment of the present disclosure;
[0044] Figure 5 The diagram illustrates an overall flowchart of allocating multiple memory segments to multiple running cores according to an exemplary embodiment of the present disclosure;
[0045] Figure 6 A block diagram of a memory allocation apparatus according to an exemplary embodiment of the present disclosure is shown schematically;
[0046] Figure 7 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown schematically;
[0047] Figure 8 The illustration shows a schematic diagram of a computer-readable storage medium according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0048] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0049] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details described, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known structures, methods, apparatuses, implementations, materials, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0050] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, or in one or more software-hardened modules, or in different network and / or processor devices and / or microcontroller devices.
[0051] When conducting DDR system-level testing, since traditional computer systems are single-core machines, computer manufacturers continuously increased the clock speed of computers in order to improve computer performance and speed up computing. Later, they encountered the power limit, and the computer clock speed could not be increased further. Multi-core technology was then adopted to improve the performance and computing power of computers.
[0052] When performing DDR system-level testing on a multi-core system platform, the current memory segment distribution is generally as follows: small memory blocks are usually at the front, and the largest memory block is at the back. If the conventional method is used to allocate memory from front to back, multiple small memory segments will be assigned to the same running core, causing the running core with multiple memory segments to test slower than other running cores, resulting in an increase in overall test time and a decrease in test efficiency.
[0053] Based on this, in this example embodiment, a memory allocation method is first provided. The memory allocation method of this disclosure can be implemented using a server or using a terminal device. The terminal described in this disclosure can include mobile terminals such as mobile phones, tablets, laptops, handheld computers, and personal digital assistants (PDAs), as well as fixed terminals such as desktop computers. Figure 1 A schematic diagram illustrating a memory allocation method flow according to some embodiments of the present disclosure is provided. (Reference) Figure 1 The memory allocation method may include the following steps:
[0054] Step S110: Obtain multiple memory segments corresponding to the task to be processed, and determine the multiple running cores contained in the running platform that executes the task to be processed;
[0055] Step S120: Determine a first capacity memory segment and a second capacity memory segment among multiple memory segments based on multiple running cores; the memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment.
[0056] Step S130: Allocate the first capacity memory segment to each running core one by one, and determine the remaining memory capacity corresponding to each running core;
[0057] Step S140: Allocate the second capacity memory segment to each running core according to the remaining memory capacity to obtain the memory allocation result.
[0058] According to the memory allocation method in this example embodiment, the first capacity memory segment (smaller memory segment) is allocated to different running cores one by one until the first capacity memory segment is allocated. Then, the remaining running cores can divide the memory from the second capacity memory segment (larger memory segment) to complete the memory allocation of the running cores. This memory allocation method can allocate a certain number of segmented memory to each running core. Compared with the memory allocation scheme of the existing DDR system-level test, it can shorten the test time and improve the test efficiency.
[0059] The memory allocation method in this example embodiment will be further explained below.
[0060] In step S110, multiple memory segments corresponding to the task to be processed are obtained, and multiple running cores contained in the running platform that executes the task to be processed are determined.
[0061] In some exemplary embodiments of this disclosure, the task to be processed can be a task currently awaiting processing. The memory segment can be multiple memory segments required to execute the task to be processed. The runtime platform can be the platform that executes the task to be processed. The runtime kernel can be a processing kernel contained within the runtime platform.
[0062] Before allocating memory, the tasks to be processed can be identified. These tasks can be of various types, such as software and hardware tests. In DDR memory applications, they might be DDR system-level test tasks. Due to the inherent characteristics of DDR system-level testing, corresponding memory segments can be pre-allocated based on these characteristics before execution. Therefore, multiple memory segments corresponding to the tasks can be obtained before execution. Furthermore, DDR system-level test tasks are typically processed using a platform with multiple cores. Therefore, the number of cores within the platform can be determined, and the memory segments can be allocated to these cores.
[0063] In one exemplary embodiment of this disclosure, a task to be processed is obtained, and the task execution requirements of the task to be processed are determined; a specified execution environment corresponding to the task to be processed is determined according to the task execution requirements; and multiple memory segments corresponding to the task to be processed in the specified execution environment are determined.
[0064] The task execution requirements can be the specific requirements of the task to be processed during its execution. The specified execution environment can be the execution environment used when executing the task to be processed.
[0065] After identifying the tasks to be processed, the first step is to determine their execution requirements. For example, the execution requirements for a DDR system-level test task might include the expected goals of the task, the runtime environment it depends on, and the specific steps involved. Once these requirements are obtained, the designated runtime environment for the task can be determined. For instance, DDR system-level testing can typically be performed in a UEFI environment, meaning the designated runtime environment for the task could be a UEFI environment. In a UEFI environment, memory can usually be divided into multiple memory segments. Before allocating memory, these memory segments can be obtained within the UEFI environment to facilitate allocation.
[0066] In one exemplary embodiment of this disclosure, a memory configuration file corresponding to a specified operating environment is obtained, and the corresponding memory type is determined according to the memory configuration file; the memory type has corresponding segmented memory; the memory capacity corresponding to the segmented memory is configured to generate memory segments corresponding to each segmented memory.
[0067] The memory configuration file is the configuration file used when configuring memory for the task to be processed. The memory type can be the specific type of memory. Segmented memory can be a memory segment corresponding to a specific memory type. The memory capacity can be the specific size of the memory segment.
[0068] When determining the multiple memory segments corresponding to a task in a specified runtime environment, the memory configuration file for that task can be obtained first. This configuration file may include the memory types included in the specified runtime environment and the specific uses of different memory types. For DDR system-level test tasks, since this task is typically performed in a UEFI environment, the memory configuration file for the DDR system-level test in the UEFI environment should be obtained. In a UEFI environment, the processing platform can usually divide memory into various types of segmented memory based on its usage. Specifically, the `EFI_MEMORY_TYPE` variable can be defined in the memory configuration file under the UEFI environment.
[0069] typedef enum{
[0070] EfiReservedMemoryType = 0, || Reserved type, not used
[0071] EfiLoaderCode, the code assigned to the OS Loader
[0072] EfiLoaderData, / / Data allocated to the OS Loader, the default type when applications allocate memory.
[0073] EfiBootServicesCode, ∥ Code section for starting the service driver / application
[0074] EfiBootServicesData, / / Data area for startup service drivers / applications, the default type of memory allocated by the BS driver.
[0075] EfiRuntimeServicesCode, || Code section for runtime service drivers
[0076] EfiRuntimeServicesData, / / Runtime service driver, the default type for RS driver memory allocation.
[0077] EfiConventionalMemory, || Allocatable Memory
[0078] EfiUnusableMemory, / / An error occurred in this memory region, it cannot be used.
[0079] EfiACPIReclaimMemory, used to store ACPI tables
[0080] EfiACPIMemoryNVS, reserved for firmware use
[0081] EfiMemoryMappedIO, ∥ memory-mapped I / O, can be used by runtime services.
[0082] EfiMemoryMappedIOPortSpace, / / Memory-mapped I / O, is used by the CPU to convert memory cycles to I / O cycles.
[0083] EfiPalCode, reserved for firmware
[0084] EfiMaxMemory Type
[0085] }EFI_MEMORY_TYPE;
[0086] The `EFI_MEMORY_TYPE` variable defines multiple memory types within the UEFI environment through an enumeration, each with corresponding memory segments. After determining these memory segments, a corresponding memory capacity can be configured for each segment to generate multiple memory segments for allocation within the UEFI environment. Specifically, after the platform boots up, only type 7 is a free memory segment available for testing, as shown in the memory segment distribution below.
[0087] Address: 0x0--0x9e000, (632K) (buffer type: 7)
[0088] Address: 0x100000--0x4ae2a000(1225896K)(buffer type: 7)
[0089] Address: 0x4af2a000--0x5ca4a000, (289920K) (buffer type: 7)
[0090] Address: 0x5cc290000--0x60b0f000, (64408K) (buffer type: 7)
[0091] Address: 0x614d6000--0x61574000, (632K) (buffer type: 7
[0092] Address: 0x615f7000--0x61636000, (252K) (buffer type: 7)
[0093] Address: 0x65c29000--0x66044000, (4204K) (buffer type: 7)
[0094] Address: 0x6e200000--0x6e3d7000, (1884K) (buffer type: 7)
[0095] Address: 0x6ffff000--0x70000000, (4K) (buffer type: 7)
[0096] Address: 0x1000000000--0x6040000000, (399507456K) (buffer type: 7)
[0097] Based on the specific distribution of memory segments, it can be seen that the memory capacity of the first 9 test segments is relatively small, while the memory capacity of the 10th test segment is very large.
[0098] In one exemplary embodiment of this disclosure, in response to the boot command of the operating platform, the system enters a specified operating environment according to the task's requirements; obtains the system running file in the specified operating environment, and obtains the memory configuration file from the system running file.
[0099] The boot command can be the command that starts the operating platform. The system runtime files can be the folder that stores the main files of the operating system of the operating platform.
[0100] Since the memory configuration file can be a configuration file for a specified runtime environment, the runtime platform can be started before obtaining the memory configuration file, allowing it to enter the specified runtime environment. For example, the runtime platform typically performs DDR system-level testing in a UEFI environment. When controlling the startup of the runtime platform, a boot command can be sent to the runtime platform. In response to the boot command, the runtime platform can enter the UEFI environment after completing the boot process, according to the task's requirements.
[0101] Once the platform enters the UEFI environment, the system runtime files for that environment can be obtained. These runtime files are folders containing the platform's main operating system files. They are typically created automatically during the operating system installation process, with relevant files placed in their corresponding folders. Most system runtime files should not be modified arbitrarily. After obtaining the system runtime files for the UEFI environment, memory configuration files can be retrieved from them. These configuration files are then used to determine multiple memory segments for the DDR system-level test task within the UEFI environment, and these memory segments are allocated to multiple cores on the platform.
[0102] In step S120, a first capacity memory segment and a second capacity memory segment are determined from multiple memory segments based on multiple running cores; the memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment.
[0103] In some exemplary embodiments of this disclosure, the first capacity memory segment can be a memory segment with a memory capacity smaller than the memory partitioning reference value, i.e., a small memory segment. The second capacity memory segment can be a memory segment with a memory capacity larger than the memory partitioning reference value, i.e., a large memory segment.
[0104] After identifying the multiple memory segments in the DDR system-level test task under a UEFI environment, as well as the memory cores contained in the running platform, the memory segments can be further classified according to the memory cores, into first-capacity memory segments and second-capacity memory segments. During this memory classification process, memory can be classified according to pre-configured memory partitioning rules, and then the multiple memory segments can be allocated to multiple running cores based on the classification results.
[0105] In one exemplary embodiment of this disclosure, the total memory capacity corresponding to multiple memory segments is determined; the number of running cores included in the operating platform is determined; a memory partitioning reference value is determined based on the total memory capacity and the number of running cores, where the memory partitioning reference value = total memory capacity / number of running cores; and a first capacity memory segment and a second capacity memory segment are determined based on the memory partitioning reference value.
[0106] The total memory capacity can be the sum of the capacities of multiple memory segments. The number of running cores can be the number of running cores included in the operating platform. The memory partitioning reference value can be a memory reference value used to distinguish between the first and second memory segments, and the memory partitioning reference value can be determined based on the total memory capacity and the number of running cores.
[0107] After identifying multiple memory segments for the DDR system-level test task in a UEFI environment, the memory capacities of these segments can be summed to obtain the total memory capacity. Assuming the total memory capacity is Q and the number of running cores on the platform is U, then the average memory size to be tested per running core is Q / U = P.
[0108] refer to Figure 2 , Figure 2 A flowchart illustrating the determination of a first capacity memory segment and a second capacity memory segment according to an exemplary embodiment of the present disclosure is shown. In step S210, the total memory capacity corresponding to the plurality of memory segments is determined. (See reference...) Figure 3 , Figure 3 A schematic diagram illustrating the memory capacity corresponding to each of multiple memory segments according to an exemplary embodiment of the present disclosure is shown. Figure 3 It can be seen that the DDR system-level test task in the UEFI environment includes 4 memory segments: memory segment 1, memory segment 2, memory segment 3 and memory segment 4, and the sizes of the 4 memory segments are 3M, 4M, 5M and 100M respectively. Therefore, the total memory capacity of these 4 memory segments is 112M.
[0109] In step S220, the number of running cores in the running platform is determined. After determining the total memory capacity, the specific number of running cores in the running platform can be determined. In this embodiment, the running platform contains a total of 8 running cores, so the number of running cores is 8, that is, 8 cores together test 3+4+5+100=112MB.
[0110] In step S230, a memory partitioning reference value is determined based on the total memory capacity and the number of running cores. After determining the total memory capacity and the number of running cores, the memory partitioning reference value can be determined based on these two values. Specifically, the memory partitioning reference value can be determined by dividing the total memory capacity by the number of running cores. In this case, the memory partitioning reference value is 14M, and the average memory per core is 112 / 8 = 14M.
[0111] In step S240, a first-capacity memory segment and a second-capacity memory segment are determined based on the memory partitioning reference values. After determining the memory partitioning reference values, the first-capacity memory segment and the second-capacity memory segment can be determined based on the memory partitioning reference values, so that memory allocation processing can be performed on the first-capacity memory segment and the second-capacity memory segment respectively.
[0112] In one exemplary embodiment of this disclosure, a memory segment with a memory capacity less than the memory partitioning reference value is defined as a first capacity memory segment; and a memory segment with a memory capacity greater than or equal to the memory partitioning reference value is defined as a second capacity memory segment.
[0113] For example, among the four memory segments mentioned above, memory segment 1, memory segment 2, and memory segment 3 are designated as the first-capacity memory segment; and memory segment 4 is designated as the second-capacity memory segment. By classifying memory segments according to memory partitioning reference values, multiple memory segments can be divided into small memory segments and large memory segments.
[0114] It will be readily understood by those skilled in the art that the specific values of the memory capacity of the memory segment and the number of running cores in the operating platform can be determined based on the actual operating conditions. This disclosure does not impose any special limitations on the memory capacity of the memory segment or the specific number of running cores.
[0115] In step S130, the first capacity memory segment is allocated to each running core one by one, and the remaining memory capacity corresponding to each running core is determined.
[0116] In some exemplary embodiments of this disclosure, the remaining memory capacity may be the current remaining memory capacity of the running core.
[0117] Existing multi-core platform testing methods typically traverse memory segments sequentially and allocate them to the running cores. Specifically, in a UEFI environment, type 7 (Conventional) memory segments are traversed from beginning to end, with each running core allocated a segment of a certain size. However, some DRAM testing algorithms do not exhibit a linear relationship between testing small and large memory blocks; that is, testing 10 segments of 20MB each takes longer than testing a single 200MB segment. In the system-generated memory map, small memory blocks are usually placed at the beginning, with the largest blocks at the end.
[0118] If memory is allocated sequentially from front to back using the conventional method, multiple small memory segments are evenly distributed across the same running core. Specifically, running core 1 acquires memory segment 1 (3M) + memory segment 2 (4M) + memory segment 3 (5M) + memory segment 4 (2M) = 14M. Then, running cores 2 through 8 each acquire 14M of memory from memory segment 4 for testing. However, for some DRAM testing algorithms, testing multiple non-contiguous small segments on a single core is slower than testing a single segment of the same size. This causes running core 1 to be slower than running cores 2 through 8, resulting in an overall increase in testing time.
[0119] To avoid the problems inherent in conventional memory allocation schemes, where small memory segments are not allocated to the same core, this embodiment allocates the first-capacity memory segment (i.e., small memory segment) one by one to different running cores during memory allocation. This prevents multiple small memory segments from being allocated to the same running core. After allocating the first-capacity memory segment (i.e., small memory segment), the current remaining memory capacity of each running core in the operating platform can be determined to allocate the second-capacity memory segment.
[0120] In one exemplary embodiment of this disclosure, a preset sequential order of multiple first-capacity memory segments is used as the memory segment arrangement order of the multiple first-capacity memory segments; the running core arrangement order of multiple running cores is obtained, and the multiple first-capacity memory segments are allocated to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
[0121] The memory segment arrangement order can be determined by arranging multiple memory segments according to a certain sorting rule. The running core arrangement order can be determined by arranging multiple running cores according to their running core numbers.
[0122] After determining the first memory segment based on the memory partitioning reference value, multiple first memory segments can be sorted according to their memory capacity. For example, multiple first memory segments can be sorted in ascending order of memory capacity to obtain the memory segment arrangement order of the first memory segments. For Figure 3 There are four memory segments in the memory, of which memory segment 1, memory segment 2 and memory segment 3 are the first capacity memory segments. Since the order of these three memory segments is already obtained by sorting according to memory capacity, they can be directly used as the memory segment arrangement order.
[0123] Furthermore, the arrangement order of multiple running cores in the operating platform can be determined. For example, the running cores in the operating platform can usually be sorted according to the alphabetical order of their running core numbers to obtain the corresponding running core arrangement order. For example, in this embodiment, there are 8 running cores, so the 8 running cores can be arranged sequentially according to their numerical numbers. After determining the memory segment arrangement order and the running core arrangement order, multiple first-capacity memory segments can be allocated to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
[0124] In one exemplary embodiment of this disclosure, the memory segment number corresponding to each first capacity memory segment is determined according to the memory segment arrangement order; the running core number corresponding to each running core is determined according to the running core arrangement order; the number of running cores is obtained, and the memory allocation number is determined according to the number of running cores and the memory segment number; the first capacity memory segment is allocated to the corresponding memory core according to the memory allocation number and the running core number.
[0125] Here, the memory segment number can be the number corresponding to each memory segment. The running core number can be the number corresponding to each running core. The memory allocation number can be the number corresponding to the memory segment allocation process.
[0126] refer to Figure 4 , Figure 4 This schematically illustrates a diagram of allocating multiple memory segments to multiple running cores according to an exemplary embodiment of this disclosure. (In conjunction with...) Figure 3 and Figure 4 It is known that there are 3 first-capacity memory segments, each with a corresponding memory segment number of 1, 2, and 3; and 8 running cores, each with a running core number of 1, 2, 3, 4, 5, 6, 7, and 8. During memory allocation, the memory allocation number can be determined based on the number of running cores and the memory segment number. In this embodiment, the number of running cores is relatively large. During the process of allocating the first-capacity memory segments to the running cores in the running platform one by one, the memory allocation number is the same as the memory segment number. In this case, each running core may not necessarily be allocated a first-capacity memory segment; the scenario where zero first-capacity memory segments are allocated to a running core also falls within the scope of this disclosure. Through the above processing method, small memory segments can be allocated more evenly across the running cores, avoiding the situation where multiple small memory segments are allocated to the same running core.
[0127] It will be readily understood by those skilled in the art that in other embodiments of this disclosure, there may be a situation where the number of running cores is less than the number of first-capacity memory segments (the number of small memory segments). In this case, a modulo operation can be performed on the number of running cores and the number of small memory segments to determine the memory allocation number based on the modulo calculation result. After determining the memory allocation number corresponding to each first-capacity memory segment, the first-capacity memory segment can be allocated to the corresponding memory core according to the memory allocation number and the running core number.
[0128] In one exemplary embodiment of this disclosure, a first capacity memory segment allocated in the running core is determined, and the occupied memory capacity of the running core is determined based on the allocated first capacity memory segment; a memory partitioning reference value is obtained, and the remaining memory capacity is determined based on the memory partitioning reference value and the occupied memory capacity.
[0129] The occupied memory capacity can be the capacity occupied by the memory that has been allocated in the running kernel.
[0130] After the above processing steps, when allocating memory to each of the running cores 1 through 8, once the first capacity memory segment (small memory segment) has been allocated to each running core, the remaining memory capacity of each running core can be further determined. Specifically, the first capacity memory segment already allocated to each running core is determined, and the occupied memory capacity of that running core is determined based on the allocated first capacity memory segment. Since multiple running cores in the platform jointly process all memory segments, the memory processing capacity corresponding to each running core is equal to the memory partitioning reference value. That is, in this embodiment, the memory processing capacity corresponding to running cores 1 through 8 is 14M. Based on the memory partitioning reference value and the occupied memory capacity, the remaining memory capacity of each running core can be determined. A memory segment of the corresponding size is then obtained from the second capacity memory segment based on the remaining memory capacity for memory allocation, completing the memory allocation process for this running core.
[0131] according to Figure 4 It can be seen that for running core 1, the memory occupied is 3M, and the remaining memory is 11M; for running core 2, the memory occupied is 4M, and the remaining memory is 10M; for running core 3, the memory occupied is 5M, and the remaining memory is 9M; for running cores 4 to 8, no small memory segments have been allocated, therefore, the remaining memory for running cores 4 to 8 is 14M.
[0132] In step S140, the second capacity memory segment is allocated to each running core according to the remaining memory capacity to obtain the memory allocation result.
[0133] In some exemplary embodiments of this disclosure, the memory allocation result may be the result of allocating multiple memory segments to multiple memory cores.
[0134] Once all first-capacity memory segments (i.e., small memory segments) have been allocated to each running core, the allocation of second-capacity memory segments can proceed. At this point, the amount of memory that can be obtained from the second-capacity memory segments can be determined based on the remaining memory capacity of each running core, and then allocated to the corresponding running core to obtain the final memory allocation result.
[0135] Specifically, since the memory capacity M of the second memory segment (i.e., the large memory segment) is usually much larger than P, i.e., M >> P, after the first memory segment (small memory segment) is allocated, the remaining running cores can all allocate memory from the second memory segment (i.e., the large memory segment), and each running core still needs a memory segment size of PN.
[0136] In one exemplary embodiment of this disclosure, the order of multiple running cores is obtained; and the remaining memory allocation steps are performed on each running core one by one according to the remaining memory capacity and the order of the running cores, so as to allocate the second capacity memory segment to each running core.
[0137] In this embodiment, the eight running cores of the platform are sorted according to their core numbers and have a corresponding core arrangement order. After determining the remaining memory capacity for each running core, the remaining memory allocation steps are performed on each running core one by one according to the remaining memory capacity and the core order, so as to allocate the second capacity memory segment to each running core. For example, for eight running cores, memory of the same size as the remaining memory capacity is obtained from the second capacity memory segment and allocated to the corresponding running core, thus completing the allocation of all memory segments.
[0138] In one exemplary embodiment of this disclosure, the remaining memory allocation step includes: obtaining the currently running core and the remaining memory capacity of the current running core; determining the remaining memory segment corresponding to the current running core from the second capacity memory segment; the remaining memory segment is a portion of the second capacity memory segment that has the same remaining memory capacity as the current core; and allocating the remaining memory segment to the current running core.
[0139] Here, the currently running core can be the memory core currently performing memory allocation operations. The remaining memory capacity of the currently running core can be the remaining memory capacity in the currently running core, that is, the unused memory capacity.
[0140] For all running cores of the platform, perform the remaining memory allocation step one by one. Specifically: first, obtain one running core as the current running core, and determine the remaining memory capacity of the current running core, refer to [reference needed]. Figure 4 The system sets core 1 as the current running core. Since core 1 has 11MB of remaining memory, the current core also has 11MB of remaining memory. When allocating remaining memory, a segment can be determined from the second memory segment, which is memory segment 4 with a capacity of 100MB. An 11MB segment is extracted from this 100MB and allocated to core 1 to complete the memory allocation for core 1.
[0141] Similarly, for running core 2, after allocating the first memory segment, if running core 2 has 10MB of remaining memory, then 10MB of memory is allocated from memory segment 4. For running core 3, after allocating the first memory segment, if running core 3 has 9MB of remaining memory, then 9MB of memory is allocated from memory segment 4. At this point, the first memory segment allocation is complete. Therefore, running cores 4 through 8 each allocate 14MB of memory from memory segment 4, allowing each running core to test a maximum of two memory segments, thus improving testing efficiency.
[0142] In one exemplary embodiment of this disclosure, the occupied memory capacity and memory start address of the currently running core are obtained; the memory intermediate address corresponding to the currently running core is determined based on the memory start address and the occupied memory capacity; and the start address corresponding to the remaining memory segment is determined based on the memory intermediate address.
[0143] The occupied memory capacity can be the amount of memory already used by the running core. The memory start address can be the starting address corresponding to the memory allocation performed by the running core. The memory intermediate address can be the end address corresponding to the first memory segment after the current running core has been allocated the first memory segment. The starting address corresponding to the remaining memory segment can be the starting address of the memory corresponding to the allocation of the remaining memory segment to the running core.
[0144] When allocating the remaining memory segments to the currently running core, since the memory allocated to some running cores is obtained from different memory segments, in order to ensure the address continuity of the tested memory in the current running core, the memory address of different memory segments can be determined for each running core. Taking the memory address allocation of running core 1 as an example, the starting address of the memory of running core 1 can be 0. After allocating memory segment 1 to running core 1, since the memory size of memory segment 1 is 3M, the middle address of memory segment 1 in the memory of running core 1 is 3M-1. Then, the remaining memory segment (i.e., the 11M memory segment) is obtained from the memory segment and memory is allocated to running core 1. The starting address of this 11M remaining memory segment is calculated from 3M to ensure the continuity of the tested memory address within the same running core.
[0145] In other embodiments of this disclosure, memory allocation can also be performed through the following steps: in this memory allocation method, memory is allocated to each running core one by one, and memory allocation is performed for the next running core only after the memory allocation for one running core is completed. (See reference...) Figure 5 , Figure 5This schematically illustrates an overall flowchart of allocating multiple memory segments to multiple running cores according to an exemplary embodiment of the present disclosure. In step S510, the entire small segment plus a portion of the largest segment (total memory size P) is allocated to one processing core; where P is a memory partitioning reference value. Once the memory allocation for one running core is complete, memory allocation processing is performed for the next running core. In step S520, the number of running cores is incremented by 1, meaning processing continues with the next running core.
[0146] In step S530, it is determined whether the small memory segment has been fully allocated. If the small memory segment has not been fully allocated, step S510 continues until the small memory segment is fully allocated. After the small memory segment is fully allocated, only the large memory segment remains. At this point, step S540 can be executed to obtain a portion of memory (size P) from the large memory segment and allocate it to a running core. After the memory allocation for this running core is completed, step S550 is executed, the number of running cores is incremented by 1, and memory allocation processing is performed for the next running core. In step S560, it is determined whether the large memory segment has been fully allocated. If the large memory segment has been fully allocated, the entire memory allocation process ends; otherwise, step S540 continues until all memory segments have been allocated to their corresponding running cores.
[0147] In one exemplary embodiment of this disclosure, the task to be processed is executed in a specified runtime environment based on the memory allocation result.
[0148] After allocating multiple memory segments to their respective running cores and obtaining the memory allocation results, the tasks to be executed can be run in a specified operating environment, i.e., DDR system-level testing in a UEFI environment. Since the memory allocation results obtained through the memory allocation scheme in this disclosure result in small memory segments being evenly distributed across all running cores, and typically no single running core contains multiple small memory segments, this maximizes the chances of all running cores starting and ending test tasks simultaneously, avoiding resource waste and effectively improving task execution efficiency.
[0149] It should be noted that the terms "first" and "second" used in this disclosure are only for distinguishing different memory capacity segments and should not impose any limitations on this disclosure.
[0150] In summary, this method involves obtaining multiple memory segments corresponding to the task to be processed, determining the multiple running cores contained in the platform executing the task, identifying a first-capacity memory segment and a second-capacity memory segment based on the multiple running cores, with the second-capacity memory segment having a larger capacity than the first-capacity memory segment, allocating the first-capacity memory segment to each running core, and determining the remaining memory capacity for each running core, and then allocating the second-capacity memory segment to each running core based on the remaining memory capacity to obtain the memory allocation result. On one hand, this memory allocation method allows each running core to be allocated a certain number of segmented memory segments, which, compared to existing DDR system-level testing memory allocation schemes, allows for a more even distribution of memory segments across each running core. On the other hand, allocating memory based on the number of running cores ensures the uniformity of memory segments allocated to each running core, maximizing the simultaneous start and end of task processing on all running cores, avoiding resource waste, and thus effectively improving task execution efficiency.
[0151] It should be noted that although the steps of the method in this invention are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0152] Furthermore, in this example embodiment, a memory allocation device is also provided. (See reference...) Figure 6 The memory allocation device 600 may include: an acquisition module 610, a memory determination module 620, a first memory allocation module 630, and a second memory allocation module 640.
[0153] Specifically, the acquisition module 610 is used to acquire multiple memory segments corresponding to the task to be processed and determine the multiple running cores contained in the running platform that executes the task to be processed; the memory determination module 620 is used to determine a first capacity memory segment and a second capacity memory segment among the multiple memory segments based on the multiple running cores; the memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment; the first memory allocation module 630 is used to allocate the first capacity memory segments to each running core one by one and determine the remaining memory capacity corresponding to each running core; the second memory allocation module 640 is used to allocate the second capacity memory segments to each running core based on the remaining memory capacity to obtain the memory allocation result.
[0154] In one exemplary embodiment of this disclosure, the memory allocation device further includes a memory segment determination module, which is used to acquire a task to be processed, determine the task execution requirements of the task to be processed, determine the specified execution environment corresponding to the task to be processed based on the task execution requirements, and determine multiple memory segments corresponding to the task to be processed in the specified execution environment.
[0155] In one exemplary embodiment of this disclosure, the memory segment determination module includes a memory segment determination unit, which is used to obtain a memory configuration file corresponding to a specified operating environment, determine the corresponding memory type according to the memory configuration file; the memory type has corresponding segmented memory; configure the memory capacity corresponding to the segmented memory to generate memory segments corresponding to each segmented memory.
[0156] In one exemplary embodiment of this disclosure, the memory segment determination unit includes a file acquisition subunit, which is used to respond to the boot-up command of the running platform, enter a specified running environment according to the task running requirements, acquire the system running file in the specified running environment, and acquire the memory configuration file from the system running file.
[0157] In one exemplary embodiment of this disclosure, the memory determination module includes a memory partitioning unit, used to determine the total memory capacity corresponding to multiple memory segments; determine the number of running cores included in the running platform; determine a memory partitioning reference value based on the total memory capacity and the number of running cores, where the memory partitioning reference value = total memory capacity / number of running cores; and determine a first capacity memory segment and a second capacity memory segment based on the memory partitioning reference value.
[0158] In one exemplary embodiment of this disclosure, the memory partitioning unit includes a memory partitioning subunit, used to determine memory segments with memory capacity less than the memory partitioning reference value as first capacity memory segments; and to determine memory segments with memory capacity greater than or equal to the memory partitioning reference value as second capacity memory segments.
[0159] In one exemplary embodiment of this disclosure, there are multiple first capacity memory segments, and the first memory allocation module includes a first memory allocation unit, which is used to use a preset sequential arrangement order of the multiple first capacity memory segments as the memory segment arrangement order of the multiple first capacity memory segments; obtain the running core arrangement order of the multiple running cores, and allocate the multiple first capacity memory segments to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
[0160] In one exemplary embodiment of this disclosure, the first memory allocation unit includes a first memory allocation subunit, configured to determine the memory segment number corresponding to each first capacity memory segment according to the memory segment arrangement order; determine the running core number corresponding to each running core according to the running core arrangement order; obtain the number of running cores; determine the memory allocation number according to the number of running cores and the memory segment number; and allocate the first capacity memory segment to the corresponding memory core according to the memory allocation number and the running core number.
[0161] In one exemplary embodiment of this disclosure, the first memory allocation module further includes a remaining memory capacity determination unit, used to determine the first capacity memory segment already allocated in the running core, determine the occupied memory capacity of the running core based on the allocated first capacity memory segment, obtain a memory partitioning reference value, and determine the remaining memory capacity based on the memory partitioning reference value and the occupied memory capacity.
[0162] In one exemplary embodiment of this disclosure, the second memory allocation module includes a second memory allocation unit, which is used to obtain the running core arrangement order of multiple running cores; and to perform the remaining memory allocation step on each running core one by one according to the remaining memory capacity and the running core order, so as to allocate the second capacity memory segment to each running core.
[0163] In one exemplary embodiment of this disclosure, the second memory allocation unit includes a second memory allocation subunit, configured to obtain the currently running core and the remaining memory capacity of the current running core; determine the remaining memory segment corresponding to the current running core from the second capacity memory segment; the remaining memory segment is a portion of the second capacity memory segment that is the same as the remaining memory capacity of the current core; and allocate the remaining memory segment to the current running core.
[0164] In one exemplary embodiment of this disclosure, the second memory allocation subunit is configured to perform: obtaining the occupied memory capacity and memory start address of the currently running core; determining the memory intermediate address corresponding to the currently running core based on the memory start address and the occupied memory capacity; and determining the start address corresponding to the remaining memory segment based on the memory intermediate address.
[0165] In one exemplary embodiment of this disclosure, the memory allocation device further includes a task execution module for executing a task to be processed in a specified operating environment based on the memory allocation result.
[0166] The specific details of the virtual modules of each memory allocation device mentioned above have been described in detail in the corresponding memory allocation methods, so they will not be repeated here.
[0167] It should be noted that although several modules or units of the memory allocation device have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0168] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0169] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented as entirely hardware embodiments, entirely software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, collectively referred to herein as “circuit,” “module,” or “system.”
[0170] The following is for reference. Figure 7 To describe an electronic device 700 according to such an embodiment of the present disclosure. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0171] like Figure 7 As shown, the electronic device 700 is manifested in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including storage unit 720 and processing unit 710), and a display unit 740.
[0172] The storage unit stores program code that can be executed by the processing unit 710, causing the processing unit 710 to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of this disclosure.
[0173] Storage unit 720 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 721 and / or cache memory 722, and may further include a read-only memory (ROM) 723.
[0174] Storage unit 720 may include a program / utility 724 having a set (at least one) program module 725, such program module 725 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0175] Bus 730 can represent one or more of several types of bus structures, including memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processing unit, or local bus using any of the multiple bus structures.
[0176] Electronic device 700 can also communicate with one or more external devices 770 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0177] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0178] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section above.
[0179] refer to Figure 8As shown, a program product 800 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0180] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0181] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0182] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0183] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0184] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0185] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0186] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A memory allocation method, characterized in that, include: Obtain multiple memory segments corresponding to the task to be processed, and determine the multiple running cores contained in the running platform that executes the task to be processed; The first capacity memory segment and the second capacity memory segment among the multiple memory segments are determined based on the multiple running cores; The memory capacity of the second memory segment is greater than the memory capacity of the first memory segment; The first capacity memory segment is allocated to each of the running cores one by one, and the remaining memory capacity corresponding to each running core is determined; The second capacity memory segment is allocated to each of the running cores according to the remaining memory capacity, so as to obtain the memory allocation result; The step of determining the first capacity memory segment and the second capacity memory segment among the plurality of memory segments based on the plurality of running cores includes: The total memory capacity corresponding to the plurality of memory segments is determined; the number of running cores included in the running platform is determined; a memory partitioning reference value is determined based on the total memory capacity and the number of running cores, wherein the memory partitioning reference value = total memory capacity / number of running cores; memory segments with memory capacity less than the memory partitioning reference value are determined as the first capacity memory segment; and memory segments with memory capacity greater than or equal to the memory partitioning reference value are determined as the second capacity memory segment. The first memory segment is multiple, and the step of allocating the first memory segment to each of the running cores one by one includes: The preset sequential order of the multiple first-capacity memory segments is used as the memory segment arrangement order of the multiple first-capacity memory segments; the running core arrangement order of the multiple running cores is obtained, and the multiple first-capacity memory segments are allocated to the running cores one by one according to the memory segment arrangement order and the running core arrangement order.
2. The method according to claim 1, characterized in that, Before acquiring the multiple memory segments corresponding to the task to be processed, the method further includes: Obtain the task to be processed and determine the task execution requirements of the task to be processed; The specified runtime environment corresponding to the task to be processed is determined based on the task's runtime requirements. Determine the multiple memory segments corresponding to the task to be processed in the specified operating environment.
3. The method according to claim 2, characterized in that, Determining the plurality of memory segments corresponding to the task to be processed in the specified runtime environment includes: Obtain the memory configuration file corresponding to the specified runtime environment, and determine the corresponding memory type based on the memory configuration file; the memory type has corresponding segmented memory. Configure the memory capacity corresponding to the segmented memory to generate memory segments corresponding to each segmented memory.
4. The method according to claim 3, characterized in that, Obtain the memory configuration file corresponding to the specified runtime environment, including: In response to the startup command of the operating platform, the system enters the specified operating environment according to the task execution requirements; Obtain the system runtime file in the specified operating environment, and obtain the memory configuration file from the system runtime file.
5. The method according to claim 1, characterized in that, According to the memory segment arrangement order and the running core arrangement order, multiple memory segments of the first capacity are allocated one by one to the running cores, including: The memory segment number corresponding to each first capacity memory segment is determined according to the memory segment arrangement order; The running core number corresponding to each running core is determined according to the running core arrangement order; Obtain the number of running cores, and determine the memory allocation number based on the number of running cores and the memory segment number; The first capacity memory segment is allocated to the corresponding running core according to the memory allocation number and the running core number.
6. The method according to claim 1, characterized in that, Determining the remaining memory capacity corresponding to each of the aforementioned running cores includes: Determine the first allocated memory segment in the running core, and determine the occupied memory capacity of the running core based on the allocated first memory segment; Obtain the memory partitioning reference value, and determine the remaining memory capacity based on the memory partitioning reference value and the already occupied memory capacity.
7. The method according to claim 1, characterized in that, Allocating the second capacity memory segment to each of the running cores according to the remaining memory capacity includes: Obtain the running core arrangement order of the multiple running cores; According to the remaining memory capacity and the order of the running cores, the remaining memory allocation step is performed on each of the running cores one by one, so as to allocate the second capacity memory segment to each of the running cores.
8. The method according to claim 7, characterized in that, The remaining memory allocation step includes: Obtain the currently running core and the remaining memory capacity of the corresponding currently running core; Determine the remaining memory segment corresponding to the currently running core from the second memory segment; the remaining memory segment is a portion of the second memory segment with the same remaining memory capacity as the current core. The remaining memory segment is allocated to the currently running core.
9. The method according to claim 8, characterized in that, Allocating the remaining memory segment to the currently running core includes: Obtain the memory usage and starting address of the currently running core; The intermediate memory address corresponding to the currently running core is determined based on the memory start address and the occupied memory capacity. The starting address of the remaining memory segment is determined based on the intermediate memory address.
10. The method according to claim 1, characterized in that, The method further includes: The task to be processed is executed in the specified runtime environment based on the memory allocation result.
11. A memory allocation device, characterized in that, include: The acquisition module is used to acquire multiple memory segments corresponding to the task to be processed and to determine the multiple running cores contained in the running platform that executes the task to be processed. A memory determination module is used to determine a first capacity memory segment and a second capacity memory segment among the multiple memory segments based on the multiple running cores; The memory capacity of the second capacity memory segment is greater than the memory capacity of the first capacity memory segment; wherein, determining the first capacity memory segment and the second capacity memory segment among the plurality of memory segments based on the plurality of running cores includes: determining the total memory capacity corresponding to the plurality of memory segments; determining the number of running cores included in the running platform; determining a memory partitioning reference value based on the total memory capacity and the number of running cores, wherein the memory partitioning reference value = total memory capacity / number of running cores; determining the memory segment whose memory capacity is less than the memory partitioning reference value as the first capacity memory segment; and determining the memory segment whose memory capacity is greater than or equal to the memory partitioning reference value as the second capacity memory segment; A first memory allocation module is used to allocate the first capacity memory segments one by one to each of the running cores, and determine the remaining memory capacity corresponding to each running core; the first capacity memory segments are multiple, and the step of allocating the first capacity memory segments one by one to each of the running cores includes: using a preset sequential arrangement order of the multiple first capacity memory segments as the memory segment arrangement order of the multiple first capacity memory segments; obtaining the running core arrangement order of the multiple running cores, and allocating the multiple first capacity memory segments one by one to the running cores according to the memory segment arrangement order and the running core arrangement order; The second memory allocation module is used to allocate the second capacity memory segment to each of the running cores according to the remaining memory capacity, so as to obtain the memory allocation result.
12. An electronic device, characterized in that, include: processor; as well as A memory storing computer-readable instructions that, when executed by the processor, implement the memory allocation method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the memory allocation method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Computer Device and Memory Startup Method of Computer Device
US20170168849A1
Memory testing in a multiple processor computer system
US5673388A