File loading method, apparatus and device

By preloading files into physical memory at the kernel level, the problem of low file loading efficiency during the startup of electronic device applications is solved, achieving more efficient file loading and performance improvement.

CN118444994BActive Publication Date: 2026-05-26HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2023-10-09
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Inefficient file loading during the application startup process on electronic devices leads to prolonged application startup time and negatively impacts user experience.

Method used

By loading the target file from external storage to physical memory in advance at the kernel level, the file is loaded directly from physical memory when the application starts, reducing the number of reads from external storage and improving file loading efficiency.

Benefits of technology

It improves file loading efficiency, reduces input/output overhead, avoids application business blockage and performance degradation, and enhances the performance of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118444994B_ABST
    Figure CN118444994B_ABST
Patent Text Reader

Abstract

The application discloses a file loading method, device and equipment. The method comprises the following steps: in response to an instruction of starting a first application of an electronic device, a kernel layer of the electronic device loads a target file used for running the first application from an external storage of the electronic device to a physical memory of the electronic device; and in a starting process of the first application, the first application loads the target file obtained from the physical memory. The file loading method provided by the application can improve the file loading efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a file loading method, apparatus, and device. Background Technology

[0002] Applications on electronic devices need to load a certain number of files (e.g., configuration files and data files) within a short period of time during startup so that the application can run normally after successfully loading the files.

[0003] In traditional technologies, during the application startup process of an electronic device, when the application needs to load files, the electronic device's system issues instructions to read the relevant files stored in the device's external storage and loads them into the device's memory for data exchange. In some scenarios, the number of files to be loaded and / or the files to be loaded during application startup (e.g., camera applications or game applications) is large, leading to low file loading efficiency based on the aforementioned traditional technologies.

[0004] Therefore, improving file loading efficiency has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a file loading method, apparatus, and device, which can improve file loading efficiency.

[0006] In a first aspect, a file loading method is provided, the method comprising: in response to an instruction to launch a first application of an electronic device, the kernel layer of the electronic device loads a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device; during the launch process of the first application, the first application loads the target file obtained from the physical memory.

[0007] During the startup process of the first application, the target file used to run the first application has already been loaded from external storage into physical memory by the kernel layer of the electronic device. In other words, when the first application actually needs to load the target file, the target file has already been pre-stored in the physical memory of the electronic device.

[0008] The kernel layer can monitor the first application, so that when instructions are generated to start the first application, the kernel layer can detect the startup operation.

[0009] In the above technical solution, upon detecting an instruction to launch the first application of the electronic device, the kernel layer of the electronic device preloads the target file for the first application from the external storage to the physical memory of the electronic device. Subsequently, during the startup process of the first application, the first application can load the target file obtained from the physical memory, thus avoiding the inefficiency problem of loading the target file from external storage in traditional technologies. Therefore, this method is beneficial for improving file loading efficiency and user satisfaction.

[0010] In one possible implementation, during the startup process of the first application, the first application loads the target file obtained from the physical memory, including: during the startup process of the first application, the kernel layer sends the target file read from the physical memory to the first application; the first application loads the target file obtained from the physical memory.

[0011] In the above technical solution, during the startup process of the first application, the kernel layer reads the target file pre-stored in physical memory and sends the read target file to the first application all at once. Subsequently, when the first application receives the target file from physical memory, it can load the target file. This method avoids the inefficiency of reading the target file from external storage in traditional technologies, as well as the business blocking and performance degradation of the first application caused by the inefficiency of reading the target file. Simultaneously, it reduces input / output (IO) overhead and improves the performance of the electronic device.

[0012] In another possible implementation, the N page data corresponding to the target file are stored in N storage addresses of the physical memory, wherein the N page data corresponds one-to-one with the N storage addresses, each storage address is used to store the corresponding page data, N is a positive integer, and during the startup process of the first application, the kernel layer sends the target file read from the physical memory to the first application, including: during the startup process of the first application, the kernel layer receives a loading request sent by the first application, wherein the loading request is used to request loading the target file; and the kernel layer reads the N page data from the N storage addresses associated with the target file according to the loading request, and sends the N page data to the first application.

[0013] The load request is used to request the loading of the target file for running the first application. Therefore, the load request may include an identifier of the first application, which indicates the first application. Optionally, the load request may also include other information besides the identifier of the first application, such as, but not limited to, the application name of the first application.

[0014] In the above technical solution, during the startup process of the first application, the kernel layer reads the target file pre-stored in physical memory and sends the read target file to the first application all at once. Subsequently, when the first application receives the target file obtained from the physical memory by the kernel layer, it can load the target file. That is, this method can avoid the problem of low efficiency in reading the target file from the external storage in the traditional technology, as well as the problem of business blocking and performance degradation of the first application due to the low efficiency of reading the target file. At the same time, it can also reduce IO overhead and improve the performance of electronic devices.

[0015] In some other implementations, during the startup process of the first application, the first application loads a target file obtained from physical memory, including: during the startup process of the first application, the following operations are performed: the first application sends a load request to the kernel layer, wherein the load request is used to request the loading of the target file; the kernel layer sends the identifier of the target file and the path of the target file to the first application according to the load request, wherein the path of the target file is used to indicate N storage addresses in physical memory;

[0016] The first application reads the corresponding N pages of data from N storage addresses in physical memory based on the target file's identifier and path, and then loads the target file obtained from physical memory.

[0017] In the above technical solution, during the startup process of the first application, after the kernel layer receives the loading request sent by the first application, it sends the storage path of the target file pre-stored in physical memory to the first application. Subsequently, the first application reads the target file from the corresponding storage path in the physical memory, thereby achieving the purpose of loading the target file obtained from physical memory. That is, this method avoids the inefficiency problem of the first application reading the target file from external storage in traditional technologies.

[0018] In another possible implementation, in response to an instruction to launch a first application of the electronic device, the kernel layer of the electronic device loads a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device, including: in response to the instruction to launch the first application, the kernel layer determines that the target file is not stored in the physical memory; if the target file is not stored in the physical memory, the kernel layer loads the target file from the external storage into the physical memory.

[0019] In the above technical solution, the kernel layer of the electronic device will only store the target file read from the external storage into the physical memory if the target file for running the first application is not stored in the physical memory of the electronic device. This helps to save the resources of the electronic device.

[0020] In another possible implementation, before the kernel layer of the electronic device loads the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch the first application of the electronic device, the method further includes: in response to the initial launch of the first application, the kernel layer listens to the first application to obtain an identifier of the target file, and the first application loads the target file obtained from the external storage; the step of loading the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch the first application of the electronic device includes: in response to an instruction to launch the first application again, the kernel layer queries the external storage according to the identifier of the target file, and loads the queried target file from the external storage into the physical memory.

[0021] "First launch of the first application" refers to launching the first application for the first time after the electronic device is powered on. "Relaunching the first application" refers to launching the first application at any time after the first launch.

[0022] For example, the first time an electronic device starts up with the first application after being powered on is called the first startup, and the second time the electronic device starts up with the first application after the first startup is called the second startup.

