Method, apparatus and program product for memory unit recovery or allocation

By adopting a distributed memory management model in multi-core systems, the borrowing and returning of storage containers solves the problem that the global pool cannot process memory allocation in parallel, achieving efficient balanced allocation and reclamation of memory resources, and reducing cross-core browsing and resource waste.

CN120849075APending Publication Date: 2025-10-28DELL PROD LP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410511012.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

In multi-core systems, the existing global pool cannot process memory allocation requests in parallel, resulting in heavy memory allocation pressure under heavy load conditions, which may lead to conflicts and resource waste.

Method used

A distributed memory management model is adopted, which achieves balanced allocation and reclamation of storage units by borrowing and returning storage containers among multiple cores, and uses a social matrix for information exchange to reduce cross-core browsing.

Benefits of technology

It effectively reduces cross-core browsing between kernels, improves the efficiency of memory allocation and reclamation, reduces resource waste, and maintains system balance, especially under heavy load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849075A_ABST
    Figure CN120849075A_ABST
Patent Text Reader

Abstract

According to the embodiment of the invention, the method for recycling or distributing the storage units is provided, each storage container comprises at least one address pointer for at least one storage unit, and the method comprises the steps that the storage units to be recycled or distributed are acquired; determining whether the remaining address pointers in the plurality of storage containers of the first kernel can recycle or allocate the storage units; and borrowing the required storage container from the second kernel in response to determining that the remaining address pointers in the first kernel cannot recycle or allocate the storage unit. According to the method for recovering or distributing the storage units, the balance of the storage containers can be realized among a plurality of kernels, so that the memory pool can be conveniently distributed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this disclosure primarily relate to the field of data management, and more specifically, to methods, apparatus, and computer program products for performing storage unit reclamation or allocation. Background Technology

[0002] With the advent of new hardware platforms, more and more central processing unit (CPU) cores have been deployed. This has led to increased demands on memory allocation pools. In particular, there is heavy allocation pressure on each core simultaneously. In related methods, a global pool exists, from which memory can be requested when the first and second cores need it. However, when the first and second cores request memory simultaneously, conflicts may occur, and the global pool cannot process the requests in parallel, resulting in heavy allocation pressure. Summary of the Invention

[0003] According to an example embodiment of this disclosure, a method for reclaiming or allocating storage units is provided, comprising: acquiring storage units to be reclaimed or allocated, the storage units to be reclaimed into a first core comprising a plurality of storage containers or to be allocated from the first core, wherein each storage container includes at least one address pointer for at least one storage unit; determining whether remaining address pointers in the plurality of storage containers of the first core are capable of reclaiming or allocating storage units; and in response to determining that remaining address pointers in the first core are not capable of reclaiming or allocating storage units, borrowing the required storage container from a second core.

[0004] In a second aspect of embodiments of this disclosure, an electronic device is provided. The electronic device includes at least one processor; and instructions coupled to and stored thereon on the at least one processor, the instructions causing the electronic device to perform actions when executed by the at least one processor, the actions including: acquiring memory units to be reclaimed or allocated, the memory units to be reclaimed into or allocated from a first core comprising a plurality of memory containers, wherein each memory container includes at least one address pointer for at least one memory unit; determining whether remaining address pointers in the plurality of memory containers of the first core are sufficient to reclaim or allocate memory units; and in response to determining that remaining address pointers in the first core are insufficient to reclaim or allocate memory units, borrowing a desired memory container from a second core.

[0005] In a third aspect of the embodiments of this disclosure, a computer program product is provided, which is tangibly stored on a non-volatile computer-readable medium and includes machine-executable instructions that, when executed, cause a machine to perform a method according to a first aspect of this disclosure.

[0006] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0007] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:

[0008] Figure 1A The design layout diagram of the data management system based on the relevant design is shown;

[0009] Figure 1B A schematic diagram illustrating kernel i data reclamation according to the relevant design is shown;

[0010] Figure 1C This diagram illustrates the process of retrieving data from kernel j according to the relevant design.

[0011] Figure 2 A schematic diagram of a design for balancing storage containers in multiple kernels, according to some embodiments of the present disclosure, is shown.

[0012] Figure 3 A schematic diagram of the layout structure of each storage container according to some embodiments of the present disclosure is shown;

[0013] Figure 4 A schematic diagram of a kernel management structure according to some embodiments of the present disclosure is shown;

[0014] Figure 5 A schematic diagram of the kernel's process for allocating memory units according to some embodiments of the present disclosure is shown;

[0015] Figure 6 A schematic diagram illustrating the process of a kernel borrowing a full storage container according to some embodiments of this disclosure is shown;

[0016] Figure 7 A schematic diagram illustrating the process of mailing an empty storage container to the kernel according to some embodiments of this disclosure is shown;

[0017] Figure 8 A schematic diagram illustrating the flow of a converged social matrix according to some embodiments of the present disclosure is shown;

[0018] Figure 9 A schematic diagram of the process for reclaiming memory units in a current kernel according to some embodiments of the present disclosure is shown;

[0019] Figure 10A schematic diagram illustrating a process of kernel borrowing an empty storage container according to some embodiments of the present disclosure is shown;

[0020] Figure 11 A schematic diagram illustrating the process of mailing a full storage container to the kernel according to some embodiments of the present disclosure is shown;

[0021] Figure 12 Flowcharts illustrating methods for reclaiming or allocating storage units in a first kernel comprising multiple storage containers, according to some embodiments of this disclosure, are shown; and

[0022] Figure 13 A schematic block diagram of an example device for implementing some embodiments of the present disclosure is shown. Detailed Implementation

[0023] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0024] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0025] As mentioned above, in the relevant methods, there exists a global pool that can be requested from the global pool when the first and second cores need memory. When the first and second cores request memory simultaneously, conflicts may occur, and the global pool cannot process the requests in parallel, resulting in heavy allocation pressure.

[0026] Figure 1A A layout diagram of a design based on the relevant method is shown. In this design, each of the multiple cores (e.g., kernel i, kernel j, and kernel k) has two memory containers (Magazine, abbreviated as MGZ in the figure): the previous memory container (prevMGZ) and the current memory container (currMGZ). Each memory container contains multiple descriptors (PDs as shown in Figure 1), and each descriptor has some metadata, including, for example, address pointers. In this design, there is also a global depot, which, as shown in Figure 1, stores all full and empty memory containers.

[0027] like Figure 1A As shown, kernel k's previous storage container was a full storage container, but its current storage container is a half-full storage container (where unfilled PDs are represented by light colors, and filled PDs by dark colors). Therefore, kernel k can no longer collect data, but a half-full storage container can still collect data. To retrieve data from kernel k or for kernel k to collect data, you can directly shoot a PD (such as the topmost PD in the current storage container (shown in black)) out of the current storage container or add data to the position above that PD.

