Memory page processing method and device and electronic equipment

By dividing active and inactive memory areas in the memory of electronic devices and performing memory page replacement in real time according to the degree of occupation, the problem of untimely memory page replacement in the prior art is solved, and the efficiency of freeing up memory space is improved.

CN119576513APending Publication Date: 2025-03-07GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311155566.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-07
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The replacement operation of memory pages in the prior art lacks timeliness, resulting in insufficient timely freeing up memory space.

Method used

In the memory of the electronic device, by dividing the memory into a first memory area and a second memory area, the memory page of the first memory area is more active. In response to the update of these two memory areas, the occupancy degree of the second memory area is obtained, and if the occupancy degree degree threshold is greater than or equal to the target degree threshold, the memory page in the second memory area is replaced.

Benefits of technology

Through this method, after each update of the memory area, the occupation of the second memory area can be obtained in time, and the memory page replacement can be triggered in time, which improves the timeliness of memory replacement and avoids system performance degradation caused by memory tightness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576513A_ABST
    Figure CN119576513A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a memory page processing method and device and electronic equipment. A memory of the electronic equipment comprises a first memory area and a second memory area, the active degree of a memory page in the first memory area is higher than that of a memory page in the second memory area, and the method comprises the steps that in response to updating of the first memory area and the second memory area, the occupancy degree of the second memory area is obtained; and if the occupancy degree is greater than or equal to a target degree threshold, replacing the memory page in the second memory area. In this way, after the first memory area and the second memory area are updated each time, the occupancy degree of the second memory area can be triggered to be obtained, so that when the occupancy degree in the second memory area is large, replacement of the memory page in the second memory area is triggered in time, and the memory page replacement efficiency is improved. Therefore, the timeliness of memory replacement is improved.
Need to check novelty before this filing date? Find Prior Art

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 an electronic device, the electronic device can manage memory pages in the memory. For example, the electronic device can replace memory pages in the memory to free up memory space for other processes. However, in the related methods, the replacement operation of memory pages lacks timeliness. 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, wherein the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area. The method includes: in response to updating the first memory area and the second memory area, obtaining the occupancy level of the second memory area; if the occupancy level is greater than or equal to a target level threshold, replacing the memory pages in the second memory area.

[0005] In a second aspect, the present application provides a memory page processing device that runs on an electronic device, wherein the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area. The device includes: an occupancy level acquisition unit, for acquiring the occupancy level of the second memory area in response to updates to the first memory area and the second memory area; and a memory replacement unit, for replacing the memory pages in the second memory area if the occupancy level is greater than or equal to a target level threshold.

[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 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. When the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than that of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. Thus, through the above method, after each update of the first memory area and the second memory area, the occupancy level of the second memory area will be triggered to obtain, so that when the occupancy level in the second memory area is large, the replacement of the memory pages in the second memory area is triggered in time, thereby improving the timeliness of memory replacement. 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 dividing a memory into a first memory area and a second memory area in an embodiment of the present application is shown;

[0012] Figure 3 A schematic diagram showing the storage of a memory page into the second memory area in an embodiment of the present application is shown;

[0013] Figure 4 A schematic diagram showing how to transfer a memory page in the second memory area to the first memory area in an embodiment of the present application is shown;

[0014] Figure 5 A flowchart of another memory page processing method proposed in an embodiment of the present application is shown;

[0015] Figure 6 A flowchart of another memory page processing method proposed in an embodiment of the present application is shown;

[0016] Figure 7 A structural block diagram of a memory page processing device proposed in an embodiment of the present application is shown;

[0017] Figure 8 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;

[0018] Fig. 9 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

[0019] 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.

[0020] Memory, also known as main memory, is a directly addressable storage space made of semiconductor devices. Programs (e.g., processes or threads) in electronic devices usually require the use of 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 still lacks timeliness.

[0021] Therefore, the inventors proposed the memory page processing method, device and electronic device in the present application. When the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than that of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. Thus, through the above method, after each update of the first memory area and the second memory area, the occupancy level of the second memory area will be triggered to obtain, so that when the occupancy level in the second memory area is large, the replacement of the memory pages in the second memory area is triggered in time, thereby improving the timeliness of memory replacement.

[0022] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0023] See also Figure 1A memory page processing method provided in an embodiment of the present application is applied to an electronic device, wherein the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, and the method includes:

[0024] S110: In response to updating the first memory area and the second memory area, obtaining the occupancy level of the second memory area.

[0025] In the embodiment of the present application, the first storage area can be understood as an active linked list, and the second storage area can be understood as an inactive linked list. Figure 2 As shown, memory pages can be transferred between active lists and inactive lists.

[0026] Optionally, the active linked list and the inactive linked list can be implemented based on the LRU (Least Recently Used) strategy. In this case, it can be understood that the LRU linked list is divided into an active linked list and an inactive linked list. Optionally, the LRU linked list is managed at the node granularity, and each node has an LRU management structure, which contains information such as the address, size, and number of uses of the node. That is, the node represents a memory page, and operating the node can be understood as operating the memory page corresponding to the interface. The LRU linked list manages active and inactive nodes through active linked lists and inactive linked lists. When a memory page is accessed, if the memory page is in the active linked list, the node corresponding to the memory page can be moved to the head of the active linked list; if the memory page is in the inactive linked list, the node of the memory page can be moved to the head of the active linked list, and the node corresponding to the memory page can be deleted from the inactive linked list. When the system memory is insufficient, the electronic device can recycle nodes (memory pages) from the tail of the inactive linked list.

[0027] Among them, updating the first memory area and the second memory area can be understood as adding memory pages to the first memory threshold or the second memory area, or removing memory pages from the first memory threshold or the second memory area. For example, in the process of updating the first memory area, the memory pages in the first memory area may be transferred to the second memory area. For another example, when updating the memory pages in the second memory area, the added memory pages may be stored in the second memory area, or the memory pages transferred from the first memory area may be stored in the second memory area.

[0028] Therefore, updating the first memory area and the second memory area may include: storing memory pages loaded into the memory to the second memory area; or transferring memory pages that have been accessed in the second memory area to the first memory area; or transferring memory pages that have not been accessed within a specified period of time in the first memory area to the second memory area.

[0029] For example, see Figure 2 and Figure 3 , if the memory page P5 is currently loaded into the memory from a location outside the memory, the memory page P5 can be stored in the second memory area (inactive linked list). For example, please refer to Figure 2 and Figure 4 , if the memory page P5 is accessed, the memory page P5 can be transferred to the first memory area (active linked list).

[0030] Among them, the memory pages loaded into the memory may include memory pages that are loaded into the memory for the first time, and may also be memory pages that are loaded into the memory again after being replaced out of the memory. It should be noted that the memory page is used to store data for the memory usage object to which it belongs. During the operation of the memory usage object, the corresponding task can be performed by accessing the corresponding memory page in the memory. For example, taking the memory usage object as an image processing program as an example, after selecting the image to be processed through the image processing program, the image to be processed can be loaded from the disk into the memory, and then the image to be processed needs to be stored through the memory page corresponding to the image processing program, so that the image processing program can directly operate the memory to complete the processing of the image to be processed.

[0031] 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 implemented 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.

[0032] 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.

[0033] Optionally, the target feature includes a user identification code UID (User Identification) of the program.

[0034] 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.

[0035] Alternatively, the target characteristics include the memory access latency requirements of the program.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] 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.

[0040] 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.

[0041] Exemplarily, the grouping of multiple programs may be shown in the following table:

[0042] ID Group ID Memory access latency requirements for groups 1 Group G1 T1 2 Group G2 T2 3 Group G3 T3

[0043] 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.

[0044] 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.

[0045] Optionally, the electronic device may determine whether to allow the creation of a new program group in a variety of ways.

[0046] 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.

[0047] 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.

[0048] 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.

[0049] 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.

[0050] 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.

[0051] 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.

[0052] 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.

[0053] 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.

[0054] 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.