[0023] In the above technical solution, during the initial startup of the first application, the kernel layer of the electronic device can monitor the application to obtain the identifier of the file (i.e., the target file identifier) ​​that the application actually needs to load during runtime. Simultaneously, during the initial startup, since the target file is not yet stored in physical memory, the application loads the target file from external storage. When the kernel layer detects an instruction to restart the first application, it can query external storage based on the previously detected identifier of the target file associated with the first application and store the target file read from external storage into physical memory. Subsequently, during the restart of the first application, the kernel layer can send the target file associated with the first application, pre-stored in physical memory, to the first application according to its loading request. This allows the first application to load the target file obtained from physical memory, thereby improving the file loading efficiency when restarting the first application.

[0024] In another possible implementation, the method further includes: in response to an upgrade instruction for the first application, the kernel layer deletes the target file in the physical memory, wherein the file used to run the upgraded first application is different from the target file.

[0025] In practical applications, if the first application does not undergo an upgrade, the target file used to run the first application remains relatively fixed and unchanged. In other words, if the first application is upgraded, the file used to run the un-upgraded first application (i.e., the target file) is different from the file used to run the upgraded first application.

[0026] In the above technical solution, when the first application is upgraded, the kernel layer can automatically delete the files (i.e. target files) of the first application before the upgrade that are stored in physical memory. This method can not only avoid wasting memory resources, but also avoid the problem that some functions of the upgraded first application cannot be used normally due to the loading of mismatched files.

[0027] In another possible implementation, the method further includes: in response to an uninstallation instruction for the first application, the kernel layer deletes the target file stored in the physical memory.

[0028] In the above technical solution, when the first application in the electronic device is uninstalled, the kernel layer can actively delete the target file used to run the first application stored in physical memory. This can save physical memory resources and improve the utilization rate of physical memory.

[0029] In another possible implementation, before the kernel layer of the electronic device loads the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device, the method further includes: the kernel layer determining that the memory usage of the physical memory exceeds a preset threshold.

[0030] When the physical memory usage of an electronic device exceeds a preset threshold, the electronic device is in a heavy-load scenario.

[0031] In the aforementioned heavy-load scenario, from the moment the first application starts, the kernel layer loads the target file used to run the first application from external storage into physical memory. In other words, at the moment the first application starts, the kernel layer releases some application data (e.g., data that has not been used for a period of time) from physical memory to preload the target file stored in external storage into unused space in physical memory as early as possible. When the first application actually needs to load the target file, the required target file is already pre-stored in physical memory. Subsequently, the first application only needs to load the target file obtained from physical memory. This avoids the inefficiency problem of the first application reading the target file from external storage in traditional technologies. Therefore, this method is beneficial for improving file loading efficiency and user satisfaction.

[0032] In another possible implementation, before the kernel layer of the electronic device loads the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch the first application of the electronic device, the method further includes: the kernel layer determining that the memory usage of the physical memory does not exceed a preset threshold.

[0033] The physical memory utilization rate of an electronic device does not exceed a preset threshold, indicating that the electronic device is operating under light load. This means that the physical memory utilization rate is less than or equal to the preset threshold.

[0034] In the above technical solution, the file loading method provided by this application can be applied not only to scenarios where electronic devices are under heavy load, but also to scenarios where electronic devices are under light load, making the application scenarios of this method more extensive.

[0035] In a second aspect, a file loading apparatus is provided, the apparatus comprising a first processing unit and a second processing unit, wherein the first processing unit is configured to: load a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device; and the second processing unit is configured to: load the target file obtained from the physical memory during the launch process of the first application.

[0036] In one possible implementation, the first processing unit is further configured to: send the target file read from the physical memory to the first application during the startup process of the first application; the second processing unit is further configured to: load the target file obtained from the physical memory.

[0037] In another possible implementation, the N page data corresponding to the target file are stored in N storage addresses of the physical memory, wherein the N page data corresponds one-to-one with the N storage addresses, each storage address is used to store the corresponding page data, N is a positive integer, and the first processing unit is further configured to: receive a loading request sent by the first application during the startup process of the first application, wherein the loading request is used to request loading the target file; and, according to the loading request, read the N page data from the N storage addresses associated with the target file, and send the N page data to the first application.

[0038] In some other implementations, during the startup process of the first application, the first application loads a target file obtained from physical memory, including: during the startup process of the first application, the second processing unit is further configured to: send a load request to the kernel layer, wherein the load request is used to request the loading of the target file; the first processing unit is further configured to: send the identifier of the target file and the path of the target file to the first application according to the load request, wherein the path of the target file is used to indicate N storage addresses in physical memory; and the second processing unit is further configured to: read N pages of data corresponding to the target file from the N storage addresses in physical memory according to the identifier of the target file and the path of the target file, and load the target file obtained from physical memory.

[0039] In another possible implementation, the first processing unit is further configured to: determine, in response to an instruction to launch the first application, that the target file is not stored in the physical memory; and, if the target file is not stored in the physical memory, load the target file from the external storage into the physical memory.

[0040] In another possible implementation, the first processing unit is further configured to perform the following operations before the kernel layer of the electronic device loads a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device: in response to the initial launch of the first application, monitoring the first application to obtain an identifier of the target file, and the first application loading the target file obtained from the external storage; the first processing unit is further configured to: in response to an instruction to launch the first application again, querying the external storage according to the identifier of the target file, and loading the queried target file from the external storage into the physical memory.

[0041] In another possible implementation, the first processing unit is further configured to: delete the target file in the physical memory in response to an upgrade instruction for the first application, wherein the file used to run the upgraded first application is different from the target file. In another possible implementation, the first processing unit is further configured to: delete the target file stored in the physical memory in response to an uninstallation instruction for the first application.

[0042] In another possible implementation, the first processing unit is further configured to perform the following operation before the kernel layer of the electronic device loads the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device: determining that the memory usage of the physical memory exceeds a preset threshold.

[0043] Thirdly, an electronic device is provided, including a unit for performing any of the methods in the first aspect. The device may be a terminal device or a chip within a terminal device. The device may include an input unit and a processing unit.

[0044] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory for storing computer program code, which, when the processor executes the computer program code stored in the memory, causes the terminal device to perform any of the methods in the first aspect.

[0045] When the device is a chip within a terminal device, the processing unit can be an internal processing unit of the chip, and the input unit can be an output interface, pin, or circuit, etc.; the chip may also include memory, which can be memory within the chip (e.g., registers, cache, etc.) or memory located outside the chip (e.g., read-only memory, random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, it causes the chip to execute any of the methods in the first aspect.

[0046] In one possible implementation, the memory is used to store computer program code; the processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to perform any of the methods in the first aspect.

[0047] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program code, which, when executed by a file loading device, causes the file loading device to perform any of the file loading methods in the first aspect.

[0048] Fifthly, a computer program product is provided, the computer program product comprising: computer program code, which, when executed by a file loading device, causes the file loading device to perform any of the file loading methods in the first aspect.

[0049] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description

[0050] Figure 1 This is a schematic diagram of the hardware system of the electronic device 100 provided in the embodiments of this application.

[0051] Figure 2 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.

[0052] Figure 3 This is a schematic diagram of the interface of an electronic device applicable to the file loading method provided in the embodiments of this application.

[0053] Figure 4 This is a schematic diagram of the interface of an electronic device applicable to the file loading method provided in the embodiments of this application.

[0054] Figure 5 This is a schematic diagram of a file loading method provided in an embodiment of this application.

[0055] Figure 6 The above Figure 5 The provided file loading method includes a diagram illustrating the timing of the first application's startup and the actual start of the first application loading the target file.

[0056] Figure 7 The above Figure 5 A diagram illustrating how the target file is stored in physical memory in the provided file loading method.

[0057] Figure 8 The above Figure 5 A schematic diagram illustrating the interaction between the application layer and kernel layer of an electronic device involved in the provided file loading method.

[0058] Figure 9 This is a schematic diagram of another file loading method provided in the embodiments of this application.

[0059] Figure 10 This is a schematic diagram of the desktop of a mobile phone 1 executing the file loading method provided in the embodiments of this application.

[0060] Figure 11 This is a schematic diagram of the file loading device provided in the embodiments of this application. Detailed Implementation

[0061] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0062] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone; A and B at the same time; and B alone.

