A method, electronic device, and apparatus for loading kernel .ko files

By reading the loaded list in the electronic device and only loading the unloaded .ko files, the problem of long loading time of .ko files during the electronic device startup process is solved, resulting in faster boot speed and a better user experience.

CN119938156BActive Publication Date: 2026-01-30HONOR DEVICE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311424833.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2026-01-30
Estimated Expiration
2043-10-27

AI Technical Summary

Technical Problem

The increased number of .ko files and complex dependencies during the startup process of electronic devices lead to longer loading times, affecting boot performance and user experience.

Method used

The target process reads the loaded list to identify unloaded .ko files and loads only the unloaded files to avoid duplicate loading. Read-write locks and shared/backup memory mechanisms are used to ensure the accuracy and security of the list.

Benefits of technology

This reduces the number and time spent loading .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 CN119938156B_ABST
    Figure CN119938156B_ABST
Patent Text Reader

Abstract

This application provides a kernel .ko file loading method, electronic device, and apparatus. The electronic device executing this method is equipped with a loaded list recording the .ko files loaded by each process. In this method, firstly, the .ko file to be loaded corresponding to the target process is determined; then, the target process reads the loaded list; based on the reading result of the target process, unloaded .ko files among the .ko files to be loaded are determined; finally, the target process loads the unloaded .ko files. The solution provided by this application avoids the repeated loading of the same .ko file, thereby reducing the number of .ko files to be loaded, correspondingly reducing the time spent loading .ko files, and further reducing the time required for the electronic device to boot up. Accordingly, this method can reduce the time users spend waiting for the electronic device to boot up, improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of communication, and particularly relates to a kernal object (ko) file loading method, an electronic device and an apparatus. BACKGROUND

[0002] Some electronic devices (such as mobile phones and the like) need to load multiple kernal object (ko) files into the kernel of the electronic device during the startup process.

[0003] However, as the functions supported by the electronic device increase, the number of ko files that need to be loaded is increasing, and the dependency relationship between the ko files is becoming more and more complex, which leads to the fact that the electronic device often needs to load a large number of ko files during the startup process, the time consumption for loading the ko files is long, and further, the time required for the startup of the electronic device is long. SUMMARY

[0004] In order to solve the problem of long time consumption for loading the ko files and long time required for the startup of the electronic device in the existing ko file loading technology, the embodiments of the present application provide a ko file loading method, an electronic device and an apparatus.

[0005] In a first aspect, the present application provides a kernal object (ko) file loading method, comprising:

[0006] determining a to-be-loaded ko file corresponding to a target process;

[0007] reading, by the target process, a loaded list, the loaded list being used to record the ko files loaded by each process;

[0008] determining, by the reading result of the target process, an unloaded ko file in the to-be-loaded ko file;

[0009] loading, by the target process, the unloaded ko file.

[0010] Through the method, if a ko file has been loaded, the target process can no longer load the ko file according to the reading result of the loaded list, repeated loading of the same ko file can be avoided, the number of loaded ko files can be reduced, the time consumption for loading the ko files can be correspondingly reduced, and further, the time required for the startup of the electronic device can be reduced.

[0011] In a feasible design, the method further comprises:

[0012] after the loading of the unloaded ko file is completed, adding the unloaded ko file in the loaded list.

[0013] Through the step, the loaded list can be adjusted according to the loading situation of the ko file, and the accuracy of determining the unloaded ko file through the loaded list is improved.

[0014] In a feasible design, the determining the to-be-loaded ko file corresponding to the target process comprises:

[0015] Determining the first ko file required to be loaded by the target process;

[0016] Reading, by the target process, a dependency list corresponding to the first ko file to determine the second ko file depended by the first ko file, the dependency list corresponding to the first ko file being used to record the ko file depended by the first ko file, and the to-be-loaded ko file comprising the first ko file and the second ko file.

[0017] In a feasible design, the reading, by the target process, the loaded list comprises:

[0018] Allocating, for the target process, a read lock in a read-write lock, the read lock being used to indicate that the target process is allowed to read the loaded list;

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

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

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

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

[0023] The reading, by the target process, the loaded list stored in the backup memory comprises:

[0024] Mapping, by the target process, the loaded list in the backup memory to a second space corresponding to the target process, and reading, by the target process, the loaded list in the second space.

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

[0026] If the target processes include at least one, a write lock in read-write locks is assigned to a first target process in the target processes, the write lock is used to indicate that the first target process supports loading of the ko file;

[0027] The first target process loads the unloaded ko file corresponding to the first target process.

[0028] In an available design, the method further includes:

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

[0030] In an available design, the method further includes:

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

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

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

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

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

[0036] In a third aspect, the application provides a computer storage medium, characterized in that the computer storage medium stores computer programs or instructions, when the computer programs or instructions are executed, the method of the first aspect is executed.

[0037] In a fourth aspect, the application provides a chip system, characterized in that the chip system includes a processor, the processor is coupled with a memory, and is used to execute computer programs or instructions stored in the memory, when the computer programs or instructions are executed, the method of any one of the first aspect is executed.

[0038] Through the scheme provided by the embodiments of the application, repeated loading of the same ko file can be avoided, thereby reducing the number of loaded ko files, and correspondingly reducing the time consumption of loading the ko files, and further reducing the time required for starting up the electronic device. Correspondingly, the scheme can reduce the time for the user to wait for the electronic device to start up, and improve the user experience. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings required to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0040] Figure 1 A schematic diagram of a ko file loading workflow is provided.

[0041] Figure 2 A schematic diagram of loading a ko list and a ko dependency list in a ko file is provided.

[0042] Figure 3 A schematic diagram of an electronic device structure provided by the embodiments of the present application is provided.

[0043] Figure 4 A software structure block diagram of an electronic device provided by the embodiments of the present application is provided.

[0044] Figure 5 A schematic diagram of a ko file loading method provided by the embodiments of the present application is provided.

[0045] Figure 6 A schematic diagram of another ko file loading method provided by the embodiments of the present application is provided.

[0046] Figure 7(a) is an example diagram corresponding to a ko file loading method provided by the embodiments of the present application.

[0047] Figure 7(b) is an example diagram corresponding to another ko file loading method provided by the embodiments of the present application.

[0048] Figure 7(c) is an example diagram corresponding to another ko file loading method provided by the embodiments of the present application.

[0049] Figure 8 A schematic diagram of another ko file loading method provided by the embodiments of the present application is provided.

[0050] Figure 9 A schematic diagram of another ko file loading method provided by the embodiments of the present application is provided.

[0051] Figure 10 A schematic diagram of a ko file loading device provided by the embodiments of the present application is provided.

[0052] Figure 11 A schematic diagram of an electronic device structure provided by the embodiments of the present application is provided. Detailed Implementation

[0053] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0054] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one” and “one or more” refer to one, two, or more than two. The term “and / or” is used to describe the relationship between related objects, indicating that three relationships may exist; for example, A and / or B can indicate: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character “ / ” generally indicates that the preceding and following related objects are in an “or” relationship.

[0055] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0056] To ensure clarity and conciseness in the description of the following embodiments, a brief introduction to the related technologies is given first:

[0057] During the boot process, some electronic devices (such as mobile phones) typically need to load multiple .ko files into the device's kernel before they can complete the boot process. Furthermore, when loading a particular .ko file, the device often requires that other .ko files it depends on be loaded into the kernel before that .ko file can be loaded.

[0058] To clarify the current technology for loading .ko files, publicly... Figure 1 . Figure 1 This is a diagram illustrating the current workflow for loading .ko files. See [link / reference] Figure 1When the ko file is loaded by the current ko file loading technology, a service (for example, a vendor.modprobe service) for loading the ko file is first started; then a ko list recording various to-be-loaded ko files to be loaded this time is traversed; according to the traversal result, a to-be-loaded ko file to be loaded this time is determined, and a process (for example, a modprobe process) corresponding to the to-be-loaded ko file is started; the process queries a ko dependency list of the to-be-loaded ko file, the ko dependency list recording other ko files depended on by the to-be-loaded ko file; the process loads the other ko files depended on by the to-be-loaded ko file, and after the loading of the other ko files is completed, the to-be-loaded ko file is loaded; after the to-be-loaded ko file is loaded into the kernel, the process exits; after each traversal of the ko list, it is determined whether the traversal of the ko list is completed; if the traversal is not completed, it indicates that there are other to-be-loaded ko files in the ko list to be loaded, and the ko list is traversed again to record the other to-be-loaded ko files; if the traversal is completed, it indicates that the to-be-loaded ko files in the ko list have all been loaded into the kernel, and the processes for loading the ko files are waited to exit, and after the processes exit, the service for loading the ko files is exited.

[0059] Through the above process, various to-be-loaded ko files can be loaded into the kernel of the electronic device. However, with the development of science and technology, the functions supported by the electronic device increase, and the number of ko files to be loaded by the electronic device also increases, and the dependency relationship between the ko files becomes more and more complex, and some ko files depend on at least one other ko file. In this case, the other ko files depended on by different to-be-loaded ko files can be the same, and each process does not know the ko files loaded by other processes, which leads to the possibility of repeated loading of the dependent ko files in the loading process of different processes, resulting in a large number of ko files to be loaded by the electronic device, and accordingly leading to a long time for loading the ko files, further leading to a long time for starting the electronic device, deteriorating the starting performance of the electronic device, a long time for the user to wait for the starting of the electronic device, and affecting the user experience.

[0060] In particular, the number of ko files to be loaded during the starting of the electronic device increases day by day, and some electronic devices often need to load hundreds of ko files. In this case, when the ko files are loaded by the related technology, the hundreds of ko files can be loaded multiple times, greatly increasing the time consumption in the starting process of the electronic device.

[0061] Reference is made to Figure 2Corresponding example, in this example, the ko list as shown on the left, the table indicates the need to load the ko file includes: ko file A, ko file B, ko file C, ko file D, ko file E and ko file F, ko dependency list as shown on the right, the table indicates that the ko file A depends on the ko file D, ko file E and ko file F, ko file B depends on ko file C, ko file F depends on ko file B.

[0062] In this case, if the ko file is loaded according to the current loading technique, when loading the ko file A, the ko files 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 the ko file B, the ko files will be loaded in the following order: ko file C->ko file B. When loading the ko file F, the ko files will be loaded in the following order: ko file B->ko file F.

[0063] That is, when loading each ko file in the ko list, 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, the repeated loading of the ko file occurs, causing waste of time.

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

[0065] Taking a mobile phone as an example of the above electronic equipment, in this embodiment, the structure of the electronic equipment can be as shown in Figure 3 , wherein,Figure 3 FIG. 1 is a structural schematic diagram of an electronic device for applying the high-definition icon display method provided in the embodiments of the present application.

[0066] As shown in FIG. 1, the electronic device can 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 key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and the like. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric 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, and the like. Figure 3 Further, when the electronic device is a mobile phone, the electronic device can further include an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and a subscriber identification module (SIM) card interface 195, and the like.

[0067] It can be understood that the structure shown in the embodiments does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0068] The processor 110 can include one or more processing units, wherein different processing units can be independent devices or integrated in one or more processors. The processor 110 can also be provided with a memory for storing instructions and data.

[0069]

[0070] ​In some embodiments, the processor 110 can include one or more interfaces. The interfaces can 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 configured to receive charging input from a charger. The power management module 141 is configured to connect the battery 142 to the processor 110 and the charging management module 140. 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, etc.

[0072] The mobile communication module 150 can provide solutions for wireless communication including 2G / 3G / 4G / 5G, etc. applied to the electronic device. The wireless communication module 160 can provide solutions for wireless communication including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. applied to the electronic device. 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 the wireless communication technology.

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

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

[0075] The electronic device can implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display 194, and an application processor, etc.

[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 code, which includes instructions. The processor 110 executes various function applications and data processing of the electronic device by running the instructions stored in the internal memory 121.

[0077] The electronic device can implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor, etc. For example, music playing, recording, etc.

[0078] The audio module 170 is used to convert digital audio information into analog audio signals for output, and 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 disposed in the processor 110, or part of the functions of the audio module 170 can be disposed in the processor 110.

[0079] The speaker 170A, also referred to as a "loudspeaker", is used to convert audio electrical signals into sound signals. The electronic device can listen to music or listen to a hands-free call through the speaker 170A. The receiver 170B, also referred to as an "earpiece", is used to convert audio electrical signals into sound signals. The microphone 170C, also referred to as a "microphone", "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by holding the mouth close to the microphone 170C, and input the sound signal into the microphone 170C. The earphone interface 170D is used to connect a wired earphone.

[0080] The pressure sensor 180A is used to sense a pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. There are many types of pressure sensors 180A, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, etc. The gyroscope sensor 180B can be used to determine the motion posture of the electronic device. The barometric 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 a flip cover. The acceleration sensor 180E can detect the acceleration of the electronic device in various 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 ambient light brightness. The fingerprint sensor 180H is used to collect fingerprints. The temperature sensor 180J is used to detect the temperature. The touch sensor 180K, also referred to as a "touch device". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch screen". The bone conduction sensor 180M can obtain a vibration signal. The key 190 includes a power-on key, a volume key, etc. The key 190 can be a mechanical key, a touch key, or a virtual key. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging state, the power change, or can be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card.

[0081] In addition, on top of the above-mentioned components, an operating system is running. For example, the iOS operating system developed by Apple Inc., the Android open source operating system developed by Google Inc., the Windows operating system developed by Microsoft Corp., etc. Application programs can be installed and run on the operating system.

[0082] In order to clearly define the functions and operations of each software architecture in the electronic device when the electronic device executes the scheme disclosed in the present application, the software structure of the electronic device is also disclosed in the embodiments of the present application.

[0083] The operating system of the electronic device can employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture, etc. Still taking the mobile phone as an example of the electronic device, the software system of the mobile phone can employ a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. Embodiments of the present application take the Android system with a layered architecture as an example to exemplarily illustrate the software structure of the mobile phone.

[0084] Figure 4 A software structure block diagram of an embodiment of the mobile phone provided in the present application is shown in FIG. 1. Referring to FIG. 1, the layered architecture divides the software into several layers, each of which has a clear role 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 system library, and the kernel layer. Figure 4

[0085] The application layer can include a series of application packages. As shown in FIG. 2, the application packages can include camera, gallery, call, navigation, Bluetooth, music, video, short message, etc. Figure 4

[0086] The application framework layer provides the application layer with application programming interfaces (APIs) and programming frameworks. The application framework layer includes some pre-defined functions. As shown in FIG. 3, the application framework layer can include window manager, content provider, view system, phone manager, resource manager, and notification manager, etc. Figure 4

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

[0088] The content provider is used to store and obtain data, and make the data accessible to the application. The data can include video, image, audio, dialed and received calls, browsing history and bookmarks, phonebook, etc.

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

[0090] The phone manager is used to provide the communication function of the mobile phone. For example, the management of the call state (including call connection, call hang-up, etc.).

[0091] ​​​The resource manager provides applications access to various resources, such as localized strings, icons, pictures, layout files, video files, etc.

[0092] The notification manager enables applications to display notification information in the status bar, which can be used to convey informational type messages that can automatically disappear after a brief stay without user interaction. For example, the notification manager is used to inform of download completion, message reminders, etc. The notification manager can also be a notification that appears in the form of a graphic or scrolling text in the status bar at the top of the system, such as a notification of an application running in the background, or a notification that appears in the form of a dialog window on the screen. For example, a text message is prompted in the status bar, a prompt sound is emitted, the electronic device vibrates, the indicator light flashes, etc.

[0093] In addition, the application framework layer can also run a service that loads 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 loads the ko file.

[0094] The Android Runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system. The core library includes two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java file of the application layer and the application framework layer into a binary file. The virtual machine is used to manage the life cycle of objects, stack management, thread management, security and exception management, and garbage collection.

[0095] The system library can include a plurality of functional modules. For example: a surface manager, media libraries, a three-dimensional graphics processing library (for example: OpenGL ES), a 2D graphics engine (for example: SGL), etc. The surface manager is used to manage the display subsystem and provides a plurality of applications with the fusion of 2D and 3D layers. The media library supports a plurality of commonly used audio, video format playback and recording, and static image files, etc. The media library can support a plurality of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The three-dimensional graphics processing library is used to realize three-dimensional 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 include display drivers, camera drivers, audio drivers, sensor drivers, etc.

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

[0098] The system library and the kernel layer and the like below the application framework layer can also be referred to as an underlying system, and the underlying system includes a state monitoring service for identifying a posture change of the mobile phone, which can be arranged in the system library and / or the kernel layer.

[0099] The above takes the Android system as an example, which is a layered architecture of a software system of an electronic device. Of course, the software system of the electronic device can also be other architectures, which are not limited in the present application.

[0100] In order to clearly understand the scheme provided in the present application, the scheme provided in the present application will be described below by means of various embodiments in combination with the accompanying drawings.

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

[0102] Referring to Figure 5 The kernel ko file loading method provided in the present application includes the following steps:

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

[0104] After the service of loading files determines that a ko file needs to be loaded, a process for the ko file is usually started, and the ko file is loaded by the process. In this case, the ko file to which the process is started can be referred to as the ko file to be loaded by the process, and the process can be referred to as the process started for the ko file. For example, if the service of loading files determines that ko file A needs to be loaded, a first process for ko file A is started, and the ko file A can be referred to as the ko file to be loaded by the first process, and the first process is the process started for the ko file A. Wherein, if the service of loading ko files is the vendor.modprobe service, the process can be the modprobe process.

[0105] In addition, a ko file can also depend on other ko files, in which case the ko file to be loaded corresponding to the target process includes the first ko file to be loaded by the target process and the second ko file depended on by the first ko file, 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 by the following method:

[0107] Firstly, a first ko file needed 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, a second ko file depended by the first ko file is determined by reading a dependency list corresponding to the first ko file through the target process, the dependency list corresponding to the first ko file is used to record ko files depended by the first ko file, and the ko files to be loaded include the first ko file and the second ko file.

[0109] That is, in the scheme provided in the embodiments of the present application, the dependency list corresponding to the first ko file is configured in the electronic device, and the second ko file depended by the first ko file can be determined by checking the dependency list, the first ko file and the second ko file are both the first ko file needed to be loaded by the target process.

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

[0111] In the embodiments of the present application, the loaded list is set for each process loading the ko file, and the loaded list is used to record ko files loaded by each process.

[0112] In a feasible design, the electronic device can set a shared memory, the shared memory can be accessed by each process, and the shared memory stores the loaded list. In addition, the loaded list can also be adjusted in the process of loading the ko file, for example, after a ko file is loaded into the kernel of the electronic device, the ko file can be added to the loaded list.

[0113] Among them, the shared memory is usually initialized in the process of starting the electronic device. For example, if the service 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 embodiments of the present application, the loaded list is used to record ko files loaded by each process. In a feasible design, the loaded list can include the correspondence between the information of the ko file and the mark value (i.e. the value).

[0115] Among them, 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, if the mark value corresponding to the information of a ko file in the loaded list is the first mark value, it indicates that the ko file has been loaded, and if the mark value corresponding to the information of a ko file is the second mark value, it indicates that the ko file has not been loaded.

[0117] The information of the ko file can include the name of the ko file, and can also include other information capable of distinguishing different ko files, which is not limited in the embodiments of the present application.

[0118] In a possible design, the first mark value can be 1, and the second mark value can be 0, and the first mark value and the second mark value can also be set as other values, which is not limited in the embodiments of the present application.

[0119] In addition, the data structure of the loaded list can be a hash table, and can also be other forms of data structure, which is not limited in the embodiments of the present application.

[0120] In step S13, the unloaded ko file in the ko files to be loaded is determined through the reading result of the target process.

[0121] Since the loaded list records the loaded ko files of each process, the unloaded ko file in the ko files to be loaded can be determined by reading the loaded list, and the unloaded ko file is a ko file that has not been loaded by each process.

[0122] In step S14, the unloaded ko file is loaded by the target process.

[0123] Since the unloaded ko file has not been loaded before, the unloaded ko file can be loaded into the kernel of the electronic device through the operation in step S14, so as to meet the starting requirement of the electronic device, and the repeated loading of the same ko file can also be avoided.

[0124] Further, 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 taken as target processes to load the ko file by the scheme provided in the embodiments of the present application until all the ko files are loaded into the kernel of the electronic device.

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

[0126] By the method provided in the embodiments of the present application, repeated loading of the same ko file can be avoided, thereby reducing the number of loaded ko files, reducing the time consumption of loading the ko files accordingly, and further reducing the time required for starting up the electronic device. Accordingly, the method can reduce the time for the user to wait for the electronic device to start up, and improve the user experience.

[0127] In order to make the advantages of the present application clear, an example is provided as follows. In the example, the list of ko files to be loaded and the list of ko dependencies are as shown in Table 1. Figure 2 As shown in Table 1, 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. Accordingly, the target processes include six, which are the process of loading ko file A, the process of loading ko file B, the process of loading ko file C, the process of loading ko file D, the process of loading ko file E and the process of 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 loading of the ko files is performed by the prior art, ko file B will be loaded three times, ko file C will be loaded three times, and ko file F will be loaded twice, i.e., repeated loading of the ko files occurs.

[0129] When the loading of the ko files is performed by the scheme provided in the embodiments 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. Moreover, 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 of loading ko file B can determine, based on the loaded list, that ko file C and ko file B have both been loaded, so that the loading of ko file C and ko file B is no longer performed.

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

[0132] Accordingly, before loading each ko file, the 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, so that the loading of ko file D, ko file E and ko file F is no longer performed.

[0133] That is, in the loading of the ko files according to the scheme provided in the embodiments of the present application, the ko file A, the ko file B, the ko file C, the ko file D, the ko file E and the ko file F are loaded only once. Compared with the prior art, the scheme provided in the embodiments of the present application can effectively reduce the number of loaded ko files, reduce the time consumption of loading the ko files, and reduce the time required for starting up the electronic device.

[0134] Further, on the basis of the above-mentioned embodiments, the present application further provides another embodiment. Referring to Figure 6 The embodiment further includes the following steps:

[0135] In 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 converted into a loaded ko file, in which case, the unloaded ko file can be added to the loaded list so as to be recorded as a loaded ko file by means of the loaded list.

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

[0138] In step S12, an operation of reading the loaded list by the target process is provided, and in a feasible design, the operation can include the following steps:

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

[0140] In the scheme provided in the embodiments of the present application, the target process can include one or at least two, and the scheme of the present application supports multiple processes to read the loaded list at the same time, in which case, even if the target process can include multiple processes, the read lock can be allocated to different target processes, and the target processes 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 by the target process; if there is a process 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.

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

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

[0144] To address this issue, in the embodiments of the present application, when a target process needs to read and write the loaded list, if there is no process loading a ko file, the loaded list in the shared memory can be directly read; if there is a process loading a 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 reads 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 the memory mapping (MMAP) technology, and in this case, the operation of reading the loaded list stored in the shared memory by the target process can include the following steps:

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

[0147] Correspondingly, the reading of the loaded list stored in the backup memory by the target process includes:

[0148] The loaded list in the backup memory is mapped to a second space corresponding to the target process by 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 can be the same space or different spaces, and the embodiments of the present application do not limit this.

[0150] To clarify this scheme, FIG. 7(a) and FIG. 7(b) are disclosed below.

[0151] Referring to FIG. 7(a), a corresponding example diagram is shown, in which the service for loading ko files starts a target process, the target process 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 by the MMAP technology.

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

[0153] In this example, the name of the ko file needed to be loaded by process 1 is pm8941-pwrkey.ko, and the loaded list indicates that the ko file is not loaded, and in this example, the second flag value is 0 and the first flag value is 1, then in the shared memory and the backup memory, the flag value corresponding to the ko file is 0.

[0154] In step S14, an operation of loading an unloaded ko file by a target process is disclosed, referring to Figure 8 The operation can include the following steps:

[0155] In step S141, if the target process includes at least one, a write lock in a read-write lock is assigned to a first target process in the target process, and the write lock is used to indicate that the first target process supports the loading of the ko file.

[0156] In step S142, the first target process loads the unloaded ko file corresponding to the first target process.

[0157] In the embodiments of the present application, the loading of the ko file is performed by each process in turn, in which case, if the target process includes at least one, a write lock in a read-write lock is assigned to a first target process in the target process, so that the first target process loads the ko file, and the first target process can be any one of the target processes. After the first target process completes the loading, other processes can perform the loading of the ko file, i.e., each process performs the loading of the ko file.

[0158] In a feasible design, a ko list can be configured, which includes each ko file needed to be loaded by the electronic device. After the first target process completes the loading, the ko list can be traversed to determine whether there is an unloaded ko file in the ko list, and if so, the loading of the ko file is continued until each ko file included in the ko list is loaded.

[0159] Further, in this embodiment, the following steps can also be included:

[0160] Step S143, before loading the un-loaded ko file corresponding to the first target process by the first target process, backup 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 during the loading process of the first target process.

[0162] In addition, after the first target process completes the loading of the un-loaded file, the backup memory can also be released to improve the utilization of memory resources.

[0163] After the backup memory is released, if a process needs to read the loaded list, the loaded list in the shared memory can be read.

[0164] Correspondingly, corresponding to the example of FIG. 7(a) and FIG. 7(b), the scenario can be as shown in FIG. 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 the loading of the pm8941-pwrkey.ko ko file, the mark value of this ko file becomes the first mark value, indicating that the ko file has been loaded.

[0166] In order to clarify the implementation of the ko file loading method provided by the embodiments of the present application, another embodiment is disclosed, see Figure 9 The embodiment includes the following processes:

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

[0168] For example, the electronic device can start the service of loading the ko file after receiving the operation of starting up.

[0169] Step S22, configure the loaded list by the service, the loaded list is used to record the ko files loaded by each process.

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

[0171] Step S23, traverse the ko list by the service, the ko list records each ko file that needs to be loaded during the startup process of the electronic device.

[0172] Step S24, determine whether there is a ko file that needs to be loaded through the traversal result, if yes, execute the operation of step S25, if not, it means that the loading is completed, and execute the operation of step S31.

[0173] Step S25, a process for loading ko files is started by the service. Wherein, if it is determined by step S24 that the first ko file needs to be loaded, the process can be used to load the first ko file.

[0174] For example, if the service for loading ko files is the vendor.modprobe service, the process can be the modprobe process.

[0175] Step S26, the ko dependency list is traversed by the process to determine the ko files to be loaded. Wherein, if the process is used to load the first ko file, the ko dependency list of the first ko file is traversed, the ko dependency list of the first ko file is used to record the ko files depended by the first ko file, the ko files depended by the first ko file can be referred to as the second ko files, and the ko files to be loaded include the first ko file and the second ko files.

[0176] Step S27, the loaded list is read by the process.

[0177] If there is no process for loading ko files, the loaded list in the shared memory can be read by the process. If there is a process for loading ko files, the service can configure a backup memory, and backup the loaded list in the shared memory to the backup memory, and the loaded list in the backup memory is read by the process.

[0178] Step S28, whether there is an unloaded ko file in the ko files to be loaded is determined by reading the result. If yes, the operation of step S29 is performed, and if no, the operation of step S30 is performed.

[0179] Step S29, the unloaded ko file is loaded by the process, and after the loading is completed, the unloaded ko file is added to the loaded list.

[0180] Wherein, 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 the loading of the unloaded ko file, the process is exited, and then the operation of step S31 is performed.

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

[0183] Step S32, after all processes for loading ko files are exited, the service for loading ko files is exited.

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

[0185] The various method embodiments described herein can be independent solutions or combined according to inherent logic, and these solutions fall within the protection scope of the present application.

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

[0187] The present application discloses a ko file loading device. Referring to Figure 10 The ko file loading device can 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 configured to determine a to-be-loaded ko file corresponding to a target process.

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

[0190] The second determination module 130 is configured to determine an unloaded ko file in the to-be-loaded ko file through a reading result of the target process.

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

[0192] In a possible design, the ko file loading device is further configured to add the unloaded ko file in the loaded list after completing loading of the unloaded ko file.

[0193] In a possible design, the first determination module 110 is configured to:

[0194] determine a first ko file required to be loaded by the target process.

[0195] read a dependency relationship list corresponding to the first ko file through the target process, determine a second ko file depended by the first ko file, and the dependency relationship list corresponding to the first ko file is configured to record ko files depended by the first ko file, and the to-be-loaded ko file includes the first ko file and the second ko file.

[0196] In a possible design, the reading module 120 is configured to:

[0197] allocating a read lock in the read-write lock to the target process, the read lock being used to indicate that the target process is allowed to read the loaded list;

[0198] reading the loaded list in the shared memory by the target process if there is no process loading ko files;

[0199] reading the loaded list in the backup memory by the target process if there is a process loading ko files, the backup memory including the loaded list copied from the shared memory.

[0200] In one possible design, when the reading module 120 reads the loaded list stored in the shared memory by the target process, the reading module 120 can map the loaded list in the shared memory to a first space corresponding to the target process by the target process, and read the loaded list in the first space by the target process.

[0201] In one possible design, when the reading module 120 reads the loaded list stored in the backup memory by the target process, the reading module 120 can map the loaded list in the backup memory to a second space corresponding to the target process by the target process, and read the loaded list in the second space by the target process.

[0202] In one possible design, the loading module 140 can be configured to:

[0203] allocating a write lock in the read-write lock to a first target process in the target processes, the write lock being used to indicate that the first target process is allowed to load ko files;

[0204] loading, by the first target process, an unloaded ko file corresponding to the first target process.

[0205] Further, the apparatus can further be configured to:

[0206] before the loading, by the first target process, of the unloaded ko file corresponding to the first target process, backing up the loaded list in the shared memory to the backup memory.

[0207] Further, the apparatus can further be configured to:

[0208] after the first target process completes the loading of the unloaded file, releasing the backup memory.

[0209] In one possible design, the loaded list includes a correspondence between information of ko files and a tag value.

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

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

[0212] The apparatus provided in this application avoids repeatedly loading the same .ko file, thereby reducing the number of .ko files to load, correspondingly reducing the time spent loading .ko files, and further reducing the time required for electronic devices to boot up. Accordingly, this method can reduce the time users spend waiting for electronic devices to boot up, improving the user experience.

[0213] Accordingly, this application discloses an electronic device, see [link to relevant documentation]. Figure 11 The schematic diagram shown indicates that the electronic device includes:

[0214] Processor 1101 and memory,

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

[0216] The processor 1101 is used to call and execute program instructions stored in the memory. When the program instructions stored in the memory are executed by the processor 1101, the electronic device performs... Figures 5 to 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 (RAM), and read-only memory (ROM) via a bus. When the electronic device needs to operate, it is booted by a basic input / output system (BIS) or a bootloader embedded in the ROM, guiding the device into normal operation. Once in normal operation, the application program and operating system run in the RAM, enabling the electronic device to perform its functions. Figures 5 to 6 , Figures 8 to 9 All or part of the steps in the corresponding embodiments.

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

[0220] In particular implementations, the embodiments of the present application further provide a computer storage medium, wherein the computer storage medium stores computer programs or instructions, and when the computer programs or instructions are executed, the computer can implement all or part of the steps in the corresponding embodiments. The computer readable storage medium can be arranged in any device, which can be a random access memory (RAM), and the memory can also include a non-volatile memory such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), and the memory can also include a combination of the above-mentioned memories. Figures 5 to 6 、 Figures 8 to 9 The computer readable storage medium can be arranged in any device, which can be a random access memory (RAM), and the memory can also include a non-volatile memory such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), and the memory can also include a combination of the above-mentioned memories.

[0221] The embodiments of the present application further provide a chip system, which includes a processor coupled with a memory, and the processor is configured to execute computer programs or instructions stored in the memory, and when the computer programs or instructions are executed, the chip system can implement 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. Figures 5 to 6 、 Figures 8 to 9 The chip system can be composed of a chip, or can include a chip and other discrete devices.

[0222] The steps of the methods or algorithms described in the embodiments of the present application can be directly embedded in hardware, software units executed by a processor, or a combination of the two. The software units 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. The storage medium can be connected with the processor, so that the processor can read information from the storage medium and write information to the storage medium. Alternatively, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, which can be arranged in a user equipment (UE). Alternatively, the processor and the storage medium can also be arranged in different components in the UE.

[0223] In the embodiments described above, the entire or part can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, the entire or part can be implemented 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 entire or part generates the processes or functions described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium, or a semiconductor medium (for example, a solid state disk (SSD)) and the like.

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

[0225] Those skilled in the art can clearly understand that the technology in the embodiments of the present application can be realized by means of software and necessary general hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, server, or network device, etc.) execute the method described in various embodiments or some parts of the embodiments of the present application.

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

[0227] The above-mentioned embodiments of the present application do not constitute a limitation on the scope of protection of the present application.

Claims

1. A kernel ko file loading method, characterized by, The method comprises the following steps: determining a to-be-loaded ko file corresponding to a target process; allocating a read lock in a read-write lock to the target process, the read lock being used to indicate that the target process is allowed to read an already-loaded list, the already-loaded list being used to record ko files loaded by each process; if there is no process loading a ko file, reading the already-loaded list in a shared memory by the target process; if there is a process loading a ko file, reading the already-loaded list in a backup memory by the target process, the backup memory including the already-loaded list copied from the shared memory; determining an unloaded ko file in the to-be-loaded ko file according to a reading result of the target process; loading the unloaded ko file by the target process.

2. The method of claim 1, wherein, Further comprising: after the loading of the unloaded ko file is completed, adding the unloaded ko file to the already-loaded list.

3. The method of claim 1, wherein, The step of determining the to-be-loaded ko file corresponding to the target process comprises: determining a first ko file to be loaded by the target process; reading a dependency list corresponding to the first ko file by the target process to determine a second ko file depended on by the first ko file, the dependency list corresponding to the first ko file being used to record ko files depended on by the first ko file, the to-be-loaded ko file including the first ko file and the second ko file.

4. The method of claim 1, wherein, The step of reading the already-loaded list stored in the shared memory by the target process comprises: mapping the already-loaded list in the shared memory to a first space corresponding to the target process by the target process, and reading the already-loaded list in the first space by the target process; The step of reading the already-loaded list stored in the backup memory by the target process comprises: mapping the already-loaded list in the backup memory to a second space corresponding to the target process by the target process, and reading the already-loaded list in the second space by the target process.

5. The method of claim 1, wherein, The step of loading the unloaded ko file by the target process comprises: if the target process includes at least one, allocating a write lock in the read-write lock to a first target process in the target process, the write lock being used to indicate that the first target process is allowed to load a ko file; loading an unloaded ko file corresponding to the first target process by the first target process.

6. The method of claim 5, wherein, Further comprising: before the unloaded ko file corresponding to the first target process is loaded by the first target process, backing up the already-loaded list in the shared memory to the backup memory.

7. The method of claim 6, wherein, Further comprising: after the first target process completes the loading of the unloaded file, releasing the backup memory.

8. The method according to any one of claims 1 to 7, wherein: the already-loaded list includes a correspondence between information of a ko file and a marker value; the marker value includes a first marker value and a second marker value; the first marker value is used to indicate that the ko file has been loaded, and the second marker value is used to indicate that the ko file has not been loaded.

9. An electronic device, comprising: The method comprises the following steps: a processor and a memory; the memory stores program instructions which, when executed by the processor, cause the electronic device to perform the method of any one of claims 1-8.

10. A computer storage medium, characterized in that, The computer storage medium stores a computer program or instructions which, when executed, perform the method of any one of claims 1-8.

11. A chip system, characterized by The chip system includes a processor coupled with a memory for executing a computer program or instructions stored in the memory, which, when executed, perform the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Method and device for starting operating system

    CN103631612A

  • Memory database access method, device and system, server and storage medium

    CN114357046A

  • Loading method, system and equipment of kernel driving module, medium and chip

    CN115809127A