[0055] S120: If the occupancy level is greater than or equal to the target level threshold, replace the memory pages in the second memory area.

[0056] Among them, when the occupancy level of the second memory area is greater than or equal to the target level threshold, it indicates that the electronic device may not be able to perform memory replacement in time. For example, if a memory usage object with a large memory demand currently applies for memory allocation, and the remaining storage space in the memory is insufficient, it will take more time to perform memory replacement and free up the memory space required by the memory usage object. Furthermore, because the startup of the memory usage object with a large memory demand itself will increase the operating pressure of the electronic device, if more processing resources are currently consumed for memory recovery, the operating pressure of the electronic device will be further increased. Furthermore, when the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced, which is conducive to freeing up more storage space in the memory in advance.

[0057] Furthermore, the activity of the memory pages stored in the first memory area will be relatively higher, which means that the memory pages in the first memory area may have been accessed more times and more frequently by the memory-using objects recently. Therefore, by replacing the memory pages in the second memory area, it is helpful to avoid affecting the normal operation of the electronic device due to replacing the memory pages in the first memory page area, thereby ensuring the normal operation of the electronic device and preparing the memory space required for subsequent operations in advance from the memory.

[0058] The present embodiment provides a memory page processing method, in which, when the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. Thus, through the above method, after each update of the first memory area and the second memory area, the occupancy level of the second memory area is triggered to obtain, so that when the occupancy level in the second memory area is large, the replacement of the memory pages in the second memory area is triggered in time, thereby improving the timeliness of memory replacement.

[0059] See also Figure 5A memory page processing method provided in an embodiment of the present application is applied to an electronic device, wherein the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, and the method includes:

[0060] S210: In response to updating the first memory area and the second memory area, obtaining an occupancy level of the second memory area.

[0061] S220: If the occupancy level is greater than or equal to the target level threshold, all memory pages in the second memory area are replaced.

[0062] As a method, when the occupancy level of the second memory area is greater than the target level threshold, it means that the storage space of the second memory area is about to run out. In this case, in order to free up more memory space, all memory pages in the second memory area can be directly replaced.

[0063] It should be noted that although the memory pages in the second memory area are less active, they may still be accessed. In order to balance the future memory usage requirements of the electronic device and ensure the access rate of the memory pages in the second memory area, as a method, before replacing all the memory pages in the second memory area, the memory usage requirements of the electronic device within a specified period of time in the future can be estimated. If the usage requirements meet the target requirement conditions, all the memory pages in the second memory area are replaced. Optionally, if the usage requirements do not meet the target requirement conditions, some of the memory pages in the second memory area are replaced.

[0064] Among them, by estimating the memory usage demand of the electronic device within a specified time period in the future, the memory usage demand of the electronic device within a specified time period in the future can be roughly estimated. If the usage demand meets the target demand condition, it means that the electronic device will have a large demand for memory usage in the future, and then all the memory pages in the second memory area can be replaced, thereby freeing up more memory space in advance. If the usage demand does not meet the target demand condition, it means that the electronic device will not have a large memory usage demand in the future. Then, in order to reduce the access rate reduction caused by the memory pages in the second memory area being replaced outside the memory, only some of the memory pages in the second memory area can be replaced.

[0065] The replaced partial memory pages may be one third of the memory pages in the second memory area, one half of the memory pages, or two thirds of the memory pages. In the embodiment of the present application, there are multiple ways to determine the partial memory pages to be replaced.

[0066] Optionally, the partial content pages to be replaced are determined based on characteristics of the memory usage object of the memory page in the second memory area, wherein the characteristics include at least one of a type corresponding to the memory usage, a running priority, and a memory access delay requirement.

[0067] Different types of memory usage objects have different memory usage requirements. For example, if the memory usage object is a program, the program running in the foreground has a higher memory access rate requirement than the program running in the background.

[0068] The present embodiment provides a memory page processing method, in which, when the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. In addition, in the present embodiment, when replacing the memory pages in the second memory area, all of them may be replaced, or only some of the memory pages may be replaced, thereby improving the flexibility of replacement.

[0069] See also Figure 6 A memory page processing method provided in an embodiment of the present application is applied to an electronic device, wherein the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, and the method includes:

[0070] S310: In response to updating the first memory area and the second memory area, obtaining an occupancy level of the second memory area;

[0071] S320: If the occupancy level is greater than or equal to the target level threshold, and the current moment is in an idle time period of the electronic device, the memory page in the second memory area is replaced.

[0072] Optionally, in an embodiment of the present application, time can be divided into an idle time period and a busy time period based on the operation of the electronic device. The idle time period can be understood as a time period when the electronic device has relatively fewer tasks to process, and the busy time period can be understood as a time period when the electronic device has relatively more tasks to process.

[0073] In the embodiment of the present application, the idle time period and the busy time period can be divided according to the historical operation status of the electronic device.

[0074] As one approach, the idle time period and the busy time period may be divided according to the number of programs running on the electronic device.

[0075] Optionally, multiple time periods may be pre-divided, and then the number of programs running in each time period may be counted, and each time period may be further divided into an idle time period or a busy time period according to the number of programs running in each time period. For example, a time period in which the number of programs running is less than a first number threshold may be determined as an idle time period, and a time period in which the number of programs running is not less than the first number threshold may be determined as a busy time period. For another example, a time period in which the occupancy rate of the processor is less than a first occupancy threshold may be determined as an idle time period, and a time period in which the occupancy rate of the processor is not less than the first occupancy threshold may be determined as a busy time period.

[0076] The length of each pre-divided time period may be of various types, for example, the length of each time period may be 1 hour, 2 hours, or 3 hours.

[0077] Optionally, the time period can be divided by counting the running conditions of the programs in the electronic device, and it is simultaneously determined whether the divided time period is an idle time period or a busy time period. In this way, the moment when the number of running programs changes compared to the first number threshold can be used as the moment when the idle time period and the busy time period intersect. After the electronic device is started, the number of currently running programs can be detected, and the moment of startup can be used as the starting time of the idle time period. If it is detected that the number of running programs is greater than the first number threshold, the moment when the number of programs is detected to be greater than the first number threshold can be used as the starting time of the busy time period, and the starting time is also the end time of an idle time period before the busy time period. If it is detected that the number of running programs is greater than the first number threshold, it is detected that the number of programs is not greater than the first number threshold after the number of running programs is greater than the first number threshold, the moment when the number of programs is detected to be less than the first number threshold will be used as the end time of the current busy time period, and the end time is also the start time of a new idle time period entered. In this way, the electronic device does not need to divide multiple time periods in advance, and thus has better flexibility.

[0078] Optionally, the time period can be divided by counting the occupancy of the processor in the electronic device, and synchronously determining whether the divided time period is an idle time period or a busy time period. In this way, the moment when the current occupancy of the processor changes compared to the first occupancy threshold can be used as the moment when the idle time period and the busy time period intersect. Among them, after the electronic device is started, the current occupancy of the processor can be detected, and the moment of startup can be used as the starting moment of the idle time period. If the occupancy of the processor is detected to be greater than the first occupancy threshold, the moment when the occupancy is detected to be greater than the first occupancy threshold can be used as the starting moment of the busy time period, and the starting moment is also the end moment of an idle time period before the busy time period. If after detecting that the occupancy is greater than the first occupancy threshold, it is detected that the occupancy is not greater than the first occupancy threshold, the moment when the occupancy is detected to be less than the first occupancy threshold will be used as the end moment of the current busy time period, and the end moment is also the start moment of a new idle time period entered.

[0079] In the case where there are multiple ways to divide the idle time period and the busy time period, the electronic device can flexibly determine which division method is currently used.

[0080] As a determination method, the user of the electronic device may determine the specific method of dividing the idle time period and the busy time period. As another method, the electronic device may determine the specific method of dividing the idle time period and the busy time period according to actual conditions.

[0081] Optionally, the method of dividing the idle time period and the busy time period may be determined according to the total running time of the electronic device after the electronic device is first started. Moreover, different division methods may result in different idle time periods and busy time periods.

