CN118444994A - File loading method, device and equipment - Google Patents

File loading method, device and equipment Download PDF

Info

Publication number
CN118444994A
CN118444994A CN202311300422.6A CN202311300422A CN118444994A CN 118444994 A CN118444994 A CN 118444994A CN 202311300422 A CN202311300422 A CN 202311300422A CN 118444994 A CN118444994 A CN 118444994A
Authority
CN
China
Prior art keywords
application
electronic device
target file
physical memory
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311300422.6A
Other languages
Chinese (zh)
Inventor
刘江涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202311300422.6A priority Critical patent/CN118444994A/en
Publication of CN118444994A publication Critical patent/CN118444994A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The application discloses a file loading method, device and equipment. The method comprises the following steps: in response to an instruction for starting a first application of an electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device; and in the 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.

Description

File loading method, device and equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a device for loading a file.
Background
An application of an electronic device needs to load a certain number of files (e.g., configuration files and data files) in a short time during the startup process so that the application can run normally after the files are successfully loaded.
In the conventional technology, in the application starting process of the electronic device, if the moment that the application actually needs to load the file is reached, the system of the electronic device issues an instruction to read the related file stored in the external memory of the electronic device, and loads the related file read from the external memory into the memory of the electronic device for data interaction. In some scenarios, the number of files that need to be loaded during the startup of an application (e.g., a camera application or a game application, etc.) is large and/or the files are too large, resulting in a problem of inefficient file loading based on the above-described conventional techniques.
Therefore, how to improve file loading efficiency is a problem to be solved.
Disclosure of Invention
The application provides a file loading method, a file loading device and file loading equipment.
In a first aspect, a method for loading a file is provided, the method comprising: in response to an instruction for starting a first application of an electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device; and in the starting process of the first application, the first application loads the target file obtained from the physical memory.
In the starting process of the first application, the target file for running the first application is already loaded into the physical memory from the external memory by the kernel layer of the electronic device in advance. That is, when the first application actually needs to load the target file, the target file is already stored in the physical memory of the electronic device in advance.
The kernel layer may perform a listening operation on the first application, such that in the event that an instruction for starting the first application is generated, the kernel layer may monitor the starting operation.
In the above technical solution, under the condition that an instruction for starting the first application of the electronic device is monitored, the kernel layer of the electronic device loads the target file for the first application into the physical memory of the electronic device from the external memory of the electronic device in advance. And then, in the starting process of the first application, the first application can load the target file obtained from the physical memory, so that the problem of low efficiency in the prior art that the first application loads the target file from the external memory can be avoided, and the method is beneficial to improving the file loading efficiency and the user satisfaction.
In one possible implementation manner, during the starting process of the first application, the first application loads the target file obtained from the physical memory, including: in the starting 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.
In the above technical solution, during the starting process of the first application, the kernel layer reads the target file stored in advance in the physical memory, and sends the read target file to the first application at one time. After that, when the first application receives the target file obtained from the physical memory by the kernel layer, the target file can be loaded, that is, the method can avoid the problem that the efficiency of the first application for reading the target file from the external memory is low in the prior art, avoid the problem that the service of the first application is blocked and the performance of the first application is deteriorated due to the low efficiency of the first application for reading the target file, and simultaneously reduce Input/Output (IO) overhead and improve the performance of the electronic equipment.
In another possible implementation manner, N page data corresponding to the target file are stored in N storage addresses of the physical memory, where the N page data are in one-to-one correspondence with the N storage addresses, each storage address is used to store the corresponding page data, N is a positive integer, and in a starting process of the first application, the kernel layer sends the target file read from the physical memory to the first application, where the sending process includes: in the starting process of the first application, the kernel layer receives a loading request sent by the first application, wherein the loading request is used for requesting to load 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.
The load request is for requesting to load a target file for running the first application, and thus the load request may include an identification of the first application, where the identification of the first application is used to indicate the first application. Optionally, the load request may also include other information than the identity of the first application, e.g., the other information may be, but is not limited to, an application name of the first application, etc.
In the technical scheme, in the starting process of the first application, the kernel layer reads the target file stored in the physical memory in advance and sends the read target file to the first application at one time, and then the first application can load the target file when receiving the target file obtained from the physical memory by the kernel layer, namely the method can avoid the problem that the first application in the prior art has low efficiency in reading the target file from the external memory, avoid the problem that the first application is blocked in service and the performance of the first application is deteriorated due to the low efficiency in reading the target file by the first application, and simultaneously can also reduce IO overhead and improve the performance of the electronic equipment.
In other implementations, during a launch of the first application, the first application loads a target file obtained from the physical memory, including: during the starting process of the first application, the following operations are performed: the method comprises the steps that a first application sends a loading request to a kernel layer, wherein the loading request is used for requesting to load a target file; the kernel layer sends an identification of a target file and a path of the target file to a first application according to a loading request, wherein the path of the target file is used for indicating N storage addresses in a physical memory;
And the first application reads N page data corresponding to the target file from N storage addresses of the physical memory according to the identification of the target file and the path of the target file, and loads the target file obtained from the physical memory.
In the above technical solution, in the starting process of the first application, after the kernel layer receives the loading request sent by the first application, the kernel layer sends the storage path of the target file pre-stored to the physical memory to the first application. After that, the first application reads the target file from the corresponding storage path in the corresponding physical memory, so that the purpose that the first application loads the target file obtained from the physical memory is realized, namely the method can avoid the problem that the first application reads the target file from the external memory in the prior art has low efficiency.
In another possible implementation manner, the responding to the instruction of starting 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 to the physical memory of the electronic device, including: responding to an instruction for starting the first application, and determining that the target file is not stored in the physical memory by the kernel layer; and under the condition that the target file is not stored in the physical memory, the kernel layer loads the target file from the external memory to the physical memory.
In the technical scheme, the kernel layer of the electronic equipment stores the target file read from the external memory into the physical memory only under the condition that the target file for running the first application is not stored in the physical memory of the electronic equipment, so that resources of the electronic equipment are saved.
In another possible implementation manner, before 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 in response to the instruction to start the first application of the electronic device, the method further includes: in response to the first application starting process, the kernel layer monitors the first application to obtain the identification of the target file, and the first application loads the target file obtained from the external memory; the method for loading the target file for running the first application from the external memory of the electronic device into the physical memory of the electronic device by the kernel layer of the electronic device in response to the instruction for starting the first application of the electronic device comprises the following steps: and responding to an instruction for restarting the first application, inquiring the external memory by the kernel layer according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
The first application is started for the first time after the electronic device is started. Restarting the first application refers to starting the first application any one time after the first application is started for the first time.
For example, a start of a first application that is started for a first time after the electronic device is started is referred to as a first start, and a start of a first application that is started for a second time after the first start is referred to as a second start.
In the above technical solution, during the first starting process of the first application, the kernel layer of the electronic device may monitor the first application to obtain the identifier of the file actually required to be loaded (i.e., the identifier of the target file) during the running process of the first application, and during the first starting process of the first application, since the target file is not stored in the physical memory, the first application loads the target file from the external memory. When the kernel layer monitors an instruction for restarting the first application, the kernel layer can query the external memory according to the identification of the target file associated with the first application, which is monitored before, and store the target file read from the external memory into the physical memory. And then, in the process of restarting the first application, the kernel layer can send the target file associated with the first application which is pre-stored in the physical memory to the first application according to the loading request of the first application, so that the first application can load the target file obtained from the physical memory, and the file loading efficiency when restarting the first application can be improved.
In another possible implementation, the method further includes: and responding to an upgrading instruction aiming at the first application, and deleting the target file in the physical memory by the kernel layer, wherein the file for running the upgraded first application is different from the target file.
In practical application, under the condition that the first application is not updated, the target file for running the first application is relatively fixed and does not change. That is, in the case where an upgrade occurs to the first application, a file for running the first application before the upgrade (i.e., a target file) and a file for running the first application after the upgrade are different.
In the technical scheme, under the condition that the first application is upgraded, the kernel layer can automatically delete the file (namely the target file) of the first application stored in the physical memory before the upgrade is operated, so that the method not only can avoid the waste of memory resources, but also can avoid the problem that partial functions of the upgraded first application cannot be normally used due to the fact that the upgraded first application loads unmatched files.
In another possible implementation, the method further includes: and in response to an uninstall instruction for the first application, the kernel layer deletes the target file stored in the physical memory.
In the technical scheme, under the condition that the first application in the electronic equipment is unloaded, the kernel layer can actively delete the target file stored in the physical memory and used for running the first application, so that the resources of the physical memory can be saved and the utilization rate of the physical memory can be improved.
In another possible implementation manner, before 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 in response to the instruction to start the first application of the electronic device, the method further includes: and the kernel layer determines that the memory utilization rate of the physical memory exceeds a preset threshold.
The memory utilization rate of the physical memory of the electronic equipment exceeds a preset threshold, namely the electronic equipment is in a reloading scene.
In the above reloading scenario, from the moment of starting the first application, the kernel layer loads the target file stored in the external memory and used for running the first application into the physical memory. That is, at the time of starting the first application, the kernel layer releases some application data (for example, unused data in a period of time) in the physical memory, so as to early load the target file stored in the external memory and used for running the first application into the unused space in the physical memory. When the first application actually needs to load the target file, the target file required by the first application is stored in the physical memory in advance, and then the first application only needs to load the target file obtained from the physical memory, so that the problem of low efficiency of the first application in the prior art in reading the target file from the external memory can be avoided, and the method is beneficial to improving the file loading efficiency and the user satisfaction.
In another possible implementation manner, before 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 in response to the instruction to start the first application of the electronic device, the method further includes: and the kernel layer determines that the memory utilization rate of the physical memory does not exceed a preset threshold.
The memory utilization rate of the physical memory of the electronic equipment does not exceed a preset threshold, namely the electronic equipment is in a light-load scene. The memory usage rate of the physical memory not exceeding the preset threshold value means that the memory usage rate of the physical memory is less than or equal to the preset threshold value.
In the technical scheme, the file loading method provided by the application can be suitable for a scene in which the electronic equipment is in heavy load, and can also be suitable for a scene in which the electronic equipment is in light load, so that the application scene to which the method is applicable is wider.
In a second aspect, a file loading device is provided, where the device includes a first processing unit and a second processing unit, where the first processing unit is configured to: in response to an instruction for starting a first application of the electronic device, loading a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device; the second processing unit is used for: and loading the target file obtained from the physical memory in the starting process of the first application.
In a possible implementation manner, the first processing unit is further configured to: in the starting process of the first application, the target file read from the physical memory is sent to the first application; the second processing unit is further configured to: and loading the target file obtained from the physical memory.
In another possible implementation manner, the N page data corresponding to the target file are stored in N storage addresses of the physical memory, where the N page data are in one-to-one correspondence 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: receiving a loading request sent by the first application in the starting process of the first application, wherein the loading request is used for requesting to load the target file; and according to the loading request, reading the N page data from the N storage addresses associated with the target file, and sending the N page data to the first application.
In other implementations, during a launch of the first application, the first application loads a target file obtained from the physical memory, including: during the starting process of the first application, the second processing unit is further configured to: sending a loading request to a kernel layer, wherein the loading request is used for requesting to load a target file; the first processing unit is further configured to: according to the loading request, sending an identification of a target file and a path of the target file to a first application, wherein the path of the target file is used for indicating N storage addresses in a physical memory; and, the second processing unit is further configured to: and according to the identification of the target file and the path of the target file, reading N page data corresponding to the target file from N storage addresses in the physical memory, and loading the target file obtained from the physical memory.
In another possible implementation manner, the first processing unit is further configured to: responding to an instruction for starting the first application, and determining that the target file is not stored in the physical memory; and under the condition that the target file is not stored in the physical memory, loading the target file into the physical memory from the external memory.
In another possible implementation manner, the first processing unit is further configured to, before the instruction for starting the first application of the electronic device, load, by the kernel layer of the electronic device, a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device, perform the following operations: in response to the first application starting process, monitoring the first application to obtain the identification of the target file, and loading the target file obtained from the external memory by the first application; the first processing unit is further configured to: and responding to an instruction for restarting the first application, inquiring the external memory according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
In another possible implementation manner, the first processing unit is further configured to: and deleting the target file in the physical memory in response to an upgrade instruction for the first application, wherein the file for running the upgraded first application is different from the target file. In another possible implementation manner, the first processing unit is further configured to: and deleting the target file stored in the physical memory in response to an uninstall instruction for the first application.
In another possible implementation manner, the first processing unit is further configured to, before the instruction for starting the first application of the electronic device, load, by the kernel layer of the electronic device, a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device, perform the following operations: and determining that the memory utilization rate of the physical memory exceeds a preset threshold.
In a third aspect, there is provided an electronic device comprising means for performing any of the methods of the first aspect. The device may be a terminal device or a chip in the terminal device. The device may comprise an input unit and a processing unit.
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 further comprise a memory for storing computer program code which, when executed by the processor, causes the terminal device to perform any of the methods of the first aspect.
When the device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin, a circuit, or the like; the chip may also include memory, which may be memory within the chip (e.g., registers, caches, etc.), or memory external to the chip (e.g., read-only memory, random access memory, etc.); the memory is for storing computer program code which, when executed by the processor, causes the chip to perform any of the methods of the first aspect.
In one possible implementation, the memory is used to store computer program code; a processor executing the computer program code stored by the memory, the processor for performing any one of the methods of the first aspect when the computer program code stored by the memory is executed.
In a fourth aspect, there is provided a computer readable storage medium storing computer program code which, when executed by a file loading apparatus, causes the file loading apparatus to perform any one of the file loading methods of the first aspect.
In a fifth aspect, there is provided a computer program product comprising: computer program code which, when run by file loading means, causes the file loading means to perform any one of the file loading methods of the first aspect.
It should be appreciated that the description of technical features, aspects, benefits or similar language in the present application does not imply that all of the features and advantages may be realized with any single embodiment. Conversely, it should be understood that the description of features or advantages is intended to include, in at least one embodiment, the particular features, aspects, or advantages. Therefore, the description of technical features, technical solutions or advantageous effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and advantageous effects described in the present embodiment may also be combined in any appropriate manner. Those of skill in the art will appreciate that an embodiment may be implemented without one or more particular features, aspects, or benefits of a particular embodiment. In other embodiments, additional features and advantages may be recognized in certain embodiments that may not be present in all embodiments.
Drawings
Fig. 1 is a schematic diagram of a hardware system of an electronic device 100 according to an embodiment of the present application.
Fig. 2 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application.
Fig. 3 is an interface schematic diagram of an electronic device suitable for the file loading method provided in the embodiment of the present application.
Fig. 4 is an interface schematic diagram of an electronic device suitable for the file loading method provided in the embodiment of the present application.
Fig. 5 is a schematic diagram of a file loading method according to an embodiment of the present application.
Fig. 6 is a schematic diagram of the time of starting the first application and the time of actually starting to load the target file, which are involved in the file loading method provided in fig. 5.
Fig. 7 is a schematic diagram of storing the target file in the physical memory, which is involved in the file loading method provided in fig. 5.
Fig. 8 is a schematic diagram of interaction between an application layer and a kernel layer of the electronic device involved in the file loading method provided in fig. 5.
Fig. 9 is a schematic diagram of another file loading method according to an embodiment of the present application.
Fig. 10 is a schematic diagram of a desktop of the mobile phone 1 for executing the file loading method provided by the embodiment of the present application.
Fig. 11 is a schematic diagram of a file loading device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B; "and/or" herein is merely one association relationship describing an association object, meaning that three relationships may exist; for example, a and/or B may represent: a alone; both A and B are present; there are three cases B alone.
In the description of embodiments of the present application, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more features. In the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more.
In the description of embodiments of the present application, the term "comprising" is used to indicate the presence of stated features, integers, steps, operations, elements, and/or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The technical scheme provided by the application is specifically explained below.
The file loading method provided by the embodiment of the application can be applied to electronic equipment. The hardware structure and the software structure of the electronic device will be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of a hardware system of an electronic device 100 according to an embodiment of the present application.
The electronic device 100 may be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an Augmented Reality (AR) device, a Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), a projector, an in-vehicle device, etc., and the specific type of the electronic device 100 is not limited in the embodiments of the present application.
The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration 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, and the like.
The configuration shown in fig. 1 does not constitute a specific limitation on the electronic apparatus 100. In other embodiments of the application, electronic device 100 may include more or fewer components than those shown in FIG. 1, or electronic device 100 may include a combination of some of the components shown in FIG. 1, or electronic device 100 may include sub-components of some of the components shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (IMAGE SIGNAL processor, ISP), a controller, a video codec, a digital signal processor (DIGITAL SIGNAL processor, DSP), a baseband processor, a neural-Network Processor (NPU). The different processing units may be separate devices or integrated devices.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. For example, the processor 110 may include at least one of the following interfaces: inter-INTEGRATED CIRCUIT, I2C interface, inter-integrated circuit audio (inter-INTEGRATED CIRCUIT SOUND, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver transmitter (universal asynchronous receiver/transceiver, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input/output (GPIO) interface, SIM interface, USB interface.
It should be understood that the connection relationships between the modules shown in fig. 1 are only illustrative, and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Alternatively, the modules of the electronic device 100 may also use a combination of the various connection manners in the foregoing embodiments.
The electronic device 100 may implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 may be used to display images or video. For example, the display screen 194 may display images or videos captured by a camera application of a target object. The display 194 includes a display panel. The display panel may employ a Liquid Crystal Display (LCD) CRYSTAL DISPLAY, 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 LIGHT-emitting diode, mini LED), a Micro light-emitting diode (Micro LED), a Micro OLED (Micro OLED) or a quantum dot light LIGHT EMITTING diode (QLED). In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. The ISP can carry out algorithm optimization on noise, brightness and color of the image, and can optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into a standard Red Green Blue (RGB), YUV, etc. format image signal. In some embodiments, electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The external memory interface 120 may be used to connect an external memory card, such as a Secure Digital (SD) card, to enable expanding the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. Wherein the storage program area may store application programs required for at least one function (e.g., a sound playing function and an image playing function) of the operating system. The storage data area may store data (e.g., audio data and phonebooks) created during use of the electronic device 100. Further, the internal memory 121 may include a high-speed random access memory, and may also include a nonvolatile memory such as: at least one disk storage device, a flash memory device, and a universal flash memory (universal flash storage, UFS), etc. The processor 110 performs various processing methods of the electronic device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The pressure sensor 180A is used to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A may be of various types, such as a resistive pressure sensor, an inductive pressure sensor, or a capacitive pressure sensor. The capacitive pressure sensor may be a device comprising at least two parallel plates with conductive material, and when a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes, and the electronic device 100 determines the strength of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic apparatus 100 detects the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the location of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon; and executing the instruction of newly creating the short message when the touch operation with the touch operation intensity being larger than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., x-axis, y-axis, and z-axis) may be determined by gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance to be compensated by the lens module according to the angle, and makes the lens counteract the shake of the electronic device 100 through the reverse motion, so as to realize anti-shake. The gyro sensor 180B can also be used for scenes such as navigation and motion sensing games.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude from barometric pressure values measured by barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. The electronic device 100 may set the characteristics of automatic unlocking of the flip cover according to the detected open-close state of the leather sheath or the open-close state of the flip cover.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically, x-axis, y-axis, and z-axis). The magnitude and direction of gravity may be detected when the electronic device 100 is stationary. The acceleration sensor 180E may also be used to recognize the gesture of the electronic device 100 as an input parameter for applications such as landscape switching and pedometer.
The distance sensor 180F is used to measure a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the electronic device 100 may range using the distance sensor 180F to achieve fast focus.
The proximity light sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, for example, a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When the reflected light is detected, the electronic device 100 may determine that an object is present nearby. When no reflected light is detected, the electronic device 100 may determine that there is no object nearby. The electronic device 100 can use the proximity light sensor 180G to detect whether the user holds the electronic device 100 close to the ear for talking, so as to automatically extinguish the screen for power saving. The proximity light sensor 180G may also be used for automatic unlocking and automatic screen locking in holster mode or pocket mode.
The ambient light sensor 180L is used to sense ambient light level. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. Ambient light sensor 180L may also cooperate with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 may utilize the collected fingerprint feature to perform functions such as unlocking, accessing an application lock, taking a photograph, and receiving an incoming call.
The temperature sensor 180J is for detecting temperature. In some embodiments, the electronic device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs a reduction in the performance of a processor located in the vicinity of temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the electronic device 100 heats the battery 142 to avoid the low temperature causing the electronic device 100 to be abnormally shut down. In other embodiments, when the temperature is below a further threshold, the electronic device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as a touch device. The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch screen. The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor 180K may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 and at a different location than the display 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is described below. The software system may employ a layered architecture, an event driven architecture, a microkernel architecture, a micro-service architecture, or a cloud architecture, and the embodiment of the present application exemplarily describes the software system of the electronic device 100.
By way of example, fig. 2 shows a schematic diagram of a software system of an electronic device. Referring to fig. 2, the software system employs a layered architecture. The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into five layers, from top to bottom, an application layer 210, an application framework layer 220, android Runtime and core library layers 230, a hardware abstraction layer (hardware abstract layer, HAL) 240, and a kernel layer 250, respectively.
The application layer 210 may include a series of application packages. For example, the application packages may include camera, gallery, chat, talk, map, navigation, calendar, bluetooth, music, video, and like applications.
Each of the applications described above may include more specific functional modules, for example, the gallery may include a business module and a notification module.
The various applications described above may be used to generate application data, e.g., gallery for generating photo data.
The application framework layer 220 provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer 220 includes a number of predefined functions.
As shown in FIG. 2, 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, and the like.
The window manager provides a Window Management Service (WMS) that may be used for window management, window animation management, surface management, and as a relay station for the input system.
The activity manager may provide activity management services (ACTIVITY MANAGER SERVICE, AMS) that may be used for system component (e.g., activity, service, content provider, broadcast receiver) start-up, handoff, scheduling, and application process management and scheduling tasks.
The input manager may provide an input MANAGER SERVICE service (IMS), which may be used to manage inputs to the system, such as touch screen inputs, key inputs, sensor inputs, etc. The IMS retrieves events from the input device node and distributes the events to the appropriate windows through interactions with the WMS.
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications.
The content provider enables the application to access data of other applications (such as address book) or enables the application to share its own data, which may include video, image, audio, phone calls made and received, browsing history and bookmarks, phone book, etc.
Android Runtime (Android run) includes a core library and virtual machines. Android run is responsible for scheduling and management of the Android system.
The core library consists of two parts: one part of the programming language (e.g., java language) needs to call the function, and the other part is the core library of the android.
The application layer 210 and the application framework layer 220 run in virtual machines. The virtual machine executes the programming files (e.g., java files) of the application layer 210 and the application framework layer 220 as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The core library layer 230 may include a plurality of functional modules. For example: surface manager (surface manager), media framework (media framework), system class library layer (ibc layer), lightweight database (SQLite), openGL ES, webkit, etc.
The surface manager is used to manage the display subsystem and provides a fusion of two-Dimensional (2D) and three-Dimensional (3D) layers for multiple applications.
Media frames support a variety of commonly used audio, video format playback and recording, still image files, and the like.
The Hardware Abstraction Layer (HAL) 240 is an interface layer between the operating system kernel and upper layer software that aims at abstracting the hardware. The hardware abstraction layer is a device kernel driven abstraction interface for enabling application programming interfaces that provide higher level Java API frameworks with access to the underlying devices. The HAL contains a plurality of library modules, such as camera HAL, vendor library, display screen, bluetooth, audio, etc. Wherein each library module implements an interface for a particular type of hardware component. It will be appreciated that the camera HAL may provide an interface for the camera FWK to access hardware components such as a camera head. The Vendor bin may provide an interface for media FWK to access hardware components such as encoders. To load library modules for the hardware component when the system framework layer API requires access to the hardware of the portable device, the Android operating system will load the library modules for the hardware component.
The kernel layer 250 is the basis of the Android operating system, and the final functions of the Android operating system are completed through the kernel layer 250, and include functions of driving, process scheduling, inter-process communication, memory management, power management and the like.
As shown in fig. 2, the kernel layer 250 may include memory management, file management, display driving, audio driving, camera driving, bluetooth driving, power management, camera driving, and the like.
Memory management in kernel layer 250 is used to manage the physical memory address space. The memory management in the kernel layer 250 is based on a paging mechanism to perform memory management on physical memory, for example, dividing physical memory address and linear address space in units of 4 bytes (Kilobyte, KB) as one page, so that the two can implement address mapping in units of 4KB pages.
File management in kernel layer 250 is responsible for managing files and file systems in the system. File management provides operations such as creation, reading, writing, deleting and the like of files and directories, and functions such as file authority management, mounting and dismounting of a file system and the like. Through file management, kernel layer 250 is able to provide applications (e.g., camera applications) and users with access to files and an operational interface, guaranteeing security and integrity of data.
It should be noted that, the software structure schematic diagram of the electronic device shown in fig. 2 provided by the present application is only used as an example, and is not limited to specific module division in different layers of the Android operating system, and the description of the software structure of the Android operating system in the conventional technology may be referred to specifically. In addition, the shooting method provided by the application can be realized based on other operating systems (such as IOS or hong mo, etc.), and the application is not limited to the example.
Next, taking the electronic device 100 shown in fig. 1 as an example of a mobile phone, a case where the mobile phone executing the file loading method provided in the embodiment of the present application runs an application program will be described.
In some implementations, the current mobile phone runs a plurality of different applications, based on which the mobile phone execution file loading method may be one of the non-running applications installed in the mobile phone. It can be understood that, in the case that the number of running application programs in the mobile phone exceeds the preset threshold, the mobile phone can be considered to be currently in a heavy load scenario, that is, the usage rate of the physical memory of the mobile phone exceeds the preset threshold.
Illustratively, taking the interface of the mobile phone 300 shown in fig. 3 as an example, a background of the mobile phone 300 runs a plurality of application programs, where the plurality of application programs include a gallery, a camera, a phone, and the like. In this scenario, the mobile phone 300 may also execute the file loading method provided in the embodiment of the present application for other applications installed in the mobile phone 300 that are not running, for example, but not limited to, a video application or a chat application.
In other implementations, the mobile phone may run one application, based on which the mobile phone execution file loading method may be one of the non-running applications installed in the mobile phone. It can be understood that when the number of running application programs in the mobile phone is less than or equal to the preset threshold, the mobile phone can be considered to be in a light load scene currently, that is, the usage rate of the physical memory of the mobile phone does not exceed the preset threshold.
For example, taking the interface of the mobile phone 400 shown in fig. 4 as an example, 1 application program runs in the background of the mobile phone 400, and the 1 application program is a gallery. In this scenario, the mobile phone 400 may also execute the file loading method provided in the embodiment of the present application for other applications installed in the mobile phone 400, for example, but not limited to, a camera application, a video application, or a chat application.
As described above, in order to solve the problem of low file loading efficiency in the conventional technology, the file loading method provided in the embodiment of the present application adopts the following technical scheme: in response to an instruction to start a first application of the electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device; in the starting process of the first application, the first application loads a target file obtained from a physical memory. The method can improve file loading efficiency and user experience.
Next, a file loading method according to an embodiment of the present application will be described in detail with reference to fig. 5 to 9.
Fig. 5 is a schematic diagram of a file loading method according to an embodiment of the present application. The file loading method provided by the embodiment of the application can be executed by the electronic equipment. It is understood that the electronic device may be implemented as software, or as a combination of software and hardware. By way of example, the electronic device in the embodiments of the present application may be, but is not limited to, the electronic device 100 shown in fig. 1. As shown in fig. 5, the file loading method provided by the embodiment of the present application includes step S510 and step S520. Next, S510 and S520 will be described in detail.
S510, in response to an instruction for starting a first application of the electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device.
For example, the external memory of the electronic device in S510 may be the external memory connected to the external memory interface 120 in the electronic device 100 shown in fig. 1, and the physical memory of the electronic device may be the internal memory 121 in the electronic device 100 shown in fig. 1. The kernel layer in S510 may be the kernel layer 250 in the software architecture of the electronic device 100 shown in fig. 2, and the kernel layer 250 may include a memory management module and a file management module. Optionally, the kernel layer may also include a power management module and various driving modules (e.g., camera driver, bluetooth driver, audio driver, camera driver, and display driver), etc. The first application in S510 may be any one of the applications in the application layer 210 shown in fig. 2, for example, the first application may be, but not limited to, a camera application, a gallery application, a chat application, a music application, a chat application, or a video application.
The external memory and the physical memory in the embodiment of the present application are described below by way of example. For example, taking an electronic device as a mobile phone, the mobile phone is 8 gigabytes (Gigabyte, GB) of memory+256 GB of memory, the external memory of the electronic device refers to 256GB of memory space, and the physical memory of the electronic device refers to 8GB of running memory. For example, in an electronic device as a computer, the memory refers to a RAM (also called a main memory) of the computer, and the external memory refers to an external memory of the computer, for example, the external memory may be a magnetic disk or a hard disk.
The instruction for starting the first application of the electronic device is used for executing the starting operation on the first application, and in the embodiment of the present application, the presentation form of the instruction for starting the first application is not particularly limited, and may 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., clicks or double clicks) an application icon of the first application in a main interface of the electronic device. As another example, the instruction to launch the first application of the electronic device may be a predefined piece of program code instructions.
The target file is a file utilized by the electronic device when running the first application, and the file utilized by the electronic device when running the first application may be a data file and/or a configuration file. The data files may be, but are not limited to, various files such as images, text, video, and the like. The configuration files may be, but are not limited to, various files such as program items, network connections, printer connections, keyboard settings, mouse settings, screen colors, and window size and location.
The number of target files used when the electronic device runs the first application is not particularly limited, and can be set according to actual conditions. In some implementations, the number of target files that the electronic device needs to utilize when running the first application is associated with a function of the first application. For example, if the algorithm function of the first application is complex, the number of target files that need to be utilized when the electronic device runs the first application is large (e.g., 10, 15, 20, etc.). For another example, if the algorithm function of the first application is simpler, the number of target files that need to be utilized when the electronic device runs the first application is smaller (e.g., 1,2, 3, etc.).
In the embodiment of the present application, the step S510 is executed, that is, in response to an instruction for starting a first application of an electronic device, the kernel layer of the electronic device loads, from an external memory of the electronic device, a target file for running the first application into a physical memory of the electronic device, including: responding to an instruction for starting a first application, and determining that a target file is not stored in a physical memory by a kernel layer; and under the condition that the target file is not stored in the physical memory, the kernel layer loads the target file from the external memory to the physical memory.
In the above implementation manner, the kernel layer may perform a monitoring operation on the first application, so that, in a case where a start instruction for the first application is generated, the kernel layer may monitor an instruction for starting the first application.
By way of example, fig. 6 shows the moment at which the first application is launched and the moment at which the first application actually starts loading the target file. As shown in fig. 6, the kernel layer stores the target file stored in the external memory into the physical memory during a period from a time when the first application is started to a time when the first application actually starts to load the target file.
In the technical scheme, the kernel layer stores the target file read from the external memory into the physical memory only under the condition that the target file associated with the first application is not stored in the physical memory, so that resources of the electronic equipment are saved.
In the following, a method for loading the target file from the external memory to the physical memory by the kernel layer in the implementation manner is described. In practical application, under the condition that the first application is not updated, the target file for running the first application is relatively fixed and does not change. That is, in the case that the first application is not upgraded, the files that the first application needs to load are the same (i.e., the target files) during any one time of starting the first application.
In some implementations, before 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 in response to an instruction to launch the first application of the electronic device, the method further includes: in response to the first starting process of the first application, the kernel layer monitors the first application to obtain the identification of the target file, and the first application loads the target file obtained from the external memory; in response to an instruction to launch a first application of the electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device, including: and responding to an instruction for restarting the first application, inquiring the external memory by the kernel layer according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
The first application is started for the first time after the electronic device is started. Restarting the first application refers to starting the first application any one time after the first application is started for the first time. It should be noted that, after the first application started for the first time loads the target file obtained from the external memory and runs normally for a period of time, the running of the first application is finished according to the instruction for finishing the first application. After the first application finishes running, the first application releases the target file loaded before. That is, during the process of restarting the first application after the first startup, the first application still needs to load the target file.
The external memory stores the target file and the mapping relation between the target file and the identification of the target file. Therefore, the kernel layer can successfully read the target file corresponding to the identifier of the target file by inquiring the external memory according to the identifier of the target file. Alternatively, other files than the target file may be stored in the external memory, for example, the other files may be files managed by other applications than the first application.
In the implementation manner, during the first starting process of the first application, the kernel layer monitors the first application to obtain the identifier of the file actually required to be loaded by the first application (i.e. the identifier of the target file) during the first application starting process, and simultaneously, during the first starting process of the first application, the target file is not stored in the physical memory, so that the first application loads the target file from the external memory. When the kernel layer detects an instruction for restarting the first application, the kernel layer can query the external memory according to the identification of the target file associated with the first application detected before, and store the target file read from the external memory into the physical memory. And then, in the process of starting the first application, the kernel layer can send the target file associated with the first application which is pre-stored in the physical memory to the first application according to the loading request of the first application, so that the first application can load the target file acquired from the physical memory, and the file loading efficiency when the first application is started again can be improved.
In other implementations, the electronic device may encapsulate, at the factory, an identifier of the target file for running the first application in the kernel layer, based on which S510 is executed, that is, in response to an instruction to start the first application of the electronic device, the kernel layer of the electronic device loads, from the external memory of the electronic device, the target file for running the first application into the physical memory of the electronic device, where the method includes: and responding to an instruction for starting the first application, inquiring the external memory by the kernel layer according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
In the above implementation manner, the address where the kernel layer stores the target file in the external memory to the physical memory is not specifically limited. In some implementations, after executing the above S510, N page data corresponding to the target file may be stored in N storage addresses of the physical memory, where the N page data corresponds to the N storage addresses one to one, and each storage address is used to store the corresponding page data, and N is a positive integer. In the embodiment of the application, after the kernel layer stores the target file read from the external storage to the physical memory, the kernel layer can know the mapping relationship between the N page data and the N storage addresses corresponding to the target file.
In the embodiment of the present application, the memory usage rate of the physical memory is not particularly limited. For example, the memory usage rate of the physical memory may exceed a preset threshold or not, where the preset threshold may be set according to an actual application scenario, which is not limited specifically. For example, the preset threshold may be, but is not limited to, 60%, 65%, or 75%. It can be appreciated that the memory usage of the physical memory of the electronic device exceeds the preset threshold, i.e. the electronic device is in a reloading scenario. The memory utilization rate of the physical memory of the electronic equipment does not exceed a preset threshold, namely the electronic equipment is in a light-load scene.
In some implementations, the file loading method provided by the embodiment of the present application is applied in a reload scenario, based on which, before 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 in response to the instruction for starting the first application of the electronic device, the method further includes: the kernel layer determines that the memory usage of the physical memory exceeds a preset threshold.
In other implementations, the file loading method provided by the embodiment of the present application is applied in a light-load scenario, based on which, before the kernel layer of the electronic device loads the target file for running the first application from the external memory of the electronic device to the physical memory of the electronic device in response to the instruction for starting the first application of the electronic device, the method further includes: the kernel layer determines that the memory usage of the physical memory does not exceed a preset threshold.
In the implementation manner, the file loading method provided by the application can be suitable for a scene where the electronic equipment is in heavy load and a scene where the electronic equipment is in light load, so that the application scene where the method is applicable is wider. In the step S510, the kernel layer of the electronic device performs the operation of loading the target file associated with the first application stored in the external memory of the electronic device into the physical memory of the electronic device in advance at the time between the actual needs of the first application to load the target file, and in the embodiment of the present application, after the kernel layer performs the step S510, the time when the first application actually needs to load the target file has not yet been reached. That is, the target file is already stored in the physical memory of the electronic device at the moment when the first application actually needs to load the target file.
S520, in the starting process of the first application, the first application loads the target file obtained from the physical memory.
In the step S520, during the starting process of the first application, the first application may load the target file pre-stored to the physical memory by the kernel layer.
In the embodiment of the present application, a loading method for loading the target file obtained from the physical memory to the first application is not particularly limited.
In some implementations, during a startup process of the first application, the first application loads a target file obtained from the physical memory, including: in the starting process of the first application, the kernel layer sends a target file read from the physical memory to the first application; the first application loads a target file obtained from the physical memory.
In the implementation manner, in the starting process of the first application, the kernel layer reads the target file pre-stored to the physical memory, and sends the read target file to the first application at one time, and then, when the first application receives the target file obtained from the physical memory by the kernel layer, the target file can be loaded. Therefore, the problem that the first application reads the target file from the external memory in the prior art is low in efficiency can be avoided, the problems that the first application is blocked and the performance of the first application is deteriorated due to the fact that the first application reads the target file in low efficiency are avoided, IO (input/output) expenditure can be reduced, and the performance of the electronic equipment is improved.
Optionally, N page data corresponding to the target file in the above implementation manner are stored in N storage addresses of the physical memory, where the N page data are in one-to-one correspondence with the N storage addresses, each storage address is used to store the corresponding page data, N is a positive integer, and in the above starting process of the first application, the kernel layer sends the target file read from the physical memory to the first application step, which includes: in the starting process of the first application, the kernel layer receives a loading request sent by the first application, wherein the loading request is used for requesting to load a target file; and the kernel layer reads N page data from N storage addresses associated with the target file according to the loading request, and sends the N page data to the first application.
In the above-mentioned starting process of the first application, after the kernel layer receives the loading request sent by the first application, the method may further include the following steps: in the starting process of the first application, the first application sends a loading request to the kernel layer.
The load request is for requesting a load of a target file for running a first application, wherein the load request may include an identification of the first application, the identification of the first application being for uniquely identifying the first application. Optionally, the load request may also include other information than the identity of the first application, e.g., the other information may be, but is not limited to, the name of the first application, etc.
The kernel layer stores the target file in the N storage addresses of the physical memory in the form of page data, and the storage method for storing the target file in the physical memory in the minimum unit of pages does not cause waste of the physical memory. The size of each page data in the N page data is not particularly limited, and may be set according to actual conditions. Illustratively, in the case where the size of the target file is 16KB and the size of each page data is 4KB, the target file corresponds to 4 page data. The value of N is not particularly limited, and may be selected according to practical situations, for example, N may be, but is not limited to, 1,2, or 6.
For example, referring to fig. 7, taking the camera file shown in fig. 7 as an example, the camera file includes 0 to N pages, where the 0 th page of the camera file corresponds to the 3 rd block of the physical memory (the block number of the physical memory is 3), the 1 st page of the camera file corresponds to the 6 th block of the physical memory (the block number of the physical memory is 6), … …, and the N th page of the camera file corresponds to the 5 th block of the physical memory (the block number of the physical memory is 5). It will be appreciated that the block number of the physical memory corresponds to a segment of the memory address in the physical memory.
In other implementations, during a launch of the first application, the first application loads a target file obtained from the physical memory, including: during the starting process of the first application, the following operations are performed: the method comprises the steps that a first application sends a loading request to a kernel layer, wherein the loading request is used for requesting to load a target file; the kernel layer sends an identification of a target file and a path of the target file to a first application according to a loading request, wherein the path of the target file is used for indicating N storage addresses in a physical memory; and the first application reads N page data corresponding to the target file from N storage addresses of the physical memory according to the identification of the target file and the path of the target file, and loads the target file obtained from the physical memory.
In the implementation manner, after receiving a loading request sent by the first application, the kernel layer sends a storage path of a target file pre-stored in the physical memory to the first application, and then the first application reads the target file from a corresponding storage path in a corresponding physical memory, and further loads the target file obtained from the physical memory. Thus, the problem that the first application has low efficiency in reading the target file from the external memory in the conventional technology can be avoided, and the problems that the first application is blocked in service and the performance of the first application is deteriorated due to the low efficiency in reading the target file by the first application can be avoided.
In the embodiment of the present application, after executing S510 and S520 described above, the operation of updating and upgrading the first application may be related to the user' S requirement. In practical application, under the condition that the first application is not updated, the target file for running the first application is relatively fixed and does not change. That is, in the case where an upgrade occurs to the first application, a file for running the first application before the upgrade and a file for running the first application after the upgrade are different.
In some implementations, the following steps may also be performed: and in response to the upgrading instruction aiming at the first application, the kernel layer deletes the target file in the physical memory, wherein the file for running the upgraded first application is different from the target file.
For example, the file for running the first application before the non-upgrade may be the file 1, and the file for running the first application after the non-upgrade may be the file 2, wherein the file 1 and the file 2 are different. For example, the file for running the first application before the upgrade may include a file 1 and a file 2, and the file for running the first application after the upgrade may include a file 1, a file 2, and a file 3, wherein the file 1, the file 2, and the file 3 are all different.
In the implementation manner, under the condition that the first application is upgraded, the kernel layer actively deletes the target file which is stored in the physical memory and is associated with the first application before being upgraded, so that the resources of the physical memory can be saved and the utilization rate of the physical memory can be improved.
In the embodiment of the present application, after the steps S510 and S520 are performed, the operation of deleting the first application may be related to the user' S requirement. Based on this, in some implementations, the following steps may also be performed: and in response to an uninstall instruction for the first application, the kernel layer deletes the target file stored in the physical memory.
In the implementation manner, under the condition that the first application installed in the electronic device is uninstalled, the kernel layer actively deletes the target file stored as the association of the first application in the physical memory, so that the resources of the physical memory can be saved and the utilization rate of the physical memory can be improved.
Fig. 8 is a schematic diagram illustrating interaction between a first application located in an application layer of an electronic device and a kernel layer in the file loading method according to the embodiment of the present application. As shown in fig. 8, in the case of an instruction to launch the first application, the kernel layer loads the target file for running the first application in the external memory into the physical memory. In the starting process of the first application, the first application sends information for requesting to load the target file associated with the first application to the kernel layer, and then the first application loads the target file stored in the physical memory in advance.
It should be understood that the file loading method shown in fig. 5 is merely illustrative, and the file loading method provided by the present application is not limited in any way. For example, the number of target files for running the first application referred to in fig. 5 described above is plural, and the plural files are stored in plural storage blocks in the external memory. For example, the external memory in fig. 5 may be referred to as external memory, and the physical memory may be referred to as internal memory.
In the embodiment of the application, under the condition that the instruction for starting the first application of the electronic equipment is monitored, the kernel layer of the electronic equipment loads the target file for the first application into the physical memory of the electronic equipment from the external memory of the electronic equipment in advance. And then, in the starting process of the first application, the first application can load the target file obtained from the physical memory, so that the problem of low efficiency in the prior art that the first application loads the target file from the external memory can be avoided, and the method is beneficial to improving the file loading efficiency and the user satisfaction. In addition, the file loading method provided by the application is suitable for the scene that the electronic equipment is in light load or heavy load, and the application range of the method is wider.
Next, taking a camera application in an electronic device as an example to load a file, another file loading method provided by the embodiment of the present application is described with reference to fig. 9. It should be understood that the file loading method described in fig. 9 is a specific example of the file loading method described in fig. 6, and the method described in fig. 9 is only illustrative, and does not limit the file loading method provided in the present application.
Fig. 9 is a schematic diagram of another file loading method according to an embodiment of the present application. The file loading method provided by the embodiment of the application can be executed by the electronic device 100 shown in fig. 1, wherein the electronic device 100 can 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. Illustratively, as shown in FIG. 9, the method includes steps S910 through S970. Next, S910 to S970 will be described in detail.
S910, in response to first starting the camera application of the electronic device (i.e. one example of the first application in the method shown in fig. 5 above), the camera application loads a target file for running the camera application from the external memory, and the kernel layer listens to the camera application to obtain a camera file list, wherein the camera file list includes an identification of the target file for running the camera application.
The first start of the camera application refers to the first start of the camera application after the electronic device is started. For example, taking an electronic device as a mobile phone, after the mobile phone is started, a user clicks a camera application icon in an interface of the mobile phone, and then the camera application is started for the first time, and this camera application start is called as the first start of the camera application.
The list of camera files includes an identification of target files that the electronic device needs to utilize when running the camera application. In the embodiment of the present application, the identification of the target file is not specifically limited, for example, the identification of the target file may be the name of the target file or the serial number of the target file.
The object files may include data files, which may be but are not limited to various files such as images, text, video, etc., and configuration files, which may be but are not limited to various files such as program items, network connections, printer connections, keyboard settings, mouse settings, screen colors, and the size and location of windows.
In the embodiment of the application, the kernel layer can continuously monitor the camera application, so that under the condition that the camera application is started and operated for the first time, the kernel layer can detect files required to be loaded after the camera application is started, and the kernel layer can determine the files as target files required to be utilized when the camera application is operated. For example, taking an example that a file that needs to be loaded by a camera application is not stored in a physical memory of the electronic device, and a file that needs to be loaded by the camera application is stored in an external memory of the electronic device, when the camera application is started for the first time, the camera application can load the file that needs to be loaded by the camera application from the external memory.
And S920, responding to an application icon event of the camera application in the interface of the electronic equipment clicked by the user, and sending notification information to the kernel layer by the camera application, wherein the notification information is used for notifying the kernel layer that the target file indicated by the camera file list is loaded into the physical memory of the electronic equipment from the external memory.
In the step S920, when the user clicks the application icon of the camera application to trigger the camera application to be started again, the camera application notifies the kernel layer to load the target file stored in the external memory of the electronic device into the physical memory of the electronic device according to the camera file list.
The notification information is used for notifying the kernel layer that the target file indicated by the camera file list is loaded into the physical memory of the electronic device from the external memory, wherein the notification information can comprise the camera file list. Optionally, the notification information may also include other information, for example, the other information may be an application identifier of the camera application, etc.
The application icon event for a user to click on a camera application in the interface of the electronic device is not particularly limited. For example, an application icon event that may be a user finger single click or double click of a camera application. As another example, an application icon event may be a user clicking or double clicking on a camera application with an electronic pen.
In the step S920, the description is given taking an example in which the user clicks the application icon of the camera application and the camera application sends notification information to the kernel layer. Optionally, a monitoring process may also be running in an application layer of the electronic device, and in response to the monitoring process monitoring that the user clicks an application icon event of the camera application, the monitoring process sends notification information to the kernel layer.
In the embodiment of the present application, the memory utilization of the physical memory is not particularly limited. For example, when the memory usage rate of the physical memory exceeds the preset threshold, the electronic device may be considered to be in a heavy-load scenario, such as when a larger number of applications (e.g., 15 or 20, etc.) are running in the background of the electronic device, and the usage rate of the physical memory utilized by the larger number of applications exceeds the preset threshold. As another example, the memory usage of the physical memory does not exceed the preset threshold, where the electronic device may be considered in a light load scenario, such as where the electronic device runs in the background a fewer number of applications (e.g., 1 or 2, etc.) that use the physical memory with the memory usage that does not exceed the preset threshold.
And S930, loading 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 by the kernel layer of the electronic device, wherein the N storage addresses are in one-to-one correspondence with N page data of the target file, each storage address is used for storing the corresponding page data, and N is a positive integer.
In S930, the target file is stored in the external memory with a file granularity, and the target file is stored in the physical memory with a page granularity. The size of each page data is not particularly limited, and may be set according to actual conditions. Illustratively, in the case where the size of the target file is 16KB and the size of each page data is 4KB, the target file corresponds to 4 page data.
The step S930 of the electronic device is executed by the electronic device, in which 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, including: traversing files stored in the external memory by the kernel layer according to the identifiers of the target files included in the camera file list included in the notification information to obtain target storage positions of the target files stored in the external memory, wherein the target storage positions are indicated by the identifiers of the target files; the kernel layer reads the target file from the target storage position of the external memory, and stores N pages of data corresponding to the read target file into N storage addresses of the physical memory.
In the implementation manner, the target file is stored in the physical memory with the page as the minimum unit, so that the waste of the physical memory is avoided.
It is understood that after the kernel layer of the electronic device executes S930, the kernel layer may learn that the storage addresses of the target file in the physical memory of the electronic device include N storage addresses.
S940, during the starting process of the camera application of the electronic device, the kernel layer of the electronic device reads corresponding N page data from N storage addresses according to a loading request sent by the camera application, wherein the loading request is used for requesting to acquire a target file utilized when the electronic device runs the camera application.
In the step S940, during the starting of the camera application of the electronic device, the camera application may send a load request to the kernel layer for requesting to acquire the target file utilized when the electronic device runs the camera application. Accordingly, the kernel layer receives a load request from the camera application. And then, the kernel layer can successfully read N page data corresponding to the target file requested by the loading request from N storage addresses according to the loading request.
The loading request is used for requesting to acquire a target file utilized when the electronic device runs the camera application, wherein the loading request can include an identifier of the camera application, and in this implementation manner, a mapping relationship between the identifier of the camera application and the target file is stored in the kernel layer, so that, when the kernel layer acquires the identifier of the camera application indicated by the loading request, the kernel layer can learn that the loading request is used for requesting the target file according to the mapping relationship, thereby learning that a storage address of the target file in the physical memory includes N storage addresses. The information included in the load request is not particularly limited, i.e., the load request may also include other information, such as, but not limited to, the following: the identification of the target file or the time when the kernel layer sends the target file stored in the physical memory to the camera application.
It should be noted that, when the camera application of the electronic device actually needs to load the target file is the target time, the target time is not yet reached after executing S910 to S940. That is, in the embodiment of the present application, before the camera application needs to load the target file, the target file is already loaded into the physical memory from the external memory through the private interface in advance. After that, if the camera application needs to load the target file, the kernel layer can directly send the target file read from the physical memory to the camera application, so that the loading efficiency of the file can be improved, meanwhile, the problems that the camera application is blocked and the camera performance is deteriorated due to the fact that the camera application is not loaded to the required target file in time are avoided, the running fluency of the camera application can be improved, and the user experience is improved.
And S950, the kernel layer of the electronic equipment sends the read N page data to the camera application so that the camera application loads the target file. Accordingly, the camera application receives the N pages of data from the kernel layer.
In S950, if the target file needs to be loaded during the starting process of the camera application, the electronic device sends all the files (i.e., the target files) that need to be loaded by the camera application and are read from the physical memory to the camera application at one time. Under the condition that the target file corresponds to a plurality of page data, the camera application can be prevented from actively uploading the page data from the physical memory for a plurality of times, so that IO overhead can be reduced, and file loading efficiency is improved.
In S940 and S950, the kernel layer executes N page data corresponding to the read target file from the physical memory, and the kernel layer sends the N page data corresponding to the read target file to the camera application for example to describe. Optionally, the method for loading the target file by the camera application described in S940 and S950 may be replaced by the camera application acquiring the target file from the physical memory according to the identifier of the target file and the storage address of the target file in the physical memory, so as to achieve the purpose of loading the target file by the camera application, which is not described in detail herein but may refer to the related description in S520.
S960, the camera application loads the target file.
S970, in response to the upgrade operation for the camera application, the kernel layer deletes N page data stored in N storage addresses of the physical memory.
In the embodiment of the application, the operation of upgrading the camera application of the electronic equipment is also involved according to the user requirement, and the performance of the camera application can be improved by upgrading the camera application, for example, the camera application is added with functions or the original functions of the camera application are optimized, and the like. For a scene in which a camera application needs to be upgraded, there may be a difference between a file that needs to be utilized when the camera application is running before the camera application is upgraded and a file that needs to be utilized when the camera application is running after the camera application is upgraded. Thus, the following steps may also be performed: in response to an upgrade operation for the camera application, the kernel layer deletes N pages of data stored in N storage addresses of the physical memory.
In the implementation manner, the files used when the electronic device runs the camera application after upgrading are different from the files used when the camera application before upgrading is run, and after the camera application of the electronic device is upgraded, the files stored in the physical memory and used for running the camera application before upgrading can be automatically deleted, so that not only can the resource waste of the physical memory be avoided, but also the problem that partial functions of the camera application after upgrading cannot be normally used due to the fact that the camera application after upgrading loads the unmatched files can be avoided.
It should be understood that the file loading method shown in fig. 9 is merely illustrative, and does not limit the file loading method provided by the present application. The file loading method shown in fig. 9 is described by taking a camera application as an example, and alternatively, the camera application in fig. 9 may be replaced by other applications installed in the electronic device, for example, but not limited to, a browser application, a shopping application, a chat application, or a video application installed in the electronic device.
In the embodiment of the application, at the moment after the user clicks the application icon of the camera application, the target file to be loaded by the camera application in the kernel layer is loaded into the physical memory from the external memory in advance. Then, under the condition that the kernel layer receives the loading request, the kernel layer reads out the target file which is stored in the physical memory in advance. After that, under the condition that the kernel layer monitors that the target file needs to be loaded in the running process of the camera application, the kernel layer sends the target file read from the physical memory to the camera application, so that the problem that in the traditional technology, the camera application reads the target file from the external memory, the efficiency is low, and the problem that the service of the camera application is blocked due to the fact that the efficiency of reading the target file by the camera application is low is avoided. In addition, the file loading method can be suitable for heavy-load scenes and light-load scenes, and the application scenes are wider.
Next, taking the above electronic device 100 as an example of the mobile phone 1, a desktop of the mobile phone 1 executing the file loading method provided in the embodiment of the present application will be described.
Fig. 10 is a schematic diagram of a desktop of the mobile phone 1 for executing the file loading method provided by the embodiment of the present application.
Referring to a desktop 510 shown in (1) of fig. 10, which includes icons of a plurality of applications including an application icon 511 of a camera-equipped application.
After the 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 the mobile phone 1 may execute the file loading method provided in the embodiment of the present application, so that the camera application operates normally.
In the case where the camera application successfully loads the target file, the camera application is in a normal running state after being started, for example, see a desktop 520 shown in (2) of fig. 10, and the desktop 520 is an interface of the camera application.
It should be understood that the schematic diagram of the desktop of the mobile phone 1 shown in fig. 10 is only schematic, and does not constitute any limitation on the desktop of the electronic device for executing the file loading method provided by the embodiment of the present application.
The file loading method according to the embodiment of the present application is described in detail above with reference to fig. 1 to 10, and the device embodiment of the present application will be described in detail below with reference to fig. 11. It should be understood that the file loading device in the embodiment of the present application may perform the foregoing various file loading methods in the embodiment of the present application, that is, the following specific working processes of various products may refer to the corresponding processes in the foregoing method embodiment.
Fig. 11 is a schematic diagram of a file loading device according to an embodiment of the present application.
By way of example, the file loading apparatus 1100 shown in fig. 11 includes: a first processing unit 1110 and a second processing unit 1120. The file loading device is applied to the electronic equipment. The roles of the first processing unit 1110 and the second processing unit 1120 are described below.
The first processing unit 1110 is configured to: in response to an instruction for starting a first application of the electronic device, loading a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device; the second processing unit 1120 is configured to: and loading the target file obtained from the physical memory in the starting process of the first application.
In one possible implementation, the first processing unit 1110 is further configured to: in the starting process of the first application, the target file read from the physical memory is sent to the first application; the second processing unit 1120 is further configured to: and loading the target file obtained from the physical memory.
In another possible implementation manner, the N page data corresponding to the target file are stored in N storage addresses of the physical memory, where the N page data are in one-to-one correspondence 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: receiving a loading request sent by the first application in the starting process of the first application, wherein the loading request is used for requesting to load the target file; and according to the loading request, reading the N page data from the N storage addresses associated with the target file, and sending the N page data to the first application.
In another possible implementation manner, the first processing unit 1110 is further configured to: responding to an instruction for starting the first application, and determining that the target file is not stored in the physical memory; and under the condition that the target file is not stored in the physical memory, loading the target file into the physical memory from the external memory.
In another possible implementation manner, the first processing unit 1110 is further configured to, before the instruction for starting the first application of the electronic device, load, by the kernel layer of the electronic device, a target file for running the first application from the external memory of the electronic device into the physical memory of the electronic device, perform the following operations: in response to the first application starting process, monitoring the first application to obtain the identification of the target file, and loading the target file obtained from the external memory by the first application; the first processing unit 1110 is further configured to: and responding to an instruction for restarting the first application, inquiring the external memory according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
In another possible implementation manner, the first processing unit 1110 is further configured to: and deleting the target file in the physical memory in response to an upgrade instruction for the first application, wherein the file for running the upgraded first application is different from the target file. In another possible implementation manner, the first processing unit 1110 is further configured to: and deleting the target file stored in the physical memory in response to an uninstall instruction for the first application.
In another possible implementation manner, the first processing unit 1110 is further configured to, before the instruction for starting the first application of the electronic device, load, by the kernel layer of the electronic device, a target file for running the first application from the external memory of the electronic device into the physical memory of the electronic device, perform the following operations: and determining that the memory utilization rate of the physical memory exceeds a preset threshold.
Note that the file loading device 1100 is embodied as a functional unit. The term "unit" herein may be implemented in software and/or hardware, without specific limitation.
For example, a "unit" may be a software program, a hardware circuit or a combination of both that implements the functions described above. The hardware circuitry may include Application Specific Integrated Circuits (ASICs), electronic circuits, processors (e.g., shared, proprietary, or group processors, etc.) and memory for executing one or more software or firmware programs, merged logic circuits, and/or other suitable components that support the described functions.
Thus, the elements of the examples described in the embodiments of the present application can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application also provides a chip which comprises a processor. The processor is configured to read and execute the computer program stored in the memory, so as to execute the file loading method provided by any embodiment of the present application.
Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
The embodiment of the application also provides a chip system which comprises a processor. The processor is configured to read and execute the computer program stored in the memory, so as to execute the file loading method provided by any embodiment of the present application.
Optionally, the chip system further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
The application also provides a computer program product which, when being executed by a processor, implements the file loading method according to any one of the method embodiments of the application.
The computer program product may be stored in a memory, for example, as a program that is ultimately converted into an executable object file that can be executed by a processor through preprocessing, compiling, assembling, and linking processes.
The application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a computer implements the file loading method according to any one of the method embodiments of the application. The computer program may be a high-level language program or an executable object program.
In the present application, "at least one" means one or more, and "a plurality" means two or more. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, or c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative; for example, the division of the units is only one logic function division, and other division modes can be adopted in actual implementation; for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1.A method of loading a file, the method comprising:
in response to an instruction for starting a first application of an electronic device, a kernel layer of the electronic device loads a target file for running the first application from an external memory of the electronic device into a physical memory of the electronic device;
and in the starting process of the first application, the first application loads the target file obtained from the physical memory.
2. The method of claim 1, wherein during the launching of the first application, the first application loads the target file obtained from the physical memory, comprising:
In the starting 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.
3. The method of claim 2, wherein the N page data corresponding to the target file are stored in N storage addresses of the physical memory, wherein the N page data are in one-to-one correspondence with the N storage addresses, each storage address is used for storing the corresponding page data, N is a positive integer, and
In the starting process of the first application, the kernel layer sends the target file read from the physical memory to the first application, including:
In the starting process of the first application, the kernel layer receives a loading request sent by the first application, wherein the loading request is used for requesting to load the target file; and
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.
4. A method according to any one of claims 1 to 3, wherein the loading, by the kernel layer of the electronic device, of the object file for running the first application from the external memory of the electronic device into the physical memory of the electronic device in response to the instruction to launch the first application of the electronic device comprises:
responding to an instruction for starting the first application, and determining that the target file is not stored in the physical memory by the kernel layer;
And under the condition that the target file is not stored in the physical memory, the kernel layer loads the target file from the external memory to the physical memory.
5. The method according to any one of claim 1 to 4, wherein,
Before 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 in response to the instruction for starting the first application of the electronic device, the method further includes:
in response to the first application starting process, the kernel layer monitors the first application to obtain the identification of the target file, and the first application loads the target file obtained from the external memory;
the method for loading the target file for running the first application from the external memory of the electronic device into the physical memory of the electronic device by the kernel layer of the electronic device in response to the instruction for starting the first application of the electronic device comprises the following steps:
And responding to an instruction for restarting the first application, inquiring the external memory by the kernel layer according to the identification of the target file, and loading the inquired target file from the external memory into the physical memory.
6. The method according to any one of claims 1 to 5, further comprising:
and responding to an upgrading instruction aiming at the first application, and deleting the target file in the physical memory by the kernel layer, wherein the file for running the upgraded first application is different from the target file.
7. The method according to any one of claims 1 to 6, further comprising:
And in response to an uninstall instruction for the first application, the kernel layer deletes the target file stored in the physical memory.
8. The method of any of claims 1 to 7, wherein before the kernel layer of the electronic device loads the object file for running the first application from the external memory of the electronic device into the physical memory of the electronic device in response to the instruction to launch the first application of the electronic device, the method further comprises:
and the kernel layer determines that the memory utilization rate of the physical memory exceeds a preset threshold.
9. An electronic device comprising a processor and a memory, the memory for storing a computer program, the processor for calling and running the computer program from the memory, such that the processor performs the file loading method of any one of claims 1 to 8.
10. A chip comprising a processor which, when executing instructions, performs the file loading method of any one of claims 1 to 8.
11. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, causes the processor to perform the file loading method of any one of claims 1 to 8.
CN202311300422.6A 2023-10-09 2023-10-09 File loading method, device and equipment Pending CN118444994A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311300422.6A CN118444994A (en) 2023-10-09 2023-10-09 File loading method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311300422.6A CN118444994A (en) 2023-10-09 2023-10-09 File loading method, device and equipment