[0028] Figure 1B A schematic diagram illustrating kernel i data reclamation according to the relevant design is shown. (e.g.) Figure 1B As shown, the current memory container of kernel i is full. Therefore, retrieving data from kernel i is relatively simple; the data (e.g., the topmost data in the current memory container) simply needs to be allocated from the current memory container. However, filling data into kernel i is more complicated. There is no space in any memory container of kernel i for filling new data. The program needs to find an empty memory container in the global repository, replace the previous full memory container with the empty memory container from the global repository, and then swap the positions of the current memory container and the obtained empty memory container to make the current memory container empty. This allows the data to be pushed into or reclaimed at the position shown by the black block in the current memory container (this position contains an address pointer to the memory bullet).

[0029] Figure 1C A schematic diagram illustrating the process of retrieving data from kernel j according to the relevant design is shown. For example... Figure 1C As shown, both the current and previous memory containers of kernel j are empty. Adding data to kernel j is relatively easy; simply fill the data into a descriptor of the current memory container. However, retrieving data from kernel j is more complicated because the current memory container of kernel j is empty, with no data available for retrieval. When it is necessary to retrieve data from kernel j, as... Figure 1C As shown, a full storage container is found in the global repository, the empty previous storage container in kernel j is replaced with the found full storage container, the current storage container is swapped with the previous storage container, and finally the required data is popped from the current storage container (e.g., ...). Figure 1C (The data represented by the black blocks shown).

[0030] like Figures 1A to 1CThe design shown is essentially a central-agent model. It works well when throughput is not high because the agent doesn't need to frequently exchange resources with the central core. However, when each core is heavily loaded, the global lock becomes a bottleneck. All cores will chase the same resources, which can waste CPU and lead to ping-pong issues with global lock sockets and cache lines between cores.

[0031] In view of the above problems, embodiments of this disclosure provide a method for reclaiming or allocating storage units. The method includes: acquiring storage units to be reclaimed or allocated, the storage units to be reclaimed into a first core comprising a plurality of storage containers or to be allocated from the first core, wherein each storage container includes at least one address pointer for at least one storage unit; determining whether remaining address pointers in the plurality of storage containers of the first core are sufficient to reclaim or allocate storage units; and in response to determining that remaining address pointers in the first core are insufficient to reclaim or allocate storage units, borrowing the required storage container from a second core. The method according to this disclosure is a purely distributed model and inherently avoids centralization issues. Therefore, it can better achieve balance among multiple cores and significantly reduce cross-core browsing between cores, especially under heavy load conditions.

[0032] Figure 2 A schematic diagram of a system for balancing storage containers across multiple kernels, according to some embodiments of the present disclosure, is shown.

[0033] like Figure 2 As shown, the data management system 200 includes multiple kernels, such as kernels i, j, k, and m. Each kernel includes multiple storage containers, each of which is a large storage container containing address pointers to multiple storage units, where a storage unit is a basic unit of storage allocation. For example, each address is a descriptor that has some metadata, including, for example, address pointers. Figure 2 As shown, each kernel includes a process magazine (PMGZ), which is a storage container that is undergoing the allocation and reclamation of data storage units (i.e., allocating and reclamation of data). For example, it can be a storage container.

[0034] In addition, such as Figure 2 As shown, each kernel also includes a first type of memory container queue, such as the Full Magazine Borrowed queue (FMBQ), which is a queue with multiple borrowed, currently full memory containers. Therefore, the FMBQ can include multiple memory containers borrowed from other kernels. Figure 2As shown, each kernel also includes a second type of storage container queue, such as its own full storage container queue FMQ (full Magazine queue), which is a queue with multiple full storage containers belonging to the kernel itself. Therefore, the FMQ can include multiple full storage containers belonging to the kernel itself.

[0035] It should be noted that although a full storage container in FMBQ is currently full in the kernel, it was empty when it was borrowed and then filled in by the kernel. Subsequently, the kernel needs to allocate all the filled data (that is, meet the return conditions) and return the empty storage container. Therefore, the storage container needs to be in the same state when it was borrowed and when it is returned. For example, the first kernel can borrow an empty storage container from the second kernel. The second kernel is not currently able to fill the empty storage container, so it lends the storage container to the first kernel. The first kernel fills the storage container, allocates all the data in the storage container, and returns the empty storage container to the second kernel.

[0036] In addition, such as Figure 2 As shown, each kernel also includes a first type of empty memory container queue, such as the empty magazine borrowed queue (EMBQ), which is a queue with multiple borrowed, currently empty memory containers. Therefore, the EMBQ can include multiple memory containers borrowed from other kernels. Figure 2 As shown, each kernel also includes a second type of empty storage container queue, such as the own empty storage container queue EMQ (empty Magazine queue), which is a queue with multiple empty storage containers belonging to the kernel itself. Therefore, the EMQ can include multiple empty storage containers belonging to the kernel itself.

[0037] It should be noted that although an empty storage container in EMBQ is currently empty in the kernel, it is full when it is borrowed, and then all the data is allocated in that kernel. Subsequently, the kernel needs to refill the storage container with data (that is, meet the conditions for return) and return the full storage container. Therefore, the storage container needs to be in the same state when it is borrowed and when it is returned. For example, the first kernel can borrow a full storage container from the second kernel. The second kernel is currently unable to allocate the data in the full storage container, so it lends the full storage container to the first kernel. The first kernel allocates all the data in the storage container, then refills the storage container and returns the full storage container to the second kernel.

[0038] like Figure 2As shown, each kernel also includes a social module, which comprises a social matrix that stores information about queues of various types of storage containers for that kernel. This social matrix serves as the medium for information exchange between storage containers when the kernel borrows and returns storage containers to each other.

[0039] Each kernel initially has a batch of full and empty MGZs, along with five queues (e.g., PMGZ, FMQ, FMBQ, EMQ, and EMBQ) and a social module. Generally, storage units are allocated or reclaimed within each kernel's budget without interaction with other kernels. When a kernel runs out of resources, it borrows an MGZ from a dedicated queue of another kernel, guided by the social matrix. Simultaneously, this kernel exchanges information with relevant kernels through the social module to improve information accuracy. When some borrowed MGZs (regardless of what the current kernel is borrowing) meet their return conditions, the MGZ will proactively restore the original kernel to its original state, thus maintaining system balance.

[0040] The following will refer to Figure 3 This is a schematic diagram illustrating the layout structure of each storage container according to some embodiments of the present disclosure.

[0041] like Figure 3 As shown, each MGZ can be 1MB in size, with a 64-byte header and the remaining space being an array of pointers. Each address pointer will point to a memory location. For example, if each memory location is 64 bytes, an MGZ can hold nearly 8MB of memory. This provides greater memory utilization compared to existing designs.

