Kernel ko file loading method, electronic equipment and device

By using the loaded list to determine the ko file to be loaded and loaded during the startup process of the electronic device, the problem of time taking to load the ko file is solved, and faster boot time and better user experience is achieved.

CN119938156AActive Publication Date: 2025-05-06HONOR DEVICE CO LTD
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202311424833.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2025-05-06
Estimated Expiration
2043-10-27

AI Technical Summary

Technical Problem

In the prior art, electronic devices need to load a large number of ko files during startup, resulting in a long loading time and a long boot time.

Method used

By determining the ko files to be loaded corresponding to the target process, reading the loaded list, determining the unloaded ko files, and loading these unloaded ko files through the target process to avoid duplicate loading.

Benefits of technology

It reduces the number and time-consuming loading of ko files, shortens the boot time of electronic devices, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938156A_ABST
    Figure CN119938156A_ABST
Patent Text Reader

Abstract

The invention provides a kernel ko file loading method, electronic equipment and a kernel ko file loading device, the electronic equipment executing the method is provided with a loaded list recording ko files loaded in all processes, and in the method, firstly, a to-be-loaded ko file corresponding to a target process is determined; then the loaded list is read through the target process; determining an unloaded ko file in the to-be-loaded ko files through a reading result of the target process; and loading the non-loaded ko file through the target process. Through the scheme provided by the embodiment of the invention, the repeated loading of the same ko file can be avoided, so that the number of loaded ko files is reduced, the time consumption for loading the ko files is correspondingly reduced, and the time required for starting the electronic equipment is further reduced. Correspondingly, according to the method, the time of waiting for the electronic equipment to be started by a user can be shortened, and user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communication technology, and in particular relates to a kernel ko file loading method, electronic equipment and device. Background Art

[0002] During the startup process of some electronic devices (such as mobile phones, etc.), multiple kernel (kernal object, ko) files need to be loaded into the kernel of the electronic device.

[0003] However, as the functions supported by electronic devices increase, the number of ko files that need to be loaded increases, and the dependencies between the corresponding ko files become more and more complex, which results in the electronic devices often needing to load a large number of ko files during the startup process. Loading ko files takes a long time, which further leads to a longer time required for the electronic device to start up. Summary of the invention

[0004] In order to solve the problem that loading KO files takes a long time and the electronic device needs a long time to start up in the existing KO file loading technology, the embodiments of the present application provide a KO file loading method, electronic device and device.

[0005] In a first aspect, the present application provides a kernel ko file loading method, comprising:

[0006] Determine the ko file to be loaded corresponding to the target process;

[0007] Reading a loaded list through the target process, wherein the loaded list is used to record the ko files loaded by each process;

[0008] Determine the unloaded ko files in the ko files to be loaded through the read result of the target process;

[0009] The unloaded ko file is loaded through the target process.

[0010] Through this method, if a ko file has been loaded, the target process can no longer load the ko file based on the reading result of the loaded list, thereby avoiding repeated loading of the same ko file, thereby reducing the number of loaded ko files, and correspondingly reducing the time consumed in loading ko files, further reducing the time required for the electronic device to start up.

[0011] A feasible design also includes:

[0012] After completing the loading of the unloaded ko file, add the unloaded ko file to the loaded list.

[0013] Through this step, the loaded list can be adjusted according to the loading status of the ko file, thereby improving the accuracy of determining the unloaded ko file through the loaded list.

[0014] In a feasible design, the step of determining the ko file to be loaded corresponding to the target process includes:

[0015] Determine the first ko file that the target process needs to load;

[0016] The dependency list corresponding to the first ko file is read through the target process to determine the second ko file on which the first ko file depends, wherein the dependency list corresponding to the first ko file is used to record the ko files on which the first ko file depends, and the ko files to be loaded include the first ko file and the second ko file.

[0017] In a feasible design, reading the loaded list through the target process includes:

[0018] Allocate a read lock in a read-write lock for the target process, where the read lock is used to indicate that the target process is supported to read the loaded list;

[0019] If there is no process loading the ko file, read the loaded list in the shared memory through the target process;

[0020] If there is a process that is loading the ko file, the loaded list in the backup memory is read by the target process, and the backup memory includes the loaded list copied from the shared memory.

[0021] In a feasible design, reading the loaded list stored in the shared memory through the target process includes:

[0022] Mapping the loaded list in the shared memory to a first space corresponding to the target process through the target process, and reading the loaded list in the first space by the target process;

[0023] The step of reading the loaded list stored in the backup memory through the target process includes:

[0024] The loaded list in the backup memory is mapped to a second space corresponding to the target process through the target process, and the loaded list in the second space is read by the target process.

[0025] In a feasible design, loading the unloaded ko file through the target process includes:

[0026] If the target process includes at least one, a write lock in a read-write lock is allocated to a first target process among the target processes, where the write lock is used to indicate that the first target process is supported to load the ko file;

[0027] The unloaded ko file corresponding to the first target process is loaded through the first target process.

[0028] A feasible design also includes:

[0029] Before loading the unloaded ko file corresponding to the first target process through the first target process, the loaded list in the shared memory is backed up to the backup memory.

[0030] A feasible design also includes:

[0031] After the first target process completes loading of the unloaded file, the backup memory is released.