[0082] It should be noted that in the early stage of using electronic devices, the user's program usage habits are relatively unstable. If the time periods are directly divided by counting the running status of the programs in the electronic devices, and the divided time periods are simultaneously determined to be idle time periods or busy time periods, the divided idle time periods and busy time periods may be inaccurate. Correspondingly, after the user has used the electronic device for a period of time, the running rules of the programs in the electronic device will be relatively fixed. In this case, it will be relatively more accurate to divide the idle time periods or busy time periods in real time based on the running status.

[0083] Furthermore, when the total running time of the electronic device after the first startup is less than the first specified time, multiple time periods can be pre-divided, and then the number of programs running in each time period can be counted, and then each time period can be divided into an idle time period or a busy time period according to the number of programs running in each time period. Correspondingly, when the total running time of the electronic device after the first startup is not less than the first specified time, the time period can be divided by counting the running status of the programs in the electronic device, and simultaneously determining whether the divided time period is an idle time period or a busy time period.

[0084] Optionally, if the occupancy level is greater than or equal to a target level threshold, and the current moment is in an idle time period of the electronic device, the memory pages in the second memory area are replaced, including: if the occupancy level is greater than or equal to a target level threshold, and the current moment is in an idle time period of the electronic device; obtaining the time interval between the current moment and the nearest busy time period in the future; if the time interval is less than the interval threshold, replacing the memory pages in the second memory area.

[0085] Among them, the time interval between the current moment and the nearest busy time period in the future can be understood as the time interval between the current moment and the start time of the busy time period. When the time interval is less than the interval threshold, it means that the busy time period is about to begin. In order to prepare memory space in advance, the memory pages in the second memory area can be replaced.

[0086] The present embodiment provides a memory page processing method, in which, when the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. Moreover, in the present embodiment, when it is detected that the occupancy level is greater than or equal to the target level threshold, it is further determined whether the current moment is in an idle time period, and when it is confirmed to be an idle time period, the memory pages in the second memory area are replaced, so that the memory can be prepared in advance for the future busy time period.

[0087] See also Figure 7 , a memory page processing device 400 provided in an embodiment of the present application runs on an electronic device, the memory of the electronic device includes a first memory area and a second memory area, the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, the device 400 includes:

[0088] The occupancy degree acquisition unit 410 is used to acquire the occupancy degree of the second memory area in response to updating the first memory area and the second memory area.

[0089] The memory replacement unit 420 is used to replace the memory pages in the second memory area if the occupancy level is greater than or equal to a target level threshold.

[0090] As a method, the memory replacement unit 420 is specifically configured to replace all memory pages in the second memory area.

[0091] Optionally, the memory replacement unit 420 is specifically used to estimate the memory usage demand of the electronic device within a specified time period in the future; if the usage demand meets the target demand condition, all memory pages in the second memory area are replaced. If the usage demand does not meet the target demand condition, some memory pages in the second memory area are replaced.

[0092] Optionally, the memory replacement unit 420 is further specifically used to determine the partial content page to be replaced based on the characteristics of the memory usage object of the memory page in the second memory area, wherein the characteristics include at least one of the type corresponding to the memory usage, the running priority and the memory access delay requirement.

[0093] As a method, the memory replacement unit 420 is specifically used to replace the memory pages in the second memory area if the occupancy level is greater than or equal to the target level threshold and the electronic device is currently in an idle time period.

[0094] Optionally, the memory replacement unit 420 is specifically used to obtain the time interval between the current moment and the nearest busy time period in the future if the occupancy level is greater than or equal to a target level threshold and the current moment is in an idle time period of the electronic device; if the time interval is less than the interval threshold, replace the memory pages in the second memory area.

[0095] A memory page processing device provided in this embodiment enables the acquisition of the occupancy level of the second memory area to be triggered each time the first memory area and the second memory area are updated, so that when the occupancy level in the second memory area is large, the replacement of the memory pages in the second memory area is triggered in time, thereby improving the timeliness of memory replacement.