[0042] The header according to embodiments of this disclosure includes: a queue link (Qlink), which links MGZs to a dedicated queue, and may be 24 bytes. The header according to embodiments of this disclosure also includes: coreOwner information, which may be 4 bytes, indicating that each MGZ should be budgeted on one core, a fundamental kernel balancing rule. MGZs can be borrowed from their home core, but they must eventually be returned to maintain memory balance among cores.

[0043] The header according to embodiments of this disclosure also includes: borrowing state information, where NONE is the default state and means that this MGZ is served within its own kernel; B_FULL means that this MGZ was full when lent to another kernel and should also be full when returned; and B_EMPTY means that this MGZ was empty when lent to another kernel and should also be empty when returned. Finally, the header according to embodiments of this disclosure also includes padding information, for example, which may be 36 bytes.

[0044] Figure 4 A schematic diagram of a kernel management structure according to some embodiments of this disclosure is shown. For example... Figure 4 As shown, each kernel has a kernel management structure to manage MGZs. This kernel management structure includes: a kernel lock (coreMgLock), where each kernel spins a lock to protect kernel management content; and a social matrix, which is a matrix storing information about each kernel's management (other information may be inaccurate except for its own, but becomes accurate after multiple communications). Each kernel has a row containing fields: a timestamp, where the CPU marks when the row is full; and various queue numbers, representing the number of MGZs in the relevant queue (e.g., FMQ, EMQ, FMBQ, EMBQ).

[0045] By default, each kernel also has one empty MGZ to prevent the system from being blocked. For example, one kernel performs data collection, while all other kernels perform data allocation. The kernel collecting data needs enough empty MGZs to buffer memory until some kernels allocating data have empty MGZs available. Therefore, each kernel sets up an empty MGZ (the number of a completely empty MGZ is equal to the process MGZ number) to ensure that all process MGZs are used up.

[0046] The balancing method for achieving storage container balancing will be detailed below. This means that all individuals will make their best efforts to utilize their existing resources to maintain system balance. This balancing method follows rules that include, by default, all kernels have an equal number of full and empty storage containers. These rules also include: kernels operate independently within their budget; and when their budget is exceeded, kernels will borrow the necessary storage containers from other kernels according to the instructions of the social matrix. When the first kernel borrows storage containers from other kernels, it must follow certain priorities. For example, when needing to borrow full storage containers from other kernels, the first priority is full storage containers in other kernels' FMBQs, and the second priority is full storage containers in other kernels' FMQs. When the first kernel borrows empty storage containers from other kernels, it must follow certain priorities. For example, the first priority is empty storage containers in other kernels' EMBQs, and the second priority is empty storage containers in other kernels' EMQs. In addition, the rule also includes: when the storage container is full / empty (that is, when the return conditions are met), the kernel will actively return the storage container based on the tag in the storage container; and when lending or returning a storage container, the content of the social matrix will be updated when both kernel locks are held.

[0047] Table 1 below shows the content fields in the social matrix in kernel i.

[0048] Table 1

[0049]

[0050] As shown in Table 1, if kernel i intends to borrow an empty storage container, it will first try to borrow kernel k because it has the largest number of EMBQs. If borrowing fails, the program will continue to try kernels with the largest number of EMBQs shown in the social matrix (which has been updated in previous attempts) until all kernels have zero EMBQs. Then the program will try kernels with the largest number of EMBQs. Similarly, if kernel i intends to borrow a full storage container, it will first try to borrow kernel j because kernel j has the largest number of FMBQs.

[0051] The following will refer to Figure 5 This describes the process of allocating storage units in the kernel according to some embodiments of the present disclosure.

[0052] Figure 5As shown, in operation 501, the process storage container is first checked to see if it is empty. If the kernel's process storage container is not empty (that is, the process storage container has some storage units available for allocation, for example, the number of storage units in the process storage container is not zero), then the storage units in the process storage container can be preferentially allocated, that is, the step of operation 502 is to eject or pop or allocate storage units in the process storage container.

[0053] If the process's memory container is empty, meaning the addresses in the memory container are not filled (there are no address pointers to memory units), and therefore no allocable memory units can be indicated, then operation 503 is executed to check if the number of full memory containers in the borrowed full memory container queue (FMBQ) in the kernel is zero. If the number of full memory containers in the FMBQ is not zero, that is, if there are address pointers to memory units to be allocated in the full memory containers borrowed from other kernels in the kernel, then operation 504 is executed, which reloads the process's memory container using the full memory containers in the FMBQ to perform the memory unit allocation task.

[0054] If the full storage container in the FMBQ is empty (i.e., the number of full storage containers in the queue is zero), then there is no address pointer for an allocable storage unit in the FMBQ. Therefore, operation 505 is performed to check the number of full storage containers in the kernel's own full storage container queue (FMQ). If the full storage containers in the FMQ are not empty (i.e., the number is not zero), then operation 504 is performed, which reloads the in-process storage container with the full storage containers in the FMQ to perform the storage unit allocation task.

[0055] If the full storage container in FMQ is empty (i.e., the quantity is zero), the process proceeds to operation 506 to borrow a full storage container from another kernel. If the borrowing is successful, the process proceeds to operation 504, which uses the full storage container borrowed from another kernel to reload the storage container in the process for storage allocation. If the borrowing fails, the program stops.

[0056] Furthermore, it should be noted that when checking full storage containers in the FMBQ, the MGZ in this queue should be empty when borrowed and needs to be returned as soon as possible. Therefore, the program will run it first when it has the opportunity. Once the storage unit pointed to by the address pointer of the MGZ that performed the storage unit allocation task (which can be a storage container in the process, a full storage container in the FMBQ, a full storage container in the FMQ, or a full storage container borrowed from another kernel) has been allocated, the MGZ becomes empty and will be returned to the owner of the storage container in Operation 507 with the status of "Mail Empty MGZ".

[0057] The following will be for reference Figure 6This section describes the process of a kernel borrowing a full storage container according to some embodiments of this disclosure. This process conforms to the rule of "striving to maintain system balance." Because the MGZ within the FMBQ was initially empty when borrowed, and the target kernel appears unable to exhaust it (therefore, it remains within the FMBQ) to reach a return state, and now the current kernel has the capacity to consume storage units, the best borrowing option is the MGZ within the target kernel's FMBQ—a win-win situation.

[0058] like Figure 6 As shown, in operation 601, the kernel first determines the target kernel, for example, by finding the kernel with the largest number of FMBQs in the social matrix as the target kernel. In operation 602, it determines whether the target kernel has a larger kernel ID. For example, if the kernel currently borrowing the full storage container is kernel j, and the target kernel is kernel k, then the target kernel has a larger kernel ID. If the target kernel is kernel i, then the target kernel has a smaller kernel ID.

[0059] If the target kernel has a smaller kernel ID, then in operation 603, the lock of the current kernel is relinquished and marked. If the target kernel has a larger kernel ID, then in operation 604, the lock of the target kernel is directly acquired and it is determined whether the current lock relinquishment operation has been marked (i.e., whether the lock of the current kernel has been relinquished). If the target kernel has a smaller kernel ID, it is also necessary to acquire the lock of the target kernel in operation 604 and determine whether the current lock relinquishment operation has been marked.

[0060] If the abort operation is marked, the process proceeds to operation 605 to acquire the lock of the current kernel. If the abort operation is not marked (i.e., no operation to relinquish the lock of the current kernel is performed), the process proceeds to operation 606 to merge the social matrices of the target kernel and the current kernel. In other words, once a spinlock holding both the current lock and the target lock is acquired during execution, a social matrix merging or merging operation occurs—that is, updating the contents of the social matrices in both the current kernel and the target kernel, which will be described in detail later. Merging or merging social matrices is a communication method to improve borrowing hit rates and reduce cross-kernel browsing.

[0061] Then, in operation 607, the FMQ in the current storage container is checked, for example, to see if the number of full storage containers in the FMQ of the current storage container meets the requirement (i.e., whether there are any full storage containers). As mentioned above, to prevent deadlock, each kernel spinlock is attempted to be held in ascending order of kernel ID during borrowing. Therefore, in some cases, the current kernel's lock may be dropped for a period of time (e.g., in operation 604). During this interval, other kernels may access the current kernel and change its resources, for example, other kernels may return some full storage containers to the current kernel. Therefore, before the current kernel performs an actual borrowing, we need to check the current kernel's FMQ to see if the number of full storage containers in the current kernel's FMQ has met the requirement.

[0062] Previously, the number of full storage containers in FMQ was checked to be zero (e.g., in operation 505). However, now the number of full storage containers in FMQ can be non-zero because, during the period when the current kernel relinquished its lock, other kernels (kernels outside the target kernel) returned some full storage containers to the current kernel. Therefore, the number of full storage containers again meets the requirement (i.e., the number is not zero). Then, the target storage container is dequeued in operation 608.

[0063] If it is determined that the number of full storage containers in the FMQ of the current storage container does not meet the requirement (i.e., the number is still zero), then in operation 609, check whether the number of full storage containers in the FMBQ of the target kernel meets the requirement (i.e., the number is not zero). If the number of full storage containers in the FMBQ of the target kernel meets the requirement, then in operation 608, perform a dequeue operation on the target storage container.

[0064] If the number of full memory containers in the target kernel's FMBQ is insufficient, then in operation 610, the lock on the target kernel is relinquished, and a new target kernel is searched for. In other words, if a full MGZ cannot be borrowed in this round, the program will initiate a new round starting with operation 601 to find a suitable target kernel through the social matrix. It should be noted that the social matrix was merged in the previous round. Therefore, a new target kernel (different from the one in the previous round) should be selected in this round.

[0065] The following will refer to Figure 7This document describes the process of mailing empty storage containers to a kernel according to some embodiments of this disclosure. Mailing an empty storage container should follow certain rules, with the focus being on checking the header of the MGZ and determining whether the empty MGZ should be returned or retained. The rules can be as follows: For an empty storage container to be returned, its "coreOwner" does not match the current kernel's ID, and the current empty storage container's "borrowingState" is empty, meaning the MGZ was empty when lent to another kernel and should also be empty upon return. For an empty storage container to be retained, none of the above conditions are met. For example, the empty storage container's "coreOwner" matches the current kernel's ID (i.e., the current kernel owns sovereignty over the empty storage container), or the current empty storage container's "borrowingState" is NONE (meaning this MGZ is served within its own kernel) or B_FULL (meaning this MGZ was full when lent to another kernel and should also be full upon return).

[0066] First, in operation 701, the kernel checks the storage container header. If the storage container header indicates that the retention rules are met, the empty storage container is kept in the current kernel; that is, in operation 702, the empty storage container is enqueued in the current kernel. If the storage container header indicates that the empty storage container to be mailed meets the return rules, then in operation 703, it is determined whether the core owner information in the storage container header indicates that the target kernel has a larger kernel ID. For example, if the current kernel is j, and the target kernel is k, then the target kernel has a larger kernel ID; if the target kernel is i, then the target kernel has a smaller kernel ID.

[0067] If the target kernel has a smaller kernel ID, in operation 704, the lock of the current kernel is relinquished and marked. Otherwise, if the target kernel has a larger kernel ID, in operation 705, the lock of the target kernel is acquired directly, and it is determined whether the lock relinquishment operation has been marked. If the target kernel has a smaller kernel ID, in operation 705, the lock of the target kernel also needs to be acquired, and it needs to be determined whether the lock relinquishment operation has been marked (i.e., whether the lock of the current kernel has been relinquished). If it is determined that the lock relinquishment operation has been marked, the process proceeds to operation 706 to acquire the lock of the current kernel.

[0068] If it is determined that the target kernel's lock is not marked (i.e., no operation to relinquish the current kernel's lock has been performed), the process proceeds to operation 707 to merge the social matrices of the target and current kernels. In other words, once a spinlock holding both the current and target locks is executed, a social matrix merging or merging operation occurs, which updates the contents of the social matrices in both the current and target kernels. Merging or merging social matrices is a way to improve borrowing hit rates and reduce cross-kernel browsing. Then, in operation 702, the empty storage container is enqueued into the target kernel.

[0069] The following will refer to Figure 8 This describes the process of integrating a social matrix according to some embodiments of the present disclosure.

[0070] Suppose two social matrices from kernel i and kernel k need to be merged to generate two new repeating matrices. The merging rules are as follows: compare the elements of the timestamp column and retain the most recent relevant row. For example, kernel i has the latest information about its own individual queues, such as... Figure 8 The timestamp of kernel i's information is 100707, which is the latest timestamp. Kernel k has the latest information about its own various queues, such as... Figure 8 The timestamp of the kernel k information is 100707, which is the latest timestamp.

[0071] However, the timestamp of the information about kernel k in kernel i is 100319, which is less than 100707. Therefore, after kernel i and kernel k are merged, the information about kernel k in kernel i is updated to the information in kernel k with timestamp 100707. Furthermore, the timestamp of the information about kernel i in kernel k is 100315, which is less than 100707. Therefore, after kernel i and kernel k are merged, the information about kernel i in kernel k is updated to the information in kernel i with timestamp 100707.