[0063] In the description of the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0064] In the description of the embodiments of this application, the term "comprising" indicates the presence of the described feature, integral, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0065] The technical solution provided in this application will now be described in detail.

[0066] The file loading method provided in this application can be applied to electronic devices. The hardware and software structures of the electronic device will now be described in detail with reference to the accompanying drawings.

[0067] Figure 1 This is a schematic diagram of the hardware system of the electronic device 100 provided in the embodiments of this application.

[0068] Electronic device 100 can be a mobile phone, smart screen, tablet computer, wearable electronic device, in-vehicle electronic device, augmented reality (AR) device, virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), projector, in-vehicle equipment, etc. This application embodiment does not limit the specific type of electronic device 100.

[0069] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0070] It should be noted that, Figure 1 The structure shown does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include... Figure 1 The components shown may include more or fewer components, or the electronic device 100 may include... Figure 1 The components shown may be a combination of certain components, or the electronic device 100 may include... Figure 1 Sub-components of some of the components shown. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0071] Processor 110 may include one or more processing units. For example, processor 110 may include at least one of the following processing units: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and neural network processing unit (NPU). These different processing units may be independent devices or integrated devices.

[0072] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0073] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0074] In some embodiments, processor 110 may include one or more interfaces. For example, processor 110 may include at least one of the following interfaces: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and a USB interface.

[0075] Understandable Figure 1 The connection relationships between the modules shown are merely illustrative and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of various connection methods described in the above embodiments.

[0076] Electronic device 100 can implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0077] Display screen 194 can be used to display images or videos. For example, display screen 194 can display images or videos captured by a camera application on a target object. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a micro OLED (Micro OLED), or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0078] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can perform algorithmic optimization of image noise, brightness, and color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0080] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard red-green-blue (RGB), YUV, or other image signal format. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0081] The external storage interface 120 can be used to connect an external memory card, such as a secure digital (SD) card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be stored on the external memory card.

[0082] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function (e.g., sound playback and image playback). The data storage area may store data created during the use of electronic device 100 (e.g., audio data and phonebook). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, and universal flash storage (UFS). Processor 110 executes various processing methods of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory disposed in the processor.

[0083] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. Pressure sensor 180A can be of many types, such as resistive pressure sensor, inductive pressure sensor, or capacitive pressure sensor. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes, and electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed; when a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0084] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, y-axis, and z-axis). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in scenarios such as navigation and motion-sensing games.

[0085] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.

[0086] The magnetic sensor 180D includes a Hall effect sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. The electronic device 100 can set features such as automatic flip unlocking based on the detected opening and closing state of the cover or the flip cover.

[0087] The accelerometer 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (typically the x-axis, y-axis, and z-axis). When the electronic device 100 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 180E can also be used to identify the attitude of the electronic device 100, serving as input parameters for applications such as screen orientation switching and pedometers.

[0088] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, such as in a shooting scenario, the electronic device 100 can utilize the distance sensor 180F to measure distance for fast focusing.

[0089] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a photosensor, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When reflected light is detected, the electronic device 100 can determine that an object is nearby. When no reflected light is detected, the electronic device 100 can determine that no object is nearby. The electronic device 100 can use the proximity sensor 180G to detect whether the user is holding the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used for automatic unlocking and automatic screen locking in folding or pocket modes.

[0090] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0091] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to perform functions such as unlocking, accessing application locks, taking photos, and answering calls.

[0092] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.

[0093] Touch sensor 180K, also known as a touch device, can be disposed on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a touch screen. Touch sensor 180K is used to detect touch operations applied to or near it. Touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be disposed on the surface of electronic device 100, and in a different location from display screen 194.

[0094] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.

[0095] The hardware system of electronic device 100 has been described in detail above. The software system of electronic device 100 is described below. The software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture as an example to exemplarily describe the software system of electronic device 100.

[0096] For example, Figure 2 A schematic diagram of the software system of an electronic device is shown. See also Figure 2The software system adopts a layered architecture. This layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer 210, the application framework layer 220, the Android Runtime and core library layer 230, the hardware abstraction layer (HAL) 240, and the kernel layer 250.

[0097] Application layer 210 may include a series of application packages. For example, application packages may include applications such as camera, gallery, chat, call, map, navigation, calendar, Bluetooth, music, and video.

[0098] The aforementioned applications may include more specific functional modules; for example, a gallery may contain business modules and notification modules.

[0099] The aforementioned applications can be used to generate application data; for example, the gallery can be used to generate photo data.

[0100] The application framework layer 220 provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer 220 includes some predefined functions.

[0101] like Figure 2 As shown, the application framework layer 220 may include a window manager, a notification manager, an activity manager, an input manager, a view system, a content provider, a resource manager, etc.

[0102] The window manager provides a window management service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.

[0103] The Activity Manager Service (AMS) can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.

[0104] The input manager can provide an input management service (IMS), which can be used to manage system inputs, such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS, distributes these events to the appropriate windows.

[0105] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and so on.

[0106] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0107] A view system includes visual controls, such as controls that display text, controls that display images, etc. View systems can be used to build applications.

[0108] Content providers enable apps to access data from other apps (such as contacts) or to share their own data, which may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0109] The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for scheduling and managing the Android system.

[0110] The core library consists of two parts: one part is the functionalities that need to be called by programming languages ​​(e.g., Java), and the other part is the Android core library.

[0111] Application layer 210 and application framework layer 220 run in a virtual machine. The virtual machine executes the programming files (e.g., Java files) of application layer 210 and application framework layer 220 as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0112] The core library layer 230 can include multiple functional modules. For example: surface manager, media framework, system library layer (ibc layer), lightweight database (SQLite), OpenGL ES, Webkit, etc.

[0113] The Surface Manager is used to manage the display subsystem and provides the fusion of two-dimensional (2D) and three-dimensional (3D) layers for multiple applications.

[0114] The media framework supports playback and recording of various commonly used audio and video formats, as well as still image files.

[0115] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and upper-level software, designed to abstract hardware. The HAL is an abstract interface for device kernel drivers, providing application programming interfaces (APIs) that allow access to the underlying device to higher-level Java API frameworks. The HAL contains multiple library modules, such as the Camera HAL, Vendor repository, display, Bluetooth, and audio. Each library module implements an interface for a specific type of hardware component. For example, the Camera HAL provides the camera firmware (FWK) with an interface to access hardware components like the camera lens. The Vendor repository provides the media firmware (FWK) with an interface to access hardware components like the encoder. When the system framework layer API requires access to the portable device's hardware, the Android operating system loads the library module for that hardware component.