Publications (1)

Publication Number Publication Date
CN118444994A true CN118444994A (en) 2024-08-06

Family

ID=92311207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311300422.6A Pending CN118444994A (en) 2023-10-09 2023-10-09 File loading method, device and equipment

Country Status (1)

Country Link
CN (1) CN118444994A (en)

Similar Documents

Publication Publication Date Title
EP3893118A1 (en) Recovery from application anomaly
CN111191224B (en) Countermeasure method and device for virtual machine detection and computer readable storage medium
CN113553130B (en) Method for executing drawing operation by application and electronic equipment
CN112256425A (en) Load balancing method and system, computer cluster, information editing method and terminal
CN112860145B (en) Application control method and electronic equipment
WO2021185352A1 (en) Version upgrade method and related apparatus
CN115292199B (en) Video memory leakage processing method and related device
EP4407421A1 (en) Device collaboration method and related apparatus
CN111381996B (en) Memory exception handling method and device
CN115017534B (en) File processing authority control method, device and storage medium
CN112035153A (en) Application updating method, device, terminal and storage medium
CN113590210A (en) Class verification method and device in application program
CN114741121B (en) Method and device for loading module and electronic equipment
CN115442517B (en) Image processing method, electronic device, and computer-readable storage medium
CN118444994A (en) File loading method, device and equipment
CN110417931B (en) Domain name resolution record acquisition method and device, computer equipment and storage medium
CN115291995B (en) Message display method, related electronic equipment and readable storage medium
CN116382896B (en) Calling method of image processing algorithm, terminal equipment, medium and product
CN115344860B (en) Method for managing application program and electronic equipment
CN116755748B (en) Card updating method, electronic device, and computer-readable storage medium
CN116661584B (en) Resource scheduling method and related equipment
CN115981576B (en) Method for sharing data, electronic device and storage medium
CN113179362B (en) Electronic device and image display method thereof
CN116662150B (en) Application starting time-consuming detection method and related device
CN114816311B (en) Screen movement method and device

Legal Events

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