Method, device, electronic equipment and program product for managing persistent memory
By employing different strategies based on the actual cost of memory objects in persistent memory management, the problem of balancing security risks and management costs in existing technologies is solved, achieving a balance between security risks and management costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
- Filing Date
- 2026-03-31
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies struggle to simultaneously address the security risks and management costs of persistent memory. While complex management strategies reduce security risks, they also increase management costs.
By employing different management strategies during persistent memory management based on the relationship between the actual management cost of memory objects and preset thresholds: when the actual management cost is high, a low-complexity strategy is used to restrict the reuse of memory objects; when the actual management cost is low, a high-complexity strategy is used for safe processing and reuse.
It achieves a reduction in the security risks of persistent memory without increasing overall management costs, balancing security risks and management costs.
Smart Images

Figure CN122432073A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and in particular relates to a method, apparatus, electronic device and program product for managing persistent memory. Background Technology
[0002] Persistent memory, characterized by low access latency, byte-level addressing, and data retention after power failure, has been widely adopted in various systems. However, precisely because persistent memory retains data even after power failure, systems employing persistent memory are more susceptible to security vulnerabilities when memory safety issues arise.
[0003] To mitigate the security risks of persistent memory, existing technologies typically employ more complex management strategies, such as incorporating security features during the management process. However, while these more complex strategies reduce security risks, they also increase management costs. It is clear that current persistent memory management methods struggle to simultaneously address both security risks and manage both the associated costs. Summary of the Invention
[0004] In view of this, embodiments of this application provide a persistent memory management method, apparatus, electronic device, and program product to solve the technical problem that the prior art is unable to simultaneously address the security risks and management costs of persistent memory.
[0005] In a first aspect, embodiments of this application provide a method for managing persistent memory, including: When any memory object in persistent memory enters the release phase, the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold is determined. If the actual management cost is greater than or equal to the management cost threshold, then the arbitrary memory object is managed using the first management strategy. If the actual management cost is less than the management cost threshold, then the arbitrary memory object is managed by a second management strategy, where the complexity of the first management strategy is less than that of the second management strategy.
[0006] Optionally, determining the relationship between the actual management cost of the arbitrary memory object and a preset management cost threshold includes: Determine the relationship between the pointer relationship complexity of the arbitrary memory object and a preset complexity threshold; If the complexity of the pointer relationship is greater than or equal to the complexity threshold, then the actual management cost is determined to be greater than or equal to the management cost threshold. If the complexity of the pointer relationship is less than the complexity threshold, then the actual management cost is determined to be less than the management cost threshold.
[0007] Optionally, determining the relationship between the pointer relationship complexity of the arbitrary memory object and a preset complexity threshold includes: Determine the number of pointers corresponding to the arbitrary memory object; If the number of pointers is greater than or equal to a preset number threshold, then the complexity of the pointer relationship is determined to be greater than or equal to the complexity threshold. If the number of pointers is less than the preset number threshold, then the complexity of the pointer relationship is determined to be less than the complexity threshold.
[0008] Optionally, managing the arbitrary memory object through the first management strategy includes: When any memory object enters the first allocation phase, the arbitrary memory object is controlled not to respond to memory object allocation instructions, and the first allocation phase is after the release phase.
[0009] Optionally, managing the arbitrary memory object through the second management strategy includes: The pointer state associated with the arbitrary memory object is handled safely, and when the arbitrary memory object enters the first allocation phase, the arbitrary memory object is controlled to respond to the memory object allocation instruction first, and the first allocation phase is after the release phase.
[0010] Optionally, the method further includes: When the arbitrary memory object enters the second allocation phase, the expected management cost of the arbitrary memory object is determined, and the second allocation phase is prior to the release phase. If the expected management cost is greater than or equal to the management cost threshold, then the arbitrary memory object is allocated to the first memory region; If the expected management cost is less than the management cost threshold, then the arbitrary memory object is allocated to the second memory region, and the physical memory space corresponding to the first memory region is different from the physical memory space corresponding to the second memory region.
[0011] Optionally, determining the expected management cost of the arbitrary memory object includes: Retrieve historical runtime data for all memory objects of the same type as the arbitrary memory object; Obtain the current running data of the arbitrary memory object; Based on the historical operating data and the current operating data, the management cost of the arbitrary memory object is predicted to obtain the expected management cost.
[0012] Secondly, embodiments of this application provide a persistent memory management device, comprising: The determining unit is used to determine the relationship between the actual management cost of any memory object and a preset management cost threshold when any memory object in persistent memory enters the release phase. The first management unit is configured to manage the arbitrary memory object through a first management strategy if the actual management cost is greater than or equal to the management cost threshold. The second management unit is used to manage the arbitrary memory object through a second management strategy if the actual management cost is less than the management cost threshold, wherein the complexity of the first management strategy is less than that of the second management strategy.
[0013] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the persistent memory management method as described in any of the first aspects above.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the persistent memory management method as described in any of the first aspects above.
[0015] Fifthly, embodiments of this application provide a computer program product that, when run on a control device, causes the control device to perform the steps of the persistent memory management method as described in any of the first aspects above.
[0016] The persistent memory management method, apparatus, electronic device, and program product provided in this application have the following beneficial effects: In the persistent memory management method provided in this application embodiment, when any memory object in persistent memory enters the release phase, the relationship between the actual management cost of the memory object and a preset management cost threshold is determined. If the actual management cost is greater than or equal to the management cost threshold, the memory object is managed using a first management strategy; if the actual management cost is less than the management cost threshold, the memory object is managed using a second management strategy. The complexity of the first management strategy is less than that of the second management strategy. In this solution, when any memory object in persistent memory enters the release phase, if the actual management cost of the memory object is determined to be low, a more complex management strategy is used to manage the memory object to reduce the security risk of persistent memory; if the actual management cost of the memory object is determined to be high, a less complex management strategy is used to manage the memory object to reduce the management cost of persistent memory. Therefore, the persistent memory management method provided in this application can simultaneously consider security risks and management costs. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating the implementation of the persistent memory management method provided in this application embodiment; Figure 2 A flowchart illustrating the implementation of a persistent memory management method according to another embodiment of this application; Figure 3 A schematic diagram of the structure of a persistent memory management device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] It should be noted that the terminology used in the embodiments of this application is only for explaining specific embodiments of this application and is not intended to limit this application. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, "at least one" or "one or more" means one, two or more. The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0020] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0021] The persistent memory management method provided in this application can be executed by an electronic device, which may include, but is not limited to, laptops, desktop computers, tablets, and mobile phones.
[0022] The persistent memory management method provided in this application can be applied to any scenario that requires persistent memory management. For example, if an electronic device uses persistent memory, the electronic device can execute the various steps of the persistent memory management method provided in this application to manage the persistent memory, thereby simultaneously addressing security risks and management costs.
[0023] Please see Figure 1 , Figure 1 The flowchart illustrates the implementation of the persistent memory management method provided in this application embodiment. The persistent memory management method provided in this application embodiment may include S101~S103, as detailed below: In S101, when any memory object in persistent memory enters the release phase, the relationship between the actual management cost of the memory object and the preset management cost threshold is determined.
[0024] In this embodiment of the application, when any memory object in persistent memory enters the release phase, the electronic device can determine the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold through steps a to c, as detailed below: In step a, the relationship between the pointer relationship complexity of any memory object and a preset complexity threshold is determined.
[0025] In this implementation, when an electronic device needs to determine the relationship between the actual management cost of an arbitrary memory object and a preset management cost threshold, it can first determine the relationship between the pointer relationship complexity of the arbitrary memory object and the preset complexity threshold, and then determine the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold based on the relationship between the pointer relationship complexity of the arbitrary memory object and the preset complexity threshold.
[0026] Specifically, electronic devices can determine the relationship between the pointer relationship complexity of an arbitrary memory object and a preset complexity threshold in the following ways: The electronic device can first determine the number of pointers corresponding to the arbitrary memory object. Then, if the number of pointers corresponding to the arbitrary memory object is greater than or equal to a preset number threshold, it can be determined that the pointer relationship complexity of the arbitrary memory object is greater than or equal to a complexity threshold. If the number of pointers corresponding to the arbitrary memory object is less than the preset number threshold, it can be determined that the pointer relationship complexity of the arbitrary memory object is less than the complexity threshold.
[0027] For example, the preset quantity threshold can be 2. Based on this, if the number of pointers corresponding to any memory object is greater than or equal to 2, it can be determined that the pointer relationship complexity of any memory object is greater than or equal to the complexity threshold; if the number of pointers corresponding to any memory object is less than 2, it can be determined that the pointer relationship complexity of any memory object is less than the complexity threshold.
[0028] In step b, if the complexity of the pointer relationship is greater than or equal to the complexity threshold, then the actual management cost is determined to be greater than or equal to the management cost threshold.
[0029] In this implementation, if step a determines that the pointer relationship complexity of the arbitrary memory object is greater than or equal to the complexity threshold, the electronic device can determine that the actual management cost of the arbitrary memory object is greater than or equal to the management cost threshold.
[0030] In step c, if the complexity of the pointer relationship is less than the complexity threshold, then the actual management cost is determined to be less than the management cost threshold.
[0031] In this implementation, if step a determines that the pointer relationship complexity of the arbitrary memory object is less than the complexity threshold, the electronic device can determine that the actual management cost of the arbitrary memory object is less than the management cost threshold.
[0032] In S102, if the actual management cost is greater than or equal to the management cost threshold, then any memory object is managed through the first management strategy.
[0033] In this embodiment of the application, after determining the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold, if the actual management cost of the arbitrary memory object is greater than or equal to the management cost threshold, it can be considered that the actual management cost of the arbitrary memory object is large, and then the arbitrary memory object can be managed by the first management strategy.
[0034] The complexity of the first management strategy is lower than that of the second management strategy.
[0035] Specifically, the first management strategy can be used to restrict the reuse of the arbitrary memory object in the first allocation phase after the release phase.
[0036] Based on this, in one possible implementation, the electronic device can manage any memory object through the first management strategy by controlling the memory object not to respond to memory object allocation instructions when the memory object enters the first allocation phase, after the first allocation phase has ended and the release phase has ended.
[0037] In this implementation, the first management strategy can be used to control the arbitrary memory object not to respond to memory object allocation instructions in the first allocation phase after the release phase, thereby controlling the arbitrary memory object not to be reused.
[0038] Since the first management strategy is used to prevent arbitrary memory objects from being reused, it has low complexity and low management cost. In addition, since the arbitrary memory object is not reused, the security risk posed by the arbitrary memory object is also low.
[0039] In S103, if the actual management cost is less than the management cost threshold, then any memory object is managed through the second management strategy, and the complexity of the first management strategy is less than that of the second management strategy.
[0040] In this embodiment of the application, after determining the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold, if the actual management cost of the arbitrary memory object is less than the management cost threshold, it can be considered that the actual management cost of the arbitrary memory object is small, and then the arbitrary memory object can be managed by the first management strategy.
[0041] The second management strategy is more complex than the first management strategy.
[0042] Specifically, the second management strategy can be used to allow the reuse of any memory object after it has been freed.
[0043] Based on this, in one possible implementation, the electronic device can manage arbitrary memory objects through the second management strategy by: safely handling the pointer state associated with arbitrary memory objects, and controlling arbitrary memory objects to respond to memory object allocation instructions first when arbitrary memory objects enter the first allocation phase, after the first allocation phase has ended.
[0044] In this implementation, the second management strategy can be used to control the arbitrary memory object to respond to memory object allocation instructions first in the first allocation phase after the release phase, thereby controlling the reuse of the arbitrary memory object.
[0045] Furthermore, since this arbitrary memory object needs to be reused, in order to reduce the security risk of this arbitrary memory object, the pointer state associated with the arbitrary memory object can be handled securely, thereby reducing the security risk of the arbitrary memory object.
[0046] Since the second management strategy is used to control the reuse of arbitrary memory objects, it is more complex and has a higher management cost than the first management strategy. However, since the second management strategy is used for arbitrary memory objects whose actual management cost is less than the management cost threshold, the management cost of these arbitrary memory objects is not high. Therefore, adopting the second management strategy with higher management cost will not increase the overall management cost. In addition, since the second management strategy can safely handle the pointer state associated with arbitrary memory objects, it can reduce the security risks of persistent memory.
[0047] As can be seen from the above, in the persistent memory management method provided in this application embodiment, when any memory object in persistent memory enters the release phase, the relationship between the actual management cost of any memory object and a preset management cost threshold is determined. If the actual management cost is greater than or equal to the management cost threshold, the memory object is managed using a first management strategy; if the actual management cost is less than the management cost threshold, the memory object is managed using a second management strategy. The complexity of the first management strategy is less than that of the second management strategy. In this solution, when any memory object in persistent memory enters the release phase, if the actual management cost of the memory object is determined to be small, a more complex management strategy is used to manage the memory object to reduce the security risk of persistent memory; if the actual management cost of the memory object is determined to be large, a less complex management strategy is used to manage the memory object to reduce the management cost of persistent memory. Therefore, the persistent memory management method provided in this application can simultaneously consider security risks and management costs.
[0048] In one possible implementation, in order to further reduce the management cost of persistent memory, before S101~S103, the electronic device may also execute the persistent memory management method provided in another embodiment of this application.
[0049] Please see Figure 2 , Figure 2 The flowchart illustrates the implementation of a persistent memory management method according to another embodiment of this application. This persistent memory management method may include steps S201-S203, as detailed below: In S201, when any memory object enters the second allocation phase, the expected management cost of the memory object is determined. The second allocation phase is prior to the release phase.
[0050] In this embodiment, the first allocation phase occurs before the release phase, and the second allocation phase occurs after the release phase. Based on this, the electronic device can first execute... Figure 2 Each step of the corresponding embodiment is then executed. Figure 1 Each step in the corresponding embodiment.
[0051] When any memory object in persistent memory enters the second allocation phase, the electronic device can determine the expected management cost of that memory object through steps d to f, as detailed below: In step d, historical runtime data for all memory objects of the same type as any memory object is obtained.
[0052] In this implementation, the definition of "same type" can include, but is not limited to: if the file read / write modules corresponding to two memory objects are the same, then the two memory objects can be determined to be of the same type; or, if the calling functions corresponding to two memory objects are the same, then the two memory objects can be determined to be of the same type; or, if the business scenarios corresponding to two memory objects are the same, then the two memory objects can be determined to be of the same type.
[0053] The historical runtime data of the memory object may include, but is not limited to, the change in the number of pointers to the memory object during the process from the second allocation phase to the release phase.
[0054] In step e, obtain the current running data of any memory object.
[0055] In this implementation, the current runtime data of any memory object may include, but is not limited to: the number of pointers to any memory object at the current moment, and the memory size corresponding to any memory object.
[0056] In step f, the management cost of any memory object is predicted based on historical and current running data to obtain the expected management cost.
[0057] In this implementation, after obtaining the historical operating data of all memory objects of the same type as the arbitrary memory object and the current operating data of the arbitrary memory object, the electronic device can predict the management cost of the arbitrary memory object based on the historical operating data of all memory objects of the same type as the arbitrary memory object and the current operating data of the arbitrary memory object, thus obtaining the expected management cost of the arbitrary memory object. The expected management cost of the arbitrary memory object may include the expected management cost of the arbitrary memory object during the process from the second allocation phase to the release phase.
[0058] In one possible implementation, the management cost of an arbitrary memory object can be predicted using a pre-trained management cost prediction model, based on the historical running data of all memory objects of the same type as the arbitrary memory object and the current running data of the arbitrary memory object, thus obtaining the expected management cost of the arbitrary memory object.
[0059] The management cost prediction model can be pre-trained using historical and current running data of various memory objects, as well as the actual management costs of these objects. The specific training method can be set according to actual needs.
[0060] In S202, if the expected management cost is greater than or equal to the management cost threshold, then any memory object is allocated to the first memory region.
[0061] In this embodiment, after determining the expected management cost of the arbitrary memory object, if the expected management cost is greater than or equal to a management cost threshold, the arbitrary memory object is allocated to the first memory region. The management cost threshold can be set according to actual needs.
[0062] The physical memory space of the first memory region can be any memory space other than the physical memory space corresponding to the second memory region.
[0063] In S203, if the expected management cost is less than the management cost threshold, any memory object will be allocated to the second memory region. The physical memory space corresponding to the first memory region is different from the physical memory space corresponding to the second memory region.
[0064] In this embodiment of the application, after determining the expected management cost of the arbitrary memory object, if the expected management cost is less than the management cost threshold, the arbitrary memory object is allocated to the second memory region.
[0065] The physical memory space of the second memory region can be any memory space other than the physical memory space corresponding to the first memory region.
[0066] Through S201~S203, memory objects with higher expected management costs and memory objects with lower expected management costs can be stored in different memory regions according to the expected management costs of each arbitrary memory object.
[0067] The reason for storing memory objects with higher expected management costs and memory objects with lower expected management costs in different memory regions is as follows: Electronic devices include physical memory space and virtual memory space, and are managed in units of pages (i.e., contiguous blocks of space). Physical memory space can be mapped to multiple virtual memory spaces. The reuse mentioned in this application refers to the reuse of virtual addresses. In practical applications, physical memory space needs to be utilized as efficiently as possible. However, it can only be reused when all memory objects stored in the virtual memory space corresponding to the physical memory space have been released. Therefore, by storing memory objects with higher expected management costs and memory objects with lower expected management costs in different memory regions, during the memory object release phase, memory objects that cannot be reused will not hinder the reuse process of memory objects that can be reused, thereby improving the overall recycling rate at the underlying physical page level and further reducing the management cost of persistent memory.
[0068] To more clearly describe the overall process of the persistent memory management method provided in the various embodiments of this application, the following describes each step of the persistent memory management method provided in the various embodiments of this application in chronological order.
[0069] First, when any memory object in persistent memory enters the first allocation phase (i.e. the second allocation phase), the electronic device can obtain the historical running data of all memory objects of the same type as the arbitrary memory object, as well as the current running data of the arbitrary memory object. Based on the historical running data of all memory objects of the same type as the arbitrary memory object and the current running data of the arbitrary memory object, the management cost of the arbitrary memory object can be predicted, and the expected management cost of the arbitrary memory object can be obtained.
[0070] After obtaining the expected management cost of the arbitrary memory object, the electronic device can compare the expected management cost of the arbitrary memory object with a management cost threshold. If the expected management cost of the arbitrary memory object is greater than or equal to the management cost threshold, the arbitrary memory object is allocated to the first memory region. If the expected management cost of the arbitrary memory object is less than the management cost threshold, the arbitrary memory object is allocated to the second memory region. The physical memory space corresponding to the first memory region is different from the physical memory space corresponding to the second memory region.
[0071] When an arbitrary memory object enters the release phase, the electronic device can determine the number of pointers corresponding to the arbitrary memory object. Then, if the number of pointers corresponding to the arbitrary memory object is greater than or equal to a preset number threshold, it can be determined that the pointer relationship complexity of the arbitrary memory object is greater than or equal to a complexity threshold, and thus the actual management cost of the arbitrary memory object is greater than or equal to a management cost threshold. If the number of pointers corresponding to the arbitrary memory object is less than a preset number threshold, it can be determined that the pointer relationship complexity of the arbitrary memory object is less than a complexity threshold, and thus the actual management cost of the arbitrary memory object is less than a management cost threshold.
[0072] Subsequently, if the electronic device determines that the actual management cost of the arbitrary memory object is greater than or equal to the management cost threshold, it manages the arbitrary memory object using a first management strategy with lower complexity to restrict its reuse in the first allocation phase after the release phase. If the electronic device determines that the actual management cost of the arbitrary memory object is less than the management cost threshold, it manages the arbitrary memory object using a second management strategy with higher complexity to allow its reuse in the first allocation phase after the release phase, and to safely handle the pointer state associated with the arbitrary memory object.
[0073] The above describes the management process for a specific memory object. It is understood that electronic devices can perform the above management process for each memory object, thereby enabling the management of each memory object to simultaneously consider security risks and management costs.
[0074] Based on the persistent memory management method provided in the above embodiments, this application further provides a persistent memory management apparatus for implementing the above method embodiments. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of a persistent memory management device provided in an embodiment of this application. Figure 3 As shown, the persistent memory management device 30 may include: a determination unit 31, a first management unit 32, and a second management unit 33. Wherein: The determining unit 31 is used to determine the relationship between the actual management cost of any memory object and a preset management cost threshold when any memory object in persistent memory enters the release phase.
[0075] The first management unit 32 is used to manage any memory object through a first management strategy if the actual management cost is greater than or equal to the management cost threshold.
[0076] The second management unit 33 is used to manage any memory object through a second management strategy if the actual management cost is less than the management cost threshold. The complexity of the first management strategy is less than that of the second management strategy.
[0077] Optionally, the determining unit 31 is specifically used for: Determine the relationship between the pointer relationship complexity of any memory object and a preset complexity threshold; If the complexity of the pointer relationship is greater than or equal to the complexity threshold, then the actual management cost is determined to be greater than or equal to the management cost threshold. If the complexity of the pointer relationship is less than the complexity threshold, then the actual management cost is determined to be less than the management cost threshold.
[0078] Optionally, the determining unit 31 is specifically used for: Determine the number of pointers corresponding to any memory object; If the number of pointers is greater than or equal to a preset threshold, then the complexity of the pointer relationship is determined to be greater than or equal to the complexity threshold. If the number of pointers is less than a preset threshold, then the complexity of the pointer relationship is determined to be less than the complexity threshold.
[0079] Optionally, the first management unit 32 is specifically used for: When any memory object enters the first allocation phase, control that the memory object not to respond to memory object allocation instructions. The first allocation phase is after the release phase.
[0080] Optionally, the second management unit 33 is specifically used for: The pointer state associated with any memory object is handled safely, and when any memory object enters the first allocation phase, the memory object is controlled to respond to memory object allocation instructions first. The first allocation phase is after the release phase.
[0081] Optionally, the persistent memory management device 30 may also include a first allocation unit and a second allocation unit.
[0082] The determining unit 31 is also used to determine the expected management cost of any memory object when the memory object enters the second allocation phase, which is before the release phase. The first allocation unit is used to allocate any memory object to the first memory region if the expected management cost is greater than or equal to a management cost threshold. The second allocation unit is used to allocate any memory object to the second memory region if the expected management cost is less than the management cost threshold. The physical memory space corresponding to the first memory region is different from the physical memory space corresponding to the second memory region.
[0083] Optionally, the determining unit 31 is specifically used for: Retrieves historical runtime data for all memory objects of the same type as any memory object; Get the current runtime data of any memory object; Based on historical and current operating data, the management cost of any memory object is predicted to obtain the expected management cost.
[0084] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of this application. Their specific functions and technical effects can be referred to the method embodiments section, and will not be repeated here.
[0085] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 4 provided in this embodiment may include: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40, such as a program for a persistent memory management method. When the processor 40 executes the computer program 42, it implements the steps described above in the embodiment of the persistent memory management method, for example... Figure 1 S101~S103 and shown Figure 2 S201~S203 are shown. Alternatively, when processor 40 executes computer program 42, it implements the functions of each module / unit in the above-described embodiment of the composite data calculation and verification device, for example... Figure 3 The functions of units 31 to 33 shown.
[0086] For example, computer program 42 can be divided into one or more modules / units, one or more of which are stored in memory 41 and executed by processor 40 to complete this application. One or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of computer program 42 in electronic device 4. For example, computer program 42 can be divided into a determining unit 31, a first management unit 32, and a second management unit 33. For the specific functions of each unit, please refer to... Figure 3 The relevant descriptions in the corresponding embodiments are not repeated here.
[0087] Those skilled in the art will understand that Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or combine certain components, or use different components.
[0088] The processor 40 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0089] The memory 41 can be an internal storage unit of the electronic device 4, such as a hard disk or RAM. The memory 41 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, or flash card. Furthermore, the memory 41 can include both internal and external storage units of the electronic device 4. The memory 41 is used to store computer programs and other programs and data required by the electronic device. The memory 41 can also be used to temporarily store data that has been output or will be output.
[0090] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units is merely an example. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the persistent memory management device can be divided into different functional units to complete all or part of the functions described above. The functional units in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0091] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.
[0092] This application provides a computer program product that, when run on a terminal device, enables the terminal device to implement the steps described in the various method embodiments above.
[0093] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.
[0094] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0095] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for managing persistent memory, characterized in that, include: When any memory object in persistent memory enters the release phase, the relationship between the actual management cost of the arbitrary memory object and the preset management cost threshold is determined. If the actual management cost is greater than or equal to the management cost threshold, then the arbitrary memory object is managed using the first management strategy. If the actual management cost is less than the management cost threshold, then the arbitrary memory object is managed by a second management strategy, where the complexity of the first management strategy is less than that of the second management strategy.
2. The method according to claim 1, characterized in that, Determining the relationship between the actual management cost of the arbitrary memory object and a preset management cost threshold includes: Determine the relationship between the pointer relationship complexity of the arbitrary memory object and a preset complexity threshold; If the complexity of the pointer relationship is greater than or equal to the complexity threshold, then the actual management cost is determined to be greater than or equal to the management cost threshold. If the complexity of the pointer relationship is less than the complexity threshold, then the actual management cost is determined to be less than the management cost threshold.
3. The method according to claim 2, characterized in that, Determining the relationship between the pointer relationship complexity of the arbitrary memory object and a preset complexity threshold includes: Determine the number of pointers corresponding to the arbitrary memory object; If the number of pointers is greater than or equal to a preset number threshold, then the complexity of the pointer relationship is determined to be greater than or equal to the complexity threshold. If the number of pointers is less than the preset number threshold, then the complexity of the pointer relationship is determined to be less than the complexity threshold.
4. The method according to claim 1, characterized in that, The management of the arbitrary memory object through the first management strategy includes: When any memory object enters the first allocation phase, the arbitrary memory object is controlled not to respond to memory object allocation instructions, and the first allocation phase is after the release phase.
5. The method according to claim 1, characterized in that, The management of the arbitrary memory object through the second management strategy includes: The pointer state associated with the arbitrary memory object is handled safely, and when the arbitrary memory object enters the first allocation phase, the arbitrary memory object is controlled to respond to the memory object allocation instruction first, and the first allocation phase is after the release phase.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: When the arbitrary memory object enters the second allocation phase, the expected management cost of the arbitrary memory object is determined, and the second allocation phase is prior to the release phase. If the expected management cost is greater than or equal to the management cost threshold, then the arbitrary memory object is allocated to the first memory region; If the expected management cost is less than the management cost threshold, then the arbitrary memory object is allocated to the second memory region, and the physical memory space corresponding to the first memory region is different from the physical memory space corresponding to the second memory region.
7. The method according to claim 6, characterized in that, Determining the expected management cost of the arbitrary memory object includes: Retrieve historical runtime data for all memory objects of the same type as the arbitrary memory object; Obtain the current running data of the arbitrary memory object; Based on the historical operating data and the current operating data, the management cost of the arbitrary memory object is predicted to obtain the expected management cost.
8. A persistent memory management device, characterized in that, include: The determining unit is used to determine the relationship between the actual management cost of any memory object and a preset management cost threshold when any memory object in persistent memory enters the release phase. The first management unit is configured to manage the arbitrary memory object through a first management strategy if the actual management cost is greater than or equal to the management cost threshold. The second management unit is used to manage the arbitrary memory object through a second management strategy if the actual management cost is less than the management cost threshold, wherein the complexity of the first management strategy is less than that of the second management strategy.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements each step of the persistent memory management method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, When the computer program product is executed by a processor, it implements the steps of the persistent memory management method as described in any one of claims 1 to 7.