[0096] 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.

[0097] The following will be combined Figure 8 An electronic device provided by the present application is described.

[0098] See also Figure 8 Based 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.

[0099] 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.

[0100] 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.

[0101] 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.

[0102] 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.

[0103] 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.

[0104] 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.

[0105] 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.

[0106] 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.

[0107] 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.

[0108] Please refer to Fig. 9 , 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.

[0109] 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.

[0110] The present application provides a memory page processing method, device and electronic device. When the memory of the electronic device includes a first memory area and a second memory area, and the activity level of the memory pages in the first memory area is higher than that of the memory pages in the second memory area, in response to updating the first memory area and the second memory area, the occupancy level of the second memory area is obtained, and if the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced. Thus, through the above-mentioned method, after each update of the first memory area and the second memory area, the occupancy level of the second memory area can be triggered to obtain, so that when the occupancy level in the second memory area is large, the replacement of the memory pages in the second memory area can be triggered in time, thereby improving the timeliness of memory replacement. Furthermore, in the present application, for small memory devices, this solution can effectively prevent the degradation of system performance due to memory shortage.

[0111] 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 an electronic device, the memory of the electronic device includes a first memory area and a second memory area, the activity level of the memory pages in the first memory area is higher than the activity level of the memory pages in the second memory area, and the method includes: In response to updating the first memory area and the second memory area, obtaining an occupancy level of the second memory area; If the occupancy level is greater than or equal to the target level threshold, the memory pages in the second memory area are replaced.

2. The method according to claim 1, characterized in that The replacing the memory page in the second memory area includes: All memory pages in the second memory area are replaced.

3. The method according to claim 2, characterized in that Before replacing all memory pages in the second memory area, the method further includes: Estimate the memory usage requirements of electronic devices within a specified period of time in the future; If the usage requirement meets the target requirement condition, the step of replacing all memory pages in the second memory area is performed.

4. The method according to claim 3, characterized in that The method further comprises: If the usage requirement does not meet the target requirement condition, some memory pages in the second memory area are replaced.

5. The method according to claim 4, characterized in that The method further comprises: The partial content pages to be replaced are determined according to the characteristics of the memory usage object in the memory page in the second memory area, wherein the characteristics include at least one of the type corresponding to the memory usage, the running priority, and the memory access delay requirement.

6. The method according to claim 1, characterized in that If the occupancy level is greater than or equal to a target level threshold, replacing memory pages in the second memory area includes: If the occupancy level is greater than or equal to the target level threshold, and the current moment is in an idle time period of the electronic device, the memory page in the second memory area is replaced.

7. The method according to claim 6, characterized in that If the occupancy level is greater than or equal to the target level threshold and the electronic device is currently in an idle time period, replacing the memory page in the second memory area includes: If the occupancy level is greater than or equal to the target level threshold, and the current moment is in the idle time period of the electronic device; Obtain the time interval between the current moment and the nearest busy time period in the future; If the time interval is less than the interval threshold, the memory page in the second memory area is replaced.

8. The method according to claim 1, characterized in that The updating of the first memory area and the second memory area includes: Storing the memory page loaded into the memory into the second memory area; Alternatively, transferring the accessed memory pages in the second memory area to the first memory area; Alternatively, memory pages in the first memory area that have not been accessed within a specified period of time are transferred to the second memory area.

9. A memory page processing device, characterized in that: Running on an electronic device, the memory of the electronic device includes a first memory area and a second memory area, the activity level of memory pages in the first memory area is higher than the activity level of memory pages in the second memory area, the device includes: an occupancy degree acquisition unit, configured to acquire an occupancy degree of the second memory area in response to updating the first memory area and the second memory area; A memory replacement unit is used to replace the memory pages in the second memory area if the occupancy level is greater than or equal to a target level threshold.

10. 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 8.

11. 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 8 is executed.

Citation Information

Cited By

  • Memory page processing method and device and electronic equipment

    CN119718609A

  • Memory page processing method, apparatus, and electronic device

    CN119718609B