[0072] It should be understood that each social matrix should have a 100% accurate latest row (like the first grayed-out row in kernel i and the third grayed-out row in kernel k), which represents the current kernel's administrative information. Therefore, when the social matrices of two kernels are merged, these two latest rows should be updated and preserved. For other rows (e.g., information for kernels j and m), they are essentially generated from other merges.

[0073] refer to Figure 9 This describes the process for reclaiming storage units in the current kernel according to some embodiments of this disclosure. For example... Figure 9As shown, when there are memory units to be reclaimed, operation 901 first checks the in-process memory container (PMGZ). If the kernel's in-process memory container is not full (meaning that some addresses can be filled into the address pointers for the memory units to be reclaimed), for example, if the amount of remaining space in the in-process memory container is greater than 0, then memory units can be reclaimed or pushed into these remaining spaces, i.e., operation 902 is entered to use the in-process memory container to perform the task of memory unit reclamation.

[0074] If the in-process storage container is full (meaning there is no address space available for the reclaimed storage units), then in operation 903, it is necessary to check whether the number of empty storage containers in the borrowed empty storage container queue (EMBQ) in the kernel is zero. If there is at least one empty storage container in the EMBQ (meaning the number of empty storage containers is not zero), then operation 904 is entered, which reloads the in-process storage container with the empty storage containers in the EMBQ to perform the storage unit reclamation task.

[0075] If the empty storage container in the EMBQ is empty (i.e., the number of empty storage containers in the queue is 0), meaning there is no address pointer for the storage unit to be reclaimed in the EMBQ, then operation 905 is performed to check the empty storage containers in the kernel's own empty storage container queue (EMQ). If the empty storage containers in the EMBQ are not empty (i.e., the number is not zero), then operation 904 is performed, which reloads the storage container in the process with the empty storage containers in the EMBQ to perform the storage unit reclamation task.

[0076] If the empty storage container in EMQ is empty (i.e., the quantity is zero), the process proceeds to operation 906 to borrow an empty storage container from another kernel. If the borrowing is successful, the process proceeds to operation 904, which uses the empty storage container borrowed from another kernel to reload the storage container in the process for memory reclamation. If the borrowing fails, the program stops.

[0077] Furthermore, it should be noted that when checking empty storage containers in EMBQ, the MGZ in this queue should be full when borrowed and need to be returned as soon as possible. Therefore, the program will run it first when it has the opportunity. Once the address pointers of the MGZ performing the storage unit reclamation task (which can be a storage container in the process, an empty storage container in EMBQ, an empty storage container in EMQ, or an empty storage container borrowed from another kernel) can be filled, the MGZ becomes full and will be returned to the owner of the storage container in Operation 907 with the status "Mailed Full MGZ".

[0078] The following will be for reference Figure 10This document describes the process of a kernel borrowing an empty storage container according to some embodiments of this disclosure. This process conforms to the rule of "striving to maintain system balance." Because the MGZ in the EMBQ was initially full when borrowed, and the target kernel appears unable to fill it (leave it in the EMBQ) to achieve the return state, and now the current kernel has the ability to fill the storage units in the storage container, the best borrowing option is the MGZ in the target kernel's EMBQ—a win-win situation.

[0079] like Figure 10 As shown, in operation 1001, the kernel first determines the target kernel, for example, by finding the kernel with the largest number of EMBQs in the social matrix as the target kernel. In operation 1002, it is determined whether the target kernel has a larger kernel ID. For example, if the kernel currently borrowing the empty storage container is kernel j, and the target kernel is kernel k, then the target kernel has a larger kernel ID. If the target kernel is kernel i, then the target kernel has a smaller kernel ID.

[0080] If the target kernel has a smaller kernel ID, then in operation 1004, the current kernel's lock is relinquished and marked. If the target kernel has a larger kernel ID, then in operation 1003, the target kernel's lock is directly acquired and it is determined whether the target kernel's lock is marked. Then, in operation 1003, the target kernel's lock is acquired again and it is determined whether the current lock relinquishment operation is marked. If the target kernel has a smaller kernel ID, then in operation 1004, the target kernel's lock also needs to be acquired, and it is determined whether the current lock relinquishment operation is marked.

[0081] If the abort operation is marked, the process proceeds to operation 1005, where the current kernel lock is acquired. If the abort operation is not marked (i.e., no operation to relinquish the current kernel lock is performed), the process proceeds to operation 1006 to merge the social matrices of the target kernel and the current kernel. In other words, once the spinlocks of the current lock and the target lock are held during execution, the operation of merging or fusing the social matrices occurs, which involves updating the contents of the social matrices in the current kernel and the target kernel.

[0082] Then, in operation 1007, the EMQ in the current storage container is checked, for example, to see if the number of empty storage containers in the current storage container's EMQ meets the reclamation requirements (i.e., whether there are empty storage containers). As mentioned above, to prevent deadlock, each kernel spinlock is attempted to be held in ascending order of kernel ID during borrowing. Therefore, in some cases, the current kernel's lock may be removed for a period of time (e.g., in operation 1004). During this interval, other kernels may access the current kernel and change its resources, for example, other kernels may return some empty storage containers to the current kernel. Therefore, before the current kernel performs an actual borrowing, we need to check the current kernel's EMQ to see if the number of empty storage containers in the current kernel's EMQ meets the requirements, i.e., whether there are empty storage containers.

[0083] Previously, the number of empty storage containers in the EMQ was zero (e.g., in operation 905). However, now the number of empty storage containers in the EMQ can be non-zero. This is because during the period when the current kernel relinquished its lock, other kernels (kernels outside the target kernel and outside the target kernel) returned some empty storage containers to the current kernel. Therefore, the number of empty storage containers again meets the reclamation requirement (i.e., the number is not zero). Thus, it is determined that the number of empty storage containers in the EMQ of the current storage container meets the reclamation requirement. Then, in operation 1008, the target storage container is dequeued.

[0084] If it is determined that the number of empty storage containers in the EMQ of the current storage container does not meet the recycling requirements (i.e., the number is still zero), then in operation 1009, check whether the number of empty storage containers in the EMBQ of the target kernel meets the recycling requirements (i.e., the number is not zero). If the number of empty storage containers in the EMBQ of the target kernel meets the recycling requirements, then in operation 1008, perform a dequeue operation on the target storage container.

[0085] If the number of empty memory containers in the target kernel's EMBQ is insufficient, then in operation 1010, the lock on the target kernel is relinquished, and a new target kernel is searched for. In other words, if borrowing an empty MGZ fails in this round, the program will initiate a new round starting with operation 1001 to find a suitable target kernel through the social matrix. It should be noted that the social matrix was merged in the previous round. Therefore, a new target kernel (different from the one in the previous round) should be selected in this round.

[0086] The following will refer to Figure 11This section describes the process of mailing full storage containers to the kernel according to some embodiments of this disclosure. Mailing full storage containers should follow certain rules, with the focus being on checking the header of the MGZ and determining whether the full MGZ should be returned or retained. The rules can be as follows: For a full storage container to be returned, its "coreOwner" does not match the current kernel's ID; and the current full storage container's "borrowingState" is full, meaning the MGZ was full when lent to another kernel and should also be full upon return. For a full storage container to be retained, the rule is: none of the above conditions are met. For example, the full storage container's "coreOwner" matches the current kernel's ID (i.e., the current kernel owns sovereignty over the full storage container), or the current full storage container's "borrowingState" is NONE (meaning this MGZ is served within its own kernel) or B_EMPTY (meaning this MGZ was empty when lent to another kernel and should also be empty upon return).

[0087] First, in operation 1101, the kernel checks the header of the storage container. If the storage container header indicates that the retention rules are met, the full storage container is kept in the current kernel; that is, in operation 1102, the full storage container is enqueued in the current kernel. If the storage container header indicates that the full storage container to be mailed meets the return rules, then in operation 1103, it is determined whether the core owner information in the storage container header indicates that the target kernel has a larger kernel ID. For example, if the current kernel is j, and the target kernel is k, then the target kernel has a larger kernel ID; if the target kernel is i, then the target kernel has a smaller kernel ID.

[0088] If the target kernel has a smaller kernel ID, in operation 1104, the lock of the current kernel is relinquished and marked. Otherwise, if the target kernel has a larger kernel ID, in operation 1105, the lock of the target kernel is acquired directly, and it is determined whether the lock relinquishment operation has been marked. If the target kernel has a smaller kernel ID, in operation 1105, the lock of the target kernel also needs to be acquired, and it needs to be determined whether the lock relinquishment operation has been marked (i.e., whether the lock of the current kernel has been relinquished). If it is determined that the lock relinquishment operation has been marked, the process proceeds to operation 1106 to acquire the lock of the current kernel.

[0089] If it is determined that the target kernel's lock is not marked (i.e., no operation to relinquish the current kernel's lock has been performed), the process proceeds to operation 1107 to merge the social matrices of the target kernel and the current kernel. Once a spinlock holding both the current and target locks is acquired during execution, a merge or aggregate of the social matrices occurs, i.e., the contents of the social matrices in both the current and target kernels are updated. Then, in operation 1102, the full storage container is enqueued into the target kernel.

[0090] In some embodiments of the present disclosure, a method is provided for reclaiming or allocating storage units in a first kernel comprising a plurality of storage containers, wherein each storage container (MGZ) includes at least one address for at least one storage unit. Figure 12 A flowchart is shown of a method 1200 for reclaiming or allocating storage units in a first core comprising multiple storage containers, according to some embodiments of the present disclosure.

[0091] In box 1210, memory units to be reclaimed or allocated are obtained. Reclaiming or allocating operations can be performed one by one for each memory unit. In box 1220, it is determined whether the remaining address pointers in multiple memory containers of the first kernel are sufficient to reclaim or allocate memory units. In box 1230, in response to determining that the remaining address pointers in the first kernel are insufficient to reclaim or allocate memory units, the required memory container is borrowed from the second kernel.

[0092] In some embodiments, the plurality of storage containers include: an in-process storage container (e.g., PMGZ) configured to perform storage unit allocation and reclamation operations; a first type storage container queue (e.g., FMBQ or EMBQ) containing at least one first type storage container borrowed from other kernels; a second type storage container queue (e.g., FMQ or EMQ) containing at least one second type storage container owned by a first kernel; and a social matrix module configured to: for each of the plurality of kernels, store a first type quantity of at least one first type storage container in the first type storage container queue and a second type quantity of at least one second type storage container in the second type storage container queue.

[0093] In some embodiments, the first type of storage container queue includes: at least one first type full storage container (e.g., a full storage container included in an FMBQ) borrowed from other kernels, wherein the first type full storage container is an empty storage container when borrowed from other kernels, is filled in a first kernel, and is to be returned to other kernels when it becomes an empty storage container again; or at least one first type empty storage container (e.g., an empty storage container included in an EMBQ) borrowed from other kernels, wherein the first type empty storage container is a full storage container when borrowed from other kernels, is emptied in a first kernel, and is to be returned to other kernels when it becomes a full storage container again.

[0094] In some embodiments, the second type of storage container queue includes: at least one second type full storage container owned by the first kernel (e.g., a full storage container included in FMQ); or at least one second type empty storage container owned by the first kernel (e.g., an empty storage container included in EMQ). The first type quantity in the social matrix module includes the quantity of first type full storage containers and the quantity of first type empty storage containers, and the second type quantity in the social matrix module includes the quantity of second type full storage containers and the quantity of second type empty storage containers.

[0095] In some embodiments, determining whether the remaining address pointers in a plurality of storage containers of a first kernel can reclaim or allocate storage units includes: determining whether a first expected remaining address pointer exists in an in-process storage container of the first kernel; in response to determining that the first expected remaining address pointer does not exist (e.g., the in-process storage container is empty when allocating storage units; or the in-process storage container is full when reclaiming storage units), determining whether a second expected remaining address pointer exists in at least one first type storage container in a first type storage container queue; in response to determining that the second expected remaining address pointer does not exist (e.g., the number of full storage containers in FMBQ is zero when allocating storage units; or the number of empty storage containers in EMBQ is zero when reclaiming storage units), determining whether a third expected remaining address pointer exists in at least one second type storage container in a second type storage container queue; and in response to determining that the third expected remaining address pointer does not exist (e.g., the number of full storage containers in FMQ is zero when allocating storage units; or the number of empty storage containers in EMQ is zero when reclaiming storage units), determining that the remaining address pointers in a plurality of storage containers of the first kernel cannot be reclaimed or allocated storage units.

[0096] In some embodiments, in response to determining the existence of a first expected remaining address pointer, it is determined that the remaining address pointers in a plurality of storage containers of the first kernel can reclaim or allocate storage units; in response to determining the existence of a second expected remaining address pointer, it is determined that the remaining address pointers in a plurality of storage containers of the first kernel can reclaim or allocate storage units; or in response to determining the existence of a third expected remaining address pointer, it is determined that the remaining address pointers in a plurality of storage containers of the first kernel can reclaim or allocate storage units.

[0097] In some embodiments, the method further includes: in response to determining that the remaining address pointers in a plurality of storage containers of the first kernel can reclaim or allocate storage units, performing a task of allocating or reclaiming storage units using an in-process storage container, a first type of storage container, or a second type of storage container; or in response to successfully borrowing the required storage container from the second kernel, performing a task of allocating or reclaiming storage units using a storage container borrowed from the second kernel.