[0116] Kernel layer 250 is the foundation of the Android operating system. The ultimate functions of the Android operating system are all accomplished through kernel layer 250, including driver management, process scheduling, inter-process communication, memory management, and power management.

[0117] like Figure 2 As shown, kernel layer 250 may include memory management, file management, display driver, audio driver, camera driver, Bluetooth driver, power management, and camera driver, etc.

[0118] Kernel layer 250 memory management is used to manage the physical memory address space. Kernel layer 250 memory management is based on a paging mechanism to manage physical memory. For example, the physical memory address space and the linear address space are divided into 4-byte (Kilobyte, KB) units, so the two can achieve address mapping in 4KB page units.

[0119] File management in kernel layer 250 is responsible for managing files and file systems within the system. File management provides operations such as creating, reading, writing, and deleting files and directories, as well as file permission management, and mounting and unmounting file systems. Through file management, kernel layer 250 provides applications (e.g., camera applications) and users with interfaces for accessing and manipulating files, ensuring data security and integrity.

[0120] It should be noted that the application provides Figure 2The illustrated software architecture diagram of the electronic device is merely an example and does not limit the specific module divisions within different layers of the Android operating system. For details, please refer to the descriptions of the Android operating system software architecture in conventional technologies. Furthermore, the shooting method provided in this application can also be implemented based on other operating systems (e.g., iOS or HarmonyOS), which will not be listed here.

[0121] Next, based on the above Figure 1 Taking a mobile phone as an example, the illustrated electronic device 100 describes the situation where a mobile phone running an application executes the file loading method provided in the embodiments of this application.

[0122] In some implementations, the phone may be running multiple different applications. Therefore, the phone's executable file loading method can target one of the installed but not running applications. It's understandable that if the number of applications running on the phone exceeds a preset threshold, the phone is considered to be under heavy load, meaning its physical memory usage exceeds the preset threshold.

[0123] For example, with Figure 3 Taking the interface of the mobile phone 300 shown as an example, multiple applications run in the background of the mobile phone 300, including a gallery, camera, and phone. In this scenario, the mobile phone 300 can also execute the file loading method provided in this application embodiment for other applications installed on the mobile phone 300 that are not running. For example, other applications that are not running may be, but are not limited to, video applications or chat applications.

[0124] In some implementations, the phone can run an application. Based on this, the phone's file loading method can target one of the non-running applications installed on the phone. It's understandable that if the number of applications running on the phone is less than or equal to a preset threshold, the phone can be considered to be in a light-load scenario, meaning the phone's physical memory usage does not exceed the preset threshold.

[0125] For example, with Figure 4 Taking the interface of the shown mobile phone 400 as an example, one application, namely the gallery, runs in the background of the mobile phone 400. In this scenario, the mobile phone 400 can also execute the file loading method provided in this application embodiment for other applications installed on the mobile phone 400, such as, but not limited to, camera applications, video applications, or chat applications.

[0126] As mentioned above, to address the low file loading efficiency problem in traditional technologies, the file loading method provided in this application adopts the following technical solution: In response to an instruction to launch a first application of an electronic device, the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device into the physical memory of the electronic device; during the startup process of the first application, the first application loads the target file obtained from the physical memory. This method can improve file loading efficiency and enhance the user experience.

[0127] Next, combined Figures 5 to 9 The file loading method provided in the embodiments of this application will be described in detail.

[0128] Figure 5 This is a schematic diagram illustrating a file loading method provided in an embodiment of this application. The file loading method provided in this embodiment can be executed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in this embodiment can be, but is not limited to, […]. Figure 1 The electronic device 100 is shown. (For example...) Figure 5 As shown, the file loading method provided in this application embodiment includes steps S510 and S520. S510 and S520 will be described in detail below.

[0129] S510, in response to the instruction to start the first application of the electronic device, the kernel layer of the electronic device loads the target file for running the first application from the external memory of the electronic device into the physical memory of the electronic device.

[0130] For example, the external memory of the electronic device in S510 described above can be Figure 1 The external memory interface 120 of the illustrated electronic device 100 is connected to an external memory, and the physical memory of the electronic device can be... Figure 1 The internal memory 121 in the illustrated electronic device 100. The kernel layer in S510 described above may be... Figure 2 The kernel layer 250 in the software architecture of the illustrated electronic device 100 may include a memory management module and a file management module. Optionally, the kernel layer may also include a power management module and various driver modules (e.g., camera driver, Bluetooth driver, audio driver, webcam driver, and display driver). The first application in the above S510 may be... Figure 2 Any application in the application layer 210 shown, for example, the first application may be, but is not limited to, a camera application, a gallery application, a chat application, a music application, or a video application.

[0131] Below, examples illustrate the presentation of external storage and physical memory in embodiments of this application. For instance, taking a mobile phone as an example, a mobile phone has 8 gigabytes (GB) of RAM + 256GB of storage. The external storage of the electronic device refers to the 256GB of storage space, and the physical memory of the electronic device refers to the 8GB of RAM. As another example, taking a computer as an example, RAM refers to the computer's random access memory (RAM, also known as main memory), and external storage refers to the computer's external storage, such as a disk or hard drive.

[0132] The instruction to launch the first application of the electronic device is used to perform a launch operation on the first application. In this embodiment, the presentation form of the instruction to launch the first application is not specifically limited and can be set according to the actual situation. For example, the instruction to launch the first application of the electronic device may be an event in which the user clicks (e.g., single-clicks or double-clicks) the application icon of the first application on the main interface of the electronic device. Alternatively, the instruction to launch the first application of the electronic device may be a predefined piece of program code.

[0133] The target file is the file used by the electronic device when running the first application. This file can be a data file and / or a configuration file. Data files can be, but are not limited to, various types of files such as images, text, and video. Configuration files can be, but are not limited to, various types of files such as program items, network connections, printer connections, keyboard settings, mouse settings, screen colors, and window size and position.

[0134] The number of target files used by the electronic device when running the first application is not specifically limited and can be set according to the actual situation. In some implementations, the number of target files required by the electronic device to run the first application is related to the function of the first application. For example, if the algorithm function of the first application is more complex, the electronic device will need to use more target files (e.g., 10, 15, or 20). Conversely, if the algorithm function of the first application is simpler, the electronic device will need to use fewer target files (e.g., 1, 2, or 3).

[0135] In this embodiment of the application, performing the above-described S510 step, i.e., in response to the instruction to start the first application of the electronic device, the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device into the physical memory of the electronic device, including: in response to the instruction to start the first application, the kernel layer determines that the target file is not stored in the physical memory; if the target file is not stored in the physical memory, the kernel layer loads the target file from the external storage into the physical memory.

[0136] In the above implementation, the kernel layer can listen to the first application. In this way, when a startup instruction for the first application is generated, the kernel layer can listen to the instruction to start the first application.

[0137] For example, Figure 6 This shows the moment the first application is launched and the moment the first application actually begins loading the target file. For example... Figure 6 As shown, during the time between the start of the first application and the actual start of loading the target file, the kernel layer stores the target file stored in external storage into physical memory.

[0138] In the above technical solution, the kernel layer will only store the target file read from the external storage into the physical memory if the target file associated with the first application is not stored in the physical memory. This helps to save the resources of electronic devices.

[0139] The following describes the method by which the kernel layer loads the target file from external storage into physical memory in the above implementation. In practical applications, the target file used to run the first application is relatively fixed and does not change if the first application is not upgraded. That is to say, if the first application is not upgraded, the file that the first application needs to load (i.e., the target file) is the same in any given startup of the first application.

[0140] In some implementations, before the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch the first application of the electronic device, the method further includes: in response to the initial launch of the first application, the kernel layer listens to the first application to obtain the identifier of the target file, and the first application loads the target file obtained from the external storage; in response to the instruction to launch the first application of the electronic device, the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device into the physical memory of the electronic device, including: in response to the instruction to launch the first application again, the kernel layer queries the external storage according to the identifier of the target file, and loads the queried target file from the external storage into the physical memory.

[0141] "Initial launch of the first application" refers to launching the first application for the first time after the electronic device is powered on. "Relaunching the first application" refers to launching the first application at any subsequent time after the initial launch. It should be noted that after the initial launch, the first application loads the target file from external storage and runs normally for a period of time, it will terminate its operation according to the command to terminate the first application. After the first application terminates, it will release the previously loaded target file. In other words, during subsequent launches of the first application after the initial launch, the first application still needs to load the target file.

[0142] The external storage contains the target file and the mapping between the target file and its identifier. Therefore, the kernel layer can successfully retrieve the target file corresponding to the identifier by querying the external storage based on the target file's identifier. Optionally, the external storage may also store other files besides the target file; for example, these other files could be files managed by applications other than the primary application.

[0143] In the above implementation, during the initial startup of the first application, the kernel layer monitors the application to obtain the identifier of the file (i.e., the target file identifier) ​​that the application actually needs to load during startup. Simultaneously, since the target file is not yet stored in physical memory during the initial startup, the application loads the target file from external storage. When the kernel layer detects an instruction to restart the first application, it can query external storage based on the previously detected identifier of the target file associated with the application and store the target file read from external storage into physical memory. Subsequently, during the startup of the first application, the kernel layer can send the target file associated with the application, pre-stored in physical memory, to the application based on its loading request. This allows the application to load the target file obtained from physical memory, thereby improving file loading efficiency when restarting the application.

[0144] In some other implementations, the electronic device can encapsulate the identifier of the target file used to run the first application in the kernel layer at the time of manufacture. Based on this, the above-mentioned S510 is executed. That is, in response to the instruction to start the first application of the electronic device, the kernel layer of the electronic device loads the target file used to run the first application from the external memory of the electronic device into the physical memory of the electronic device. This includes: in response to the instruction to start the first application, the kernel layer queries the external memory according to the identifier of the target file and loads the queried target file from the external memory into the physical memory.

[0145] In the above implementation, the kernel layer does not specifically limit the address at which it stores the target file from external storage to physical memory. In some implementations, after executing S510, the N pages of data corresponding to the target file can be stored in N memory addresses, where the N pages of data correspond one-to-one with the N memory addresses, and each memory address is used to store the corresponding page data, where N is a positive integer. In this embodiment, after the kernel layer stores the target file read from external storage to physical memory, the kernel layer knows the mapping relationship between the N pages of data and the N memory addresses corresponding to the target file.

[0146] In this embodiment, the memory utilization rate of physical memory is not specifically limited. For example, the memory utilization rate of physical memory may exceed a preset threshold or not exceed a preset threshold. The preset threshold can be set according to the actual application scenario and is not specifically limited thereto. For example, the preset threshold may be, but is not limited to, 60%, 65%, or 75%. It is understood that when the memory utilization rate of the physical memory of an electronic device exceeds the preset threshold, the electronic device is in a heavy-load scenario. When the memory utilization rate of the physical memory of an electronic device does not exceed the preset threshold, the electronic device is in a light-load scenario.

[0147] In some implementations, the file loading method provided in this application embodiment is applied in a heavy-load scenario. Based on this, before the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device to the physical memory of the electronic device in response to the instruction to start the first application of the electronic device, the method further includes: the kernel layer determining that the memory usage rate of the physical memory exceeds a preset threshold.

[0148] In some other implementations, the file loading method provided in this application is applied to light-load scenarios. Based on this, before the kernel layer of the electronic device loads the target file used to run the first application from the external storage of the electronic device to the physical memory of the electronic device in response to the instruction to start the first application of the electronic device, the method further includes: the kernel layer determining that the memory utilization rate of the physical memory does not exceed a preset threshold.

[0149] In the above implementation, the file loading method provided in this application is applicable not only to scenarios where the electronic device is under heavy load but also to scenarios where the electronic device is under light load, making the application scenarios applicable to this method more extensive. In the above S510 step, the kernel layer of the electronic device performs the operation of loading the target file associated with the first application stored in the external storage of the electronic device into the physical memory of the electronic device in advance, before the time when the first application actually needs to load the target file. In this embodiment of the application, after the kernel layer executes the above S510 step, the time when the first application actually needs to load the target file has not yet arrived. That is to say, when the time when the first application actually needs to load the target file arrives, the target file is already stored in the physical memory of the electronic device.

[0150] In the S520, during the startup process of the first application, the first application loads the target file obtained from physical memory.

[0151] In step S520 above, during the startup process of the first application, the first application can load the target file that has been pre-stored in physical memory by the kernel layer.

[0152] In this embodiment of the application, the method for loading the target file obtained from physical memory by the first application is not specifically limited.

[0153] In some implementations, during the startup process of the first application, the first application loads the target file obtained from physical memory, including: during the startup process of the first application, the kernel layer sends the target file read from physical memory to the first application; the first application loads the target file obtained from physical memory.

[0154] In the above implementation, during the startup process of the first application, the kernel layer reads the target file pre-stored in physical memory and sends the read target file to the first application all at once. Subsequently, when the first application receives the target file from physical memory, it can load the target file. This avoids the inefficiency problem of the first application reading the target file from external storage in traditional technologies, as well as the problems of business blocking and performance degradation of the first application due to the inefficiency of reading the target file. At the same time, it can also reduce I / O overhead and improve the performance of electronic devices.

[0155] Optionally, in the above implementation, the N page data corresponding to the target file are stored in N storage addresses in physical memory, wherein the N page data corresponds one-to-one with the N storage addresses, and each storage address is used to store the corresponding page data, where N is a positive integer. Furthermore, in the step of sending the target file read from physical memory to the first application during the startup process of the first application, for example, this includes: during the startup process of the first application, the kernel layer receives a loading request sent by the first application, wherein the loading request is used to request loading the target file; and the kernel layer reads N page data from the N storage addresses associated with the target file according to the loading request, and sends the N page data to the first application.

[0156] During the startup process of the first application, after the kernel layer receives the loading request sent by the first application, the following steps may also be included: During the startup process of the first application, the first application sends a loading request to the kernel layer.

[0157] A load request is used to request the loading of a target file for running a first application. The load request may include an identifier for the first application, which uniquely identifies the application. Optionally, the load request may also include other information besides the identifier of the first application, such as, but not limited to, the name of the first application.

[0158] The kernel layer stores the target file as pages across N memory addresses. This method of storing the target file in pages as the smallest unit avoids wasting physical memory. The size of each page in the N pages is not specifically limited and can be set according to actual needs. For example, if the target file size is 16KB and each page is 4KB, the target file corresponds to 4 pages. The value of N is not specifically limited and can be selected according to actual needs; for example, N can be, but is not limited to, 1, 2, or 6.

