Memory page processing method and device and electronic equipment
By determining the target object among multiple memory usage objects and replacing the candidate memory pages with the first storage area, the problem of inflexible memory page replacement operation in the prior art is solved, and more refined and flexible memory management is achieved.
Patent Information
- Application Number
- CN202311273175.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2043-09-27
AI Technical Summary
In the prior art, the replacement operation of memory pages is not flexible enough, especially when there are multiple memory usage objects, it is difficult to select the memory page to be replaced in detail.
By determining the target object from a plurality of memory usage objects, at least part of the memory pages in the candidate memory pages are replaced to the first storage area, thereby selecting the memory pages of the single memory usage object for permutation when needed, avoiding selection for all memory pages.
It realizes that memory page replacement operations are more refined and flexible in the case of multiple memory usage objects, and improves the efficiency and flexibility of memory management.
Smart Images

Figure CN119718609A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a memory page processing method, device and electronic device. Background Art
[0002] During the operation of the electronic device, the electronic device can manage the memory pages in the memory. For example, the electronic device can replace the memory pages in the memory to free up memory space for other processes. However, in the related methods, the replacement operation of the memory pages is not flexible enough. Summary of the invention
[0003] In view of the above problems, the present application proposes a memory page processing method, device and electronic device to improve the above problems.
[0004] In a first aspect, the present application provides a memory page processing method, which is applied to an electronic device, and the method includes: determining a target object from multiple memory usage objects; replacing at least part of the candidate memory pages to a first storage area, the candidate memory pages being memory pages in a second storage area corresponding to the target object, and the second storage area being located in the memory of the electronic device.
[0005] In a second aspect, the present application provides a memory page processing device that runs on an electronic device, the device comprising: a target determination unit, used to determine a target object from multiple memory usage objects; a memory page processing unit, used to replace at least part of the candidate memory pages to a first storage area, the candidate memory pages being memory pages in a second storage area corresponding to the target object, and the second storage area being located in the memory of the electronic device.
[0006] In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors to implement the above method.
[0007] In a fourth aspect, the present application provides a computer-readable storage medium, in which a program code is stored, wherein the above method is executed when the program code is executed by a processor.
[0008] The present application provides a memory page processing method, device and electronic device. In the case of multiple memory usage objects, the target object can be determined from the multiple memory usage objects, and then at least part of the candidate memory pages can be replaced to the first storage area. Therefore, through the above method, in the case of multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, so that the replacement operation of the memory page is more refined and flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A flow chart of a memory page processing method proposed in an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram showing a method of establishing program groups in an embodiment of the present application is shown;
[0012] Figure 3 A schematic diagram showing a method of dividing a memory into an uncompressed area and a memory compression area in an embodiment of the present application is shown;
[0013] Figure 4 A schematic diagram of determining a candidate memory page in an embodiment of the present application is shown;
[0014] Figure 5 A schematic diagram showing the moment of comparing candidate memory pages and replacing them in the memory compression area in an embodiment of the present application;
[0015] Figure 6 A flowchart of a memory page processing method proposed in another embodiment of the present application is shown;
[0016] Figure 7 A flowchart of a memory page processing method proposed in another embodiment of the present application is shown;
[0017] Figure 8 A flowchart of a memory page processing method proposed in another embodiment of the present application is shown;
[0018] Fig. 9 A schematic diagram showing the growth of the number of programs following the first memory threshold in an embodiment of the present application;
[0019] Fig.10 A structural block diagram of a memory page processing device proposed in an embodiment of the present application is shown;
[0020] Fig.11 A structural block diagram of an electronic device for executing a memory page processing method according to an embodiment of the present application in real time is shown in the present application;
[0021] Fig.12 A storage unit in real time of the present application is shown for storing or carrying program codes for implementing the memory page processing method according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] Memory, also known as main memory, is a directly addressable storage space made of semiconductor devices. Programs (for example, processes or threads) in electronic devices usually need to use memory to complete data processing during operation. For example, during the startup process, the program will obtain the corresponding memory for use during the startup process or after startup. In memory, data can usually be managed through memory pages. Among them, during the operation of the electronic device, the electronic device can manage the memory pages in the memory. For example, the electronic device can replace the memory pages in the memory to free up memory space for other processes. However, in the related method, the replacement operation of the memory page is not flexible enough.
[0024] Therefore, the inventors proposed the memory page processing method, device and electronic device in the present application. In the case of multiple memory usage objects, the target object can be determined from the multiple memory usage objects, and then at least part of the candidate memory pages can be replaced to the first storage area. Thus, in the above manner, when there are multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, thereby making the replacement operation of the memory page more refined and flexible.
[0025] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0026] See also Figure 1 , an embodiment of the present application provides a memory page processing method, the method comprising:
[0027] S110: Determine a target object from a plurality of memory usage objects.
[0028] In an embodiment of the present application, a memory usage object can be understood as an object that uses the memory of an electronic device. Optionally, a memory usage object can be a program, or a memory usage object can be a program grouping obtained by dividing the program. Among them, the program grouping can be based on the memory control group (Memory ControlGroup, Memcg for short) technology of an operating system (for example, a Linux system). In the case where the memory usage object is a program grouping, each program grouping can include at least one program. In an embodiment of the present application, a program can be understood as a complete application, or it can be understood as a process or thread included in the application.
[0029] Wherein, in the case of multiple program groups, the multiple program groups may be obtained by dividing the multiple programs. Optionally, the multiple program groups may be obtained by dividing according to target features of the programs, wherein the target features of the programs in the same program group are the same. In the embodiment of the present application, the target features may be implemented in multiple ways.
[0030] Optionally, the target feature includes a user identification code UID (User Identification) of the program.
[0031] In the case of dividing the program groups according to the user identification code, the user identification codes of the programs in the same program group are the same. If the program represents a process, then the same program group may include multiple processes with the same corresponding user identification code. For example, the same application may further include multiple programs (e.g., multiple processes), and because the multiple programs belong to the same application, the user identification codes of the multiple programs may be the same. In this case, the multiple programs can be divided into the same program group.
[0032] For example, Figure 2As shown, the electronic device includes application A1, application A2 and application A3. Among them, application A1 includes program A11, program A12 and program A13. Application A2 includes program A21 and program A22. Application A3 includes program A31, program A32, program A33 and program A34. Among them, because program A11, program A12 and program A13 all belong to application A1, the user identification codes corresponding to them will be the same. Similarly, the user identification codes corresponding to program A21 and program A22 will be the same, and the user identification codes corresponding to program A31, program A32, program A33 and program A34 will be the same. When programs corresponding to the same identification code are classified into the same group, program A11, program A12, and program A13 can be classified into the same program group G1, program A21 and program A22 can be classified into the same program group G2, and program A31, program A32, program A33, and program A34 can be classified into the same program group G3.
[0033] Alternatively, the target characteristics include the memory access latency requirements of the program.
[0034] In an embodiment of the present application, the memory access delay requirement represents the timeliness requirement of the program when performing memory access. For example, some programs expect access requests to be responded to quickly when performing memory access, wherein a quick response to the access request can be understood as the data requested to be accessed can be returned to the program quickly, or a quick response to the access request can be understood as the requested calculation in the memory can get the returned calculation result quickly. Optionally, the meaning represented by the memory access delay requirement can be: the maximum delay time that the program can accept. Or, optionally, the meaning represented by the memory access delay requirement can be: the maximum number of memory access delays that the program can accept within a specified time length. In this way, an application whose memory access delay requirement meets the specified requirement conditions can be used as the first target application. Optionally, the specified requirement conditions can be: the maximum delay time is less than the specified time length, or the maximum number of memory access delays is less than the specified number.
[0035] Optionally, the electronic device can group the applications based on the memory access delay requirements of the applications, thereby obtaining multiple program groups. Among them, for the same program group, the memory access delay requirements of the included applications are the same or similar. In this case, an application in one or more of the program groups can be selected as the first target application. For example, a program in a program group with the shortest maximum delay time that the included programs can accept can be selected as the first target application. Alternatively, a program in a program group with the smallest maximum number of memory access delays that the included programs can accept can be selected as the first target application.
[0036] After the memory access latency requirements of the programs to be grouped are obtained, corresponding program groups may be configured for the programs to be grouped.
[0037] As a method, multiple program groups can be preconfigured, and a corresponding memory access latency requirement can be configured for each program group. In this way, after obtaining the application programs to be grouped, the memory access latency requirements of the application programs to be grouped can be compared with the memory access latency requirements corresponding to each program group configuration, so as to group the programs whose corresponding memory access requirements are similar or identical to the memory access requirements of the application programs to be grouped as the groups into which the application programs to be grouped are divided.
[0038] Among them, the two memory access delay requirements are similar, which can be understood as the delay requirements expressed by the two memory access delay requirements are relatively close. For example, taking the meaning represented by the memory access delay requirement as the maximum delay time that the program can accept as an example, the delay requirements expressed by the two memory access delay requirements are relatively close, which can be understood as the difference between the maximum delay times that the two memory access delay requirements can accept is less than the specified threshold. For another example, taking the meaning represented by the memory access delay requirement as the maximum number of memory access delays that the program can accept within a specified time length as an example, the delay requirements expressed by the two memory access delay requirements are relatively close, which can be understood as the difference between the maximum number of memory access delays is less than the specified threshold.
[0039] Exemplarily, the grouping of multiple programs may be shown in the following table:
[0040] ID Group ID Memory access latency requirements for groups 1 Group G1 T1 2 Group G2 T2 3 Group G3 T3
[0041] As shown in the above table, T1, T2 and T3 in the memory access delay requirements of the groups in the above table represent the maximum acceptable delay time. Among them, the values of T1, T2 and T3 can be non-negative numbers. For example, T1 can be 0.5 seconds, T2 can be 1 second, and T3 can be 2 seconds. Based on the situation shown in the above table, after obtaining the application to be grouped, if the maximum acceptable delay time represented by the memory access delay requirement of the application to be grouped is T1, the application to be grouped will be divided into group G1. If the maximum acceptable delay time represented by the memory access delay requirement of the application to be grouped is T3, the application to be grouped will be divided into group G3. If the maximum acceptable delay time represented by the memory access delay requirement of the application to be grouped is T4, and the difference between T4 and T1 is calculated to be less than the specified threshold, it is determined that the memory access delay requirement of the application to be grouped is similar to the memory access delay requirement of group G1, and the application to be grouped will be divided into group G1.
[0042] As a method, if the memory access delay requirement of the program to be grouped is different from and not similar to the memory access delay requirement of each group, it can be detected whether the creation of a new program group is allowed. If it is detected that the creation of a new program group is allowed, a new program group is created, and the memory access requirement of the program to be grouped is used as the memory access requirement of the newly created program group. If the creation of a new program group is not allowed, a group whose corresponding memory access delay requirement is closest to the memory access delay requirement of the program to be grouped is determined from the currently established program groups as the program group corresponding to the program to be grouped.
[0043] Optionally, the electronic device may determine whether to allow the creation of a new program group in a variety of ways.
[0044] As a determination method, the user of the electronic device may configure whether to allow the creation of a new program group. In this method, a configuration interface may be displayed in the electronic device, and the configuration interface may display an option of prohibiting the creation of a new program group and an option of allowing the creation of a new program group. Then, the user may select the desired option according to his or her needs.
[0045] As another determination method, the electronic device can determine whether to allow the creation of a new program group based on the currently remaining storage space. It should be noted that, in the case of creating a new program group, it is necessary to allocate corresponding storage space for the new program group to store corresponding data. The data may include the data of the program group itself to store the data in the program group. Therefore, each time a new program group is created, more storage space is consumed. In this case, the electronic device can determine that a new program group is not allowed to be created if it detects that the remaining storage space is insufficient, and correspondingly, it can determine that a new program group is allowed to be created if it detects that the remaining storage space is sufficient.
[0046] Optionally, when it is detected that the remaining storage space is greater than a specified storage threshold, it is determined that the remaining storage space is sufficient; otherwise, it is determined that the remaining storage space is insufficient.
[0047] It should be noted that, in the embodiment of the present application, the memory access delay requirement of the application can be pre-configured by the developer of the program, or can be determined by the electronic device according to the category and / or running state of the application. Correspondingly, when the memory access delay requirement of the application can be characterized by the memory access delay level, the memory access delay level of the application can be determined according to the category and / or running state of the application.
[0048] For example, if the category of an application indicates that the program is an application running in the foreground or a system program, then the memory access latency requirement of the application indicates that the memory direction requirement of the application needs to be responded to quickly. For another example, if the category of an application indicates that the program is a program running in the background, then the memory access latency requirement of the application indicates that the memory direction requirement of the application can be delayed for a certain period of time before responding.
[0049] Among them, foreground operation can be understood as the state of a program or process in the operating system, indicating that the program or process is executing and the user can interact with it directly. When a program is in the foreground running state, its window will be displayed at the forefront of the screen, and the user can interact with it directly, such as entering text, clicking buttons, etc. In contrast, background operation means that the program or process is running in the background and the user cannot interact with it directly. Programs running in the background usually perform tasks that do not require user interaction, such as data backup, file download, etc.
[0050] It should be noted that the memory access requirements for the same application in different operating states may also be different. For example, for an audio player, in the operating state when it is started and no audio playback is performed, the operations performed may include operations with low timeliness. The operations with low timeliness may include page switching operations, music search operations, or configuration operations. In the operating state of the audio player, when the audio player starts to play audio, the audio player will obtain audio data from the network in real time, and load it into the memory for decoding and playback. Therefore, the audio playback operation performed by the audio player is an operation with high timeliness.
[0051] For another example, for a game program, when it is started and the game operation interface is not entered, the operations performed may include operations with low timeliness. The operations with low timeliness may include page switching operations, game configuration operations, or game item purchase operations, etc. In the game program, when the game operation interface is displayed, the game program will obtain game data (for example, other players' data or real-time map data, etc.) from the network in real time, and load it into the memory for processing. Therefore, when the game program is in the running state of displaying the game operation interface, the memory access request needs to be responded to faster. Among them, when the game program displays the game operation interface, the game operation object in the game operation interface can be controlled.
[0052] In the embodiment of the present application, the programs in the program group may also be deleted. As shown in the foregoing, there may be multiple ways to determine the programs to be grouped, and in this case, there may also be multiple ways to delete the programs in the program group.
[0053] The determined target object can be understood as a memory usage object that needs to perform memory page replacement, and the memory page that needs to be replaced exists in the memory buffer area. In the case where the memory usage object is a program group, the determined target object can be a target program group. In the case where the memory usage object is a program, the target object is the target program.
[0054] In the embodiments of the present application, there are multiple ways to determine the target object. Among them, when the internal usage object is a program group, the target program group (a target object) can be determined based on the occupation of the memory buffer area by each program group as a whole. For another example, the target program group can also be determined based on the running status of the program in each program group. Among them, when the memory usage object is a program, the target program (a target object) can be determined directly based on the running status of the program.
[0055] S120: Replace at least part of the candidate memory pages to the first storage area, the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
[0056] As a method, when replacing memory pages in the memory, the replaced memory pages can be directly replaced to the disk, external storage device or network of the electronic device. Alternatively, the replaced memory pages can be replaced to the memory compression area in the memory. Furthermore, the memory pages in the memory compression area can also be further replaced to the disk, external storage device or network of the electronic device.
[0057] Among them, the speed of loading the memory pages in the first storage area into the memory will be slower than the speed of loading the memory pages from the second storage area into the memory. In this case, optionally, the first storage area can be a disk, an external storage device or a network of the electronic device, and the second storage area can be a compressed memory area. Optionally, the first storage area can be a compressed memory area in the memory, and the second storage area can be an uncompressed area in the memory.
[0058] It should be noted that the memory of the electronic device can be divided into an uncompressed area and a memory compression area. Among them, the memory pages in the uncompressed area are not compressed, while the memory pages in the memory compression area are compressed. In this case, the memory pages in the uncompressed area can be used directly by the memory user object, but if the memory pages in the memory compression area are needed, the memory pages in the memory compression area can be decompressed first, and then loaded into the uncompressed area for use. Among them, replacing the memory pages in the memory into the memory compression area can be understood as compressing the memory pages in the uncompressed area of the memory and then replacing them into the memory compression area. For example, Figure 3 As shown, the memory of the electronic device is divided into an uncompressed area and a compressed memory area, wherein the memory pages P1 and P2 in the uncompressed area are uncompressed memory pages, and the memory pages P4 and P4 in the compressed memory area are compressed memory pages.
[0059] Optionally, a memory compression area can be established through zram. Among them, the memory pages replaced in the memory compression area will be compressed to reduce the storage space occupied. It should be noted that the memory pages replaced from the memory may be reused, and then need to be loaded back into the memory. Among them, the memory pages replaced in the memory compression area can be loaded back into the memory more quickly than the memory pages replaced to the location outside the memory. However, the size of the memory compression area is limited, and therefore, in some cases, the memory pages in the memory compression area need to be replaced to the location outside the memory so that there is enough space for the memory compression area to be used.
[0060] After the target object is determined, the memory page corresponding to the target object in the second storage area can be used as a candidate memory page. The memory page corresponding to the target object can be understood as a memory page whose recorded data belongs to the target object. For example, Figure 4 As shown, the second storage area at least includes memory page P1, memory page P2, memory page P3, memory page P4, memory page P5 and memory page P6. The data recorded in memory page P2, memory page P3 and memory page P4 belong to the memory usage object D1. Then, when the memory usage object D1 is determined as the target object, memory page P2, memory page P3 and memory page P4 can be determined as candidate memory pages.
[0061] When the candidate memory pages are determined, memory pages can be selected from the subsequent memory pages to be replaced in the first storage area. Optionally, some memory pages in the candidate memory pages can be selected to be replaced in the first storage area, or all candidate memory pages can be selected to be replaced in the first storage area.
[0062] It should be noted that, in the embodiment of the present application, there may be multiple ways to determine the memory page to be selected for replacement from the candidate memory pages.
[0063] As a determination method, the number of memory pages replaced from the candidate memory pages to the first storage area can be configured as a specified value. The specified value can be understood as a fixed value. In this way, when determining the candidate memory pages, memory pages of the specified value can be selected from the candidate memory pages to be replaced in the first storage area. Among them, if the number of candidate memory pages is greater than the specified value, memory pages of the specified value can be selected from the core candidate memory pages to be replaced in the first storage area. If the number of candidate memory pages is not greater than the specified value, all candidate memory pages can be replaced to locations outside the memory.
[0064] As another determination method, when the first storage area is a location outside the memory, and the second storage area is a memory compression area, the memory page to be replaced to a location outside the memory can be determined based on the time when the candidate memory page was added to the second storage area. It should be noted that the memory page replaced to the second storage area can be understood as a memory page that will not be called temporarily. Furthermore, the longer the time when the memory page is replaced to the second storage area, the lower the probability of being used again recently. Therefore, the memory page among the candidate memory pages whose time between the time when it was replaced to the second storage area and the current time is greater than the specified time can be replaced to a location outside the memory. Exemplary, such as Figure 5 As shown, if the candidate memory pages include memory page P2, memory page P3 and memory page P4, the time when memory page P2 is replaced in the second storage area is T1, the time when memory page P3 is replaced in the second storage area is T2, and the time when memory page P4 is replaced in the second storage area is T3. The time between the time when memory page P2 is replaced in the second storage area and the current time is T0-T1, the time between the time when memory page P3 is replaced in the second storage area and the current time is T0-T2, and the time between the time when memory page P3 is replaced in the second storage area and the current time is T0-T3. If T0-T1 and T0-T2 are greater than the specified time, it will be determined that memory page P2 and memory page P3 will be replaced in a location outside the memory.
[0065] As another way, when the first storage area is a location outside the memory, and the second storage area is a memory compression area, the memory page to be replaced outside the memory can be determined based on the access frequency of the candidate memory page in the most recent specified time period. It should be noted that some memory pages in the second storage area may be frequently replaced between the memory and the second storage area. If these memory pages that are frequently replaced back and forth between the memory and the second storage area are replaced in the first storage area, the operating performance of the memory-using object that uses the memory page may be affected. Therefore, optionally, memory pages whose access frequency in the most recent specified time period is lower than a specified frequency threshold can be selected and replaced in the first storage area. Optionally, the most recent specified time period can be one hour, one day, or one week.
[0066] In the case where there are multiple ways to determine the memory page to be replaced in the first storage area from the candidate memory pages, the specific way to determine the memory page to be replaced can be determined according to the current actual situation.
[0067] Optionally, the memory page that needs to be replaced in the candidate memory pages can be determined according to the category of the memory usage object to which the candidate memory page belongs. It should be noted that for some memory usage objects, there may be a greater probability of repeatedly processing the same or similar data, such as document editing programs or image editing programs. However, for some memory usage objects, there may be a greater probability of processing new data, such as video playback programs or game programs.
[0068] Among them, processing the same or similar data repeatedly with a greater probability can be understood as processing the same or similar data repeatedly with a greater probability than processing new data. Correspondingly, processing the new data with a greater probability can be understood as processing the new data with a greater probability than processing the same or similar data repeatedly.
[0069] Therefore, as a method, when the first storage area is a location outside the memory and the second storage area is a memory compression area, if the memory usage object to which the candidate memory page belongs will repeatedly process the same or similar data, the memory page to be replaced outside the memory can be determined based on the access frequency of the candidate memory page in the most recent specified time period; if the memory usage object to which the candidate memory page belongs is more likely to process new data, the memory page to be replaced outside the memory can be determined based on the time when the candidate memory page is added to the second storage area.
[0070] Optionally, in an electronic device, the category of a memory usage object can be determined by establishing an object list. For example, a first object list can be established for memory usage objects that will repeatedly process the same or similar data. A second object list can be established for memory usage objects that are more likely to process new data. In this way, when the target object is determined, by querying the list where the target object is located, the category of the target object can be determined, and then a method for determining the selection of a memory page from the candidate memory pages can be obtained.
[0071] The present embodiment provides a memory page processing method, in the case of multiple memory usage objects, the target object can be determined from the multiple memory usage objects, and then at least part of the candidate memory pages can be replaced to the first storage area. Therefore, through the above method, in the case of multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, so that the replacement operation of the memory page is more refined and flexible.
[0072] See also Figure 6 , an embodiment of the present application provides a memory page processing method, the method comprising:
[0073] S210: Among the multiple memory usage objects, the memory usage object whose corresponding memory page occupies a storage space in the second storage area that meets the target space condition is used as the target memory usage object.
[0074] As a method, for each memory usage object, a corresponding memory usage upper limit can be configured. The memory usage upper limit represents the maximum storage space that the corresponding memory usage object can use in the second storage area. For example, when the second storage area is a memory compression area, the memory usage upper limit represents the maximum storage capacity that the corresponding memory usage object can occupy in the memory compression area. In the case where the memory usage upper limit is configured, a memory usage threshold can also be configured. The memory usage threshold can be less than the memory usage upper limit, so that when the storage space occupied by the memory page corresponding to the memory usage object in the second storage area is greater than the memory usage threshold, it represents that the storage capacity of the memory usage object in the second storage area is about to run out, and then at least part of the memory page needs to be replaced to the first storage space. Then as a method, the target space condition can include: the storage space occupied by the memory page corresponding to the memory usage object in the second storage area is greater than the memory usage threshold corresponding to the memory usage object.
[0075] In the embodiment of the present application, the memory usage upper limit corresponding to each memory usage object may be the same or different. Furthermore, there may be multiple ways to determine the usage upper limit of each memory usage object.
[0076] As a determination method, the user of the electronic device can configure the corresponding memory usage upper limit for each memory usage object according to his / her needs. In this way, a corresponding memory configuration interface can be provided in the electronic device. Thus, the corresponding memory usage upper limit can be configured for different memory usage objects through the configuration interface.
[0077] As another determination method, the electronic device may configure the corresponding memory usage upper limit according to the characteristics of each memory usage object. It should be noted that for different memory usage objects, the demand for memory during operation may be different. For example, for a program running in the foreground, there is a relatively higher timeliness requirement during operation, while for a program running in the background, the timeliness requirement is relatively low. In this case, if the memory usage object is a program running in the foreground, or the memory usage is a program group, and the program group includes a program running in the foreground, a larger memory usage upper limit may be configured accordingly. Correspondingly, if the memory usage object is a program running in the background, or the memory usage object is a program group, and the programs included in the program group are all running in the background, a smaller memory usage upper limit may be configured accordingly.
[0078] As another way, the respective memory usage upper limit can also be determined according to the priority of each memory usage object. For a program with a higher priority, a relatively higher memory usage upper limit can be configured, and for a program with a lower priority, a relatively lower memory usage upper limit can be configured.
[0079] It should be noted that the storage space of the second storage area is limited. If a new memory usage object is generated (for example, a new program group is generated, or a new program is installed in the electronic device), it is necessary to configure a corresponding memory usage upper limit for the new memory usage object. When configuring the corresponding memory usage upper limit, there may be a situation where the remaining storage space in the second storage area cannot meet the memory usage upper limit of the new memory usage object. In this case, the electronic device can detect whether the specified usage conditions are met. If the specified usage conditions are met, the sum of the respective memory usage upper limits of all memory usage objects is allowed to be greater than the overall storage capacity of the second storage area. If the specified usage conditions are not met, the sum of the respective memory usage upper limits of all memory usage objects is not allowed to be greater than the overall storage capacity of the second storage area.
[0080] Among them, when the specified usage conditions are met, the corresponding memory usage upper limit can be configured for the new memory usage object in an established manner. The established method is any one of the aforementioned methods for determining the corresponding memory usage upper limit. When the specified usage conditions are not met, it is necessary to reconfigure the memory usage upper limits of all memory usage objects (including the original memory usage objects and the new memory usage objects) so that the configuration result meets the currently used configuration principle and the sum of the respective memory usage upper limits of all memory usage objects is not greater than the overall storage capacity of the second storage area.
[0081] Optionally, the electronic device may further configure a corresponding memory usage address for each memory usage object so that the memory addresses of memory pages belonging to the same memory usage object can be continuous.
[0082] S220: Replace at least part of the candidate memory pages to the first storage area, the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
[0083] The present embodiment provides a memory page processing method, so that in the above manner, when there are multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, thereby making the replacement operation of the memory page more refined and flexible. Moreover, in the present embodiment, when a memory usage threshold is configured for each memory usage object, when it is detected that the storage space occupied by the memory page of a certain memory usage object in the second storage area is greater than the corresponding memory usage threshold, the replacement of the memory page of the memory usage object is triggered, which is conducive to avoiding the situation where the memory usage object cannot use the second storage area.
[0084] See also Figure 7 , an embodiment of the present application provides a memory page processing method, the method comprising:
[0085] S310: Among the multiple memory usage objects, a memory usage object whose program status meets the target status condition is selected as a target object.
[0086] As a method, the target state condition includes at least one of the following conditions: the program is running in the background; the program is in a startup-prohibited state (for example, the program is frozen); the amount of processing resources occupied by the program is lower than the occupation threshold; the storage space occupied by the program in the second storage area satisfies the target space condition, wherein the target space condition can be satisfied by the storage space occupied by the memory page corresponding to the program in the second storage area being greater than the memory usage threshold of the memory usage object to which the program belongs. Wherein, in the case where the memory usage object has only one program, the memory usage threshold of the memory usage object can be understood as the memory usage threshold of the program in the memory usage object. In the case where the memory usage object includes multiple programs, the memory usage threshold of the memory usage object can be determined based on the multiple programs included.
[0087] It should be noted that when a program is running in the background, the program's timeliness requirement for memory will be relatively lower, and the memory page corresponding to the program running in the background can be replaced to the first storage area, so that other memory users can use the second storage area. Among them, when a program is in a prohibited startup state, the program may not use the memory anymore, and the corresponding memory page can be replaced to the first storage area, so that other memory users can use the second storage area.
[0088] In the embodiment of the present application, processing resources can be understood as resources such as CPU (Central Processing Unit), GPU (graphics processing unit) or NPU (Neural Processing Unit). When the amount of processing resources occupied by the program is lower than the occupation threshold, it means that the program does not currently have many tasks to be processed, and thus the occupation of the second storage area can be relatively reduced. The occupation threshold can be pre-configured by the developer, or dynamically configured by the electronic device according to actual conditions.
[0089] S320: Replace at least part of the candidate memory pages to the first storage area, the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
[0090] The present embodiment provides a memory page processing method, so that in the above manner, when there are multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, thereby making the replacement operation of the memory page more refined and flexible. Moreover, in the present embodiment, when each memory usage object includes at least one program, the target object can be determined according to the status of the program in each memory usage object, further improving the flexibility of determining the target object.
[0091] See also Figure 8 , an embodiment of the present application provides a memory page processing method, the method comprising:
[0092] S410: If the remaining memory of the electronic device is lower than a first memory threshold, at least two memory usage objects among the multiple memory usage objects are used as target objects.
[0093] As one approach, a difference between the remaining memory of the electronic device and a first memory threshold is obtained; based on the difference, the number of memory usage objects as target objects among a plurality of memory usage objects is determined, wherein the larger the difference, the larger the number.
[0094] The first memory threshold is used to characterize the lowest threshold at which the electronic device can operate normally. When the remaining memory of the electronic device is lower than the first memory threshold, the electronic device is more likely to freeze. Therefore, when the remaining memory of the electronic device is lower than the first memory threshold, the memory page can be selected to be replaced from the second storage area to the first storage area.
[0095] In an embodiment of the present application, the first memory threshold can be pre-configured by the developer of the electronic device. It can also be dynamically determined by the electronic device according to the actual situation. For example, the more programs are installed in the electronic device, the higher the probability of the electronic device being stuck. In this way, the electronic device can determine the first memory threshold based on the number of installed programs. The more programs are installed, the higher the first memory threshold can be. For example, Fig. 9 As shown, as the number of programs increases, the corresponding first memory threshold will also increase accordingly.
[0096] It should be noted that the first memory threshold may grow linearly or nonlinearly as the number of programs increases. Alternatively, it may grow linearly in some stages and nonlinearly in other stages. Among them, linear growth and nonlinear growth are two ways to describe the relationship between variables. Linear growth refers to a straight-line growth relationship between two variables (the number of programs and the first memory threshold), that is, one variable increases with a fixed step size as the other variable increases. Linear growth relationships can usually be described by a linear function or a straight-line equation. Nonlinear growth means that the relationship between two variables is not a linear relationship, but a complex relationship that presents a curve, a surface, or an uncertain relationship. Nonlinear growth relationships usually require the use of more complex mathematical models such as quadratic functions, polynomial equations, trigonometric functions, and exponential functions to describe.
[0097] As a way, when the number of programs in an electronic device is small, if a new program is added, it means that the newly added program is likely to be a program that the user may use frequently. For example, when a user replaces a new electronic device, the program initially installed in the electronic device will be a program that the user frequently uses. For example, payment programs and instant messaging programs. In the case where there are many programs installed in an electronic device, if there are new programs, it is more likely that the program will be a program that the user occasionally uses. For example, a user is temporarily required by the organizer of an event to install a program because he needs to participate in an event. For these occasionally used programs, they may remain in the electronic device for a long time, but the probability of being activated will be low.
[0098] Therefore, in order to better and more accurately determine the fluctuation range of the first memory threshold, at least one program threshold can be configured. If the number of programs of the electronic device increases, and the number of programs after the increase is less than the program threshold, the first memory threshold is increased in a linear growth manner. If the number of programs of the electronic device increases, and the number of programs after the increase is greater than the program threshold, the first memory threshold is increased in a nonlinear growth manner. Moreover, in this nonlinear growth manner, the amplitude of the first memory threshold at each increase will be smaller than the amplitude at the linear growth. For example, in the linear growth stage, the first memory threshold can be increased by n each time it increases, and in the nonlinear growth stage, the first memory threshold can be increased by m each time it increases, where n is greater than m.
[0099] S420: Replace at least part of the candidate memory pages to the first storage area, the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
[0100] The present embodiment provides a memory page processing method, so that in the above manner, when there are multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, thereby making the replacement operation of the memory page more refined and flexible. Moreover, in the present embodiment, the number of the target objects can be determined according to the difference between the remaining memory of the electronic device and the first memory threshold, thereby improving the flexibility of determining the target objects. Moreover, it is also possible to dynamically adjust the number of memory pages determined to be replaced from the second storage area.
[0101] It should be noted that in the embodiment of the present application, when replacing the memory page in the memory (uncompressed area), the memory page can be replaced to the memory compression area, or it can be directly replaced to a location outside the memory.
[0102] In an embodiment of the present application, a corresponding memory removal strategy can be configured for each program group. The memory removal strategy is used to determine whether the memory page corresponding to the corresponding program group is replaced from the non-compressed area to the memory compression area or directly replaced to a location outside the memory. When the memory removal strategy of each program group is determined, the memory pages of the programs in the program group can be replaced according to the memory removal strategy. Among them, for the memory pages corresponding to the same program group, they can be replaced to the memory compression area or to a location outside the memory. Among them, for the memory pages of the programs in some program groups, the replacement operation may not be performed.
[0103] In an embodiment of the present application, when determining the memory pages that need to be replaced in each program group, the determination can be made based on the usage frequency of the memory pages of the programs in the corresponding program group; or, the determination can be made based on the time when the memory pages of the programs in the corresponding program group are added to the memory.
[0104] Optionally, in the method of replacing memory pages according to the frequency of use, the time when the memory page was last used can be obtained, and then whether to replace it can be determined based on the time when the memory page was last used. Optionally, the interval between the time when the memory page was last used and the current time can be obtained. If the interval is longer than a specified time, it is determined that the memory page can be replaced. Optionally, the time when a plurality of memory pages were last used can be compared, and then it is determined that the memory page with the longest interval between the time and the current time can be replaced. Among them, the plurality of memory pages can be memory pages of programs in the same program group, and the memory removal policy corresponding to the program group is to replace the memory pages according to the frequency of use of the programs in the corresponding program group.
[0105] The replacement may be performed according to the usage frequency of the memory pages of the programs in the corresponding program group, or the memory pages that can be replaced may be determined in an LRU (Least Recently Used) manner.
[0106] Exemplarily, the plurality of program groups include group G1, group G2, and group G3. Among them, the memory removal strategy corresponding to group G2 is to replace the memory pages of the programs in the corresponding program group according to the usage frequency of the memory pages of the programs, then the electronic device will determine the memory pages that can be replaced from the memory pages corresponding to the programs in group G2 according to the usage frequency of the memory pages of the programs in the corresponding program group. For example, if the programs included in group G2 are program P5 and program P6, then the electronic device will determine the memory pages that need to be removed according to the usage frequency of the memory pages of program P5 and program P6.
[0107] Optionally, in the method of replacing the memory page of the program in the corresponding program group according to the time when the memory page is added to the memory, the FIFO (First Input First Output) method can be used to determine the memory page that can be replaced. In this method, the loading time of multiple memory pages loaded into the memory can be compared, and then the memory page with the longest loading time interval from the current time is determined as the memory page that can be replaced.
[0108] Exemplarily, the plurality of program groups include group G1, group G2, and group G3. Among them, the memory removal strategy corresponding to group G3 is to replace the memory page of the program in the corresponding program group according to the time when the memory page is added to the memory, then the electronic device will determine the memory page that can be replaced from the memory page corresponding to the program in group G3 according to the time when the memory page is added to the memory. For example, if the programs included in group G3 are program P7, program P8, and program P9, then the electronic device will determine the memory page that needs to be removed according to the time when the memory pages of program P7, program P8, and program P9 are loaded into the memory.
[0109] Exemplarily, the multiple program groups obtained by division in the embodiment of the present application include a first group, a second group, and a third group. Among them, the programs in the first group may be system programs, the programs in the second group may be programs running in the foreground, and the programs in the third group may be programs running in the background. Among them, the memory removal strategy corresponding to the first group may be no replacement, the memory removal strategy corresponding to the second group may be replacement according to the usage frequency of the memory pages of the programs in the corresponding program group, and the memory removal strategy corresponding to the third group may be replacement according to the time when the memory pages of the programs in the corresponding program group are added to the memory.
[0110] As a method, the target location to which the replaced memory page is moved is determined according to the program grouping corresponding to the replaced memory page. It should be noted that some memory pages will be loaded into the memory again or loaded into the original location in the memory after being replaced. For different target locations, the speed at which the memory pages included are loaded into the memory will be different. For example, some memory pages are replaced to the hard disk, while some memory pages are only replaced to memory compression. The compressed memory can be loaded into the memory after decompression, while the memory pages moved out to the hard disk need to be loaded from the hard disk into the memory, which takes relatively more time.
[0111] Exemplarily, the multiple program groups obtained by dividing in the embodiment of the present application may include the aforementioned first group, second group and third group. Among them, the target position corresponding to the first group may be the first position, the target position corresponding to the second group may be the second position, and the target position corresponding to the third group may be the third position, wherein the speed at which the memory page in the first position is loaded back into the memory is faster than the speed at which the memory page in the second position is loaded back into the memory, and the speed at which the memory page in the second position is loaded back into the memory is faster than the speed at which the memory page in the third position is loaded back into the memory. Optionally, the first position may be a position in the memory, the second position may be a flash memory (FLASH), and the third position may be a disk (Disk).
[0112] See also Fig.10 , a memory page processing device 500 provided in an embodiment of the present application runs on an electronic device, and the device 500 includes:
[0113] The target determination unit 510 is used to determine a target object from a plurality of memory usage objects.
[0114] The memory page processing unit 520 is used to replace at least part of the candidate memory pages to the first storage area, the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
[0115] As a method, the memory usage object is a program group, and the target object is a target program group, wherein the plurality of program groups are obtained by dividing according to target features of the programs, wherein the target features of the programs in the same program group are the same. Optionally, the target feature includes a user identification code of the program, or the target feature includes a memory access latency requirement of the program.
[0116] As a way, the memory usage object is the program and the target object is the target program.
[0117] As a method, the target determination unit 510 is specifically used to use, among the multiple memory usage objects, a memory usage object whose corresponding memory page in the second storage area occupies a storage space that meets the target space condition as the target memory usage object. Optionally, the target space condition includes:
[0118] The storage space occupied by the memory page corresponding to the memory usage object in the second storage area is greater than the memory usage threshold corresponding to the memory usage object.
[0119] As a method, the target determination unit 510 is specifically used to use, as the target object, a memory usage object whose program status meets the target status condition among the multiple memory usage objects. Optionally, the target status condition includes at least one of the following conditions: the program is running in the background; the program is in a startup-prohibited state; the amount of processing resources occupied by the program is lower than the occupation threshold.
[0120] As a method, the target determination unit 510 is specifically configured to use at least two memory usage objects among the multiple memory usage objects as target objects if the remaining memory of the electronic device is lower than the first memory threshold. Optionally, the difference between the remaining memory of the electronic device and the first memory threshold is obtained; and the number of memory usage objects among the multiple memory usage objects as target objects is determined based on the difference, wherein the larger the difference, the larger the number.
[0121] A memory page processing device provided by this embodiment enables, when there are multiple memory usage objects and it is necessary to replace memory pages from the second storage area to the first storage area, memory pages can be selected from the memory pages corresponding to a single memory usage object for replacement, without selecting the memory pages to be replaced for all the memory pages in the second storage area, thereby making the memory page replacement operation more refined and flexible.
[0122] It should be noted that the device embodiment in the present application corresponds to the aforementioned method embodiment. The specific principles in the device embodiment can be found in the contents of the aforementioned method embodiment and will not be repeated here.
[0123] The following will be combined Fig.11 An electronic device provided by the present application is described.
[0124] See also Fig.11Based on the above-mentioned audio processing method and device, the embodiment of the present application also provides another electronic device 200 that can execute the above-mentioned audio processing method. The electronic device 200 includes one or more (only one is shown in the figure) processors 202, a memory 204, a network module 206, a sensor module 208 and an audio acquisition device 210 that are coupled to each other. Among them, the memory 204 stores a program that can execute the content of the above-mentioned embodiment, and the processor 202 can execute the program stored in the memory 204.
[0125] Among them, the processor 202 may include one or more processing cores. The processor 202 uses various interfaces and lines to connect various parts within the entire electronic device 200, and executes various functions and processes data of the electronic device 200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 204, and calling data stored in the memory 204. Optionally, the processor 202 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 202 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 202, but may be implemented separately through a communication chip.
[0126] The memory 204 may include a random access memory (RAM) or a read-only memory (ROM). The memory 204 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 204 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.
[0127] The network module 206 is used to implement information exchange between the electronic device 200 and other devices, for example, transmission of device control instructions, operation request instructions, and status information acquisition instructions, etc. When the electronic device 200 is specifically a different device, the corresponding network module 206 may be different.
[0128] The sensor module 208 may include at least one sensor. Specifically, the sensor module 208 may include but is not limited to: a light sensor, a motion sensor, a pressure sensor, an infrared heat sensor, a distance sensor, an acceleration sensor, and other sensors.
[0129] Among them, the pressure sensor can be a sensor that detects the pressure generated by pressing on the electronic device 200. That is, the pressure sensor detects the pressure generated by the contact or pressing between the user and the electronic device, such as the pressure generated by the contact or pressing between the user's ear and the mobile terminal. Therefore, the pressure sensor can be used to determine whether contact or pressing occurs between the user and the electronic device 200, and the magnitude of the pressure.
[0130] Among them, the acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that recognize the posture of the electronic device 200 (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. In addition, the electronic device 200 can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, etc., which will not be repeated here.
[0131] The audio acquisition device 210 is used to collect audio signals. Optionally, the audio acquisition device 210 includes a plurality of audio acquisition devices. The audio acquisition device may be a microphone. For example, in one embodiment, the audio acquisition device 210 may include two microphones, in which one of the microphones may correspond to an analog-to-digital converter, and the other microphone may correspond to an analog-to-digital converter with two different analog gains. In another embodiment, the audio acquisition device 210 may include three microphones. In this embodiment, two of the microphones (e.g., a main microphone and a secondary microphone) may each correspond to an analog-to-digital converter, and the other microphone (e.g., a camera microphone) may correspond to an analog-to-digital converter with two different analog gains.
[0132] As a way, the network module of the electronic device 200 is a radio frequency module, which is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The radio frequency module may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM) cards, memories, etc. For example, the radio frequency module can exchange information with an external device through the electromagnetic waves sent or received, and then receive audio signals sent by the external device.
[0133] Furthermore, the electronic device 200 may also include an image acquisition device for image acquisition, for example, a video, a static picture or a dynamic picture may be taken by the image acquisition device.
[0134] Please refer to Fig.12 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 800 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0135] The computer readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 that performs any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 810 can be compressed, for example, in an appropriate form.
[0136] The present application provides a memory page processing method, device and electronic device. In the case of multiple memory usage objects, the target object can be determined from the multiple memory usage objects, and then at least part of the candidate memory pages can be replaced to the first storage area. Therefore, through the above method, in the case of multiple memory usage objects, when it is necessary to replace the memory page from the second storage area to the first storage area, the memory page can be selected from the memory page corresponding to the single memory usage object for replacement, without selecting the memory page to be replaced for all the memory pages in the second storage area, so that the replacement operation of the memory page is more refined and flexible.
[0137] Moreover, in the present application, when the first storage area is a memory compression area and the second storage area is a storage location outside the memory (for example, a FLASH device), the memory pressure can be effectively dealt with by dynamically adjusting the use of the memory compression area and the storage location outside the memory. Furthermore, in the present application, customized memory management is provided for each memory usage object, which improves the response speed and operating efficiency of the system. In addition, by dynamically moving the memory pages in the memory compression area to the storage location outside the memory, the problem of being unable to perform memory compression when the memory compression area is fully loaded is avoided, and the memory expansion capacity is improved. In addition, in the case of high memory pressure, the operation of key applications can be better guaranteed, and the stability of the system is improved.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements 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 the present application.
Claims
1. A memory page processing method, characterized in that: Applied to electronic equipment, the method comprises: Determine a target object from among multiple memory-using objects; At least part of the candidate memory pages are replaced to the first storage area, wherein the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
2. The method according to claim 1, characterized in that The memory usage object is a program group, and the target object is a target program group, wherein the plurality of program groups are obtained by dividing according to target features of the programs, wherein the target features of the programs in the same program group are the same.
3. The method according to claim 2, characterized in that The target feature includes a user identification code of the program, or the target feature includes a memory access latency requirement of the program.
4. The method according to claim 1, characterized in that: The memory usage object is a program, and the target object is a target program.
5. The method according to claim 1, characterized in that Each memory usage object includes at least one program, and determining a target object from the plurality of memory usage objects includes: Among the multiple memory usage objects, a memory usage object whose program status meets the target status condition is taken as a target object.
6. The method according to claim 5, characterized in that The target state condition includes at least one of the following conditions: The program is running in the background; The program is in a startup-prohibited state; The program's usage of processing resources is below the usage threshold; The storage space occupied by the program in the second storage area meets the target space condition.
7. The method according to claim 1, characterized in that The step of determining a target object from a plurality of memory usage objects comprises: If the remaining memory of the electronic device is lower than a first memory threshold, at least two memory usage objects among the multiple memory usage objects are used as target objects.
8. The method according to claim 7, characterized in that The method further comprises: Obtaining a difference between the remaining memory of the electronic device and a first memory threshold; The number of memory usage objects as target objects among the plurality of memory usage objects is determined based on the difference value, wherein the larger the difference value is, the larger the number is.
9. The method according to any one of claims 1 to 8, characterized in that: The first storage area is a storage area outside the memory, and the second storage area is a memory compression area.
10. The method according to claim 9, characterized in that The storage area outside the memory includes a FLASH device, and the memory compression area is a ZRAM.
11. A memory page processing device, characterized in that: Running on an electronic device, the device comprises: A target determination unit, used for determining a target object from a plurality of memory usage objects; A memory page processing unit is used to replace at least part of the candidate memory pages to the first storage area, wherein the candidate memory pages are memory pages corresponding to the target object in the second storage area, and the second storage area is located in the memory of the electronic device.
12. An electronic device, characterized in that: The method comprises one or more processors and a memory; one or more programs are stored in the memory and are configured so that the one or more processors execute the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is executed by a processor, the method according to any one of claims 1 to 10 is executed.
Citation Information
Patent Citations
Page swap-out method
CN107766151A
Memory recovery method and device
CN113778662A
Memory page processing method and device and electronic equipment
CN119576513A
Patent on method for enhancing security and net service business model
JP2023037659A