[0098] In some embodiments, the method further includes: when performing a task of allocating or reclaiming storage units, in response to a target storage container meeting a return condition, returning the target storage container that has met the return condition to its respective target kernel.

[0099] In some embodiments, in response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated storage units, borrowing the required storage container from the second kernel includes: querying the number of first types for other kernels in the social matrix module of the first kernel, determining the kernel with the largest number of first types as the second kernel to which the required storage container will be borrowed, so as to borrow the required storage container from the second kernel.

[0100] In some embodiments, the method further includes: fusing a first social matrix module of a first kernel and a second social matrix module of a second kernel to update the first type quantity and the second type quantity in the first social matrix module and the second social matrix module for the first kernel and the second kernel; querying the updated second type quantity in the updated first social matrix module; and in response to determining that the updated second type quantity in the updated first social matrix module is not zero, not borrowing the required storage container from the second kernel and performing a storage unit reclamation or allocation task using the second type storage container of the first kernel.

[0101] In some embodiments, the method further includes: in response to the updated second type quantity in the updated first social matrix module being zero, querying whether the updated first type quantity in the updated second social matrix module is zero; in response to the updated first type quantity not being zero, borrowing the required storage container from the second kernel; or in response to the updated first type quantity being zero, determining the kernel with the largest first type quantity as another target kernel based on the updated first social matrix module or the updated second social matrix module, so as to borrow the required storage container from the other target kernel.

[0102] In some embodiments, returning a target storage container that has met the return conditions to its home target kernel includes: determining whether a first identity of the first kernel is consistent with a second identity of the target kernel; in response to determining that the first identity and the second identity are consistent, retaining the target storage container in the first kernel; in response to determining that the first identity and the second identity are inconsistent, merging a first social matrix module of the first kernel and a third social matrix module of the target kernel to update the first type quantity and the second type quantity for the first kernel and the target kernel in the first social matrix module and the third social matrix module; and enqueuing the target storage container in the target kernel, wherein the return conditions include the target storage container reaching the state it was in when it was borrowed.

[0103] In some embodiments, a storage unit includes a storage unit to be allocated, remaining address pointers in a plurality of storage containers including filled addresses, and a borrowed required storage container including a full storage container from a second kernel and borrowed from other kernels outside the second kernel; or a storage unit includes a storage unit to be reclaimed, remaining address pointers in a plurality of storage containers including unfilled addresses, and a borrowed required storage container including an empty storage container from a second kernel and borrowed from other kernels outside the second kernel.

[0104] Figure 13 A schematic block diagram of an example device 1300 that can be used to implement embodiments of the present disclosure is shown. Device 1300 can be used to implement the computing device 102 of FIG1. ​​As shown, device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 1302 or loaded from storage unit 1308 into random access memory (RAM) 1303. Various programs and data required for the operation of device 1300 may also be stored in RAM 1303. CPU 1301, ROM 1302, and RAM 1303 are interconnected via bus 1304. Input / output (I / O) interface 1305 is also connected to bus 1304.

[0105] Multiple components in device 1300 are connected to I / O interface 1305, including: input unit 1306, such as keyboard, mouse, etc.; output unit 1307, such as various types of displays, speakers, etc.; storage unit 1308, such as disk, optical disk, etc.; and communication unit 1309, such as network card, modem, wireless transceiver, etc. Communication unit 1309 allows device 1300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0106] Processing unit 1301 performs the various methods and processes described above, such as any one of processes 200, 400, 500, and 600. For example, in some embodiments, any one of processes 200, 400, 500, and 600 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1300 via ROM 1302 and / or communication unit 1309. When the computer program is loaded into RAM 1303 and executed by CPU 1301, one or more steps of any one of processes 200, 400, 500, and 600 described above may be performed. Alternatively, in other embodiments, CPU 1301 may be configured to perform any one of processes 200, 400, 500, and 600 by any other suitable means (e.g., by means of firmware).

[0107] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload programmable logic devices (CPLDs), and so on.

[0108] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0109] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 of the foregoing.

[0110] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.

[0111] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for reclaiming or allocating storage units, comprising: Acquire storage units to be reclaimed or allocated, the storage units to be reclaimed into a first core comprising a plurality of storage containers or to be allocated from the first core, wherein each storage container includes at least one address pointer for at least one storage unit; Determine whether the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage units; as well as In response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated, the required storage container is borrowed from the second kernel.

2. The method according to claim 1, wherein the plurality of storage containers comprises: The in-process storage container is configured to perform storage unit allocation and reclamation operations; A first-type storage container queue, containing at least one first-type storage container borrowed from other kernels; The second type of storage container queue contains at least one second type of storage container owned by the first kernel. as well as The social matrix module is configured to: for each of the multiple kernels, store a first type quantity of the number of at least one first type storage container in the first type storage container queue, and a second type quantity of the number of at least one second type storage container in the second type storage container queue.

3. The method according to claim 2, The first type of storage container queue includes: At least one first-type full storage container borrowed from other kernels, wherein the first-type full storage container was an empty storage container when borrowed from other kernels, was filled in the first kernel, and was to be returned to the other kernels when it became an empty storage container again; or At least one first-type empty storage container borrowed from other kernels, wherein the first-type empty storage container is a full storage container when borrowed from other kernels, is emptied in the first kernel, and is to be returned to the other kernels when it becomes a full storage container again; as well as The second type of storage container queue includes: The first kernel has at least one second-type full storage container; or The first kernel has at least one empty storage container of type II. The first type of quantity includes the number of full storage containers of the first type and the number of empty storage containers of the first type; and The second type of quantity includes the number of full storage containers of the second type and the number of empty storage containers of the second type.

4. The method of claim 2, wherein determining whether the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage units comprises: Determine whether the first expected remaining address pointer exists in the process storage container of the first kernel; In response to determining that the first expected remaining address pointer does not exist, determine whether a second expected remaining address pointer exists in at least one first type of storage container in the first type of storage container queue; In response to determining that the second expected remaining address pointer does not exist, determine whether a third expected remaining address pointer exists in the at least one second type of storage container in the second type of storage container queue; as well as In response to determining that the third expected remaining address pointer does not exist, it is determined that the remaining address pointers in the plurality of storage containers of the first kernel cannot be reclaimed or allocated.

5. The method according to claim 4, wherein: In response to determining the existence of the first expected remaining address pointer, it is determined that the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage units; In response to determining the existence of the second expected remaining address pointer, it is determined that the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage unit; or In response to determining the existence of the third expected remaining address pointer, it is determined that the remaining address pointers in the plurality of storage containers of the first kernel are capable of reclaiming or allocating the storage units.

6. The method according to claim 2, further comprising: In response to determining that the remaining address pointers in the plurality of storage containers of the first kernel are capable of reclaiming or allocating the storage units, the task of allocating or reclaiming storage units is performed using the in-process storage container, the first type of storage container, or the second type of storage container; or In response to successfully borrowing the required storage container from the second kernel, the task of allocating or reclaiming storage units is performed using the storage container borrowed from the second kernel.

7. The method according to claim 6, further comprising: When performing a task of allocating or reclaiming storage units, in response to a target storage container meeting the return conditions, the target storage container that has met the return conditions is returned to the target kernel to which it belongs.

8. The method of claim 2, wherein borrowing the required storage container from the second kernel in response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated includes: The number of first types for other kernels in the social matrix module of the first kernel is queried, and the kernel with the largest number of first types is determined as the second kernel to borrow the required storage container, so as to borrow the required storage container from the second kernel.

9. The method according to claim 8, further comprising: The first social matrix module of the first kernel and the second social matrix module of the second kernel are merged to update the number of the first type and the number of the second type in the first social matrix module and the second social matrix module for the first kernel and the second kernel, respectively. as well as Query the updated number of the second type in the first social matrix module; as well as In response to the determination that the updated second type quantity in the first social matrix module is not zero, the required storage container is not borrowed from the second kernel, and the storage unit reclamation or allocation task is performed using the second type storage container of the first kernel.

10. The method of claim 9, further comprising: In response to the updated second type quantity being zero in the updated first social matrix module, query whether the updated first type quantity in the updated second social matrix module is zero; In response to the updated first type quantity being non-zero, the required storage container is borrowed from the second kernel; or In response to the updated first type quantity being zero, based on the updated first social matrix module or the updated second social matrix module, the kernel with the largest first type quantity is determined as another target kernel to borrow the required storage container from the other target kernel.

11. The method of claim 7, wherein returning the target storage container that has met the return conditions to its parent target kernel comprises: Determine whether the first identity identifier of the first kernel matches the second identity identifier of the target kernel; In response to determining that the first identity identifier and the second identity identifier are consistent, the target storage container is retained in the first kernel; In response to determining that the first identity identifier and the second identity identifier are inconsistent, the first social matrix module of the first kernel and the third social matrix module of the target kernel are merged to update the number of the first type and the number of the second type in the first social matrix module and the third social matrix module for the first kernel and the target kernel, respectively; and The target storage container is added to the target kernel. The return conditions mentioned above include the state of the target storage container when it was borrowed.

12. The method according to claim 1, wherein: The storage unit includes a storage unit to be allocated, the remaining address pointers in the plurality of storage containers include filled addresses, and the required borrowed storage container includes a full storage container from the second kernel and borrowed from other kernels outside the second kernel; or The storage unit includes a storage unit to be reclaimed, the remaining address pointers in the plurality of storage containers include unfilled addresses, and the required borrowed storage containers include empty storage containers from the second kernel and borrowed from other kernels outside the second kernel.

13. An electronic device, comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, which, when executed by the processor, cause the device to perform actions such as memory reclamation or allocation, the actions including: Acquire storage units to be reclaimed or allocated, the storage units to be reclaimed into a first core comprising a plurality of storage containers or to be allocated from the first core, wherein each storage container includes at least one address pointer for at least one storage unit; Determine whether the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage units; and In response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated, the required storage container is borrowed from the second kernel.

14. The electronic device of claim 13, wherein the plurality of storage containers comprises: The in-process storage container is configured to perform storage unit allocation and reclamation operations; A first-type storage container queue, containing at least one first-type storage container borrowed from other kernels; The second type of storage container queue contains at least one second type of storage container owned by the first kernel. as well as The social matrix module is configured to: for each of the multiple kernels, store a first type quantity of the number of at least one first type storage container in the first type storage container queue, and a second type quantity of the number of at least one second type storage container in the second type storage container queue.

15. The electronic device according to claim 14, The first type of storage container queue includes: At least one first-type full storage container borrowed from other kernels, wherein the first-type full storage container was an empty storage container when borrowed from other kernels, was filled in the first kernel, and was to be returned to the other kernels when it became an empty storage container again; or At least one first-type empty storage container borrowed from other kernels, wherein the first-type empty storage container is a full storage container when borrowed from other kernels, is emptied in the first kernel, and is to be returned to the other kernels when it becomes a full storage container again; as well as The second type of storage container queue includes: The first kernel has at least one second-type full storage container; or The first kernel has at least one empty storage container of type II. The first type of quantity includes the number of full storage containers of the first type and the number of empty storage containers of the first type; The second type of quantity includes the number of full storage containers of the second type and the number of empty storage containers of the second type.

16. The electronic device of claim 14, wherein determining whether the remaining address pointers in the plurality of storage containers of the first kernel are capable of reclaiming or allocating the storage units comprises: Determine whether the first expected remaining address pointer exists in the process storage container of the first kernel; In response to determining that the first expected remaining address pointer does not exist, determine whether a second expected remaining address pointer exists in at least one first type of storage container in the first type of storage container queue; In response to determining that the second expected remaining address pointer does not exist, determine whether a third expected remaining address pointer exists in the at least one second type of storage container in the second type of storage container queue; as well as In response to determining that the third expected remaining address pointer does not exist, it is determined that the remaining address pointers in the plurality of storage containers of the first kernel cannot be reclaimed or allocated.

17. The electronic device of claim 14, further comprising: In response to determining that the remaining address pointers in the plurality of storage containers of the first kernel are capable of reclaiming or allocating the storage units, the task of allocating or reclaiming storage units is performed using the in-process storage container, the first type of storage container, or the second type of storage container; or In response to successfully borrowing the required storage container from the second kernel, the task of allocating or reclaiming storage units is performed using the storage container borrowed from the second kernel.

18. The electronic device of claim 17, further comprising: When performing a task of allocating or reclaiming storage units, in response to a target storage container meeting the return conditions, the target storage container that has met the return conditions is returned to the target kernel to which it belongs.

19. The electronic device of claim 14, wherein borrowing the required storage container from the second kernel in response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated includes: The number of first types for other kernels in the social matrix module of the first kernel is queried, and the kernel with the largest number of first types is determined as the second kernel to borrow the required storage container, so as to borrow the required storage container from the second kernel.

20. A computer program product tangibly stored on a non-volatile computer-readable medium and comprising machine-executable instructions that, when executed, cause a machine to: Acquire storage units to be reclaimed or allocated, the storage units to be reclaimed into a first core comprising a plurality of storage containers or to be allocated from the first core, wherein each storage container includes at least one address pointer for at least one storage unit; Determine whether the remaining address pointers in the plurality of storage containers of the first kernel can reclaim or allocate the storage units; as well as In response to determining that the remaining address pointers in the first kernel cannot be reclaimed or allocated, the required storage container is borrowed from the second kernel.