Continuous memory allocation device and continuous memory allocation method
By calculating the file page bump value to decide whether to lend continuous memory, the problem of the existing technology being unable to take into account both memory usage efficiency and video playback speed, and achieving more efficient memory usage and faster video playback speed.
Patent Information
- Application Number
- CN202410561423.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-08-24
- Filing Date
- 2024-05-08
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art cannot take into account both the memory usage efficiency and the on-play speed of playing videos, especially when continuous memory needs to be recycled, the on-play speed of the videos is slower.
The file page bump value of the memory is calculated and the continuous memory is decided based on the relative relationship. When the file page bump value is large, the memory will be borrowed to improve the memory usage efficiency; when the file page bump value is small, the lent is prohibited to ensure the video playback speed.
It achieves the speed of video playback without sacrificing memory usage efficiency, and solves the problem that the prior art cannot take into account both memory efficiency and video playback speed.
Smart Images

Figure CN119512442A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a continuous memory allocation device and a continuous memory allocation method, and in particular to a continuous memory allocation device and a continuous memory allocation method for determining whether to lend continuous memory according to a file page bump value. Background Art
[0002] The Contiguous Memory Allocator (CMA) can provide contiguous memory to users in need. If the contiguous memory is not in use, the CMA can lend the contiguous memory to other users.
[0003] The Linux operating system tends to lend continuous memory to other users to improve memory usage efficiency. However, when there is a need to play a video, since the continuous memory is lent to other users, the Linux operating system needs to reclaim the continuous memory first, resulting in a slower start speed of the video.
[0004] Google's Android Common Kernels (ACK) excludes file system related parties from borrowing continuous memory, limiting the efficiency of memory usage. However, when there is a need to play a video, Google's Android Common Kernels has more continuous memory to speed up the start of the video. It can be seen that no matter what technology is used, it is impossible to achieve both memory usage efficiency and the start speed of playing videos. Summary of the invention
[0005] In view of the deficiencies of the prior art, one of the objectives of the present invention is (but not limited to) to provide a continuous memory allocation device and a continuous memory allocation method to improve the deficiencies of the prior art.
[0006] In some embodiments, the continuous memory allocation device includes a memory and a processor. The memory is used to store at least one instruction. The processor is used to read at least one instruction to perform the following steps: calculating a file page bump value of the memory; determining a relative relationship between the file page bump value and a preset bump value; and determining whether to lend the continuous memory according to the relative relationship.
[0007] In some embodiments, a processor reads at least one instruction stored in a memory to execute a continuous memory allocation method, which includes the following steps: calculating a file page jitter value of a memory; determining a relative relationship between the file page jitter value and a preset jitter value; and determining whether to lend continuous memory based on the relative relationship.
[0008] The technical means embodied in the embodiments of the present invention can improve at least one of the shortcomings of the prior art. The continuous memory allocation device and continuous memory allocation method of the present invention can determine whether to lend continuous memory according to the file page jitter value. When the file page jitter value is large, it means that the memory usage is large. At this time, the continuous memory is lent. In addition, when the file page jitter value is small, it means that the memory usage is small. At this time, the continuous memory is prohibited from being lent to speed up the start of the video. It can be seen that the present invention can achieve both memory usage efficiency and the start speed of playing the video.
[0009] The features, implementation and efficacy of the present invention are described in detail below with reference to the accompanying drawings for preferred embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic diagram of a continuous memory allocation device according to some embodiments of the present invention;
[0011] Figure 2 A flowchart of a method for allocating continuous memory according to some embodiments of the present invention is shown;
[0012] Figure 3 A flowchart of a method for allocating continuous memory according to some embodiments of the present invention is shown;
[0013] Figure 4 It is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention;
[0014] Figure 5 It is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention;
[0015] Figure 6 It is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention;
[0016] Figure 7 It is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention;
[0017] Figure 8 is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention; and
[0018] Fig. 9 The present invention is a schematic diagram showing the operation of a continuous memory allocation device according to some embodiments of the present invention.
[0019] Description of reference numerals:
[0020] 100: continuous memory allocation device 110: processor 120: memory
[0021] 200: Method 210-230: Step 300: Method
[0022] 310-340: Steps 410-440: Operations 510, 520: Operations
[0023] 610: Operation 710, 720: Operation 810, 820: Operation
[0024] 910~995:Operation DETAILED DESCRIPTION
[0025] All words used herein have their ordinary meanings. The definitions of the above words in commonly used dictionaries, including the use of any of the words discussed herein in the context of the present invention, are merely illustrative and should not limit the scope and meaning of the present invention. Similarly, the present invention is not limited to the various embodiments shown in this specification.
[0026] In order to improve the problem that no matter which technology of lending continuous memory is adopted, it is impossible to achieve both memory usage efficiency and video start speed, the present invention proposes a continuous memory allocation device and a continuous memory allocation method, which are described in detail as follows.
[0027] Figure 1 FIG. 1 is a schematic diagram of a continuous memory allocation device 100 according to some embodiments of the present invention. As shown in the figure, the continuous memory allocation device 100 includes a processor 110 and a memory 120. The memory 120 is used to store at least one instruction. The processor 110 is used to read at least one instruction to perform a continuous memory allocation operation. To make the operation of the continuous memory allocation device 100 easy to understand, please refer to FIG. Figure 2 , Figure 2 FIG. 2 is a flow chart of a method 200 for allocating continuous memory according to some embodiments of the present invention.
[0028] See also Figure 1 and Figure 2 In step 210, a file page thrashing value of the memory is calculated. For example, the processor 110 calculates the file page thrashing value of the memory 120. In some embodiments, the processor 110 calculates the file page thrashing value based on the number of currently frequently used file pages, the number of previously frequently used file pages, and the previous total number of file pages. The detailed formula is as follows:
[0029]
[0030] As shown in Formula 1, Value thash is the file page bump value (expressed in percentage %), fileinit The number of file pages that are frequently recovered and read per second. init The number of file pages that were frequently recovered and read in the previous second, file base is the total number of file pages in the previous second. The total number of file pages in the previous second may include the number of inactive file pages in the system and the number of active file pages in the system. Formula 1 calculates the number of file pages currently frequently used. work And the number of file pages frequently used in the previous second file init The difference in the number of file pages between the two, and then calculate the difference in the number of file pages and the total number of file pages in the previous second. base A percentage (%) is used as the file page bump value Value thash .
[0031] If the file page bump value Value calculated by formula 1 thash Low means that most file pages are kept in the memory page cache, and applications read file pages quickly, which also means that the overall memory demand of the current system is not large.
[0032] If the file page bump value Value calculated by formula 1 thash High: indicates that the current memory pressure is high and file pages are frequently recycled and read. When an application fails to read a recycled file page, reading it back to the memory again will cause delays. This also means that the overall memory demand of the current system is high.
[0033] In step 220, the relative relationship between the file page jitter value and the preset jitter value is determined. For example, the preset jitter value is proportional to the memory pressure of the memory 120. In other words, when the memory pressure of the memory 120 is relatively high, the preset jitter value is correspondingly set higher. After the preset jitter value is set, the processor 110 of the present invention can determine the relative relationship between the file page jitter value and the preset jitter value.
[0034] In some embodiments, the preset bump value is between 1% and 200%. In some embodiments, the preset bump value is between 5% and 150%. In some embodiments, the preset bump value is between 10% and 100%. In some embodiments, the preset bump value may be approximately 10%. In some embodiments, the preset bump value may be approximately 20%, 30%, 40%, or 50%.
[0035] In step 230, whether to lend the continuous memory is determined based on the relative relationship. For example, the processor 110 determines whether to lend the continuous memory based on the relative relationship between the file page bump value and the preset bump value. Since the present invention can determine and determine whether to lend the continuous memory based on the state of the memory 120, the present invention can solve the problem that the prior art cannot take into account both the memory usage efficiency and the start speed of playing the video.
[0036] In some embodiments, see Figure 3 , Figure 3 FIG. 3 is a flowchart of a method 300 for allocating continuous memory according to some embodiments of the present invention. Step 310 and Figure 2 The process is similar to step 210 and will not be described in detail here. In step 320, it is determined whether the file page jitter value is greater than the preset jitter value. For example, the processor 110 can determine whether the file page jitter value is greater than the preset jitter value. If the file page jitter value is greater than the preset jitter value, it means that the overall memory demand of the current system is large, and step 330 is executed to lend the continuous memory. If the file page jitter value is not greater than the preset jitter value, it means that the overall memory demand of the current system is not large, and step 340 is executed to prohibit lending the continuous memory.
[0037] Since the present invention can lend out continuous memory according to the file page bump value when the overall memory demand of the current system is large, so as to improve the memory usage efficiency. In addition, the present invention can not lend out memory according to the file page bump value when the overall memory demand of the current system is not large, so as to improve the start speed of the video playback. Therefore, the present invention can solve the problem that the prior art cannot take into account both the memory usage efficiency and the start speed of the video playback.
[0038] Figure 4 It is a schematic diagram of the operation of a continuous memory allocation device 100 according to some embodiments of the present invention. As shown in the figure, in operation 410, Linux, Android universal kernel (ACK) and the present invention all play the 4K video of streaming platform A first. Then, in operation 420, return to the main screen (such as executing the back to home launcher). Then, in operation 430, all three play the 4K video of streaming platform B. Then, in operation 440, return to the main screen. In some embodiments, streaming platform A may be YouTube, and streaming platform B may be Netflix, but the present invention is not limited to this, and it is only used to exemplify the implementation of the present invention. In other embodiments, other suitable streaming platforms such as Disney+ may also be used for implementation, depending on actual needs.
[0039] Please refer to the test results in Table 1 below. Figure 4In the operation, if Linux is used as the benchmark and set to 0.00%, the start speed of playing videos of the Android general kernel and the present invention is 26.68% and 24.34% faster respectively. It can be seen that the present invention can indeed improve the start speed of playing videos.
[0040] Table 1. Test results:
[0041] project Linux Android common kernel The present invention Third-party software 19.21% 0.00% 22.17% Figure 4 Operation 0.00% -26.68% -24.34% Figure 5 Operation 0.00% -24.18% -16.52% Figure 6 Operation 0.00% -52.66% -51.44% Figure 7 Operation 0.00% -13.75% -14.35% Figure 8 Operation 0.00% -26.83% -27.95% Fig. 9 Operation 0.00% -24.52% -24.06%
[0042] In addition, as shown in Table 1, if a third-party software (such as memory benchmark) is used for testing, if the Android general kernel is used as the benchmark and set to 0.00%, the performance of Linux and the present invention is improved by 19.21% and 22.17% respectively. It can be seen that the present invention can indeed improve the memory performance / efficiency.
[0043] Figure 5 The following is a schematic diagram of the operation of a continuous memory allocation device 100 according to some embodiments of the present invention. As shown in the figure, in operation 510, Linux, Android universal kernel and the present invention all play the 4K video of streaming platform A first. Then, in operation 520, all three directly play the 4K video of streaming platform B. For example, when the three are playing the 4K video of streaming platform A, the user directly presses the shortcut key to play streaming platform B, and then directly plays the 4K video of streaming platform B. Please refer to the test results in Table 1 above. If Linux is set as 0.00% as the benchmark, the start speed of the video playback of Android universal kernel and the present invention is 24.18% and 16.52% faster respectively. It can be seen that the present invention can indeed improve the start speed of playing the video.
[0044] Figure 6 Schematic diagram of the operation of a continuous memory allocation device 100 according to some embodiments of the present invention. As shown in the figure, in operation 610, Linux, Android universal kernel and the present invention all play the first episode of the 4K video of the A streaming platform. Then, when the first episode is finished, the three continue to play the second episode of the 4K video of the A streaming platform. Please refer to the test results in Table 1 above. If Linux is set as 0.00% as the benchmark, the start speed of the video played by the Android universal kernel and the present invention is 52.66% and 51.44% faster respectively. It can be seen that the present invention can indeed improve the start speed of the video.
[0045] Figure 7 and Figure 8 FIG. 1 is a schematic diagram showing the operation of a continuous memory allocation device 100 according to some embodiments of the present invention. Figure 7 and Figure 8In operations 710 and 810, Linux, Android universal kernel and the present invention are all powered on for two minutes. After two minutes, in operations 720 and 820, all three play 4K videos on streaming platform A or all three play 4K videos on streaming platform B. Please refer to the test results in Table 1 above. If Linux is used as the benchmark and set to 0.00%, then Figure 7 The Android general kernel and the present invention have a video playback start speed that is 13.75% and 14.35% faster, respectively. Figure 8 The start speed of playing videos of the Android universal kernel and the present invention is respectively 26.83% and 27.95% faster. It can be seen that the present invention can indeed improve the start speed of playing videos.
[0046] Fig. 9 The operation diagram of a continuous memory allocation device 100 according to some embodiments of the present invention is shown. As shown in the figure, in operation 910, Linux, Android universal kernel and the present invention all play the h264 codec video of the A streaming platform first. Then, in operation 920, return to the main screen. Then, in operation 930, all three play the 4K video of the B streaming platform. Then, in operation 940, return to the main screen. Furthermore, in operation 950, all three play the VP9 codec video of the A streaming platform. Then, in operation 960, return to the main screen. Then, in operation 970, all three play the 4K video of the B streaming platform. Then, in operation 980, return to the main screen. Furthermore, in operation 990, all three play the AVI codec video of the A streaming platform. Then, in operation 995, return to the main screen. Please refer to the test results in Table 1 above. If Linux is used as the benchmark and set to 0.00%, the start speed of the video playback of the Android general kernel and the present invention is 24.52% and 24.06% faster respectively. It can be seen that the present invention can indeed improve the start speed of the video playback.
[0047] It should be noted that the present invention is not based on Figures 1 to 9 The embodiments shown are limited to one embodiment of the present invention, which is only used to exemplarily illustrate one of the implementation methods of the present invention to make the technology of the present invention easy to understand. The protection scope of the present invention shall be based on the definition of the claims of the present invention. Those skilled in the art shall make modifications and modifications to the embodiments of the present invention without departing from the spirit of the present invention and still fall within the protection scope of the present invention.
[0048] In summary, the continuous memory allocation device and continuous memory allocation method of the present invention can determine whether to lend continuous memory according to the file page bump value. When the file page bump value is large, it means that the memory usage is large. At this time, the continuous memory is lent. In addition, when the file page bump value is small, it means that the memory usage is small. At this time, the continuous memory is prohibited from being lent to speed up the start of the movie. It can be seen that the present invention can achieve both memory usage efficiency and the start speed of playing the movie.
[0049] Although the embodiments of the present invention are described above, these embodiments are not intended to limit the present invention. A technician with ordinary knowledge in the technical field may make changes to the technical features of the present invention based on the explicit or implicit contents of the present invention. These changes all fall within the scope of protection sought by the present invention. In other words, the scope of protection of the present invention shall be based on the definition of the claims of the present invention.
Claims
1. A continuous memory allocation device, comprising: a memory for storing at least one instruction; as well as A processor, configured to read the at least one instruction to execute the following steps: Calculating a file page bump value of the memory; Determining a relative relationship between the file page jitter value and a preset jitter value; as well as Whether to lend a continuous memory is determined according to the relative relationship.
2. The continuous memory allocation device according to claim 1, characterized in that: The processor is further configured to read the at least one instruction to execute the following steps: Determining whether the file page jitter value is greater than the preset jitter value; and If the file page bump value is greater than the preset bump value, the continuous memory is loaned out.
3. The continuous memory allocation device according to claim 1, characterized in that: The processor is further configured to read the at least one instruction to execute the following steps: Determining whether the file page jitter value is greater than the preset jitter value; and If the file page bump value is not greater than the preset bump value, lending the continuous memory is prohibited.
4. The continuous memory allocation device according to claim 1, characterized in that: The preset bump value is proportional to a storage pressure of the storage.
5. The continuous memory allocation device according to claim 1, characterized in that: The preset bump value is between 1 percent and 200 percent.
6. The continuous memory allocation device according to claim 1, characterized in that: The preset jolting value includes 10 percent.
7. The continuous memory allocation device according to claim 1, characterized in that: The processor is further configured to read the at least one instruction to execute the following steps: The file page bump value is calculated according to a current frequently used file page number, a previous frequently used file page number and a previous total file page number.
8. The continuous memory allocation device according to claim 1, characterized in that: The processor is further configured to read the at least one instruction to execute the following steps: Calculating a file page number difference between a current frequently used file page number and a previous frequently used file page number; and The file page bump value is calculated as the file page bump value by calculating the file page number difference and a percentage of a previous total file page number.
9. A method for allocating a continuous memory, wherein a processor reads at least one instruction stored in a memory to execute the method, comprising: Calculating a file page bump value of the memory; Determining a relative relationship between the file page jitter value and a preset jitter value; as well as Whether to lend a continuous memory is determined according to the relative relationship.
10. The method for allocating continuous memory according to claim 9, wherein the step of determining the relative relationship between the file page bump value and the preset bump value comprises: Determining whether the file page jitter value is greater than the preset jitter value; The step of determining whether to lend the continuous memory according to the relative relationship comprises: If the file page bump value is greater than the preset bump value, lending the continuous memory; If the file page bump value is not greater than the preset bump value, lending the continuous memory is prohibited.