[0159] For example, refer to Figure 7 ,by Figure 7 Taking the camera file shown as an example (the target file), the camera file consists of pages 0 to N. Page 0 of the camera file corresponds to the 3rd memory block in physical memory (block number 3), page 1 corresponds to the 6th memory block in physical memory (block number 6), and so on, until page N corresponds to the 5th memory block in physical memory (block number 5). It can be understood that the block number in physical memory corresponds to a segment of storage address within physical memory.

[0160] In some other implementations, during the startup process of the first application, the first application loads a target file obtained from physical memory, including: during the startup process of the first application, the following operations are performed: the first application sends a load request to the kernel layer, wherein the load request is used to request the loading of the target file; the kernel layer, according to the load request, sends the identifier of the target file and the path of the target file to the first application, wherein the path of the target file is used to indicate N storage addresses in physical memory; the first application, according to the identifier of the target file and the path of the target file, reads N pages of data corresponding to the target file from the N storage addresses in physical memory, and loads the target file obtained from physical memory.

[0161] In the above implementation, during the startup process of the first application, after the kernel layer receives the loading request sent by the first application, it sends the storage path of the target file pre-stored in physical memory to the first application. Subsequently, the first application reads the target file from the corresponding storage path in the physical memory, and then loads the target file obtained from physical memory. This avoids the inefficiency problem of the first application reading the target file from external storage in traditional technologies, and also avoids the business blockage and performance degradation of the first application due to the inefficiency of reading the target file.

[0162] In this embodiment, after executing S510 and S520, the user may need to update or upgrade the first application. In practical applications, if the first application is not upgraded, the target file used to run the first application is relatively fixed and does not change. That is, if the first application is upgraded, the file used to run the first application before the upgrade is different from the file used to run the first application after the upgrade.

[0163] In some implementations, the following steps may also be performed: in response to an upgrade instruction for the first application, the kernel layer deletes the target file in physical memory, wherein the file used to run the upgraded first application is different from the target file.

[0164] For example, the file used to run the first application before the upgrade could be file 1, and the file used to run the first application after the upgrade could be file 2, where file 1 and file 2 are different. For example, the files used to run the first application before the upgrade could include file 1 and file 2, and the files used to run the first application after the upgrade could include file 1, file 2, and file 3, where file 1, file 2, and file 3 are all different.

[0165] In the above implementation, if the first application is upgraded, the kernel layer actively deletes the target files stored in physical memory that were associated with the first application before the upgrade. This can save physical memory resources and improve the utilization of physical memory.

[0166] In this embodiment, after executing steps S510 and S520, the user may need to delete the first application. Therefore, in some implementations, the following steps may also be performed: in response to an uninstallation instruction for the first application, the kernel layer deletes the target file stored in physical memory.

[0167] In the above implementation, when the first application installed on the electronic device is uninstalled, the kernel layer actively deletes the target file associated with the first application stored in physical memory. This can save physical memory resources and improve the utilization of physical memory.

[0168] For example, Figure 8 This illustration shows a schematic diagram of the interaction between a first application located in the application layer of an electronic device and the kernel layer in the file loading method provided in an embodiment of this application. For example... Figure 8 As shown, when the instruction to start the first application is received, the kernel layer loads the target file for running the first application from external storage into physical memory. During the startup process of the first application, the first application sends a request to the kernel layer to load the target file associated with the first application. Subsequently, the first application loads the target file pre-stored in physical memory.

[0169] It should be understood that the above Figure 5 The file loading method shown is merely illustrative and does not constitute any limitation on the file loading method provided in this application. For example, the above... Figure 5 The number of target files involved in running the first application is multiple, and these multiple files are stored in multiple storage blocks in external storage. For example, the above... Figure 5 External storage in a system can be called external storage, while physical memory can be called memory.

[0170] In this embodiment, upon detecting an instruction to launch a first application of the electronic device, the kernel layer of the electronic device preloads the target file for the first application from the external storage to the physical memory of the electronic device. Subsequently, during the startup process of the first application, the first application can load the target file obtained from the physical memory, thereby avoiding the inefficiency problem of loading the target file from external storage in traditional technologies. Therefore, this method is beneficial for improving file loading efficiency and user satisfaction. Furthermore, the file loading method provided in this application is applicable to scenarios where the electronic device is under light or heavy load, thus broadening its applicability.

[0171] Below, we will take loading files for camera applications in electronic devices as an example, combined with... Figure 9 This application introduces another file loading method provided by an embodiment. It is understood that... Figure 9 The file loading method described above is as follows. Figure 6 A specific example of the described file loading method, Figure 9 The methods described are for illustrative purposes only and do not constitute any limitation on the file loading methods provided in this application.

[0172] Figure 9 This is a schematic diagram of another file loading method provided in an embodiment of this application. The file loading method provided in this embodiment can be... Figure 1 The illustrated electronic device 100 performs this action, wherein the electronic device 100 may be, but is not limited to, a mobile phone. It is understood that the electronic device 100 may be implemented as software, or a combination of software and hardware. For example, as shown... Figure 9 As shown, the method includes steps S910 to S970. Steps S910 to S970 will be described in detail below.

[0173] S910, responding to the camera application upon first startup of the electronic device (i.e., the above). Figure 5 (An example of the first application in the method shown) The camera application loads the target file for running the camera application from external storage, and the kernel layer listens to the camera application to obtain a list of camera files, wherein the list of camera files includes the identifier of the target file for running the camera application.

[0174] The first launch of the camera app refers to the first time the camera app is launched after an electronic device is turned on. For example, taking a mobile phone as an example, after the phone is turned on, the camera app is launched for the first time when the user clicks the camera app icon on the phone's interface. This launch of the camera app is called the first launch of the camera app.

[0175] The camera file list includes identifiers of target files required by the electronic device to run the camera application. In this embodiment, the identifier of the target file is not specifically limited; for example, the identifier of the target file can be the name of the target file or the serial number of the target file.

[0176] The target file may include data files and configuration files. Data files may be, but are not limited to, various types of files such as images, text, and videos. Configuration files may be, but are not limited to, various types of files such as program projects, network connections, printer connections, keyboard settings, mouse settings, screen colors, and window size and position.

[0177] In this embodiment, the kernel layer can continuously monitor the camera application. Thus, upon the first launch of the camera application, the kernel layer can detect the files that the camera application needs to load after startup and identify these files as the target files required for the camera application's runtime. For example, if the physical memory of the electronic device does not store the files that the camera application needs to load, but the external storage of the electronic device stores the files, the camera application can load and run the required files from the external storage upon its first launch.

[0178] S920, in response to the user clicking the application icon of the camera application in the interface of the electronic device, the camera application sends a notification message to the kernel layer, wherein the notification message is used to instruct the kernel layer to load the target file indicated by the camera file list from the external storage into the physical memory of the electronic device.

[0179] In step S920 above, when the camera application is restarted due to the user clicking the application icon, the camera application notifies the kernel layer to load the target file stored in the external storage of the electronic device into the physical memory of the electronic device according to the camera file list.

[0180] The notification information is used to instruct the kernel layer to load the target file indicated by the camera file list from external storage into the physical memory of the electronic device. The notification information may include the camera file list. Optionally, the notification information may also include other information, such as the application identifier of the camera application.

[0181] There are no specific limitations on the event of a user clicking the camera application icon on the interface of an electronic device. For example, it could be a user's finger clicking or double-clicking the camera application icon. Or, it could be a user using a stylus to click or double-click the camera application icon.

[0182] The above S920 step is described using the example of a user clicking the camera application icon and the camera application sending a notification message to the kernel layer. Optionally, a monitoring process can also run in the application layer of the electronic device. In response to the monitoring process detecting the user clicking the camera application icon event, the monitoring process sends a notification message to the kernel layer.

[0183] In this embodiment, the physical memory utilization rate is not specifically limited. For example, if the physical memory utilization rate exceeds a preset threshold, the electronic device can be considered to be under heavy load, such as when a large number of applications (e.g., 15 or 20) are running in the background, and the physical memory utilization rate of these applications exceeds the preset threshold. Conversely, if the physical memory utilization rate does not exceed the preset threshold, the electronic device can be considered to be under light load, such as when a small number of applications (e.g., 1 or 2) are running in the background, and the physical memory utilization rate of these applications does not exceed the preset threshold.

[0184] S930: According to the notification information, the kernel layer of the electronic device loads the target file stored in the external memory of the electronic device into N storage addresses in the physical memory of the electronic device. The N storage addresses correspond one-to-one with the N pages of data in the target file. Each storage address is used to store the corresponding page data, and N is a positive integer.

[0185] In S930 above, the target file is stored in external storage at the file level and in physical memory at the page level. The size of each page is not specifically limited and can be set according to actual needs. For example, if the target file size is 16KB and each page size is 4KB, the target file corresponds to 4 pages.

[0186] The electronic device executes the above-described S930, that is, the kernel layer of the electronic device loads the target file stored in the external memory of the electronic device into N storage addresses of the physical memory of the electronic device according to the notification information. This includes: the kernel layer traversing the files stored in the external memory according to the identifier of the target file included in the camera file list included in the notification information to obtain the target storage location in the external memory indicated by the target file identifier; the kernel layer reads the target file from the target storage location in the external memory and stores the N page data corresponding to the read target file into N storage addresses of the physical memory.

[0187] In the above implementation, the target file is stored in physical memory in pages as the smallest unit, thus avoiding waste of physical memory.

[0188] It is understandable that after the kernel layer of the electronic device executes the above S930, the kernel layer can know that the target file is stored in the physical memory of the electronic device, including N storage addresses.

[0189] S940, during the startup process of the camera application of the electronic device, the kernel layer of the electronic device reads the corresponding N pages of data from N storage addresses according to the loading request sent by the camera application. The loading request is used to request the target file used by the electronic device when running the camera application.

[0190] In step S940 above, during the startup of the camera application on the electronic device, the camera application sends a loading request to the kernel layer to request the target file used by the electronic device to run the camera application. Correspondingly, the kernel layer receives the loading request from the camera application. Subsequently, based on the loading request, the kernel layer can successfully read N pages of data corresponding to the target file requested by the loading request from N storage addresses.

[0191] A load request is used to request the target file used by an electronic device to run a camera application. The load request may include the identifier of the camera application. In this implementation, the kernel layer stores a mapping relationship between the camera application identifier and the target file. Thus, when the kernel layer obtains the camera application identifier indicated by the load request, it can determine, based on the mapping relationship, that the load request is for a target file, and therefore know that the target file is located at one of N physical memory addresses. The information included in the load request is not specifically limited; it may also include other information, such as, but not limited to, the identifier of the target file or the time instructing the kernel layer to send the target file stored in physical memory to the camera application.

[0192] It should be noted that the actual time when the camera application of the electronic device needs to load the target file is the target time, which has not yet been reached after executing S910 to S940. In other words, in this embodiment, before the camera application needs to load the target file, the target file has already been pre-loaded from external storage into physical memory via a private interface. Subsequently, if the camera application needs to load the target file, the kernel layer can directly send the target file read from physical memory to the camera application. This improves file loading efficiency and avoids camera service blocking and performance degradation caused by the camera application not loading the required target file in time, thus improving the smoothness of camera application operation and enhancing the user experience.

[0193] In S950, the kernel layer of the electronic device sends N pages of data to the camera application so that the camera application can load the target file. Correspondingly, the camera application receives N pages of data sent from the kernel layer.

[0194] In the S950 described above, when a target file needs to be loaded during the camera application startup process, the electronic device will send all the files (i.e., the target file) that the camera application needs to load from physical memory to the camera application all at once. If the target file corresponds to multiple pages of data, this avoids the camera application actively loading these multiple pages of data from physical memory multiple times, thus reducing I / O overhead and improving file loading efficiency.

[0195] The above S940 and S950 are described using the kernel layer as an example, where the kernel layer reads N pages of data corresponding to the target file from physical memory, and the kernel layer sends the read N pages of data corresponding to the target file to the camera application. Optionally, the method for the camera application to load the target file described in S940 and S950 can also be replaced by the camera application retrieving the target file from physical memory based on the target file's identifier and its storage address in physical memory, thereby achieving the purpose of loading the target file. Details not elaborated here can be found in the relevant description in S520 above.

[0196] S960, the camera application loads the target file.

[0197] In response to an upgrade operation for the camera application, the S970 kernel layer deletes N pages of data stored at N memory addresses.

[0198] In this embodiment, the application may also involve upgrading the camera application of an electronic device, depending on user needs. Upgrading the camera application can improve its performance, such as by adding new features or optimizing existing functions. In scenarios requiring camera application upgrades, the files required for running the camera application before and after the upgrade may differ. Therefore, the following steps may also be performed: In response to the camera application upgrade operation, the kernel layer deletes N pages of data stored at N memory addresses.

[0199] In the above implementation, the files used by the electronic device when running the upgraded camera application are different from those used when running the unupgraded camera application. After upgrading the camera application of the electronic device, the files of the unupgraded camera application stored in the physical memory can be automatically deleted. This not only avoids the waste of physical memory resources, but also avoids the inability of some functions of the upgraded camera application to work properly due to the loading of incompatible files.

[0200] It should be understood that the above Figure 9 The file loading method shown is for illustrative purposes only and does not constitute any limitation on the file loading method provided in this application. Figure 9The file loading method shown is illustrated using a camera application as an example. Optionally, the above... Figure 9 The camera app can also be replaced with other apps installed on the electronic device, such as, but not limited to, browser apps, shopping apps, chat apps, or video apps.

[0201] In this embodiment, immediately after the user clicks the camera application icon, the kernel layer preloads the target file that the camera application needs to load from external storage into physical memory. Next, upon receiving a loading request, the kernel layer reads the target file pre-stored in physical memory. Subsequently, if the kernel layer detects that the camera application needs to load a target file during operation, it sends the target file read from physical memory to the camera application. This avoids the inefficiency of reading target files from external storage in traditional technologies, and also avoids the business blockage of the camera application due to inefficient target file reading. This method improves file loading efficiency and user satisfaction. Furthermore, the above file loading method is applicable to both heavy-load and light-load scenarios, making it more widely applicable.

[0202] Next, taking the above-mentioned electronic device 100 as a mobile phone 1 as an example, the desktop of the mobile phone 1 that executes the file loading method provided in the embodiments of this application will be described.

[0203] Figure 10 This is a schematic diagram of the desktop of a mobile phone 1 executing the file loading method provided in the embodiments of this application.

[0204] See Figure 10 The desktop 510 shown in (1) includes icons for multiple applications, including an application icon 511 for the backup camera application.

[0205] When mobile phone 1 detects that the user clicks the application icon 511 of the camera application on the desktop 510, the camera application 511 and the kernel of mobile phone 1 can execute the file loading method provided in this application embodiment so that the camera application can run normally.

[0206] If the camera application successfully loads the target file, the camera application will run normally after startup. For example, see [link to example]. Figure 10 (2) shows desktop 520, which is the interface of the camera application.

[0207] It should be understood that the above Figure 10 The schematic diagram of the desktop of mobile phone 1 shown is for illustrative purposes only and does not constitute any limitation on the desktop of an electronic device that performs the file loading method provided in the embodiments of this application.

[0208] The above text combined Figures 1 to 10 The document describes in detail the file loading method of the embodiments of this application. The following will be combined with... Figure 11 This document describes in detail the apparatus embodiments of this application. It should be understood that the file loading apparatus in the embodiments of this application can execute the various file loading methods described in the foregoing embodiments of this application. That is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.

[0209] Figure 11 This is a schematic diagram of the file loading device provided in the embodiments of this application.

[0210] For example, Figure 11 The file loading device 1100 shown includes a first processing unit 1110 and a second processing unit 1120. This file loading device is used in an electronic device. The functions of the first processing unit 1110 and the second processing unit 1120 are described below.

[0211] The first processing unit 1110 is configured to: in response to an instruction to launch a first application of the electronic device, load a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device; the second processing unit 1120 is configured to: during the launch process of the first application, load the target file obtained from the physical memory.

[0212] In one possible implementation, the first processing unit 1110 is further configured to: send the target file read from the physical memory to the first application during the startup process of the first application; the second processing unit 1120 is further configured to: load the target file obtained from the physical memory.

[0213] In another possible implementation, the N page data corresponding to the target file are stored in N storage addresses of the physical memory, wherein the N page data corresponds one-to-one with the N storage addresses, each storage address is used to store the corresponding page data, N is a positive integer, and the first processing unit 1110 is further configured to: receive a loading request sent by the first application during the startup process of the first application, wherein the loading request is used to request loading the target file; and, according to the loading request, read the N page data from the N storage addresses associated with the target file, and send the N page data to the first application.

[0214] In another possible implementation, the first processing unit 1110 is further configured to: determine, in response to an instruction to start the first application, that the target file is not stored in the physical memory; and, if the target file is not stored in the physical memory, load the target file from the external storage into the physical memory.

[0215] In another possible implementation, the first processing unit 1110 is further configured to perform the following operations before the kernel layer of the electronic device loads a target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device: in response to the initial launch of the first application, monitoring the first application to obtain an identifier of the target file, and the first application loading the target file obtained from the external storage; the first processing unit 1110 is further configured to: in response to an instruction to launch the first application again, querying the external storage according to the identifier of the target file, and loading the queried target file from the external storage into the physical memory.

[0216] In another possible implementation, the first processing unit 1110 is further configured to: delete the target file in the physical memory in response to an upgrade instruction for the first application, wherein the file used to run the upgraded first application is different from the target file. In another possible implementation, the first processing unit 1110 is further configured to: delete the target file stored in the physical memory in response to an uninstallation instruction for the first application.

[0217] In another possible implementation, the first processing unit 1110 is further configured to perform the following operation before the kernel layer of the electronic device loads the target file for running the first application from the external storage of the electronic device into the physical memory of the electronic device in response to an instruction to launch a first application of the electronic device: determining that the memory usage of the physical memory exceeds a preset threshold.

[0218] It should be noted that the aforementioned file loading device 1100 is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, without any specific limitation.

[0219] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.

[0220] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0221] This application also provides a chip, including a processor. The processor is used to read and execute a computer program stored in a memory to perform the file loading method provided in any embodiment of this application.

[0222] Optionally, the chip may also include a memory, which is connected to the processor via a circuit or wire.

[0223] This application also provides a chip system including a processor. The processor is used to read and execute a computer program stored in a memory to perform the file loading method provided in any embodiment of this application.

[0224] Optionally, the chip system also includes a memory, which is connected to the processor via circuitry or wires.

[0225] This application also provides a computer program product that, when executed by a processor, implements the file loading method described in any of the method embodiments of this application.

[0226] The computer program product can be stored in memory, for example, it is a program. The program is eventually converted into an executable object file that can be executed by the processor after processes such as preprocessing, compilation, assembly and linking.

[0227] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the file loading method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.

[0228] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0229] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0230] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0231] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0232] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0233] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0234] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0235] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A file loading method, characterized in that, The method includes: When the first application of the electronic device is launched for the first time, the kernel layer of the electronic device obtains the identifier of the target file of the first application, and the first application loads the target file from external storage; After the first application is launched for the first time, in response to the instruction to launch the first application of the electronic device again, the kernel layer determines whether the memory usage rate of the physical memory of the electronic device exceeds a preset threshold; if the kernel layer determines that the memory usage rate of the physical memory exceeds the preset threshold, the kernel layer loads the target file used to run the first application from the external storage of the electronic device into the physical memory at a time before the target time, wherein the target time is the time when the first application actually needs to load the target file; After the kernel layer loads the target file into the physical memory, it sends the target file to the first application at the target time, and the first application loads the target file obtained from the physical memory.

2. The method according to claim 1, characterized in that, The N page data corresponding to the target file are stored in N storage addresses of the physical memory, wherein the N page data corresponds one-to-one with the N storage addresses, and each storage address is used to store the corresponding page data, where N is a positive integer. After the kernel layer loads the target file into the physical memory, it sends the target file to the first application at the target time, including: After the kernel layer loads the target file into the physical memory, at the target time, the kernel layer receives a loading request sent by the first application, wherein the loading request is used to request loading the target file; and, The kernel layer reads the N pages of data from the N storage addresses associated with the target file according to the loading request, and sends the N pages of data to the first application.

3. The method according to claim 1, characterized in that, Loading the target file used to run the first application from the external storage of the electronic device into the physical memory at a time prior to the target time includes: At a time prior to the target time, the kernel layer determines whether the target file is stored in the physical memory; If it is determined that the target file is not stored in the physical memory, the target file used to run the first application is loaded from the external storage of the electronic device into the physical memory.

4. The method according to claim 1, characterized in that, The step of loading the target file used to run the first application from the external storage of the electronic device into the physical memory at a time before the target time includes: querying the external storage according to the identifier of the target file at a time before the target time, and loading the target file obtained from the external storage into the physical memory.

5. The method according to claim 1, characterized in that, The method further includes: In response to an upgrade instruction for the first application, the kernel layer deletes the target file from the physical memory, wherein the file used to run the upgraded first application is different from the target file.

6. The method according to claim 1, characterized in that, The method further includes: In response to an uninstallation command for the first application, the kernel layer deletes the target file stored in the physical memory.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: If the kernel layer determines that the physical memory usage exceeds a preset threshold, it determines that the electronic device is under heavy load.

8. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program from the memory, such that the processor performs the file loading method according to any one of claims 1 to 7.

9. A chip, characterized in that, Includes a processor, which, when executing instructions, performs the file loading method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the file loading method according to any one of claims 1 to 7.