[0032] In a feasible design, the loaded list includes the correspondence between the information of the ko file and the tag value;

[0033] The tag value includes a first tag value and a second tag value;

[0034] The first mark value is used to indicate that the ko file has been loaded, and the second mark value is used to indicate that the ko file has not been loaded.

[0035] In a second aspect, the present application provides an electronic device, comprising: a processor and a memory; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method described in the first aspect.

[0036] In a third aspect, the present application provides a computer storage medium, characterized in that a computer program or instruction is stored in the computer storage medium, and when the computer program or instruction is executed, the method described in the first aspect is executed.

[0037] In a fourth aspect, the present application provides a chip system, characterized in that the chip system includes a processor, the processor is coupled to a memory, and is used to execute a computer program or instruction stored in the memory. When the computer program or instruction is executed, the method described in any one of the first aspects is executed.

[0038] The solution provided by the embodiment of the present application can avoid repeated loading of the same ko file, thereby reducing the number of ko files loaded, correspondingly reducing the time consumed in loading ko files, and further reducing the time required for the electronic device to start up. Accordingly, the solution can reduce the time users wait for the electronic device to start up, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 This is a workflow diagram for loading ko files;

[0041] Figure 2 A schematic diagram of loading the ko list and ko dependency list in a ko file;

[0042] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0043] Figure 4 A software structure block diagram of an electronic device provided in an embodiment of the present application;

[0044] Figure 5 A schematic diagram of the workflow of a ko file loading method provided in an embodiment of the present application;

[0045] Figure 6 A schematic diagram of the workflow of another ko file loading method provided in an embodiment of the present application;

[0046] FIG. 7( a) is an example diagram corresponding to a ko file loading method provided in an embodiment of the present application;

[0047] FIG. 7( b) is an example diagram corresponding to another ko file loading method provided in an embodiment of the present application;

[0048] FIG. 7( c ) is an example diagram corresponding to another ko file loading method provided in an embodiment of the present application;

[0049] Figure 8 A schematic diagram of the workflow of another ko file loading method provided in an embodiment of the present application;

[0050] Fig. 9 A schematic diagram of the workflow of another ko file loading method provided in an embodiment of the present application;

[0051] Fig.10 A schematic diagram of the structure of a ko file loading device provided in an embodiment of the present application;

[0052] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0054] The terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one, two or more. The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0055] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0056] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:

[0057] During the startup process of some electronic devices (such as mobile phones, etc.), multiple ko files are usually loaded into the kernel of the electronic device before the startup can be completed. When loading a ko file, the electronic device often needs to load other ko files that the ko file depends on into the kernel before loading the ko file.

[0058] In order to clarify the current technology of loading ko files, the public Figure 1 . Figure 1 This is a diagram of the current workflow for loading ko files, see Figure 1When loading a ko file through the current ko file loading technology, first start the service for loading the ko file (such as the vendor.modprobe service); then traverse the ko list, which records the various ko files to be loaded this time; according to the traversal result, determine a ko file to be loaded this time, and start the process corresponding to the ko file to be loaded (such as the modprobe process); the process queries the ko dependency list of the ko file to be loaded, and the ko dependency list records other ko files that the ko file to be loaded depends on; the process loads the ko file that depends on ko files, and after completing the loading of other ko files, load the ko file to be loaded; after loading the ko file to be loaded into the kernel, the process exits; after each traversal of the ko list, determine whether the traversal of the ko list is completed; if the traversal is not completed, it indicates that there are other ko files to be loaded in the ko list that need to be loaded, then traverse the ko list again to continue recording other ko files to be loaded; if the traversal is completed, it indicates that all the ko files to be loaded in the ko list have been loaded into the kernel, then wait for each process used to load the ko file to exit, and after each process exits, exit the service of loading the ko file.

[0059] Through the above process, each ko file to be loaded can be loaded into the kernel of the electronic device. However, with the development of science and technology, the functions supported by electronic devices increase therewith, and the number of ko files that electronic devices need to load is also increasing, and the dependency relationship between corresponding ko files is becoming more and more complicated, and some ko files depend on at least one other ko file. In this case, the other ko files that different ko files to be loaded depend on may be the same, and each process is not aware of the ko files loaded by other processes, which causes different processes to repeatedly load the ko files that are relied on during loading, causing the number of ko files that electronic devices need to load to be large, and correspondingly causing the time consuming of loading ko files to be longer, further causing the time required for booting to be longer, the boot performance of electronic devices to deteriorate, and the time that users wait for booting to be longer, affecting user experience.

[0060] In particular, the number of ko files that need to be loaded during the startup of electronic devices is increasing. Some electronic devices often need to load hundreds of ko files. In this case, when loading through related technologies, hundreds of ko files may be loaded multiple times, greatly increasing the time consumed in the startup process.

[0061] See also Figure 2Corresponding example, in this example, the ko list is shown on the left, which indicates that the ko files that need to be loaded include: ko file A, ko file B, ko file C, ko file D, ko file E and ko file F, and the ko dependency list is shown on the right, which indicates that ko file A depends on ko file D, ko file E and ko file F, ko file B depends on ko file C, and ko file F depends on ko file B.

[0062] In this case, if the ko file is loaded according to the current loading technology, when loading ko file A, each ko file will be loaded in the following order: ko file C->ko file B->ko file F->ko file E->ko file D->ko file A. Correspondingly, when loading ko file B, each ko file will be loaded in the following order: ko file C->ko file B. When loading ko file F, each ko file will be loaded in the following order: ko file B->ko file F.

[0063] That is to say, when loading each ko file to be loaded in the ko list, ko file B will be loaded three times, ko file C will be loaded three times, and ko file F will be loaded twice, that is, repeated loading of ko files occurs, resulting in a waste of time.

[0064] In order to solve the above problems, the present application provides a ko file loading method, device and electronic device. The method can be executed by an electronic device, and the electronic device needs to load a ko file. For example, the electronic device can be a wireless terminal, a vehicle-mounted wireless terminal, a portable device, a wearable device, a mobile phone (or a "cellular" phone), a portable, pocket-sized, handheld terminal, etc., which exchange language and / or data with a wireless access network. For example, personal communication service (PCS) phone, cordless phone, session initiation protocol (SIP) phone, wireless local loop (WLL) station, personal digital assistant (PDA) and other devices. The wireless terminal can also be a subscriber unit (subscriber unit), an access terminal (access terminal), a user terminal (user terminal), a user agent (user agent), a user device (user device) or a user equipment (user equipment, UE), etc. The present application does not limit the type of electronic device.

[0065] Taking a mobile phone as an example of the electronic device, in this embodiment, the structure of the electronic device can be as follows: Figure 3 As shown, Figure 3 A schematic diagram of the structure of an electronic device to which the high-definition icon display method provided in an embodiment of the present application is applied.

[0066] like Figure 3 As shown, the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0067] Furthermore, when the electronic device is a mobile phone, the electronic device may also include: antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, and subscriber identification module (SIM) card interface 195, etc.

[0068] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0069] The processor 110 may include one or more processing units, wherein different processing units may be independent devices or integrated into one or more processors. A memory may also be provided in the processor 110 for storing instructions and data.

[0070] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0071] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.

[0072] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The wireless communication module 160 can provide solutions for wireless communications including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc., applied to electronic devices. In some embodiments, the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.

[0073] The electronic device implements the display function through a graphics processing unit (GPU), a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0074] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. A series of graphical user interfaces (GUIs) can be displayed on the display screen 194 of the electronic device, and these GUIs are the main screens of the electronic device.

[0075] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0076] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121.

[0077] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0078] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0079] Speaker 170A, also called "horn", is used to convert audio electrical signals into sound signals. The electronic device can listen to music or listen to hands-free calls through speaker 170A. Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. Headphone jack 170D is used to connect wired headphones.

[0080] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The gyroscope sensor 180B can be used to determine the motion posture of the electronic device. The air pressure sensor 180C is used to measure the air pressure. The magnetic sensor 180D includes a Hall sensor. The electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). The distance sensor 180F is used to measure the distance. The proximity light sensor 180G can include a light emitting diode (LED) and a light detector. The ambient light sensor 180L is used to sense the brightness of the ambient light. The fingerprint sensor 180H is used to collect fingerprints. The temperature sensor 180J is used to detect the temperature. The touch sensor 180K is also called a "touch device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The bone conduction sensor 180M can obtain vibration signals. The buttons 190 include a power button, a volume button, etc. The button 190 can be a mechanical button, a touch button, or a virtual button. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card.

[0081] In addition, an operating system is running on the above components, such as the iOS operating system developed by Apple, the Android open source operating system developed by Google, and the Windows operating system developed by Microsoft. Application programs can be installed and run on the operating system.

[0082] In order to clarify the functional operations performed by various software architectures within the electronic device when the electronic device executes the solution disclosed in the present application, the embodiment of the present application also discloses the software structure of the electronic device.

[0083] The operating system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture, etc. Still taking a mobile phone as an example of the above electronic device, the software system of the mobile phone can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the mobile phone.

[0084] Figure 4 This is a software structure diagram of an implementation of the mobile phone provided by this application. Figure 4 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and the system library, and the kernel layer.

[0085] The application layer can include a series of application packages. Figure 4 As shown, the application package may include applications such as camera, gallery, call, navigation, Bluetooth, music, video, short message, etc.

[0086] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0087] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, the parameters of each display area on the display interface, etc.

[0088] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0089] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface includes a camera icon.

[0090] The phone manager is used to provide the communication functions of the mobile phone, such as the management of call status (including answering, hanging up, etc.).

[0091] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0092] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0093] In addition, the application framework layer can also run a service for loading ko files, such as a vendor.modprobe service. If a ko file needs to be loaded, the service can start a corresponding process so that the process can load the ko file.

[0094] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0095] The system library can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0096] The kernel layer is the layer between hardware and software. The kernel layer can contain display drivers, camera drivers, audio drivers, sensor drivers, etc.

[0097] In addition, the kernel layer may also be provided with a shared memory, which may be used to store a loaded list, which records the ko files loaded by each process. The shared memory may be accessed by each process, and accordingly, each process may read the loaded list.

[0098] The system library and kernel layer below the application framework layer may also be referred to as the underlying system. The underlying system includes a status monitoring service for identifying changes in the posture of the mobile phone. The status monitoring service may be provided in the system library and / or the kernel layer.

[0099] In the above, the software system of the electronic device adopts the layered architecture of the Android system as an example. Of course, the software system of the electronic device can also adopt other architectures, which is not limited in this application.

[0100] In order to clarify the solution provided by the present application, the solution provided by the present application is introduced and explained through various embodiments in conjunction with the accompanying drawings.

[0101] In order to solve the problem in the prior art that loading ko files takes a long time, the embodiments of the present application provide a kernel ko file loading method, device and electronic device.

[0102] See also Figure 5 The kernel ko file loading method provided in the embodiment of the present application includes the following steps:

[0103] Step S11, determining the ko file to be loaded corresponding to the target process.

[0104] After determining that a certain ko file needs to be loaded, the service for loading files usually starts a process for the ko file, and the ko file is loaded by the process. In this case, the ko file targeted by the process when it is started can be called the ko file that the process needs to load, and the process can be called the process started for the ko file. For example, if the service for loading files determines that ko file A needs to be loaded, and starts the first process for ko file A, then the ko file A can be called the ko file that the first process needs to load, and the first process is the process started for ko file A. Among them, if the service for loading ko files is the vendor.modprobe service, the process can be the modprobe process.

[0105] In addition, a ko file may also depend on other ko files. In this case, the ko files to be loaded corresponding to the target process include the first ko file that the target process needs to load and the second ko file on which the first ko file depends, that is, the target process can load the first ko file and the second ko file.

[0106] In a feasible design, the ko file to be loaded corresponding to the target process can be determined in the following way:

[0107] First, a first ko file that needs to be loaded by a target process is determined. The target process is a process started by the electronic device for the first ko file.

[0108] Then, the dependency list corresponding to the first ko file is read through the target process to determine the second ko file that the first ko file depends on. The dependency list corresponding to the first ko file is used to record the ko files that the first ko file depends on. The ko file to be loaded includes the first ko file and the second ko file.

[0109] That is to say, in the solution provided in the embodiment of the present application, a dependency list corresponding to the first ko file is configured in the electronic device. By viewing the dependency list, the second ko file on which the first ko file depends can be determined. The first ko file and the second ko file are both the first ko files that need to be loaded by the target process.

[0110] Step S12: read the loaded list through the target process, where the loaded list is used to record the ko files loaded by each process.

[0111] In an embodiment of the present application, a loaded list is set for each process that loads a ko file, and the loaded list is used to record the ko files loaded by each process.

[0112] In a feasible design, the electronic device may be provided with a shared memory, which is accessible to each process, and the shared memory stores the loaded list. In addition, during the process of loading the ko file, the loaded list may be adjusted, for example, after a ko file is loaded into the kernel of the electronic device, the ko file may be added to the loaded list.

[0113] The shared memory is usually initialized during the startup of the electronic device. For example, if the service for loading the ko file is the vendor.modprobe service and the target process is the modprobe process, the shared memory can be initialized after the vendor.modprobe service is started so as to store the loaded list through the shared memory.

[0114] In the embodiment of the present application, the loaded list is used to record the ko files loaded by each process. In a feasible design, the loaded list may include the corresponding relationship between the information of the ko file and the tag value (ie, value).

[0115] The mark value includes a first mark value and a second mark value, the first mark value is used to indicate that the ko file has been loaded, and the second mark value is used to indicate that the ko file has not been loaded.

[0116] That is to say, if the tag value corresponding to the information of a ko file in the loaded list is the first tag value, it indicates that the ko file has been loaded, and if the tag value corresponding to the information of a ko file is the second tag value, it indicates that the ko file has not been loaded.

[0117] The information of the ko file may include the name of the ko file, and of course, may also include other information that can distinguish different ko files, which is not limited in this embodiment of the present application.

[0118] In a feasible design, the first mark value may be 1, and the second mark value may be 0. Of course, the first mark value and the second mark value may also be set to other values, which is not limited in the embodiment of the present application.

[0119] In addition, the data structure of the loaded list may be a hash table, or of course, may be other forms of data structures, which is not limited in the embodiments of the present application.

[0120] Step S13: Determine the unloaded ko files in the ko files to be loaded through the reading result of the target process.

[0121] Since the loaded list records the ko files loaded by each process, by reading the loaded list, the unloaded ko files in the ko files to be loaded can be determined, and the unloaded ko files are ko files that are not loaded by each process.

[0122] Step S14: Load the unloaded ko file through the target process.

[0123] Since the unloaded ko file has not been loaded before, through the operation of step S14, the unloaded ko file can be loaded into the kernel of the electronic device to meet the startup requirements of the electronic device, and can also avoid repeated loading of the same ko file.

[0124] Furthermore, if it is determined through the reading result of the target process that all the ko files to be loaded have been loaded, the target process will not perform the operation of loading the ko file, and other processes can also be used as target processes. Through the solution provided in the embodiment of the present application, other processes load the ko files until all the ko files are loaded into the kernel of the electronic device.

[0125] An embodiment of the present application provides a kernel ko file loading method. The electronic device executing the method is provided with a loaded list recording the ko files loaded by each process. In the method, the ko file to be loaded corresponding to the target process is first determined; then the loaded list is read through the target process; through the reading result of the target process, the unloaded ko file in the ko file to be loaded is determined; and then the unloaded ko file is loaded through the target process.

[0126] The method provided by the embodiment of the present application can avoid repeated loading of the same ko file, thereby reducing the number of ko files loaded, correspondingly reducing the time consumed in loading ko files, and further reducing the time required for the electronic device to start up. Accordingly, the method can reduce the time a user spends waiting for the electronic device to start up, thereby improving the user experience.

[0127] In order to clarify the advantages of this application, an example is provided below. In this example, the ko list and ko dependency list to be loaded are as follows Figure 2 As shown, the ko files to be loaded include: ko file A, ko file B, ko file C, ko file D, ko file E and ko file F. Correspondingly, there are six target processes, namely, the process for loading ko file A, the process for loading ko file B, the process for loading ko file C, the process for loading ko file D, the process for loading ko file E and the process for loading ko file F. Moreover, ko file A depends on ko file D, ko file E and ko file F, ko file B depends on ko file C, and ko file F depends on ko file B.

[0128] If the ko file is loaded by the prior art, the ko file B will be loaded three times, the ko file C will be loaded three times, and the ko file F will be loaded twice, that is, repeated loading of the ko file occurs.

[0129] When loading ko files through the solution provided by the embodiment of the present application, when loading ko file A, each ko file will be loaded in the following order: ko file C->ko file B->ko file F->ko file E->ko file D->ko file A. And after the loading of ko file A is completed, the loaded list records that ko file C, ko file B, ko file F, ko file E, ko file D and ko file A have all been loaded.

[0130] Then, before loading ko file B, the process loading ko file B can determine based on the loaded list that both ko file C and ko file B have been loaded, so that ko file C and ko file B are no longer loaded.

[0131] In addition, before loading ko file C, the process that loads ko file C can determine that ko file C has been loaded based on the loaded list, so that ko file C is no longer loaded.

[0132] Correspondingly, before loading each ko file, other processes can also determine based on the loaded list that ko file D, ko file E and ko file F have all been loaded, and thus ko file D, ko file E and ko file F are no longer loaded.

[0133] That is to say, in this example, when the ko file is loaded through the solution provided in the embodiment of the present application, ko file A, ko file B, ko file C, ko file D, ko file E and ko file F only need to be loaded once. Compared with the prior art, the solution of the embodiment of the present application can effectively reduce the number of ko files loaded, reduce the time consumption of loading ko files, and reduce the time required for starting up the electronic device.

[0134] Further, based on the above embodiment, the present application also provides another embodiment. Figure 6 , the embodiment further comprises the following steps:

[0135] Step S15: After the loading of the unloaded ko file is completed, the unloaded ko file is added to the loaded list.

[0136] After the loading of the unloaded ko file is completed, the unloaded ko file has been transformed into a loaded ko file. In this case, the unloaded ko file can be added to the loaded list so that it can be recorded as a loaded ko file through the loaded list.

[0137] Through this step, each time the ko file is loaded, it can be added to the loaded list, that is, the loaded list is adjusted in time according to the loading status of the ko file, thereby improving the accuracy of determining the loading status of the ko file using the loaded list, and effectively avoiding repeated loading of the same ko file.

[0138] In step S12, an operation of reading the loaded list through the target process is provided. In a feasible design, the operation may include the following steps:

[0139] First, a read lock in the read-write lock is allocated to the target process, where the read lock is used to indicate that the target process is supported to read the loaded list.

[0140] In the solution provided in the embodiment of the present application, the target process may include one or at least two, and the solution of the present application supports multiple processes to read the loaded list at the same time. In this case, even if the target process may include multiple processes, read locks can be allocated to different target processes, and the target process allocated with the read lock can read the loaded list, that is, one or more different target processes can read the loaded list at the same time.

[0141] Then, if there is no process loading the ko file, the loaded list in the shared memory is read through the target process; if there is a process loading the ko file, the loaded list in the backup memory is read through the target process, and the backup memory includes the loaded list copied from the shared memory.

[0142] In a feasible implementation, if a process starts to load a ko file, the backup memory may be configured, and the loaded list in the shared memory may be copied to the backup memory.

[0143] Multiple processes for loading ko files can be run in an electronic device. Sometimes, when some processes need to read the loaded list, other processes are loading ko files. The operation of loading ko files by other processes will cause the loaded list to be adjusted to add the loaded ko files. In this case, if the loaded list in the shared memory is still read, the reading may fail because the loaded list is being adjusted.

[0144] In response to this situation, in an embodiment of the present application, when the target process needs to read and write the loaded list, if there is no process loading the ko file, the loaded list in the shared memory can be directly read; if there is a process loading the ko file, the backup memory can be determined and the loaded list in the shared memory can be copied to the backup memory, so that the target process can read the loaded list in the backup memory to avoid reading failure.

[0145] In addition, in this design, the reading of the loaded list can be implemented by memory mapping (MMAP) technology. In this case, the operation of reading the loaded list stored in the shared memory by the target process may include the following steps:

[0146] The loaded list in the shared memory is mapped to the first space corresponding to the target process through the target process, and the loaded list in the first space is read by the target process.

[0147] Accordingly, the loaded list stored in the backup memory is read by the target process, including:

[0148] The loaded list in the backup memory is mapped to the second space corresponding to the target process through the target process, and the loaded list in the second space is read by the target process.

[0149] The first space and the second space may be the same space or different spaces, which is not limited in the embodiment of the present application.

[0150] In order to clarify this solution, FIG. 7( a ) and FIG. 7 ( b ) are disclosed below.

[0151] Referring to the example diagram corresponding to FIG. 7 (a), in this example, the service that loads the ko file starts the target process, which includes process 1, process 2, ... process n, and the service is also configured with a shared memory, which includes a loaded list. Each target process can map the loaded list to its own space through the MMAP technology.

[0152] In addition, referring to FIG. 7( b ), during the loading process of the ko file, if process 1 loads the ko file, a backup memory may be configured, and the backup memory includes a loaded list copied from the shared memory. After completing the loading of the ko file, process 1 may add the loaded ko file to the loaded list of the shared memory. During the loading process of the ko file by process 1, if process 2 needs to read the loaded list, the loaded list in the backup memory may be read.

[0153] Assume that in this example, the name of the ko file that process 1 needs to load is pm8941-pwrkey.ko, and the loaded list indicates that the ko file has not been loaded. In this example, the second tag value is 0 and the first tag value is 1. Then in the shared memory and backup memory, the tag value corresponding to the ko file is 0.

[0154] In step S14, the operation of loading the unloaded ko file through the target process is disclosed, see Figure 8 As shown in the workflow diagram, the operation may include the following steps:

[0155] Step S141: If the target process includes at least one, a write lock in the read-write lock is allocated to a first target process among the target processes, where the write lock is used to indicate that the first target process is supported to load the ko file;

[0156] Step S142: Load the unloaded ko file corresponding to the first target process through the first target process.

[0157] In the embodiment of the present application, each process sequentially loads the ko file. In this case, if the target process includes at least one, a write lock in the read-write lock is allocated to a first target process in the target process so that the first target process can load the ko file. The first target process can be any process in the target process. After the first target process completes the loading, the ko file can be loaded by other processes, that is, the ko file is loaded by one process each time.

[0158] In a feasible design, a ko list may be set, which includes various ko files that the electronic device needs to load. After the first target process completes loading, the ko list may be traversed to determine whether there are any unloaded ko files in the ko list. If so, the loading of the ko files continues until all ko files included in the ko list are loaded.

[0159] Furthermore, in this embodiment, the following steps may also be included:

[0160] Step S143: Before loading the unloaded ko file corresponding to the first target process through the first target process, back up the loaded list in the shared memory to the backup memory.

[0161] In this case, other processes can read the loaded list in the backup memory while the first target process is loading.

[0162] In addition, after the first target process completes loading of the unloaded file, the backup memory may be released to improve the utilization of memory resources.

[0163] After the backing memory is freed, if a process needs to read the loaded list, it can read the loaded list in shared memory.

[0164] Accordingly, corresponding to the examples of Figure 7(a) and Figure 7(b), the scenario can be shown in Figure 7(c). In this example, process 1 completes the loading of the ko file, the backup memory is released, and process 2 can read the loaded list in the shared memory.

[0165] In addition, in this example, since process 1 completes loading of the ko file pm8941-pwrkey.ko, the tag value of the ko file becomes the first tag value to indicate that the ko file has been loaded.

[0166] In order to clarify the implementation of the ko file loading method provided in the embodiment of the present application, another embodiment is disclosed, see Fig. 9 , this embodiment includes the following process:

[0167] Step S21, start the service of loading the ko file.

[0168] Exemplarily, the electronic device may start the service of loading the ko file after receiving the power-on operation.

[0169] Step S22: a loaded list is configured through the service, and the loaded list is used to record the ko files loaded by each process.

[0170] The service may configure a shared memory corresponding to each process, and then store the loaded list through the shared memory so that each process may access the loaded list.

[0171] Step S23, traversing the ko list through the service, wherein the ko list records various ko files that need to be loaded during the startup of the electronic device.

[0172] Step S24, by traversing the results, determine whether there is a ko file that needs to be loaded. If so, execute the operation of step S25. If not, it indicates that the loading is completed, and execute the operation of step S31.

[0173] Step S25, starting a process for loading a ko file through the service. If, through step S24, it is determined that the first ko file needs to be loaded, the process can be used to load the first ko file.

[0174] Exemplarily, if the service for loading the ko file is the vendor.modprobe service, the process may be the modprobe process.

[0175] Step S26, traversing the ko dependency list through the process to determine the ko file to be loaded. If the process is used to load the first ko file, the ko dependency list of the first ko file is traversed, and the ko dependency list of the first ko file is used to record the ko file on which the first ko file depends, and the ko file on which the first ko file depends can be called the second ko file, and the ko file to be loaded includes the first ko file and the second ko file.

[0176] Step S27, reading the loaded list through this process.

[0177] If there is no process loading the ko file, the process can read the loaded list in the shared memory. If there is a process loading the ko file, the service can configure the backup memory and back up the loaded list in the shared memory to the backup memory, and the process reads the loaded list in the backup memory.

[0178] Step S28, by reading the result, determine whether there is an unloaded ko file in the ko file to be loaded. If so, perform the operation of step S29, if not, perform the operation of step S30.

[0179] Step S29: load the unloaded ko file through the process, and add the unloaded ko file to the loaded list after the loading is completed.

[0180] If the unloaded ko file includes the first ko file and the second ko file, since the first ko file depends on the second ko file, the second ko file is usually loaded first, and then the first ko file is loaded.

[0181] Step S30: After the process completes loading of the unloaded ko file, exit the process and then execute the operation of step S31.

[0182] Step S31, wait for all processes loading ko files to exit.

[0183] Step S32: After all processes for loading ko files exit, the service for loading ko files exits.

[0184] Through the operations of step S21 to step S32, the loading of the ko file can be realized, and repeated loading of the same ko file can be avoided, the time consumption of loading the ko file is reduced, and the time required for starting up the electronic device is correspondingly reduced.

[0185] The various method embodiments described in this document may be independent solutions or may be combined according to internal logic, and these solutions all fall within the protection scope of this application.

[0186] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0187] The present application embodiment discloses a ko file loading device. Fig.10 As shown in the structural schematic diagram, the ko file loading device may include: a first determination module 110, a reading module 120, a second determination module 130 and a loading module 140.

[0188] The first determination module 110 is used to determine the ko file to be loaded corresponding to the target process;

[0189] The reading module 120 is used to read the loaded list through the target process, and the loaded list is used to record the ko files loaded by each process;

[0190] The second determining module 130 is used to determine the unloaded ko files in the ko files to be loaded according to the reading result of the target process;

[0191] The loading module 140 is used to load the unloaded ko file through the target process.

[0192] In a feasible design, the ko file loading device is also used to add the unloaded ko file to the loaded list after completing the loading of the unloaded ko file.

[0193] In a feasible design, the first determining module 110 is used to:

[0194] Determine the first ko file that the target process needs to load;

[0195] The dependency list corresponding to the first ko file is read through the target process to determine the second ko file on which the first ko file depends, wherein the dependency list corresponding to the first ko file is used to record the ko files on which the first ko file depends, and the ko files to be loaded include the first ko file and the second ko file.

[0196] In a feasible design, the reading module 120 is used to:

[0197] Allocate a read lock in a read-write lock for the target process, where the read lock is used to indicate that the target process is supported to read the loaded list;

[0198] If there is no process loading the ko file, read the loaded list in the shared memory through the target process;

[0199] If there is a process that is loading the ko file, the loaded list in the backup memory is read by the target process, and the backup memory includes the loaded list copied from the shared memory.

[0200] When the reading module 120 reads the loaded list stored in the shared memory through the target process, the loaded list in the shared memory may be mapped to the first space corresponding to the target process through the target process, and the loaded list in the first space may be read by the target process;

[0201] When the reading module 120 reads the loaded list stored in the backup memory through the target process, the loaded list in the backup memory can be mapped to the second space corresponding to the target process through the target process, and the loaded list in the second space can be read by the target process.

[0202] In a feasible design, the loading module 140 is used to:

[0203] If the target process includes at least one, a write lock in a read-write lock is allocated to a first target process among the target processes, where the write lock is used to indicate that the first target process is supported to load the ko file;

[0204] The unloaded ko file corresponding to the first target process is loaded through the first target process.

[0205] Furthermore, the device is also used for:

[0206] Before loading the unloaded ko file corresponding to the first target process through the first target process, the loaded list in the shared memory is backed up to the backup memory.

[0207] Furthermore, the device is also used for:

[0208] After the first target process completes loading of the unloaded file, the backup memory is released.

[0209] In a feasible design, the loaded list includes the correspondence between the information of the ko file and the tag value;

[0210] The tag value includes a first tag value and a second tag value;

[0211] The first mark value is used to indicate that the ko file has been loaded, and the second mark value is used to indicate that the ko file has not been loaded.

[0212] The device provided by the embodiment of the present application can avoid repeated loading of the same ko file, thereby reducing the number of ko files loaded, correspondingly reducing the time consumed in loading ko files, and further reducing the time required for the electronic device to start up. Accordingly, the method can reduce the time a user spends waiting for the electronic device to start up, thereby improving the user experience.

[0213] Accordingly, the present application embodiment discloses an electronic device, see Fig.11 As shown in the structural schematic diagram, the electronic device comprises:

[0214] Processor 1101 and memory,

[0215] The memory is used to store program instructions;

[0216] The processor 1101 is used to call and execute the program instructions stored in the memory. When the program instructions stored in the memory are executed by the processor 1101, the electronic device executes Figure 5 to Figure 6 , Figures 8 to 9 All or part of the steps in the corresponding embodiments.

[0217] Furthermore, the electronic device may also include: a transceiver 1102 and a bus 1103 , and the memory includes a random access memory 1104 and a read-only memory 1105 .

[0218] The processor is coupled to the transceiver, random access memory and read-only memory through a bus. When the electronic device needs to be operated, the basic input and output system solidified in the read-only memory or the bootloader boot system in the embedded system is used to start the electronic device and guide it into a normal operating state. After the electronic device enters the normal operating state, the application program and the operating system are run in the random access memory, so that the electronic device executes Figure 5 to Figure 6 , Figures 8 to 9 All or part of the steps in the corresponding embodiments.

[0219] The electronic device according to the embodiment of the present invention may correspond to the above Figure 5 to Figure 6 , Figures 8 to 9 The electronic device in the corresponding embodiment, and the processor and storage in the electronic device can implement Figure 5 to Figure 6 , Figures 8 to 9 For the sake of brevity, the functions of the electronic device in the corresponding embodiment and / or the various steps and methods implemented are not described in detail here.

[0220] In a specific implementation, the embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the computer can implement the following steps: Figure 5 to Figure 6 , Figures 8 to 9 All or part of the steps in the corresponding embodiments. The computer-readable storage medium is set in any device, and the arbitrary device may be a random access memory (RAM), and the memory may also include a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory may also include a combination of the above-mentioned types of memory, etc.

[0221] The present application also provides a chip system, which includes a processor coupled to a memory and configured to execute a computer program or instruction stored in the memory. When the computer program or instruction is executed, the chip system can implement the following steps: Figure 5 to Figure 6 , Figures 8 to 9 All or part of the steps in the corresponding embodiments. The chip system can be composed of a chip, or can include a chip and other discrete devices.

[0222] The steps of the method or algorithm described in the embodiments of the present application can be directly embedded in hardware, a software unit executed by a processor, or a combination of the two. The software unit can be stored in a random access memory (RAM), a flash memory, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a register, a hard disk, a removable disk, a portable compact disc read-only memory (CD-ROM), or any other form of storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal (UE). Optionally, the processor and the storage medium can also be arranged in different components in the UE.

[0223] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0224] The same or similar parts between the various embodiments of this specification can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0225] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.

[0226] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the embodiment of the road constraint determination device disclosed in this application, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0227] The above-described embodiments of the present invention do not limit the protection scope of the present invention.

Claims

1. A kernel ko file loading method, characterized in that: include: Determine the ko file to be loaded corresponding to the target process; Reading a loaded list through the target process, wherein the loaded list is used to record the ko files loaded by each process; Determine the unloaded ko files in the ko files to be loaded through the read result of the target process; The unloaded ko file is loaded through the target process.

2. The method according to claim 1, characterized in that: Also includes: After completing the loading of the unloaded ko file, add the unloaded ko file to the loaded list.

3. The method according to claim 1, characterized in that: The step of determining the ko file to be loaded corresponding to the target process includes: Determine the first ko file that the target process needs to load; The dependency list corresponding to the first ko file is read through the target process to determine the second ko file on which the first ko file depends, wherein the dependency list corresponding to the first ko file is used to record the ko files on which the first ko file depends, and the ko files to be loaded include the first ko file and the second ko file.

4. The method according to claim 1, characterized in that The step of reading the loaded list through the target process includes: Allocate a read lock in a read-write lock for the target process, where the read lock is used to indicate that the target process is supported to read the loaded list; If there is no process loading the ko file, read the loaded list in the shared memory through the target process; If there is a process that is loading the ko file, the loaded list in the backup memory is read by the target process, and the backup memory includes the loaded list copied from the shared memory.

5. The method according to claim 4, characterized in that The step of reading the loaded list stored in the shared memory through the target process includes: Mapping the loaded list in the shared memory to a first space corresponding to the target process through the target process, and reading the loaded list in the first space by the target process; The step of reading the loaded list stored in the backup memory through the target process includes: The loaded list in the backup memory is mapped to a second space corresponding to the target process through the target process, and the loaded list in the second space is read by the target process.

6. The method according to claim 4, characterized in that The step of loading the unloaded ko file through the target process includes: If the target process includes at least one, a write lock in a read-write lock is allocated to a first target process among the target processes, where the write lock is used to indicate that the first target process is supported to load the ko file; The unloaded ko file corresponding to the first target process is loaded through the first target process.

7. The method according to claim 6, characterized in that Also includes: Before loading the unloaded ko file corresponding to the first target process through the first target process, the loaded list in the shared memory is backed up to the backup memory.

8. The method according to claim 7, characterized in that Also includes: After the first target process completes loading of the unloaded file, the backup memory is released.

9. The method according to any one of claims 1 to 8, characterized in that: The loaded list includes the correspondence between the information of the ko file and the tag value; The tag value includes a first tag value and a second tag value; The first mark value is used to indicate that the ko file has been loaded, and the second mark value is used to indicate that the ko file has not been loaded.

10. An electronic device, characterized in that: include: A processor and a memory; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 9.

11. A computer storage medium, characterized in that: The computer storage medium stores a computer program or instruction. When the computer program or instruction is executed, the method according to any one of claims 1 to 9 is executed.

12. A chip system, characterized in that: The chip system includes a processor, which is coupled to a memory and is used to execute a computer program or instruction stored in the memory. When the computer program or instruction is executed, the method as described in any one of claims 1 to 9 is executed.

Citation Information

Patent Citations

  • Method and device for starting operating system

    CN103631612A

  • Dynamic loading method and apparatus, and computer readable storage medium

    CN108595226A

  • Linux system starting method and device and readable storage medium

    CN112000382A

  • Game resource management method and device, game resource loading method and device and storage medium

    CN112473132A

  • Network disk file cleaning method, system, computer equipment and storage medium thereof

    CN113836093A