Memory operation method, electronic device and non-transitory computer readable medium
By using compression algorithms and direct memory access technology under the condition of limited memory resources to compress and preload applications into the compressed data area of volatile memory, the problem of slow application loading speed in the existing technology is solved, and faster application loading and boot speed are achieved.
Patent Information
- Application Number
- CN202410332299.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-22
- Publication Date
- 2025-09-23
AI Technical Summary
When memory resources are limited, existing technologies cannot effectively improve the loading speed of applications, especially when loading from non-volatile memory to volatile memory, which takes a long time.
The application is compressed into a compressed format file using a compression algorithm and preloaded into a compressed data area of a volatile memory. The loading process is accelerated through direct memory access technology and the application is decompressed into the volatile memory.
Significantly improves the loading speed of applications, especially when memory resources are limited, reducing loading time and improving user experience.
Smart Images

Figure CN120687020A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an operating method, and more particularly to a memory operating method, an electronic device, and a non-transitory computer-readable medium. Background Art
[0002] In applications such as over-the-top (OTT) services and digital video set-top boxes (STBs), application launch speed often impacts the user experience. To speed up application launch, a common practice is to preload frequently used and important applications into high-speed memory, such as double-data-rate synchronous dynamic random-access memory (DDR SDRAM). However, rising costs have led to shrinking memory specifications (e.g., reduced memory capacity), further reducing the number of applications that can be preloaded into memory. If an application cannot be preloaded into memory, it must be loaded from non-volatile memory into high-speed memory after the user clicks on the application. With current technology, preloading an application into high-speed memory and then launching it (i.e., launching it a second time) takes approximately 1 to 2 seconds, while loading it from non-volatile memory (i.e., launching it a first time) takes approximately 7 to 8 seconds. Clearly, there is a significant difference in the time it takes to load applications from memory between the two approaches. Summary of the Invention
[0003] The object of the present invention is to provide a memory operation method and an electronic device, which can load frequently used applications into the memory at a faster speed for execution under the condition of limited memory resources.
[0004] One aspect of the present invention provides a memory operation method, comprising: compressing at least one application program in a non-volatile memory into at least one compressed format file using a compression algorithm; preloading the at least one compressed format file from the non-volatile memory into a compressed data area in a volatile memory; obtaining an image of the compressed data area based on the at least one compressed format file preloaded into the compressed data area, and writing the image back to the non-volatile memory; and decompressing the at least one compressed format file in the volatile memory into at least one application program.
[0005] In some embodiments, the non-volatile memory complies with the eMMC (Embedded MultiMediaCard) flash memory standard.
[0006] Another aspect of the present invention provides an electronic device comprising a non-volatile memory, a volatile memory, and a processor. The non-volatile memory is configured to store at least one application. The volatile memory is configured to store at least one compressed file, wherein the volatile memory further includes a compressed data area. The processor is configured to compress the at least one application in the non-volatile memory into the at least one compressed file using a compression algorithm, preload the at least one compressed file from the non-volatile memory into the compressed data area in the volatile memory, then obtain an image of the compressed data area based on the at least one compressed file preloaded into the compressed data area, write the image back to the non-volatile memory, and then decompress the at least one compressed file into the at least one application in the volatile memory.
[0007] In some embodiments, the processor is further configured to remove at least one function library shared by at least one application after preloading each of at least one compressed format file of at least one application into the compressed data area in the volatile memory.
[0008] In some embodiments, the processor removes at least one function library shared by at least one application program in an offline manner.
[0009] In some embodiments, the processor is further configured to adjust and reduce the compressed data area before obtaining the image of the compressed data area according to at least one compression format file preloaded into the compressed data area.
[0010] In some embodiments, the processor performs the operation of adjusting and shrinking the compressed data area in an offline manner.
[0011] In some embodiments, the processor loads at least one compressed format file from the non-volatile memory to the compressed data area in the volatile memory in an offline manner.
[0012] In some embodiments, the processor performs the operation of obtaining the image of the compressed data area according to at least one compression format file loaded into the compressed data area in an offline manner.
[0013] Another aspect of the present invention is to provide a non-transitory computer-readable medium for storing one or more computer program instructions. When these computer program instructions are executed by a processor, the processor performs the following operations: compressing at least one application in a non-volatile memory into at least one compressed format file using a compression algorithm; preloading at least one compressed format file from the non-volatile memory to a compressed data area in a volatile memory; obtaining an image of the compressed data area based on the at least one compressed format file preloaded into the compressed data area, and writing the image back to the non-volatile memory; and decompressing at least one compressed format file in the volatile memory into at least one application. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] To make the above and other objects, features, advantages and embodiments of the present invention more apparent, the accompanying drawings are described as follows:
[0015] Figure 1 is a flow chart of a memory operation method according to an embodiment of the present invention;
[0016] Figure 2 is a flowchart of a system on a chip (SOC) software activation procedure according to an embodiment of the present invention; and
[0017] Figure 3 FIG. 4 is a functional block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following detailed description of the embodiments of the present invention is provided. It will be appreciated that the embodiments provide many applicable concepts that can be implemented in a variety of specific contexts. The embodiments discussed and disclosed are for illustration only and are not intended to limit the scope of the present invention.
[0019] Figure 1 FIG. 1 is a flow chart of a memory operation method 100 according to an embodiment of the present invention. The memory operation method 100 includes steps S110 to S140, which are described below.
[0020] Step S110: Compress at least one application in the non-volatile memory into at least one compressed format file using a compression algorithm. This step illustrates that the processor compresses relatively important and frequently used applications in the non-volatile memory into a compressed format file using a compression algorithm, and stores the compressed format file in the non-volatile memory in block-based format. It should be noted that this non-volatile memory complies with the eMMC (Embedded MultiMediaCard) flash memory standard. In one embodiment of the present invention, the compression algorithm can be, but is not limited to, the LZ4 compression algorithm, the LZO compression algorithm, or the zlib compression algorithm.
[0021] Step S120: Preload at least one compressed format file from the non-volatile memory into the compressed data area of the volatile memory. This step illustrates that the processor preloads the compressed format file from the non-volatile memory into the compressed data area of the volatile memory and then stores the compressed format file in a page-based manner in the volatile memory. In one embodiment of the present invention, the processor can perform the operation of loading the compressed format file from the non-volatile memory into the compressed data area of the volatile memory offline.
[0022] In some embodiments, to increase the speed of preloading a compressed format file from a non-volatile memory to a compressed data area in a volatile memory, a memory space may be reserved in the non-volatile memory (e.g., flash memory) for mapping to a page of the compressed data area in the volatile memory. During the loading process of the compressed format file, direct memory access (DMA) technology may be utilized to load the compressed format file into the compressed data area in the volatile memory. Compared to a general application program that loads a compressed format file from a non-volatile memory to a compressed data area in a volatile memory in block form and then executes the application program in a page-by-page manner, the method of loading the compressed format file into the compressed data area in the volatile memory via direct memory access technology can increase the speed of preloading the compressed format file of the application program from the non-volatile memory to the volatile memory.
[0023] In some embodiments, when there are multiple sets of commonly used applications, one or more compressed data areas (e.g., ZRAM) may be allocated in the volatile memory for use by each of the multiple sets of applications. Specifically, the processor preloads a separate compressed format file for each set of applications from the non-volatile memory into a separately allocated compressed data area in the volatile memory.
[0024] Step S130: Obtain an image of the compressed data area based on at least one compression format file preloaded into the compressed data area, and write the image back to the non-volatile memory. This step illustrates that the processor obtains the image of the compressed data area based on the compression format file preloaded into the compressed data area, and writes the image of the compressed data area back to the non-volatile memory for use when the same batch of frequently used applications is preloaded next time. In some embodiments, the processor may not write the image back to the non-volatile memory.
[0025] In one embodiment of the present invention, after preloading each compressed format file into the compressed data area of the volatile memory, the processor removes at least one function library shared by the applications to reduce the memory space redundantly occupied by the applications. It should be noted that the processor can perform the removal of the function library shared by the applications offline.
[0026] In another embodiment of the present invention, before obtaining an image of the compressed data area based on the compression format file preloaded into the compressed data area, the processor will adjust and shrink the compressed data area to maximize the utilization rate of the compressed data area, thereby saving the memory space of the volatile memory occupied by the compressed data area as much as possible. It should be noted that the operation of the processor adjusting and shrinking the compressed data area can be performed offline.
[0027] In another embodiment of the present invention, the operation of the processor obtaining the image of the compressed data area according to the compression format file loaded into the compressed data area can be performed in an offline manner.
[0028] Generally speaking, the processor performs steps S110 to S130 online to obtain an image of a compressed data area in a volatile memory composed of files in a compression format of commonly used applications. It should be noted that when the processor performs steps S110 to S130 online, any compression algorithm such as the LZ4 compression algorithm, the LZO compression algorithm, or the zlib compression algorithm can be used, but is not limited thereto. Furthermore, steps S110 to S130 can also be performed offline. Specifically, operations such as the processor loading the compressed format file from the non-volatile memory to the compressed data area in the volatile memory, the processor removing the function library shared by the application, the processor adjusting and shrinking the compressed data area based on the compressed format file preloaded into the compressed data area, and the processor obtaining the image of the compressed data area based on the compressed format file loaded into the compressed data area can all be performed offline, and a memory space is reserved in the non-volatile memory for mapping to the compressed data area in the volatile memory. When the electronic device (such as a smart phone, a smart bracelet, a tablet computer, etc.) is turned on, the reserved memory space in the non-volatile memory is loaded into the volatile memory, and the compressed data area in the volatile memory is established based on the obtained image. Compared with loading online, in the process of performing steps S110 to S130 in an offline manner, since steps S110 to S130 have been completed offline, the compression algorithm used has been selected, and the loading speed of the compressed format file of the application loaded by the processor in an offline manner is faster than the loading speed of the compressed format file of the application loaded by the processor in an online manner.
[0029] Step S140: Decompress at least one compressed format file into at least one application program in the volatile memory. This step illustrates that the processor decompresses the compressed format file preloaded from the non-volatile memory into the volatile memory into the application program in the volatile memory. Generally, the processor decompresses the compressed format file in the non-volatile memory into the application program at runtime and then loads the application program into the volatile memory. In contrast, preloading the compressed format file from the non-volatile memory into the volatile memory and then decompressing the compressed format file into the application program in the volatile memory can significantly increase the application loading speed.
[0030] In one embodiment of the present invention, when the available memory space of a volatile memory (e.g., a double data rate synchronous dynamic random access memory) is about to be exhausted and space in the compressed data area is needed, the processor removes (swap out) the compressed format files of an application that has been idle in the compressed data area for a long time and has not been used. When the application is needed again in the future, the processor compresses the application into one or more compressed format files and preloads them into the compressed data area of the volatile memory again.
[0031] Figure 2 FIG2 is a flow chart of a method 200 for activating system on a chip (SOC) software according to an embodiment of the present invention. Generally speaking, the method 200 for activating system on a chip (SOC) software includes steps S210 to S230, which are described below.
[0032] Step S210: Load the read-only memory from the read-only memory within the integrated circuit (IC) to the random access memory, and initialize the non-volatile memory and the volatile memory. It should be noted that the non-volatile memory complies with the eMMC flash memory standard, and the volatile memory is double data rate synchronous dynamic random access memory (DDRSDRAM).
[0033] Step S220 : Load the operating system from the non-volatile memory (eg, flash memory) to the volatile memory (eg, DDR SDRAM), and initialize the input / output (I / O) interface and one or more registers.
[0034] Step S230: Load the application program from the non-volatile memory to the volatile memory, and the processor allocates a memory space for each application program loaded into the volatile memory.
[0035] The memory operation method 100 can be used to improve the application loading speed of the system-on-chip software activation method 200. Specifically, it optimizes the portion of loading the application from the non-volatile memory to the volatile memory described in step S230 to increase the application loading speed. Specifically, in step S110, at least one application in the non-volatile memory is compressed into at least one compressed format file using a compression algorithm. Then, in step S120, the at least one compressed format file is preloaded from the non-volatile memory into a compressed data area in the volatile memory. Then, in step S130, an image of the compressed data area is obtained based on the at least one compressed format file preloaded into the compressed data area and the image is written back to the non-volatile memory. Finally, in step S140, the at least one compressed format file is decompressed in the volatile memory into at least one application. Therefore, through the operations of steps S110 to S140 of the memory operation method 100, these applications are compressed using a compression algorithm before being executed and then loaded into the volatile memory, and an image of the compressed data area of the volatile memory is obtained, which can effectively improve the loading speed of the application. The boot speed is faster than the general application loading method without preloading.
[0036] Figure 3The figure is a functional block diagram of an electronic device 300 according to an embodiment of the present invention. The electronic device 300 includes a non-volatile memory 310, a volatile memory 320, and a processor 330. The non-volatile memory 310 is configured to store at least one application program and may be, but is not limited to, a read-only memory (ROM), a programmable read-only memory (PROM), an electrically alterable read-only memory (EAROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a non-volatile random access memory (NVRAM), a battery-powered static random access memory (SRAM), or other similar devices or combinations thereof. The volatile memory 320 is configured to store files in a compressed format. The volatile memory 320 may include a compressed data area 322, which may be a random access memory (RAM), such as, but not limited to, dynamic random access memory (DRAM), static random access memory (SRAM), other similar devices, or a combination thereof. The processor 330 is configured to compress the application stored in the non-volatile memory 310 into a compressed format file using a compression algorithm, preload the compressed format file from the non-volatile memory 310 into the compressed data area 322 in the volatile memory 320, then retrieve an image of the compressed data area 322 based on the compressed format file preloaded into the compressed data area 322, write the image back to the non-volatile memory 310, and then decompress the compressed format file into the application in the volatile memory 320.The processor 330 may be a central processing unit (CPU), a graphics processing unit (GPU), a microcontroller unit (MCU), a microprocessor, a system-on-chip (SoC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic controller (PLC), or a combination of the above components, but is not limited thereto.
[0037] Processor 330 uses a compression algorithm to compress relatively important and frequently used applications in non-volatile memory 310 into compressed files, and then stores the compressed files in blocks in non-volatile memory 310. It should be noted that this non-volatile memory complies with the eMMC flash memory standard. In one embodiment of the present invention, the compression algorithm may be, but is not limited to, the LZ4, LZO, or zlib compression algorithms.
[0038] The processor 330 preloads the compressed format file from the non-volatile memory 310 into the compressed data area 322 of the volatile memory 320, and then stores the compressed format file in the volatile memory 320 in a paged manner. It should be noted that the volatile memory 320 is a double data rate synchronous dynamic random access memory. In one embodiment of the present invention, the processor 330 can perform the operation of loading the compressed format file from the non-volatile memory 310 into the compressed data area 322 of the volatile memory 320 in an offline manner.
[0039] In some embodiments, to increase the speed of preloading compressed files from the non-volatile memory 310 to the compressed data area 322 in the volatile memory 320, a memory space may be reserved in the non-volatile memory 310 for mapping to a page in the compressed data area 322. During the compressed file loading process, direct memory access (DMA) may be used to load the compressed file into the compressed data area 322. Compared to conventional applications that load blocks from the non-volatile memory 310 to the compressed data area 322 of the volatile memory 320 and then execute them in pages in the volatile memory 320, DMA loading compressed files into the compressed data area 322 of the volatile memory 320 via DMA can speed up the preloading of compressed files from the non-volatile memory 310 to the volatile memory 320.
[0040] In some embodiments, when there are multiple sets of commonly used applications, one or more compressed data areas 322 (e.g., ZRAM) may be allocated in the volatile memory 320 for use by each of the application sets. Specifically, the processor 330 preloads the compressed format files of the respective application sets from the non-volatile memory 310 into the compressed data areas 322 in the volatile memory 320.
[0041] The processor 330 obtains an image of the compressed data area 322 based on the compression format file of the application preloaded into the compressed data area 322 and writes the image of the compressed data area 322 back to the non-volatile memory 310 for use when the same batch of commonly used applications is preloaded next time. In some embodiments, the processor 330 may not write this image back to the non-volatile memory 310.
[0042] In one embodiment of the present invention, after preloading each compressed format file into the compressed data area 322 in the volatile memory 320, the processor 330 will remove the function library shared by the application to reduce the memory space repeatedly occupied by the application. It should be noted that the operation of the processor 330 to remove the function library shared by the application can be performed offline.
[0043] In another embodiment of the present invention, before obtaining an image of the compressed data area 322 based on the compression format file of the application preloaded into the compressed data area 322, the processor 330 will adjust and shrink the compressed data area 322 to maximize the utilization rate of the compressed data area 322, thereby saving the memory space of the volatile memory 320 occupied by the compressed data area 322 as much as possible. It should be noted that the operation of the processor 330 to adjust and shrink the compressed data area 322 can be performed offline.
[0044] In another embodiment of the present invention, the operation of the processor 330 obtaining the image of the compressed data area 322 according to the compression format file loaded into the compressed data area 322 can be performed in an offline manner.
[0045] The memory operation method 100 may be programmed into computer program instructions, which may be executed by a processor (eg, Figure 3The computer program instructions are executed by the processor 330 shown in FIG. 3 and may be stored in a non-transitory computer-readable medium. When the computer program instructions are executed by the processor, the processor performs the following operations: compressing at least one application program in the non-volatile memory into at least one compressed format file using a compression algorithm; preloading the at least one compressed format file from the non-volatile memory into a compressed data area in the volatile memory; obtaining an image of the compressed data area based on the at least one compressed format file preloaded into the compressed data area and writing the image back to the non-volatile memory; and decompressing the at least one compressed format file in the volatile memory into at least one application program. The non-transitory computer-readable medium may be a read-only memory, a non-volatile memory, a floppy disk, a hard disk, an optical disk, a universal serial bus (USB) flash drive, a magnetic tape, a database accessible on the Internet, or other computer-readable media apparent to one of ordinary skill in the art.
[0046] In summary, the memory operation method and electronic device of the present invention first compresses an application into a compressed format file using a compression algorithm. This compressed format file is then preloaded from non-volatile memory into a compressed data area in volatile memory. An image of the compressed data area is then retrieved and written back to the non-volatile memory for future use when the application is loaded again. This allows for faster loading of frequently used applications into volatile memory and decompression for execution, even when memory resources are limited.
[0047] Although the present invention has been disclosed above with reference to the embodiments, they are not intended to limit the scope of the invention. Anyone with ordinary skill in the art can make various changes, substitutions, and modifications without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the scope of the appended patent applications.
[0048]
Explanation of symbols
[0049] 100:Memory operation method
[0050] 200: System on chip software activation method
[0051] 300: Electronic devices
[0052] 310: Non-volatile memory
[0053] 320: Volatile memory
[0054] 322: compressed data area
[0055] 330: Processor
[0056] S110, S120, S130, S140, S210, S220, S230: Steps
Claims
1. A memory operation method, comprising: Compressing at least one application program in the non-volatile memory into at least one compressed format file using a compression algorithm; Preloading the at least one compressed format file from the non-volatile memory to a compressed data area in the volatile memory; Obtaining an image of the compressed data area according to the at least one compression format file preloaded into the compressed data area, and writing the image back to the non-volatile memory; as well as The at least one compressed format file is decompressed into the volatile memory to obtain the at least one application program. 2 . The memory operating method according to claim 1 , wherein the non-volatile memory complies with the eMMC flash memory standard.
3. An electronic device comprising: a non-volatile memory configured to store at least one application program; a volatile memory configured to store at least one file in a compressed format, wherein the volatile memory further comprises a compressed data area; as well as A processor is configured to compress the at least one application in the non-volatile memory into the at least one compressed format file using a compression algorithm, preload the at least one compressed format file from the non-volatile memory into the compressed data area in the volatile memory, then obtain an image of the compressed data area based on the at least one compressed format file preloaded into the compressed data area, write the image back to the non-volatile memory, and then decompress the at least one compressed format file into the at least one application in the volatile memory.
4. The electronic device according to claim 3, wherein the processor is further configured to remove at least one function library shared by the at least one application after preloading each of the at least one compressed format file of the at least one application into the compressed data area in the volatile memory. 5 . The electronic device according to claim 4 , wherein the processor performs an operation of removing the at least one function library shared by the at least one application program in an offline manner. 6 . The electronic device according to claim 3 , wherein the processor is further configured to adjust and reduce the compressed data area before obtaining the image of the compressed data area according to the at least one compression format file preloaded into the compressed data area. 7 . The electronic device according to claim 6 , wherein the processor adjusts and reduces the compressed data area in an offline manner. 8 . The electronic device according to claim 3 , wherein the processor loads the at least one compressed format file from the non-volatile memory to the compressed data area in the volatile memory in an offline manner. 9 . The electronic device according to claim 3 , wherein the processor performs an operation of obtaining the image of the compressed data area according to the at least one compression format file loaded into the compressed data area in an offline manner.
10. A non-transitory computer-readable medium storing one or more computer program instructions, which, when executed by a processor, cause the processor to perform the following operations: Compressing at least one application program in the non-volatile memory into at least one compressed format file using a compression algorithm; Preloading the at least one compressed format file from the non-volatile memory to a compressed data area in the volatile memory; Obtaining an image of the compressed data area according to the at least one compression format file preloaded into the compressed data area, and writing the image back to the non-volatile memory; as well as The at least one compressed format file is decompressed into the volatile memory to obtain the at least one application program.