CN111858057B - Distribution method and device of running memory, computer equipment and storage medium - Google Patents

Distribution method and device of running memory, computer equipment and storage medium Download PDF

Info

Publication number
CN111858057B
CN111858057B CN202010723095.5A CN202010723095A CN111858057B CN 111858057 B CN111858057 B CN 111858057B CN 202010723095 A CN202010723095 A CN 202010723095A CN 111858057 B CN111858057 B CN 111858057B
Authority
CN
China
Prior art keywords
type
page
pages
target
computer device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010723095.5A
Other languages
Chinese (zh)
Other versions
CN111858057A (en
Inventor
李培锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN202010723095.5A priority Critical patent/CN111858057B/en
Publication of CN111858057A publication Critical patent/CN111858057A/en
Application granted granted Critical
Publication of CN111858057B publication Critical patent/CN111858057B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Abstract

The application discloses a method and a device for allocating operating memory, computer equipment and a storage medium, and belongs to the technical field of computers. The method is used in a computer device, and comprises the following steps: acquiring a first page quantity according to a page application request; in response to the first page number being less than the target number, recycling the running memory; acquiring a recovery attribute in the process of recovering the operating memory; responding to the recovery attribute meeting the target recovery attribute, and acquiring a third type page of the first quantity difference; and taking the target type pages with the first number of pages and the third type pages with the first number difference as distribution pages distributed by the computer equipment in response to the page application request. According to the method and the device, the third type page can be flexibly used as the first type page to be allocated through the computer equipment, so that the flexibility of allocating the running memory of the computer equipment is improved, and the efficiency of allocating the running memory of the computer equipment is improved.

Description

Distribution method and device of running memory, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for allocating an operating memory, a computer device, and a storage medium.
Background
With the rapid development of computer technology, a variety of computer devices are available in people's daily lives. Among them, the operating memory of computer equipment is often of great concern.
Currently, for an operating system of a computer device, the operating system of the computer device may manage and allocate its running memory. For the allocation of the operating memory, the operating system usually divides the operating memory in a page form, and then allocates the operating memory according to the divided operating memory. When the running memory needs to be used in the computer equipment, the operating system can allocate the pages with the corresponding number, so that the running memory with the corresponding size is allocated, and the normal running of the computer equipment is further ensured. Among these pages, the computer device also classifies these pages, assigning corresponding page types, such as: type A, type B, etc.
In the related art, when the operating memory of the computer device is not sufficiently allocated, the memory is often recovered and the recovered operating memory is then reallocated, which causes the problems of long time spent by the computer device in allocating the operating memory, low efficiency, and the like.
Disclosure of Invention
The embodiment of the application provides a method and a device for allocating an operating memory, a computer device and a storage medium, which can improve the efficiency of allocating the operating memory when a certain type of page of the computer device is insufficient. The technical scheme is as follows:
in one aspect, an embodiment of the present application provides a method for allocating operating memory, where the method is executed by a computer device, and the method includes:
acquiring a first page quantity according to a page application request, wherein the page application request is used for requesting allocation of a target quantity of pages of a first type, the pages are used for indicating a division result of an operating memory in the computer equipment, the first page quantity is the quantity of the pages of a target type, and the target type comprises the first type and a second type;
in response to the first page number being less than the target number, recycling the running memory;
in the process of recovering the operating memory, obtaining a recovery attribute, wherein the recovery attribute is used for indicating at least one of the efficiency or the duration of the computer equipment for recovering the operating memory;
responding to the recovery attribute meeting a target recovery attribute, and acquiring a third type of page with a first quantity difference value, wherein the first quantity difference value is the difference value between the target quantity and the first page quantity, and the matching degree of the first type of page and the second type of page is higher than that of the first type of page and the third type of page;
taking the pages of the target type with the first number of pages and the pages of the third type with the first number difference as allocation pages allocated by the computer device in response to the page application request.
In another aspect, an embodiment of the present application provides an allocation apparatus for operating a memory, where the apparatus is used in a computer device, and the apparatus includes:
a quantity obtaining module, configured to obtain a first page quantity according to a page application request, where the page application request is used to request allocation of a target quantity of pages of a first type, and the page is used to indicate a partition result of an operating memory in the computer device, where the first page quantity is the quantity of the pages of a target type, and the target type includes the first type and a second type;
the memory recycling module is used for recycling the running memory in response to the fact that the number of the first pages is smaller than the target number;
the attribute acquisition module is used for acquiring a recovery attribute in the process of recovering the operating memory, wherein the recovery attribute is used for indicating the efficiency or duration of recovering the operating memory by the computer equipment;
a page obtaining module, configured to obtain, in response to a recycle attribute satisfying a target recycle attribute, a third type of page with a first number of difference values, where the first number of difference values is a difference value between the target number and the first number of pages, and a matching degree between the first type of page and the second type of page is higher than a matching degree between the first type of page and the third type of page;
a page allocation module, configured to use the pages of the target type with the first number of pages and the pages of the third type with the first number of difference values as allocation pages allocated by the computer device in response to the page application request.
In another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the method for allocating an operating memory as described above.
In another aspect, an embodiment of the present application provides a computer-readable storage medium, where at least one instruction, at least one program, a code set, or a set of instructions is stored in the storage medium, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by a processor to implement the method for allocating an operating memory as described above.
In another aspect, embodiments of the present application provide a computer program product including computer instructions, which are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and executes the computer instructions, so that the computer device executes the allocation method of the operating memory provided by the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the method and the device, the recovery attribute used for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained in the operating memory recovery process of the computer device, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for distribution, the problem of low distribution efficiency caused by too long time of computer device distribution when the operating memory is recovered is solved, the flexibility of the computer device for distributing the operating memory is increased, and the efficiency of the computer device for distributing the operating memory is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for allocating an operating memory according to an exemplary embodiment of the present application;
fig. 2 is a flowchart of a method for allocating an operating memory according to an exemplary embodiment of the present application;
fig. 3 is a flowchart of a method for allocating an operating memory according to an exemplary embodiment of the present application;
fig. 4 is a flowchart of a method for allocating operating memory according to an exemplary embodiment of the present application;
fig. 5 is a block diagram illustrating a configuration of an allocation apparatus for operating a memory according to an exemplary embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The scheme provided by the application can be used in a real scene that when people use computer equipment with an operating memory in daily life, the computer equipment responds to the operation of an application program of the computer equipment and allocates the operating memory for the operating application program, and for convenience of understanding, first, some terms related to the embodiment of the application and the structure of the terminal are briefly introduced below.
An Operating System (OS) is a computer program that manages and controls hardware and software resources of a computer device, and is a collection of System software that manages hardware resources of a computer device, controls the execution of other programs, and provides an interactive interface for a user.
Running Memory (RAM): refers to the memory of a computer device when running an application program and may also be referred to as a running or random access memory or a system memory. The operating memory may typically serve as a temporary storage medium for the operating system or other programs being executed.
The Linux operating system comprises: is a cloning system developed based on the Unix (U.S.) operating system.
With the rapid development of the technical field of computers, the daily life of people is greatly facilitated. The user can run various application programs by using the computer device, and in the process of running various application programs by using the computer device, the operating system of the computer device often allocates a running memory with a corresponding size to the running application programs, so that the normal operation of the user is ensured.
Alternatively, the computer device may be a terminal having an operating memory, for example, the terminal may be a mobile phone, a tablet computer, an electronic book reader, smart glasses, a smart watch, an MP3 player (Moving Picture Experts Group Audio Layer III, motion Picture Experts Group Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion Picture Experts Group Audio Layer 4), a notebook computer, a laptop computer, a desktop computer, and the like.
Optionally, the computer device may also be a server, or a plurality of servers, or a virtualization platform, or a cloud computing service center.
Alternatively, the operating system of the computer device may be any one of an Android operating system, a BSD (Berkeley Software Distribution) operating system, an iOS operating system, a Linux operating system, a Mac OS X operating system, a Windows Phone (WP) operating system, a z/OS operating system, and the like.
In a possible implementation manner, the operating system of the computer device manages and allocates the running memory of the operating system by also according to a page allocation manner. For example, for a computer device, an operating system of the computer device is a Linux operating system, a running memory is 6GB (gigabytes), the computer device can divide the running memory with the size of 6GB based on its own Linux operating system to obtain pages of various types, and management allocation of the running memory is realized by calling and allocating the pages.
After the operating system of the computer device divides the running memory, a fixed number of various pages are obtained. For example, there are 5 pages of the first type, 3 pages of the second type, 8 pages of the third type, 4 pages of the fourth type, 3 pages of the fifth type, and so on. When the operating system of the computer device runs the application program, if the running of the application program needs 2 pages of the second type, the operating system of the computer device can correspondingly allocate 2 pages of the second type from the divided pages to the application program, so that the computer device can normally run the application program.
Optionally, if an application needs to be allocated 2 pages of the fourth type by the operating system, and 4 pages of the fourth type in the computer device are all occupied (equivalent to that type of page is exhausted), or 1 page of the fourth type remains, the operating system of the computer device cannot allocate 2 pages of the fourth type to the application for the moment, and the computer device may recycle the allocated running memory, so that the number of pages of the fourth type is more than two, and then allocate 2 pages of the fourth type to the application.
In the related art, in order to improve the efficiency of allocating and operating the memory for the computer device, the operating system may not perform memory recovery when all the 4 pages of the fourth type are occupied, and obtain the pages (for example, the pages of the first type and the pages of the second type) with higher matching degree with the pages of the fourth type. Alternatively, the degree of matching between different types of pages may be set by a developer. That is, when a certain application needs to be allocated with 2 pages of the fourth type by the operating system, and at this time, 4 pages of the fourth type in the computer device are all occupied, the operating system may further acquire 2 pages of the first type when the number of the pages of the first type is more than 2, and allocate the 2 pages of the first type to the application for use, thereby avoiding a delay problem caused by the computer device recycling the running memory.
However, in the computer device, since the page with higher matching degree corresponding to the certain type of page may also be exhausted, if the page with lower matching degree corresponding to the certain type of page is idle, according to the related art, the page with lower matching degree is not acquired by the computer device, so as to execute the recycling of the operating memory.
For example, the matching degree between the page of the fourth type and the page of the fifth type is low, the matching degree between the page of the fourth type and the page of the first type and the page of the second type is higher than the matching degree between the page of the fourth type and the page of the fifth type, the operating system needs to allocate the page of the fourth type, and the number of the fourth type pages is not enough, the operating system may acquire the first type pages, the second type pages, but not the fifth type pages, and at this time, if the first type of page, the second type of page are exhausted and the fifth type of page is remained in the computer device, the operating system can not acquire the fifth type of page, and executing the recovery of the operating memory also easily causes the problems of long time spent by the computer device in allocating the operating memory, low efficiency and the like. In the application, the computer device may also obtain the page of the fifth type, and allocate the page of the fifth type to the currently required application program, so that the time taken for the computer device to allocate the operating memory is reduced, and the efficiency for the computer device to allocate the operating memory is improved.
In order to reduce the time taken by the computer device to allocate the operating memory and improve the efficiency of allocating the operating memory by the computer device, the present application provides a solution, please refer to fig. 1, which shows a flowchart of a method for allocating the operating memory according to an exemplary embodiment of the present application. The method can be applied to the computer equipment with the operating memory and executed by the computer equipment. As shown in fig. 1, the method for allocating operating memory may include the following steps:
step 101, acquiring a first page number according to a page application request.
The page application request is used for requesting allocation of a target number of pages of a first type, the pages are used for indicating a partition result of a running memory in the computer equipment, the number of the pages of the first type is the number of the pages of the target type, and the target type comprises the first type and a second type. That is, the computer device may obtain, according to the page application request, the number of the first type of pages and the second type of pages that include the allocation requested by the page application request.
Alternatively, the page application request may be generated when an application program is run in the computer device, and the target number may be determined by the application program. The application program may be an application program carried by the computer device, or an application program installed subsequently by the computer device.
Step 102, in response to the first page number being less than the target number, the operating memory is recycled.
Optionally, the computer device may detect a size relationship between the first number of pages and the target number, and execute the step of recycling the running memory when the first number of pages is smaller than the target number.
Step 103, in the process of recovering the operating memory, a recovery attribute is obtained, and the recovery attribute is used for indicating at least one of efficiency or duration of the computer device in recovering the operating memory.
Optionally, in the process of recycling the operating memory, the computer device may further obtain at least one of efficiency or duration of recycling the operating memory of the computer device as a recycling attribute.
And 104, responding to the recovery attribute meeting the target recovery attribute, and acquiring the third type page with the first quantity difference.
The first quantity difference is the difference between the target quantity and the first page quantity, wherein the matching degree of the first type page and the second type page is higher than the matching degree of the first type page and the third type page. Alternatively, the matching degree between different types of pages may be preset by a developer.
Alternatively, the computer device may detect a relationship between the recycle attribute and the target recycle attribute, and acquire the third type of page of the first number of difference values in a case where the acquired recycle attribute satisfies the target recycle attribute.
And 105, taking the target type pages with the first number of pages and the third type pages with the first number of difference values as distribution pages distributed by the computer equipment in response to the page application request.
That is, the computer device allocates the target type pages of the first number of pages and the third type pages of the first number difference, and responds to the page application request to ensure the normal operation of the computer device.
To sum up, in the method and the device, the recovery attribute for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained by the computer device in the operating memory recovery process, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for allocation, the problem of low allocation efficiency caused by too long allocation of the computer device when the operating memory is recovered is avoided, the flexibility of the computer device for allocating the operating memory is increased, and the efficiency of the computer device for allocating the operating memory is improved.
In a possible implementation manner, when a computer device runs a certain application program or code, the computer device may create a corresponding process, and actively generate a page application request for the created process, and through the page application request, an operating system of the computer device automatically allocates a target number of certain types of pages.
The scheme shown in fig. 1 is described by taking an example that a computer device actively generates a page application request, and a recycle attribute set by a developer is used for indicating the efficiency of recycling an operating memory of the computer device. Referring to fig. 2, a flowchart of a method for operating a memory allocation method according to an exemplary embodiment of the present application is shown. The method can be applied to the computer equipment with the operating memory and executed by the computer equipment. As shown in fig. 2, the method for allocating operating memory may include the following steps:
step 201, responding to the trigger operation of the first process, generating a page application request.
Wherein the first process is any one of processes spawned in the computer device. The page application request is used for requesting allocation of a target number of pages of a first type, and the pages are used for indicating a partition result of an operating memory in the computer equipment. Alternatively, the first type may be determined by the application itself.
Optionally, after the operating memory is divided in the computer device, various types of pages can be obtained, and the computer device allocates the operating memory through the various types of pages. When a certain application program is run or a certain code program is executed in the computer device, the computer device may correspondingly create a process, and the process needs a certain size of running memory, at this time, the computer device may correspondingly generate a page application request, and request the running memory of a corresponding size, that is, request the operating system to allocate a certain number of certain types of pages to the page application request.
For example, the running memory of the computer device is 4GB, and after the operating system divides the running memory of the computer device, 5 pages of type a, 3 pages of type B, 8 pages of type C, and 4 pages of type D are obtained. When the first application program runs in the computer device, the computer device creates a process, and the computer device can respond to the creation of the process to generate a page application request for requesting the operating system to allocate 3 pages of the type A.
Step 202, recording the time of generating the page application request.
Optionally, in this embodiment of the present application, when generating a page application request, the computer device may record a current time of generating the page application request. For example, a page application request is generated at point 11 and point 12 in the computer device, and the computer device may record point 11 and point 12 corresponding to the page application request, indicating the creation time of the page application request.
Step 203, obtaining the first type according to the page application request.
Optionally, the computer device may obtain the type and number of the pages requested to be allocated from the page application request. That is, if the page application request needs to obtain the target number of pages of the first type, the computer device may obtain the first type and the target number according to the page application request. For example, if the page application request needs to obtain 3 pages of the a type, the computer device may obtain the a type and 3 according to the page application request.
Step 204, obtaining a first number of pages according to the first type.
Wherein the first number of pages is a number of pages of a target type, the target type including a first type and a second type. That is, the computer device may directly obtain the number of pages of the first type and the number of pages of the second type according to the obtained first type. And the matching degree between the first type of page and the second type of page is higher than the threshold value of the matching degree.
Optionally, the developer may set a first matching table, where the first matching table includes types whose matching degrees respectively corresponding to the types are higher than a threshold matching degree. Please refer to table 1, which shows a correspondence table of a first matching table referred to in an exemplary embodiment of the present application.
First type Of the second type
Type A B type, C type, D type
Type B Type A, type C, type D
Type C Type A, type D
…… ……
TABLE 1
As shown in table 1, if the first type is a type, there are B type, C type, D type, etc. if the matching degree with the page of the first type is higher than the threshold value of the matching degree.
Optionally, when the computer device obtains the number of the first pages according to the first type, the number of the first type of pages may be obtained according to the first type first. Judging whether the number of the pages of the first type is smaller than the target number requested in the page application request, and acquiring a second type by the computer equipment according to the first type and the first matching relation in response to the fact that the number of the pages of the first type is smaller than the target number; acquiring the number of the pages of the second type according to the second type; and acquiring the number of the first pages according to the number of the first type pages and the number of the second type pages.
That is, the computer device searches the pages of the first type from the various types of pages left by the computer device according to the first type, and counts the number of the remaining pages of the first type. For example, the first type is a type a, and after obtaining the type a, the computer device finds that the number of pages of the type a in the remaining various types of pages is 2, so that the computer device obtains the number of pages of the first type as 2.
Optionally, if the number of targets requested in the page application request is 3, the computer device acquires the number of targets as 3 while acquiring the first type, and in this step, the computer device may determine whether the number of acquired pages of the first type is smaller than the number of targets requested in the page application request. Here, the number of the pages of the type a is 2, the target number is 3, and the computer device determines that the number of the acquired pages of the first type is smaller than the target number requested in the page application request, then, according to the first type and the first matching relationship, the second type is acquired, that is, according to the table 1, the second type corresponding to the first type is queried, and according to the second type, the number of the pages of the second type is acquired. Here, the manner in which the computer device obtains the number of the pages of the second type according to the second type may refer to the manner in which the computer device obtains the number of the pages of the first type according to the first type, and details are not described here.
After obtaining the number of pages of the first type and the number of pages of the second type, the computer device may sum the two to obtain the number of first pages. For example, if the number of the type a pages is 2, the number of the type B pages is 1, the number of the type C pages is 0, and the number of the type D pages is 2, then the number of the first pages obtained by the computer device is 5.
Optionally, if the computer device determines that the number of the first type pages is not less than the target number, the computer device may further obtain the target number of the first type pages in response to that the number of the first type pages is not less than the target number; and taking the target number of the pages of the first type as distribution pages distributed by the computer equipment in response to the page application request.
That is, in this step, if the computer device determines that the number of the first type pages is not less than the target number, it indicates that the number of the remaining first type pages in the computer device is sufficient to meet the target number requested in the page application request of this time, and the computer device may directly allocate the target number of the first type pages in the remaining first type pages to the first process, complete the response to the page application request, and end the process.
In step 205, in response to the first number of pages being less than the target number, the operating memory is recycled.
Optionally, after obtaining the first number of pages, the computer device may determine a size relationship between the first number of pages and the target number, and perform recycling of the operating memory in response to the first number of pages being smaller than the target number. For example, the computer device obtains, according to the first type, that the number of the first pages is 3 and the target number is 5, and the computer device may determine that the number of the first pages is smaller than the target number, which indicates that the number of the remaining first pages in the computer device at this time cannot meet the requirement of the page application request, and needs to recycle the allocated pages and reallocate the pages to the first process.
In step 206, the recovery time of the operating memory and the size of the recovered operating memory are obtained.
Optionally, the computer device may periodically obtain the recycling time of the running memory and the size of the running memory that has been recycled in the process of running memory recycling. For example, the computer device collects the recovery condition of the running memory every 2 milliseconds, including the recovery time point and the size of the running memory. For example, at 11 o 'clock 20 minutes, the running memory recovered by the computer device is 156MB (megabyte), then the recovery time point of the running memory acquired by the computer device is 11 o' clock 20 minutes, and the size of the recovered running memory is 156 MB.
Step 207, obtaining a recycling attribute according to the time of generating the page application request, the recycling time of the operating memory and the size of the recycled operating memory, wherein the recycling attribute is used for indicating the efficiency of the computer device for recycling the operating memory.
Optionally, in this embodiment, the recycling attribute is used to indicate efficiency of the computer device for recycling the operating memory, so in this step, the computer device may obtain the efficiency of the computer device for recycling the operating memory according to time for generating the page application request, recycling time of the operating memory, and a size of the recycled operating memory.
For example, in the process that the computer device executes the recycling of the operating memory in response to that the number of the first pages is smaller than the target number, the computer device obtains the recycling time of the operating memory and the size of the operating memory that has been recycled at a first time, and subtracts the time of generating the page application request recorded in the step 202 from the first time obtained at this time to obtain a first time length, where the first time length is used to indicate a time period from the generation of the page application request to the recycling of the operating memory.
And dividing the size of the recycled operation memory by the first time length to obtain the recycling efficiency, and taking the recycling efficiency as a recycling attribute. For example, the time for generating the page application request recorded in step 202 is 11 o 'clock 15 minutes, the recovery time of the operating memory acquired in step 206 is 11 o' clock 15 minutes 20 milliseconds, and the size of the operating memory that has been recovered is 156MB, then the computer device may obtain the first time length as 20 milliseconds (ms), the recovery efficiency as 7.8MB/ms, and use the recovery efficiency as the recovery attribute.
In response to the recycling attribute being less than the recycling efficiency threshold, a third type of page of the first number of difference values is obtained, step 208.
The first quantity difference is the difference between the target quantity and the first page quantity, wherein the matching degree of the first type page and the second type page is higher than the matching degree of the first type page and the third type page.
Optionally, the developer may set a second matching table, where the second matching table includes types whose matching degrees respectively corresponding to the types are lower than the threshold value of the matching degree. Please refer to table 2, which shows a corresponding relationship table of a second matching table referred to in an exemplary embodiment of the present application.
First type Third type
Type A Type E
Type B F type, H type
Type C Type G
…… ……
TABLE 2
As shown in table 2, if the first type is the a type, there is the E type in which the matching degree with the page of the first type is lower than the matching degree threshold.
Alternatively, the manner in which the computer device obtains the third type of page may be as follows: the computer equipment responds to the recovery attribute meeting the target recovery attribute, and obtains a third type according to the first type and the second matching relation; acquiring a first quantity difference value according to the target quantity and the first page quantity; and acquiring the third type page with the first quantity difference according to the third type and the first quantity difference.
The manner of obtaining the third type of page with the first number difference by the computer device according to the third type and the first number difference may be as follows: acquiring a second page number according to the third type, wherein the second page number is the number of the pages of the third type; and responding to the second page number not less than the first number difference, and acquiring a third type page of the first number difference.
In this embodiment, the recovery attribute is used to indicate efficiency of the computer device in recovering the operating memory, and correspondingly, a recovery efficiency threshold may be preset in the computer device, the computer device compares the calculated recovery efficiency with the recovery efficiency threshold, and when the recovery attribute is smaller than the recovery efficiency threshold, the third type page with the first quantity difference is obtained.
For example, the computer device may calculate a difference between the target number and the first page number, and when the first page number is smaller than the target number and the recycling attribute is smaller than the recycling efficiency threshold, the computer device may obtain a third type according to the table 2, query remaining pages of the third type, obtain a second page number, determine a size relationship between the second page number and the first number difference, and when the second page number is not smaller than the first number difference, the computer device obtains the third type page of the first number difference. For example, the page application request is used to request allocation of 3 a-type pages, the computer device obtains that the first number of pages (including B-type, C-type, and D-type) is 2 in the above process, and determines that the recycling efficiency is smaller than the recycling efficiency threshold (that is, the recycling attribute satisfies the target recycling attribute), and the computer device obtains an E-type page with a first number of difference (1).
In a possible implementation manner, the computer device may further recycle the running memory in response to that the second page number is smaller than the first number difference; acquiring a first type page with a first quantity difference from the page corresponding to the recycled running memory; and taking the target type pages with the first page quantity, the third type pages with the second page quantity and the first type pages with the first quantity difference as distribution pages distributed by the computer equipment in response to the page application request.
That is, the number of the third type pages is not enough to meet the requirement of the first process, and at this time, the computer device may recycle the running memory and directly obtain the first type pages with the first number difference from the pages corresponding to the recycled running memory. Optionally, the manner in which the computer device obtains the first type of pages with the first quantity difference from the pages corresponding to the recycled operating memory may refer to the manner in which the computer device obtains the first type of pages with the target quantity, which is not described herein again, and finally, the target type of pages with the first page quantity, the third type of pages with the second page quantity, and the first type of pages with the first quantity difference are used as allocation pages for the computer device to allocate in response to the page application request, so as to end the process of page allocation this time.
In a possible implementation manner, the computer device may further obtain, in response to the recycle attribute not meeting the target recycle attribute, a first type of page with a first number of difference values from the pages corresponding to the recycled operating memory; and taking the target type pages with the first number of pages and the first type pages with the first number difference as distribution pages distributed by the computer equipment in response to the page application request. That is, the recovery efficiency obtained by the computer device is greater than the recovery efficiency threshold, and the computer device may directly obtain the first type of page with the first quantity difference from the page corresponding to the recovered operating memory; and finally, taking the pages with the target type and the pages with the first type of the first number difference as distribution pages distributed by the computer equipment in response to the page application request, and ending the process of distributing the pages.
Step 209, the target type pages with the first number of pages and the third type pages with the first number of differences are used as allocation pages for the computer device to allocate in response to the page application request.
Optionally, the computer device obtains the target type pages of the first page quantity from the remaining target type pages, and obtains the third type pages of the first quantity difference from the remaining third type pages, and uses these pages as allocation pages to be allocated by the computer device in response to the page application request, thereby ending the process of page allocation this time.
In one possible implementation, the computer device may obtain a target number of pages of the target type in response to the first number of pages not being less than the target number; and taking the target number of the target type pages as distribution pages distributed by the computer equipment in response to the page application request. That is, in step 205, it is determined that the first number of pages is not less than the target number, which indicates that the remaining pages of the target type in the computer device can satisfy the page application request, so the computer device may directly obtain the target number of pages of the target type and allocate the pages.
To sum up, in the method and the device, the recovery attribute for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained by the computer device in the operating memory recovery process, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for allocation, the problem of low allocation efficiency caused by too long allocation of the computer device when the operating memory is recovered is avoided, the flexibility of the computer device for allocating the operating memory is increased, and the efficiency of the computer device for allocating the operating memory is improved.
In a possible implementation manner, the scheme shown in fig. 1 is described by taking an example that a computer device actively generates a page application request, and a recycle attribute set by a developer is used to indicate a duration of recycling an operating memory of the computer device.
Referring to fig. 3, a flowchart of a method for operating a memory allocation method according to an exemplary embodiment of the present application is shown. The method can be applied to the computer equipment with the operating memory and executed by the computer equipment. As shown in fig. 3, the method for allocating operating memory may include the following steps:
step 301, responding to the trigger operation of the first process, generating a page application request.
Step 302, recording the time of generating the page application request.
Step 303, obtaining the first type according to the page application request.
In step 304, a first number of pages is obtained according to the first type.
Step 305, in response to the first number of pages being less than the target number, the operating memory is recycled.
The descriptions in step 301 to step 305 may refer to the descriptions in step 201 to step 205 in the embodiment of fig. 2, and are not repeated here.
Step 306, obtaining the recovery time of the operating memory.
Optionally, the computer device may also periodically obtain the recovery time of the operating memory during the process of operating memory recovery. For example, the computer device collects the recovery condition of the running memory every 2 milliseconds, including the recovery time point of the running memory. For example, the operating memory is recycled at 11 o 'clock 20 minutes, and in the recycling process of the operating memory, the recycling time of the operating memory is acquired as 11 o' clock 20 minutes and 20 milliseconds.
Step 307, acquiring a recycling attribute according to the time for generating the page application request and the recycling time of the operating memory, wherein the recycling attribute is used for indicating the duration for recycling the operating memory by the computer device.
Optionally, in this embodiment of the present application, the recycling attribute is used to indicate the duration of the running memory being recycled by the computer device, so in this step, the computer device may obtain a time difference between the time when the page application request is generated and the recycling time of the running memory, and use the time difference as the duration of the running memory being recycled by the computer device.
For example, in the process that the computer device executes the recycling of the operating memory in response to that the number of the first pages is smaller than the target number, the computer device obtains the recycling time of the operating memory at a first time, and subtracts the time of generating the page application request recorded in the step 302 from the first time obtained at this time to obtain a first time, where the first time is used as the recycling attribute.
Step 308, in response to the recycling attribute not being greater than the recycling delay threshold, obtaining a third type of page of the first number of difference values.
In this embodiment, the recovery attribute is a time length for indicating the computer device to recover and run the memory, and correspondingly, a recovery delay threshold may be preset in the computer device, the computer device compares the calculated first time length with the recovery delay threshold, and obtains a third type of page with the first quantity difference when the first time length is greater than the recovery efficiency threshold.
Optionally, the manner of obtaining the third type page with the first number difference in this step may also refer to the description in step 208, and is not described herein again.
Step 309, taking the target type pages with the first number of pages and the third type pages with the first number difference as allocation pages allocated by the computer device in response to the page application request.
The descriptions in step 308 to step 309 may refer to the descriptions in step 208 to step 209 in the embodiment of fig. 2, and are not repeated here.
To sum up, in the method and the device, the recovery attribute for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained by the computer device in the operating memory recovery process, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for allocation, the problem of low allocation efficiency caused by too long allocation of the computer device when the operating memory is recovered is avoided, the flexibility of the computer device for allocating the operating memory is increased, and the efficiency of the computer device for allocating the operating memory is improved.
In the following, the embodiment shown in fig. 2 is described with an example of several interfaces, in which an operating system of the computer device is a Linux operating system, and various types of pages are removable pages, non-removable pages, urgent pages, recyclable pages of a recycle page, and continuous pages of a tma page.
Referring to fig. 4, a flowchart of a method for operating a memory allocation method according to an exemplary embodiment of the present application is shown. The method may be used in a computer device having an operating memory, and the computer device executes the method, as shown in fig. 4, where the method for allocating the operating memory may include the following steps:
step 401, a page application request is generated.
Optionally, the user may start the voice wake-up function in the terminal in advance, and the terminal may wake up the terminal after receiving the wake-up voice when the terminal starts the voice wake-up function, so as to execute other steps of the present application. In a possible implementation manner, a user may set the voice wake-up function to be turned on and off in a setting interface of the terminal, and in this step, the user turns on the voice wake-up function of the terminal.
Step 402, recording the generation time of the page application request.
Wherein the page application request is for requesting a target number of the movable pages.
In step 403, it is detected whether there are a target number of movable pages.
If so, go to step 413, otherwise go to step 404.
In step 404, the difference between the target number and the remaining movable pages is obtained.
In step 405, it is detected whether there are recyclable pages having a difference between the target number and the number of remaining movable pages.
That is, the pages of the first type and the second type described above are equivalent between the movable page and the recyclable page. If so, go to step 413, and if not, go to step 406.
Step 406, executing the recovery of the operating memory.
Step 407, in the process of recovering the operating memory, obtaining the recovering time of the operating memory.
Step 408, calculating a time difference between the recovery time of the operating memory and the generation time of the page application request.
That is, in this embodiment, the recycling attribute is also used to instruct the computer device to recycle the duration of the running memory.
Step 409, detecting whether the time difference is greater than a time threshold.
If so, go to step 410, otherwise go to step 406.
Step 410, obtain the emergency page.
The movable page and the emergency page are equivalent to the pages of the first type and the third type.
In step 411, it is detected whether the number of urgent pages is greater than the difference between the target number and the number of remaining movable pages.
If so, go to step 412, otherwise go to step 406.
In step 412, the number of emergency pages that is the difference between the target number and the number of remaining movable pages is stolen.
In step 413, page allocation is performed.
To sum up, in the method and the device, the recovery attribute for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained by the computer device in the operating memory recovery process, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for allocation, the problem of low allocation efficiency caused by too long allocation of the computer device when the operating memory is recovered is avoided, the flexibility of the computer device for allocating the operating memory is increased, and the efficiency of the computer device for allocating the operating memory is improved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 5, a block diagram of an allocation apparatus for operating a memory according to an exemplary embodiment of the present application is shown. The allocation apparatus 500 for operating memory may be used in a computer device to execute all or part of the steps executed by the computer device in the methods provided in the embodiments shown in fig. 1, fig. 2, fig. 3, or fig. 4. The allocation apparatus 500 for operating memory may include: a number obtaining module 501, a memory recycling module 502, an attribute obtaining module 503, a page obtaining module 504, and a page allocating module 505.
The number obtaining module 501 is configured to obtain a first number of pages according to a page application request, where the page application request is used to request allocation of a target number of pages of a first type, where the pages are used to indicate a partition result of an operating memory in the computer device, the first number of pages is the number of pages of a target type, and the target type includes the first type and a second type;
the memory recycling module 502 is configured to recycle the operating memory in response to that the first number of pages is smaller than the target number;
the attribute obtaining module 503 is configured to obtain a recycling attribute in the process of recycling the operating memory, where the recycling attribute is used to indicate efficiency or duration of the computer device for recycling the operating memory;
the page obtaining module 504 is configured to, in response to the recycle attribute satisfying a target recycle attribute, obtain a third type of page with a first number of difference values, where the first number of difference values is a difference value between the target number and the first number of pages, and a matching degree between the first type of page and the second type of page is higher than a matching degree between the first type of page and the third type of page;
the page allocation module 505 is configured to use the pages of the target type with the first number of pages and the pages of the third type with the first number of difference values as allocation pages allocated by the computer device in response to the page application request.
To sum up, in the method and the device, the recovery attribute for indicating at least one of the efficiency and the duration of the computer device for recovering the operating memory is obtained by the computer device in the operating memory recovery process, and when the recovery attribute meets the target recovery attribute, the page of the third type with lower matching degree with the first type is obtained, so that the page of the third type is flexibly used as the page of the first type for allocation, the problem of low allocation efficiency caused by too long allocation of the computer device when the operating memory is recovered is avoided, the flexibility of the computer device for allocating the operating memory is increased, and the efficiency of the computer device for allocating the operating memory is improved.
Optionally, in response to the recycling attribute, indicating the efficiency of the computer device for recycling the operating memory;
the page obtaining module 504 is further configured to obtain the page of the third type of the first number difference value in response to the recycling attribute being smaller than a recycling efficiency threshold.
Optionally, the apparatus further comprises:
a request generating module, configured to generate a page application request in response to a trigger operation of a first process before obtaining a first page quantity according to the page application request;
the time recording module is used for recording the time for generating the page application request;
the attribute obtaining module 503 includes: a first acquisition unit and a second acquisition unit;
the first obtaining unit is configured to obtain a recovery time of the operating memory and a size of the recovered operating memory;
the second obtaining unit is configured to obtain the recycling attribute according to the time for generating the page application request, the recycling time of the operating memory, and the size of the recycled operating memory.
Optionally, in response to the recycle attribute, instructing the computer device to recycle the duration of the running memory;
the page obtaining module 504 is further configured to obtain the page of the third type of the first number of difference values in response to the recycling attribute not being greater than a recycling delay threshold.
Optionally, the attribute obtaining module 503 includes: a third acquisition unit and a fourth acquisition unit;
the third obtaining unit is configured to obtain a recovery time of the operating memory;
and the fourth obtaining unit is configured to obtain the recycling attribute according to the recycling time of the operating memory and the time of generating the page application request.
Optionally, the apparatus further comprises:
a first obtaining module, configured to obtain, in response to that the recovery attribute does not satisfy a target recovery attribute, the first type page of the first quantity difference from the page corresponding to the recovered operating memory;
a first allocation module, configured to use the pages of the target type with the first number of pages and the pages of the first type with the first number difference as allocation pages allocated by the computer device in response to the page application request.
Optionally, the number obtaining module 501 includes: a fifth acquiring unit and a sixth acquiring unit;
the fifth obtaining unit is configured to obtain the first type according to the page application request;
the sixth obtaining unit is configured to obtain the first number of pages according to the first type.
Optionally, the sixth obtaining unit includes: a first acquisition subunit, a second acquisition subunit, a third acquisition subunit and a fourth acquisition subunit;
the first obtaining subunit is configured to obtain, according to the first type, the number of the pages of the first type;
the second obtaining subunit is configured to, in response to that the number of the pages of the first type is smaller than the target number, obtain the second type according to the first type and a first matching relationship;
the third obtaining subunit is configured to obtain, according to the second type, the number of the pages of the second type;
the fourth obtaining subunit is configured to obtain the number of the first pages according to the number of the pages of the first type and the number of the pages of the second type.
Optionally, the apparatus further comprises:
a second obtaining module, configured to obtain the target number of the pages of the first type in response to that the number of the pages of the first type is not less than the target number;
a second allocating module, configured to use the target number of the pages of the first type as an allocation page allocated by the computer device in response to the page application request.
Optionally, the page obtaining module 504 includes: a seventh acquiring unit, an eighth acquiring unit and a ninth acquiring unit;
the seventh obtaining unit, configured to, in response to the recycle attribute satisfying the target recycle attribute, obtain the third type according to the first type and a second matching relationship;
the eighth obtaining unit is configured to obtain the first number difference according to the target number and the first page number;
the ninth obtaining unit is configured to obtain the page of the third type with the first number difference according to the third type and the first number difference.
Optionally, the ninth obtaining unit includes: a fifth acquisition subunit and a sixth acquisition subunit;
the fifth obtaining subunit is configured to obtain, according to the third type, a second number of pages, where the second number of pages is the number of pages of the third type;
the sixth obtaining subunit is configured to, in response to that the second number of pages is not less than the first number difference, obtain the third type of page of the first number difference.
Optionally, the apparatus further comprises:
the first recovery module is used for recovering the running memory in response to the fact that the number of the second pages is smaller than the first number difference;
a second obtaining module, configured to obtain the first type page with the first quantity difference from the recovered page corresponding to the operating memory;
the page allocating module 505 is further configured to use the pages of the target type in the first number of pages, the pages of the third type in the second number of pages, and the pages of the first type with the first number difference as allocated pages to be allocated by the computer device in response to the page application request.
Optionally, the apparatus further comprises:
a third obtaining module, configured to obtain the target number of the pages of the target type in response to that the first number of pages is not less than the target number;
and the second allocation module is used for taking the target number of the pages of the target type as allocation pages allocated by the computer equipment in response to the page application request.
Fig. 6 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present application. As shown in fig. 6, the computer apparatus 600 includes a Central Processing Unit (CPU) 601, a system Memory 604 including a Random Access Memory (RAM) 602 and a Read Only Memory (ROM) 603, and a system bus 605 connecting the system Memory 604 and the CPU 601. The computer device 600 also includes a basic Input/Output System (I/O System) 606 for facilitating information transfer between devices within the computer, and a mass storage device 607 for storing an operating System 612, application programs 613, and other program modules 614.
The basic input/output system 606 includes a display 608 for displaying information and an input device 609 such as a mouse, keyboard, etc. for a user to input information. Wherein the display 608 and the input device 609 are connected to the central processing unit 601 through an input output controller 610 connected to the system bus 605. The basic input/output system 606 may also include an input/output controller 610 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input/output controller 610 may also provide output to a display screen, a printer, or other type of output device.
The mass storage device 607 is connected to the central processing unit 601 through a mass storage controller (not shown) connected to the system bus 605. The mass storage device 607 and its associated computer-readable media provide non-volatile storage for the computer device 600. That is, the mass storage device 607 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM (Compact disk Read-Only Memory) drive.
The computer readable media may include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash Memory or other solid state Memory technology, CD-ROM, DVD (Digital Video Disc) or other optical, magnetic, tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 604 and mass storage device 607 described above may be collectively referred to as memory.
The computer device 600 may be connected to the internet or other network devices through a network interface unit 611 connected to the system bus 605.
The memory further includes one or more programs, the one or more programs are stored in the memory, and the central processing unit 601 implements all or part of the steps executed by the computer device in the methods provided by the above embodiments of the present application by executing the one or more programs.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as a memory comprising computer programs (instructions), executable by a processor of a computer device to perform all or part of the steps of the methods shown in the various embodiments of the present application, is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM (Compact Disc Read-Only Memory) drive, a magnetic tape, a floppy disk, an optical data storage device, and the like. Optionally, the storage medium has at least one instruction, at least one program, a code set, or a set of instructions stored therein, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the method for allocating operating memory according to the above embodiments.
Embodiments of the present application also provide a computer program product including computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the allocation method of the operating memory provided in the various alternative implementations of the foregoing embodiments.
It should be noted that: when the allocation apparatus for the operating memory provided in the foregoing embodiment executes the allocation method for the operating memory, only the foregoing embodiments are described as examples, and in an actual program, the function allocation may be completed by different functional modules according to needs, that is, an internal structure of a device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (16)

1. A method for allocating operating memory, the method being performed by a computer device, the method comprising:
acquiring a first page quantity according to a page application request, wherein the page application request is used for requesting allocation of a target quantity of pages of a first type, the pages are used for indicating a division result of an operating memory in the computer equipment, the first page quantity is the quantity of the pages of a target type, and the target type comprises the first type and a second type;
in response to the first page number being less than the target number, recycling the running memory;
in the process of recovering the operating memory, obtaining a recovery attribute, wherein the recovery attribute is used for indicating at least one of the efficiency or the duration of the computer equipment for recovering the operating memory;
responding to the recovery attribute meeting a target recovery attribute, and acquiring a third type of page with a first quantity difference value, wherein the first quantity difference value is the difference value between the target quantity and the first page quantity, and the matching degree of the first type of page and the second type of page is higher than that of the first type of page and the third type of page;
taking the pages of the target type with the first number of pages and the pages of the third type with the first number difference as allocation pages allocated by the computer device in response to the page application request.
2. The method of claim 1, wherein the efficiency of the computer device in reclaiming the operating memory is indicated in response to the reclamation attribute;
the obtaining a third type of the page of the first number of differences in response to the recycle attribute satisfying a target recycle attribute comprises:
and acquiring the page of the third type of the first number difference value in response to the recycling attribute being smaller than a recycling efficiency threshold.
3. The method of claim 2, further comprising, prior to said obtaining a first number of pages in accordance with a page request,:
responding to the trigger operation of the first process, and generating the page application request;
recording the time for generating the page application request;
in the process of recovering the operating memory, obtaining a recovery attribute includes:
acquiring the recovery time of the operating memory and the size of the recovered operating memory;
and acquiring the recycling attribute according to the time for generating the page application request, the recycling time of the operating memory and the size of the recycled operating memory.
4. The method of claim 1, wherein the length of time that the computer device is to reclaim the operating memory is indicated in response to the reclaim attribute;
the obtaining a third type of the page of the first number of differences in response to the recycle attribute satisfying a target recycle attribute comprises:
and acquiring the page of the third type of the first number of difference values in response to the recycle attribute not being greater than a recycle delay threshold.
5. The method according to claim 4, wherein the obtaining a recycling attribute during the recycling of the operating memory comprises:
acquiring the recovery time of the operating memory;
and acquiring the recycling attribute according to the recycling time of the operating memory and the time for generating the page application request.
6. The method of any of claims 1 to 5, further comprising:
responding to the recovery attribute not meeting the target recovery attribute, and acquiring the first type of pages with the first quantity difference from the recovered pages corresponding to the running memory;
taking the pages of the target type with the first number of pages and the pages of the first type with the first number difference as allocation pages allocated by the computer device in response to the page application request.
7. The method according to any one of claims 1 to 5, wherein the obtaining a first number of pages according to a page application request comprises:
acquiring the first type according to the page application request;
and acquiring the first page number according to the first type.
8. The method of claim 7, wherein obtaining a first number of pages according to the first type comprises:
acquiring the number of the pages of the first type according to the first type;
responding to the situation that the number of the pages of the first type is smaller than the target number, and acquiring the second type according to the first type and a first matching relation;
acquiring the number of the pages of the second type according to the second type;
and acquiring the number of the first pages according to the number of the pages of the first type and the number of the pages of the second type.
9. The method of claim 8, further comprising:
responding to the number of the pages of the first type not less than the target number, and acquiring the pages of the first type of the target number;
and taking the target number of the pages of the first type as distribution pages distributed by the computer equipment in response to the page application request.
10. The method of any of claims 1 to 5, wherein said obtaining a first number of difference values for said page of a third type in response to said recycle attribute satisfying a target recycle attribute comprises:
responding to the recovery attribute meeting the target recovery attribute, and acquiring the third type according to the first type and a second matching relationship;
acquiring the first quantity difference value according to the target quantity and the first page quantity;
and acquiring the page of the third type of the first quantity difference value according to the third type and the first quantity difference value.
11. The method according to claim 10, wherein said obtaining said page of said third type for said first number of differences according to said third type and said first number of differences comprises:
acquiring a second page number according to the third type, wherein the second page number is the number of the pages of the third type;
and responding to the second page quantity not less than the first quantity difference value, and acquiring the page of the third type of the first quantity difference value.
12. The method of claim 11, further comprising:
in response to the second page number being less than the first number difference, recovering the running memory;
acquiring the first type page of the first quantity difference from the recovered page corresponding to the running memory;
taking the pages of the target type with the first number of pages, the pages of the third type with the second number of pages, and the pages of the first type with the first number difference as allocation pages allocated by the computer device in response to the page application request.
13. The method of claim 1, further comprising:
responding to the first page number not less than the target number, and acquiring the target number of the pages of the target type;
and taking the target number of the pages of the target type as a distribution page distributed by the computer equipment in response to the page application request.
14. An allocation apparatus for operating memory, the apparatus being used in a computer device, the apparatus comprising:
a quantity obtaining module, configured to obtain a first page quantity according to a page application request, where the page application request is used to request allocation of a target quantity of pages of a first type, and the page is used to indicate a partition result of an operating memory in the computer device, where the first page quantity is the quantity of the pages of a target type, and the target type includes the first type and a second type;
the memory recycling module is used for recycling the running memory in response to the fact that the number of the first pages is smaller than the target number;
the attribute acquisition module is used for acquiring a recovery attribute in the process of recovering the operating memory, wherein the recovery attribute is used for indicating the efficiency or duration of recovering the operating memory by the computer equipment;
a page obtaining module, configured to obtain, in response to a recycle attribute satisfying a target recycle attribute, a third type of page with a first number of difference values, where the first number of difference values is a difference value between the target number and the first number of pages, and a matching degree between the first type of page and the second type of page is higher than a matching degree between the first type of page and the third type of page;
a page allocation module, configured to use the pages of the target type with the first number of pages and the pages of the third type with the first number of difference values as allocation pages allocated by the computer device in response to the page application request.
15. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, set of codes, or set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the method of allocating operating memory according to any one of claims 1 to 13.
16. A computer-readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement a method of allocating operating memory as claimed in any one of claims 1 to 13.
CN202010723095.5A 2020-07-24 2020-07-24 Distribution method and device of running memory, computer equipment and storage medium Active CN111858057B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010723095.5A CN111858057B (en) 2020-07-24 2020-07-24 Distribution method and device of running memory, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010723095.5A CN111858057B (en) 2020-07-24 2020-07-24 Distribution method and device of running memory, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111858057A CN111858057A (en) 2020-10-30
CN111858057B true CN111858057B (en) 2022-04-15

Family

ID=72950565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010723095.5A Active CN111858057B (en) 2020-07-24 2020-07-24 Distribution method and device of running memory, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111858057B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593298A (en) * 2013-10-16 2014-02-19 北京航空航天大学 Memory recovery method and device
CN106030499A (en) * 2014-05-28 2016-10-12 株式会社日立制作所 Computer system and computer system control method
CN106843756A (en) * 2017-01-13 2017-06-13 中国科学院信息工程研究所 Memory pages recovery method and system based on page classifications
CN107153493A (en) * 2016-03-02 2017-09-12 阿里巴巴集团控股有限公司 The distribution method and device of business object
US10152428B1 (en) * 2017-07-13 2018-12-11 EMC IP Holding Company LLC Virtual memory service levels
CN111414254A (en) * 2020-03-19 2020-07-14 Oppo广东移动通信有限公司 Device management method, device, storage medium and electronic device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7853771B2 (en) * 2005-04-12 2010-12-14 International Business Machines Corporation Page allocation management for virtual memory
US7814292B2 (en) * 2005-06-14 2010-10-12 Intel Corporation Memory attribute speculation
US10303618B2 (en) * 2012-09-25 2019-05-28 International Business Machines Corporation Power savings via dynamic page type selection

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593298A (en) * 2013-10-16 2014-02-19 北京航空航天大学 Memory recovery method and device
CN106030499A (en) * 2014-05-28 2016-10-12 株式会社日立制作所 Computer system and computer system control method
CN107153493A (en) * 2016-03-02 2017-09-12 阿里巴巴集团控股有限公司 The distribution method and device of business object
CN106843756A (en) * 2017-01-13 2017-06-13 中国科学院信息工程研究所 Memory pages recovery method and system based on page classifications
US10152428B1 (en) * 2017-07-13 2018-12-11 EMC IP Holding Company LLC Virtual memory service levels
CN111414254A (en) * 2020-03-19 2020-07-14 Oppo广东移动通信有限公司 Device management method, device, storage medium and electronic device

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A unified framework for designing high performance in-memory and hybrid memory file systems;XianzhangChen等;《Journal of Systems Architecture》;elsevier;20180831;第68卷;第51-64页 *
一种面向实时数据库存储引擎的设计与实现;刘波等;《计算机技术与发展》;20110810(第08期);第34-38页 *
可变分区存储管理方式的内存分配回收;宋新伟;《电脑知识与技术》;20140425;第10卷(第12期);第2880-2882页 *
基于新型非易失性存储器的移动终端性能优化研究;钟刊;《中国博士学位论文全文数据库 信息科技辑》;中国学术期刊(光盘版)电子杂志社;20190415(第04期);I137-5 *

Also Published As

Publication number Publication date
CN111858057A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN109857555B (en) Memory recovery method and device, storage medium and electronic equipment
CN102650931B (en) Method and system for writing data
CN110247984B (en) Service processing method, device and storage medium
CN111078406B (en) Memory management method and device, storage medium and electronic equipment
CN107533435B (en) Storage space allocation method and storage equipment
CN114096953A (en) Memory management method and device, electronic equipment and computer readable medium
CN109753361B (en) Memory management method, electronic equipment and storage device
CN112667405B (en) Information processing method, device, equipment and storage medium
CN114416352A (en) Computing resource allocation method and device, electronic equipment and storage medium
WO2008006674A1 (en) Reserve pool management in virtualized storage systems
CN111309440B (en) Method and equipment for managing and scheduling multiple types of GPUs
CN110895492A (en) Device control method, device, storage medium and electronic device
WO2022001136A1 (en) Inode number distribution management method for distributed storage system and related component
CN111090521A (en) Memory allocation method and device, storage medium and electronic equipment
CN115495025B (en) Method and device for managing abnormal memory block
CN114996173B (en) Method and device for managing write operation of storage equipment
CN110633130A (en) Virtual memory management method and device based on memory hot plug technology
CN113867644A (en) Disk array optimization method and device, computer equipment and storage medium
CN115421909A (en) Memory management method and device, electronic equipment and storage medium
CN111522659B (en) Space use method and device
CN110019475B (en) Data persistence processing method, device and system
CN111858057B (en) Distribution method and device of running memory, computer equipment and storage medium
CN105677481A (en) Method and system for processing data and electronic equipment
WO2023236930A1 (en) Memory allocation method and apparatus based on ion allocator, electronic device, and readable storage medium
CN109086223B (en) Method and device for controlling garbage recovery

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant