WO2022100208A1 - Dynamic library loading method, kernel deployment adjustment method, and related apparatuses - Google Patents

Dynamic library loading method, kernel deployment adjustment method, and related apparatuses Download PDF

Info

Publication number
WO2022100208A1
WO2022100208A1 PCT/CN2021/115233 CN2021115233W WO2022100208A1 WO 2022100208 A1 WO2022100208 A1 WO 2022100208A1 CN 2021115233 W CN2021115233 W CN 2021115233W WO 2022100208 A1 WO2022100208 A1 WO 2022100208A1
Authority
WO
WIPO (PCT)
Prior art keywords
dynamic
dynamic library
loaded
libraries
linked
Prior art date
Application number
PCT/CN2021/115233
Other languages
French (fr)
Chinese (zh)
Inventor
欧炜
陈计亮
江维财
徐高峰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022100208A1 publication Critical patent/WO2022100208A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a method for loading a dynamic library, a method for adjusting core deployment, and a related device.
  • a multi-core processor can support multiple concurrent applications at the same time.
  • the multi-core processor in the base station supports the LTE standard of 4G and the NR standard of 5G.
  • Core 1, core 2, and core 3 of the processor are responsible for resource allocation for 4G users, and core 4 and core 5 of the processor are responsible for resource allocation for 5G users.
  • the number of 4G users and 5G users may change. For example, the number of 4G users drops to 50, and the number of 5G users rises to 100.
  • the relevant dynamic library may be pre-linked in the code compilation stage for relocation. This saves the time consumed by relocation when the dynamic library is loaded, and improves the loading speed of the dynamic library.
  • the present application provides a method for loading a dynamic library, a method for adjusting core deployment, and a related device, so as to improve the loading speed of the dynamic library when the core deployment is adjusted, and solve the problem that the dynamic library fails to be loaded.
  • the embodiment of the present application provides a dynamic library loading method, including:
  • the executable files of all the dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system;
  • the executable files of all the dynamic libraries to be loaded include: the version associated with the first service dynamic library The executable file of the dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
  • the executable file is stored in the file system;
  • the method further includes:
  • a dynamic library load request is received; the dynamic library load request indicates all dynamic libraries and target kernels to be loaded.
  • the method when loading the pre-linked executable file of each dynamic library to be loaded into the target kernel of the processor, the method further includes:
  • the pre-linked executable file of each dynamic library to be loaded is stored in the memory space corresponding to the target kernel in the memory with the pre-arranged storage address.
  • the method further includes:
  • the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
  • the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged, specifically including:
  • n is a positive integer
  • a dynamic library that can be stored in the remaining storage space and the segment size of the executable file is closest to the remaining storage space is determined from the n dynamic libraries whose storage addresses are not arranged.
  • the addresses are programmed into the address range of the remaining memory space.
  • the segment size of the executable file of the dynamic library includes: the size of the code segment and the size of the data segment in the executable file of the dynamic library.
  • the file system includes: at least one dynamic library version container;
  • At least one dynamic library version container includes: a dynamic library version first container; the dynamic library version first container includes executable files of all dynamic libraries related to loading of the first application; executable files of all dynamic libraries related to loading of the first application are included.
  • the executable files include: executable files of all dynamic libraries to be loaded corresponding to the target kernel;
  • the executable files of all dynamic libraries to be loaded corresponding to the target kernel are obtained from the first container of the dynamic library version.
  • the file system further includes: a dynamic library pre-linked version container corresponding to each dynamic library version container, including a dynamic library pre-linked version first container corresponding to the dynamic library version first container;
  • it also includes: when loading the first application on the target kernel again, directly obtaining the pre-linked executable files of all the dynamic libraries to be loaded corresponding to the target kernel from the file system, and converting each of the dynamic libraries to be loaded.
  • the pre-linked executable is loaded into the target kernel.
  • Embodiments of the present application also provide a method for adjusting core deployment, including:
  • the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
  • all dynamic libraries to be unloaded are unloaded from the target kernel, and the pre-linked executable files of all dynamic libraries to be loaded are obtained from the file system, and all dynamic libraries to be loaded are pre-linked.
  • the executable is loaded into the target kernel;
  • the pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
  • the embodiment of the present application also provides a dynamic library loading device, including:
  • the obtaining module is used to, when the first application is loaded in the target kernel, obtain the executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system; the executable files of all the dynamic libraries to be loaded include: the first service The executable file of the dynamic library associated with the dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
  • the pre-link module is used to pre-link the executable files of all the dynamic libraries to be loaded separately, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and link each dynamic library to be loaded.
  • the pre-linked executable file of the dynamic library is stored in the file system;
  • the loading module is used to obtain the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  • Embodiments of the present application also provide an apparatus for adjusting nuclear deployment, including:
  • the receiving module is used to receive a core deployment adjustment request;
  • the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
  • the deployment adjustment module is used to unload all the dynamic libraries to be unloaded from the target kernel according to the core deployment adjustment request, obtain the pre-linked executable files of all the dynamic libraries to be loaded from the file system, and load all the dynamic libraries to be loaded.
  • the executable file pre-linked by the dynamic library is loaded into the target kernel;
  • the pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
  • the embodiments of the present application at least have the following advantages:
  • the executable files of all the dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system;
  • the executable files of all the dynamic libraries to be loaded include: : the executable file of the dynamic library associated with the first service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version.
  • the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
  • the executable file is stored in the file system; the pre-linked executable file of each dynamic library to be loaded is obtained from the file system, and the pre-linked executable file of each dynamic library to be loaded is loaded into the target kernel.
  • the application of the target kernel is usually switched frequently, for example, frequently switching from the second application to the first application, and frequently switching from the first application to the second application.
  • the pre-linked executable file of each dynamic library to be loaded is stored in the file system, when the first application needs to be switched and loaded on the target kernel in the future, it can be directly
  • the pre-linked executable files of these dynamic libraries to be loaded are obtained from the file system, without performing the pre-linking operation every time.
  • pre-linking can be performed based on the executable file of the dynamic library associated with the latest dynamic library version of the platform. In this way, the pre-linked executable file is compatible with the latest dynamic library version of the platform, avoiding the problem of dynamic library loading failure.
  • FIG. 1 is a schematic flowchart of a dynamic library loading method provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram comparing the storage effects of executable files after dynamic library pre-linking before memory arrangement and after memory arrangement according to an embodiment of the present application;
  • FIG. 3 is a schematic structural diagram of a file system according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a method for adjusting core deployment provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of an application scenario of a method for adjusting core deployment provided by an embodiment of the present application
  • FIG. 6 is a schematic structural diagram of another file system provided by an embodiment of the present application.
  • FIG. 7A is a signaling diagram of a dynamic library loading method provided by an embodiment of the present application.
  • 7B is a signaling diagram of a method for adjusting core deployment provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a dynamic library loading apparatus provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of an apparatus for adjusting core deployment according to an embodiment of the present application.
  • Dynamic library relocatable object files are packaged into a single file in a specific way, and when linking to generate an executable file, "copy” what it needs from this single file to the final executable file, and it is not necessary to "copy” all the binary code of the required content into the executable file at link time, but only “copy” some relocation and symbol table information, which can be completed when the program is running. the linking process.
  • This separate file is called a dynamic library.
  • GAT Global Offset Table
  • Pre-Link is a method to optimize application load time by resolving library symbols before startup.
  • the pre-linking process of the current dynamic library loading method is carried out in the compilation stage. If the version of the dynamic library is updated on the platform that supports the operation of the business application, the version of the executable file of the dynamic library obtained by the previous pre-linking will be the same as the actual version of the platform. The latest dynamic library version is not compatible, and the problem that the dynamic library loading fails sometimes occurs. At present, a technical solution of using GOT table to load dynamic library can also be adopted. In this scheme, all applications need to perform jump access through the GOT table, which increases the running consumption and thus affects the performance of the system.
  • the present application provides a dynamic library loading method, an adjustment method for core deployment, and a related device, which can ensure the successful loading of the dynamic library on the basis of improving the loading speed of the dynamic library. And compared with the GOT table loading dynamic library scheme, there will be no additional running consumption, so it will not have a negative impact on the performance of the system.
  • the embodiments of the present application will be described in further detail below with reference to the accompanying drawings and specific implementation manners. Referring to FIG. 1 , this figure is a schematic flowchart of a dynamic library loading method provided by an embodiment of the present application. As shown in FIG. 1 , the dynamic library loading method provided by the embodiment of the present application includes the following steps S101 to S103:
  • the dynamic library is loaded to at least one core of the multi-core processor.
  • the target kernel is one of at least one kernel that needs to load dynamic libraries. There are various reasons for loading the dynamic library into the target kernel, and the reasons for loading are described below with examples.
  • the target kernel is idle, and other kernels loaded with the first application are insufficient to support the current traffic of the first application.
  • the target kernel needs to be converted from an idle state to a working state supporting services related to the first application.
  • a dynamic library related to the first application needs to be loaded into the target kernel.
  • Another example reason is that the target kernel has previously loaded relevant dynamic libraries of other applications, but due to the adjustment of the kernel deployment, the target kernel needs to be switched from other applications to the first application. For this purpose, a dynamic library related to the first application needs to be loaded into the target kernel.
  • the file system is a system outside the processor that stores all dynamic library-related files, independent of memory.
  • the file system may store the platform-related dynamic library and the file system of the service-related dynamic library.
  • the business-related dynamic library is most closely related to the application switching of the target kernel.
  • the platform specifically refers to a system that supports loading and running of the first application, for example, an operating system.
  • Platform-related dynamic libraries may undergo version updates.
  • business-related dynamic libraries may also undergo version updates.
  • the version updates of dynamic libraries are embodied in the file system.
  • the target kernel needs to be switched to a working state that supports services related to the first application.
  • the processor obtains executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system.
  • it includes both the executable file of the dynamic library associated with the first service dynamic library version, and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version supports the loading of the first application The latest dynamic library version for the platform.
  • the first service dynamic library version refers to a dynamic library version formed by a collection of executable files of all service-related dynamic libraries to be loaded in order to load the first application.
  • the first platform dynamic library version refers to a dynamic library version formed by a collection of executable files of all the latest platform-related dynamic libraries in order to load the first application.
  • the executable files of all dynamic libraries to be loaded corresponding to the target kernel may change.
  • business-related dynamic libraries may change; platform-related dynamic libraries may change or remain unchanged.
  • all the executable files of the dynamic library to be loaded include: the executable file of the dynamic library associated with the second service dynamic library version and the executable file of the dynamic library associated with the second platform dynamic library version.
  • the second service dynamic library version refers to a dynamic library version formed by a collection of executable files of all service-related dynamic libraries to be loaded in order to load the second application.
  • the second platform dynamic library version refers to a dynamic library version formed by a collection of executable files of all the latest platform-related dynamic libraries in order to load the second application.
  • the dynamic library associated with the first service dynamic library version and the dynamic library associated with the second service dynamic library version may be partially the same, or may be completely different.
  • S102 Pre-link the executable files of all the dynamic libraries to be loaded respectively, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and pre-link each dynamic library to be loaded.
  • the linked executable is stored in the file system.
  • Pre-linking an executable file of a dynamic library is a relatively mature technology in the art, so the implementation manner of pre-linking is not limited here, and the implementation process of pre-linking is not described in detail.
  • the occurrence period of the pre-link technology is implemented in the first application loading process. During the loading process of the first application, even if the dynamic library version associated with the platform is adjusted and updated in real time, it can respond in time, avoiding the problem of incompatibility with the platform version after pre-linking.
  • S103 Acquire the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  • step S101 the executable files of all dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system, including the executable files of the dynamic libraries p1, p2 and p3 and the executable files of the dynamic libraries s1, s2, s3 and s4.
  • the execution file wherein the dynamic libraries p1-p3 are dynamic libraries associated with the first service dynamic library version, and the dynamic libraries s1-s4 are dynamic libraries associated with the first platform dynamic library version.
  • Step S101 pre-links the executable files of the dynamic libraries p1-p3 and s1-s4 respectively, and imports the pre-linked executable files of the dynamic libraries p1-p3 and s1-s4 into the file system.
  • step S103 in order to load these dynamic libraries, the pre-linked executable files of the dynamic libraries p1-p3 and s1-s4 are taken out from the file system and loaded into the target kernel.
  • the above-mentioned p1-p3 and s1-s4 are not shown in the figure.
  • the executable file of the dynamic library to be loaded is pre-linked, and the pre-linked executable file is stored in the file system, so as to facilitate the retrieval again, Improved the loading speed of dynamic libraries.
  • pre-linking since the first pre-linking is performed when the target kernel loads the first application, pre-linking can be performed based on the executable file of the dynamic library associated with the dynamic library version of the platform at that time, so that the pre-linked platform dynamic library can be pre-linked.
  • the version is the latest. In this way, the problem that the pre-linked executable file does not match the latest dynamic library version of the platform is avoided, and the compatibility performance is guaranteed.
  • a dynamic library loading request may also be received; the dynamic library loading request indicates all the dynamic libraries to be loaded and the target kernel.
  • the information of all dynamic libraries to be loaded and the target kernel can be directly obtained according to the dynamic library loading request itself, or all the dynamic libraries to be loaded and the target kernel can be indicated according to the dynamic library loading request.
  • the ID information of the target kernel obtains all dynamic libraries to be loaded and the target kernel, which is not limited in this embodiment of the present application.
  • the method provided by the embodiment of the present application can obtain the dynamic library to be loaded as dynamic library A according to the ID information 001 in the dynamic library loading request and the mapping relationship between the ID information and the dynamic library, according to the ID information 002 and the ID information and the dynamic library A From the mapping relationship of the dynamic library, the dynamic library to be loaded can be obtained as dynamic library B.
  • the requested storage granularity is a fixed value. For example: when the storage granularity of the application is 4k, the storage granularity of each application is an integer multiple of 4k.
  • the order of loading the dynamic library is certain. After the action of loading the pre-linked executable files of the dynamic library in sequence is completed, there may be a large hole in the memory, so that the executable file after the dynamic library pre-linking is loaded as a whole. Occupy a lot of memory, or the problem of wasting memory space.
  • the storage addresses of these files in the memory can be arranged based on these linked executable files, so as to reduce the memory usage. Empty.
  • the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
  • the storage addresses are arranged according to the segment size of the executable file of each dynamic library to be loaded because the corresponding segment size does not change significantly before and after pre-linking.
  • the segment size of the executable file of the dynamic library specifically includes: the size of the code segment and the size of the data segment.
  • Code segments and data segments have different properties. It should be noted that the essence of an executable file is a description file, and the size of the executable file itself does not represent the size of the memory occupied by the executable file after it is loaded into the memory.
  • the format of the executable file can be ELF (Executable and Linkable Format) format.
  • memory can be organized separately based on different attributes. For example, according to the size of the data segment in the executable file of the dynamic library 1 to be loaded and the size of the data segment in the executable file of the dynamic library 2 to be loaded, the memory arrangement is unified; according to the executable file of the dynamic library 1 to be loaded The size of the code segment and the size of the code segment in the executable file of the dynamic library 2 to be loaded are unified for memory arrangement.
  • FIG. 2 shows the storage effect of a pre-linked executable file of a dynamic library before memory arrangement (see section 2a) and the memory arrangement according to the technical solution of the present application.
  • the loading order of the dynamic library is predetermined, and it is necessary to load the dynamic library 0, the dynamic library 1, the dynamic library 2, and the dynamic library 3 in sequence.
  • the remaining storage space of dynamic library 0 is larger than the pre-linked executable file of dynamic library 2.
  • dynamic library 2 will be stored in the remaining storage space of dynamic library 0; when loading dynamic library 3, since the remaining space of dynamic libraries 0 to 2 is smaller than the segment size of the executable file pre-linked by dynamic library 3, Then the dynamic library 3 will re-apply for a granular memory to store in it. Since part 2b shows the technical effects of the technical solutions of the present application, the following will first introduce the technical solutions provided by the implementation of the present application and examples of application of the technical solutions.
  • the storage address of the pre-linked executable file of each dynamic library to be loaded may be stored according to the storage granularity of the memory and the segment size of the pre-linked executable file of each dynamic library to be loaded. Make arrangements.
  • An example implementation is provided below. It should be understood that the following examples do not constitute a limitation on the methods provided in the present application.
  • the storage address of the executable file after pre-linking of each dynamic library to be loaded is arranged, Can specifically include:
  • n is a positive integer (for example, n is 3, n is not limited here, and n can also be all remaining The total number of dynamic libraries with unprogrammed storage addresses); determine a dynamic library that can be stored in the remaining storage space and the segment size of the executable file is the closest to the remaining storage space from the n dynamic libraries with unprogrammed storage addresses.
  • the storage address of the executable file pre-linked by the dynamic library is programmed into the address range of the remaining storage space. If the smallest segment size of the executable files of the dynamic library whose storage addresses are not arranged cannot be stored in the remaining storage space, the storage granularity can be re-applied, or the value of n can be enlarged. In this way, it can be ensured that the remaining space in each granular memory can be used to the greatest extent possible, so that the memory occupied by the pre-linked executable files of all the dynamic libraries to be loaded can be reduced, and the dynamic libraries can be loaded and unloaded from the memory. speed increased.
  • part 2b in FIG. 2 is a schematic diagram of the storage effect of the pre-linked executable file of the arranged dynamic library in the memory.
  • the memory shown in part 2b arranges the storage address of each pre-linked executable file of the dynamic library to be loaded according to the storage granularity of the memory before loading, and then loads the pre-linked executable file of the dynamic library according to the arrangement result. .
  • the segment size of the executable file of dynamic library 3 is larger than the segment size of the executable file of dynamic library 2, the segment size of the executable file of dynamic library 1 is relatively too large, and the remaining storage space corresponding to dynamic library 0 is larger than The segment size of the executable file of the dynamic library 3, so in order to more fully utilize the remaining space corresponding to the dynamic library 0, the dynamic library 3 is loaded into the remaining space corresponding to the dynamic library 0 during the programming process. Dynamic libraries 1 and 2 will be loaded into the granular memory of the newly allocated memory. It can be seen from the above that the dynamic library 3 is loaded into the newly applied granular memory before the arrangement, and the dynamic library 3 is loaded into the remaining space corresponding to the dynamic library 0 after the arrangement. As shown in FIG. 2 , the segment size of dynamic library 3 is larger than that of dynamic library 2. Therefore, on the whole, dynamic library 0, dynamic library 1, dynamic library 2, and dynamic library 3 occupy less memory.
  • each dynamic library to be loaded is pre-
  • the method provided by the embodiment of the present application may further include: storing the pre-linked executable file of each dynamic library to be loaded into a pre-arranged storage address. into the storage space corresponding to the target kernel in memory.
  • the method provided by the embodiment of the present application arranges the storage address of the pre-linked executable file of each dynamic library to be loaded according to the storage granularity of the memory and the segment size of the executable file, which reduces the size of the executable file.
  • the memory hole when the execution file is stored in the memory can reduce the memory occupied by the pre-linked executable file, improve the memory performance, and improve the speed of loading and unloading the dynamic library in the memory.
  • the file system provided by the embodiment of the present application includes: at least one dynamic library version container;
  • the at least one dynamic library version container includes: a first dynamic library version container; the first dynamic library version container includes executable files of all dynamic libraries related to loading the first application; all dynamic library versions related to loading the first application
  • the executable files of the library include: executable files of all dynamic libraries to be loaded corresponding to the target kernel. Therefore, in the embodiment of the present application, obtaining executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system specifically includes: obtaining all the dynamic libraries to be loaded corresponding to the target kernel from the first container of the dynamic library version executable file.
  • the file system provided by the embodiment of the present application further includes: a dynamic library pre-linked version container corresponding to each dynamic library version container, including a dynamic library pre-linked version first container corresponding to the dynamic library version first container. Therefore, in the implementation of the present application, storing the pre-linked executable file of each dynamic library to be loaded into the file system specifically includes: storing the pre-linked executable file of each dynamic library to be loaded into the dynamic library Pre-linked version of the first container. In the embodiment of the present application, acquiring the pre-linked executable file of each dynamic library to be loaded from the file system specifically includes: acquiring the pre-linked executable file of each dynamic library to be loaded from the first container of the pre-linked version of the dynamic library executable file.
  • FIG. 3 is a schematic structural diagram of a file system provided by an embodiment of the present application.
  • the loading module 100 in the digital signal processor 1000 obtains the dynamic library loading request
  • the loading module 100 obtains all the pending files corresponding to the target kernel from the first container 300 of the dynamic library version. Loaded dynamic library executable.
  • the loading module 100 stores the pre-linked executable file of each dynamic library to be loaded into the first container 400 of the pre-linked version of the dynamic library.
  • the loading module 100 in the DSP processor 1000 obtains the pre-linked executable file of each dynamic library to be loaded from the first container 400 of the dynamic library pre-linked version.
  • loading the pre-linked executable file of each dynamic library to be loaded into the target kernel in this application may further include: the loading module 100 in the DSP processor 1000 pre-loads each dynamic library to be loaded.
  • the linked executable is loaded into the target kernel.
  • the method provided by this embodiment of the present application may further include: when the first application is loaded on the target kernel again, All pre-linked executable files of the dynamic library to be loaded corresponding to the target kernel are directly obtained from the file system, and each pre-linked executable file of the dynamic library to be loaded is loaded into the target kernel.
  • an embodiment of the present application further provides a method for adjusting core deployment.
  • this figure is a schematic flowchart of a method for adjusting core deployment provided by an embodiment of the present application.
  • the method for adjusting core deployment provided by this embodiment of the present application includes the following steps S401 to S403:
  • S401 Receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel.
  • S402 Unload all dynamic libraries to be unloaded from the target kernel according to the core deployment adjustment request, obtain pre-linked executable files of all dynamic libraries to be loaded from the file system, and pre-link all dynamic libraries to be loaded After the executable is loaded into the target kernel.
  • the pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded;
  • the executable files of all the dynamic libraries to be loaded include : the executable file of the dynamic library associated with the first service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest update of the platform that supports the loading of the first application library version.
  • FIG. 5 is a schematic diagram of an application scenario of the method for adjusting core deployment provided by the embodiment of the present application.
  • the core deployment adjustment method provided by the present application can redeploy the core 3 in the processor 5 cores in the figure, and the core 3 is used as an example to illustrate: Specifically, the method provided by the present application will , application) 0 is unloaded from the core 3, and obtains all pre-linked executable files related to APP1 to be loaded from the file system, and loads all the pre-linked executable files related to APP1 to be loaded into the core 3. In this way, the core 3 originally deployed in APP0 can be deployed to APP1.
  • the method provided by the present application can also unload all pre-linked executable files related to APP1 to be loaded from core 3, and obtain all pre-linked executable files related to APP0 to be loaded from the file system. file, load all pre-linked executable files related to APP0 to be loaded into core 3, so that core 3 originally deployed in APP1 can be deployed to APP0.
  • the cores deployed by the methods provided in the embodiments of the present application are not limited to the core 3 in the above example, but include any one or more deployable cores.
  • the platform and application in this application do not limit the dynamic library for core deployment adjustment.
  • the method for core deployment provided by the present application can also be applied to the readjustment and deployment of the core deployed in the 4G service and the core deployed in the 5G service in the signal base station.
  • this figure is a schematic structural diagram of another file system provided by an embodiment of the present application.
  • the deployment adjustment module 200 after the deployment adjustment module 200 in the DSP 1000 receives the core deployment adjustment request, the deployment adjustment module 200 unloads all the dynamic libraries to be uninstalled from the target kernel according to the core deployment adjustment request, and pre-links the version from the dynamic library
  • the first container 400 obtains all pre-linked executable files of the dynamic library to be loaded, and loads all the pre-linked executable files of the dynamic library to be loaded into the target kernel.
  • this figure is a signaling diagram of a dynamic library loading method provided by an embodiment of the present application.
  • the loading module obtains the versions of all dynamic libraries through the first container of the dynamic library version; the loading module pre-links all the dynamic libraries together, and pre-links the The version is sent to the first container of the dynamic library pre-linked version for storage. Then, the loading module obtains the pre-linked version of the dynamic library stored in the first container from the pre-linked version of the dynamic library (including all pre-linked executable files of the dynamic library to be loaded), and loads the pre-linked version of the dynamic library. version of the executable is loaded onto the target kernel.
  • this figure is a signaling diagram of a method for adjusting core deployment provided by an embodiment of the present application.
  • the deployment adjustment module will unload the dynamic library on the corresponding target kernel, and obtain the pre-linked version of the dynamic library from the first container of the pre-linked version of the dynamic library , and load the executable file of the pre-linked version of the dynamic library into the target kernel.
  • the unloaded dynamic library is a dynamic library associated with other applications other than the first application.
  • the dynamic library associated with the other application can be unloaded, and then loaded again.
  • the executable file after all dynamic libraries related to the first application are pre-linked.
  • the APP in the embodiment of the present application may be an application program on a terminal, and may also be an application under different standards.
  • APP0 can be an application of 4G LTE standard
  • APP1 can be an application of 5G NR standard.
  • the form of application is not limited here.
  • the method provided by the embodiments of the present application pre-links the executable file of the dynamic library to be loaded, and stores the pre-linked executable file in the file system, so as to facilitate the retrieval again and improve the dynamic performance.
  • the loading speed of the library also avoids the problem that the pre-linked executable file does not match the latest dynamic library version of the platform.
  • the method provided by the embodiment of the present application also arranges the storage address of the executable file according to the storage granularity of the memory and the segment size of the executable file, so that the memory occupied by the pre-linked executable file can be reduced. , memory performance improvement, memory loading dynamic library and unloading dynamic library speed increase.
  • an embodiment of the present application further provides a dynamic library loading apparatus.
  • FIG. 8 this figure is a schematic structural diagram of a dynamic library loading apparatus provided by an embodiment of the present application.
  • the dynamic library loading device provided by the embodiment of the present application includes:
  • the obtaining module 801 is used to, when the first application is loaded in the target kernel, obtain from the file system the executable files of all the dynamic libraries to be loaded corresponding to the target kernel; the executable files of all the dynamic libraries to be loaded include: the first The executable file of the dynamic library associated with the service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
  • the pre-linking module 802 is used to pre-link the executable files of all the dynamic libraries to be loaded respectively, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and link each dynamic library to be loaded.
  • the pre-linked executable file of the loaded dynamic library is stored in the file system;
  • the loading module 803 is used to obtain the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  • the dynamic library loading apparatus before obtaining the executable files of all the dynamic libraries to be loaded from the file system, the dynamic library loading apparatus provided in this embodiment of the present application further includes: a receiving module configured to receive a dynamic library loading request;
  • the dynamic library load request indicates all dynamic libraries and target kernels to be loaded.
  • the loading module 803 is further configured to: store the pre-linked executable file of each dynamic library to be loaded into the storage space corresponding to the target kernel in the memory with a pre-programmed storage address.
  • the dynamic library loading apparatus when all executable files of the dynamic library to be loaded are pre-linked, the dynamic library loading apparatus provided in this embodiment of the present application further includes: an orchestration module for, according to the storage granularity of the memory and each The segment size of the executable file of each dynamic library to be loaded is arranged, and the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
  • the orchestration module is specifically configured to: determine, according to the storage granularity of the memory and the segment size of the executable file of the dynamic library whose storage address is newly arranged Remaining storage space; determine the dynamic libraries with the unarranged n storage addresses at the top of the loading order, and determine the segment size of the executable file of the dynamic libraries with n storage addresses unarranged; n is a positive integer; from n storage addresses A dynamic library that can be stored in the remaining storage space and the segment size of the executable file is closest to the remaining storage space is determined from the unprogrammed dynamic library, and the storage address of the executable file pre-linked to the dynamic library is arranged to the remaining storage space. within the address range of the space.
  • the dynamic library loading apparatus further includes: a direct acquisition module for directly acquiring all pending files corresponding to the target kernel from the file system when the first application is loaded on the target kernel again. Loading the pre-linked executable file of the loaded dynamic library, and loading the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  • an embodiment of the present application further provides an apparatus for adjusting nuclear deployment.
  • FIG. 9 this figure is a schematic structural diagram of an apparatus for adjusting core deployment provided by an embodiment of the present application.
  • the apparatus for adjusting core deployment provided by the embodiment of the present application includes:
  • the receiving module 901 is configured to receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
  • the deployment adjustment module 902 is configured to, according to the core deployment adjustment request, unload all the dynamic libraries to be unloaded from the target kernel, obtain the pre-linked executable files of all the dynamic libraries to be loaded from the file system, and load all the dynamic libraries to be loaded.
  • the pre-linked executable file of the dynamic library is loaded into the target kernel;
  • the pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
  • the method for loading a dynamic library, the method for adjusting core deployment, and the related apparatus provided in the above solution can be specifically applied to a multi-core processor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

A dynamic library loading method, a kernel deployment adjustment method, and related apparatuses. The dynamic library loading method comprises: when a first application is loaded in a target kernel, obtaining, from a file system, executable files of all dynamic libraries to be loaded corresponding to the target kernel, wherein the executable file of a dynamic library that is associated with a first platform dynamic library version in the executable files of all said dynamic libraries is the latest dynamic library version of a platform that supports the loading of the first application; respectively pre-linking and then storing the executable files of all said dynamic libraries; and then acquiring a pre-linked executable file of each of said dynamic libraries, and loading the pre-linked executable file of each of said dynamic libraries into the target kernel. Therefore, during each subsequent instance that a first application needs to be switched and loaded on a target kernel, a pre-linked executable file that is compatible with and matches the latest dynamic library version of a platform can be directly obtained from a file system, such that the problem of a loading failure of a dynamic library is prevented.

Description

动态库加载方法、核部署的调整方法及相关装置Dynamic library loading method, core deployment adjustment method and related device
本申请要求于2020年11月13日提交中华人民共和国国家知识产权局、申请号为202011268494.3、发明名称为“动态库加载方法、核部署的调整方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 13, 2020 with the State Intellectual Property Office of the People's Republic of China, the application number is 202011268494.3, and the invention name is "dynamic library loading method, nuclear deployment adjustment method and related devices", The entire contents of which are incorporated herein by reference.
技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种动态库加载方法、核部署的调整方法及相关装置。The present application relates to the field of computer technologies, and in particular, to a method for loading a dynamic library, a method for adjusting core deployment, and a related device.
背景技术Background technique
多内核的处理器可以同时支持多种应用并发。作为示例,在基站中多内核的处理器支持4G的LTE制式和5G的NR制式,4G用户有100个,分布在3个小区;5G用户有50个,分布在3个小区。处理器的内核1、内核2和内核3负责4G用户的资源分配,处理器的内核4和内核5负责5G用户的资源分配。实际应用中,随着人员的流动或5G普及使用等原因,4G用户与5G用户数量可能发生变化,例如4G用户下降至50个,5G用户上升至100个。此时,由于5G用户数量的激增,内核4和内核5已经不足以支持所有5G用户,为此,需要对4G LTE制式和5G NR制式的核部署进行实时、快速的调整,例如将内核3调整部署为负责5G用户的资源分配。此时,涉及到将内核3的4G应用相关的动态库切换为5G应用相关的动态库,期间涉及动态库的加载和卸载。为了提升用户的使用体验,以动态库加载为例,现有技术中可在代码编译阶段对相关的动态库预链接以进行重定位。这样节约了动态库加载时重定位消耗的时间,提升动态库加载速度。A multi-core processor can support multiple concurrent applications at the same time. As an example, the multi-core processor in the base station supports the LTE standard of 4G and the NR standard of 5G. There are 100 4G users distributed in 3 cells; there are 50 5G users distributed in 3 cells. Core 1, core 2, and core 3 of the processor are responsible for resource allocation for 4G users, and core 4 and core 5 of the processor are responsible for resource allocation for 5G users. In practical applications, with the flow of people or the popularization of 5G, the number of 4G users and 5G users may change. For example, the number of 4G users drops to 50, and the number of 5G users rises to 100. At this time, due to the surge in the number of 5G users, core 4 and core 5 are no longer enough to support all 5G users. For this reason, real-time and rapid adjustments to the core deployment of 4G LTE and 5G NR systems are required, such as adjusting core 3. Deployed to be responsible for resource allocation for 5G users. At this time, it involves switching the dynamic library related to the 4G application of the kernel 3 to the dynamic library related to the 5G application, which involves the loading and unloading of the dynamic library. In order to improve the user experience, taking dynamic library loading as an example, in the prior art, the relevant dynamic library may be pre-linked in the code compilation stage for relocation. This saves the time consumed by relocation when the dynamic library is loaded, and improves the loading speed of the dynamic library.
但是由于预链接过程是在编译阶段进行的,如果支持业务应用运行的平台发生动态库版本更新,此前预链接得到的动态库的可执行文件的版本与平台实际最新的动态库版本并不兼容,导致动态库加载失败的问题时有发生。如何在提升动态库加载速度的基础上保证动态库成功加载,已经成为本领域急需解决的技术问题。However, since the pre-linking process is carried out in the compilation phase, if the dynamic library version is updated on the platform that supports the running of business applications, the version of the executable file of the dynamic library obtained by pre-linking is not compatible with the actual latest dynamic library version of the platform. Problems that cause dynamic library loading to fail have occurred from time to time. How to ensure the successful loading of the dynamic library on the basis of improving the loading speed of the dynamic library has become an urgent technical problem to be solved in this field.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种动态库加载方法、核部署的调整方法及相关装置,以提核部署发生调整时动态库的加载速度,并解决动态库加载失败的问题。The present application provides a method for loading a dynamic library, a method for adjusting core deployment, and a related device, so as to improve the loading speed of the dynamic library when the core deployment is adjusted, and solve the problem that the dynamic library fails to be loaded.
本申请实施例提供了一种动态库加载方法,包括:The embodiment of the present application provides a dynamic library loading method, including:
当在目标内核加载第一应用时,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件;所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本;When the first application is loaded in the target kernel, the executable files of all the dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system; the executable files of all the dynamic libraries to be loaded include: the version associated with the first service dynamic library The executable file of the dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
对所有待加载的动态库的可执行文件分别预链接,获得所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入文件系统中;Pre-link the executable files of all the dynamic libraries to be loaded separately, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and pre-link each dynamic library to be loaded. The executable file is stored in the file system;
从文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到目标内核。Acquire the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
可选地,在从文件系统中获得所有待加载的动态库的可执行文件之前,还包括:Optionally, before obtaining the executable files of all dynamic libraries to be loaded from the file system, the method further includes:
接收动态库加载请求;动态库加载请求指示了所有待加载的动态库和目标内核。A dynamic library load request is received; the dynamic library load request indicates all dynamic libraries and target kernels to be loaded.
可选地,在将每个待加载的动态库预链接后的可执行文件加载到处理器的目标内核时,方法还包括:Optionally, when loading the pre-linked executable file of each dynamic library to be loaded into the target kernel of the processor, the method further includes:
以预先编排的存储地址,将每个待加载的动态库预链接后的可执行文件存入内存中目标内核对应的存储空间中。The pre-linked executable file of each dynamic library to be loaded is stored in the memory space corresponding to the target kernel in the memory with the pre-arranged storage address.
可选地,在对所有待加载的动态库的可执行文件分别预链接时,方法还包括:Optionally, when prelinking the executable files of all the dynamic libraries to be loaded respectively, the method further includes:
根据内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排。According to the storage granularity of the memory and the segment size of the executable file of each dynamic library to be loaded, the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
可选地,根据内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排,具体包括:Optionally, according to the storage granularity of the memory and the segment size of the executable file of each dynamic library to be loaded, the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged, specifically including:
根据内存的存储粒度和最新编排好存储地址的动态库的可执行文件的段大小,确定最新编排好存储地址的动态库的可执行文件的剩余存储空间;According to the storage granularity of the memory and the segment size of the executable file of the dynamic library whose storage address is newly arranged, determine the remaining storage space of the executable file of the dynamic library whose storage address is newly arranged;
确定出加载顺序靠前的n个存储地址未编排的动态库,并确定n个存储地址未编排的动态库的可执行文件的段大小;n为正整数;Determine the top n dynamic libraries whose storage addresses are not arranged in the loading order, and determine the segment size of the executable files of the n dynamic libraries whose storage addresses are not arranged; n is a positive integer;
从n个存储地址未编排的动态库中确定出可存入剩余存储空间且可执行文件的段大小与剩余存储空间最接近的一个动态库,对该动态库预链接后的可执行文件的存储地址编排至剩余存储空间的地址范围内。A dynamic library that can be stored in the remaining storage space and the segment size of the executable file is closest to the remaining storage space is determined from the n dynamic libraries whose storage addresses are not arranged. The addresses are programmed into the address range of the remaining memory space.
可选地,动态库的可执行文件的段大小包括:动态库的可执行文件中代码段的大小和数据段的大小。Optionally, the segment size of the executable file of the dynamic library includes: the size of the code segment and the size of the data segment in the executable file of the dynamic library.
可选地,文件系统包括:至少一个动态库版本容器;Optionally, the file system includes: at least one dynamic library version container;
至少一个动态库版本容器包括:动态库版本第一容器;动态库版本第一容器中包括与第一应用加载相关的所有动态库的可执行文件;与第一应用加载相关的所有动态库的可执行文件包括:目标内核对应的所有待加载的动态库的可执行文件;At least one dynamic library version container includes: a dynamic library version first container; the dynamic library version first container includes executable files of all dynamic libraries related to loading of the first application; executable files of all dynamic libraries related to loading of the first application are included. The executable files include: executable files of all dynamic libraries to be loaded corresponding to the target kernel;
从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件,具体包括:Obtain the executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system, including:
从动态库版本第一容器中获得目标内核对应的所有待加载的动态库的可执行文件。The executable files of all dynamic libraries to be loaded corresponding to the target kernel are obtained from the first container of the dynamic library version.
可选地,文件系统还包括:与每个动态库版本容器对应的动态库预链接版本容器,其中包括与动态库版本第一容器对应的动态库预链接版本第一容器;Optionally, the file system further includes: a dynamic library pre-linked version container corresponding to each dynamic library version container, including a dynamic library pre-linked version first container corresponding to the dynamic library version first container;
将每个待加载的动态库预链接后的可执行文件存入文件系统中,具体包括:Store the pre-linked executable file of each dynamic library to be loaded into the file system, including:
将每个待加载的动态库预链接后的可执行文件存入动态库预链接版本第一容器;Store the pre-linked executable file of each dynamic library to be loaded into the first container of the pre-linked version of the dynamic library;
从文件系统获取每个待加载的动态库预链接后的可执行文件,具体包括:Obtain the pre-linked executable file of each dynamic library to be loaded from the file system, including:
从动态库预链接版本第一容器获取每个待加载的动态库预链接后的可执行文件。Obtain the pre-linked executable file of each dynamic library to be loaded from the first container of the dynamic library pre-linked version.
可选地,还包括:当再次在目标内核加载第一应用时,从文件系统直接获取目标内核对应的所有待加载的动态库预链接后的可执行文件,将其中每个待加载的动态库预链接后的可执行文件加载到目标内核。Optionally, it also includes: when loading the first application on the target kernel again, directly obtaining the pre-linked executable files of all the dynamic libraries to be loaded corresponding to the target kernel from the file system, and converting each of the dynamic libraries to be loaded. The pre-linked executable is loaded into the target kernel.
本申请实施例还提供了一种核部署的调整方法,包括:Embodiments of the present application also provide a method for adjusting core deployment, including:
接收核部署调整请求;核部署调整请求指示了目标内核对应的所有待卸载的动态库和目标内核对应的所有待加载的动态库;Receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
根据核部署调整请求,将所有待卸载的动态库从目标内核上卸载,并从文件系统中获得所有待加载的动态库预链接后的可执行文件,将所有待加载的动态库预链接后的可执行文件加载到目标内核;According to the core deployment adjustment request, all dynamic libraries to be unloaded are unloaded from the target kernel, and the pre-linked executable files of all dynamic libraries to be loaded are obtained from the file system, and all dynamic libraries to be loaded are pre-linked. The executable is loaded into the target kernel;
所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。The pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
本申请实施例还提供了一种动态库加载装置,包括:The embodiment of the present application also provides a dynamic library loading device, including:
获取模块用于,当在目标内核加载第一应用时,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件;所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本;The obtaining module is used to, when the first application is loaded in the target kernel, obtain the executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system; the executable files of all the dynamic libraries to be loaded include: the first service The executable file of the dynamic library associated with the dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
预链接模块用于,对所有待加载的动态库的可执行文件分别预链接,获得所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入文件系统中;The pre-link module is used to pre-link the executable files of all the dynamic libraries to be loaded separately, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and link each dynamic library to be loaded. The pre-linked executable file of the dynamic library is stored in the file system;
加载模块用于,从文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到目标内核。The loading module is used to obtain the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
本申请实施例还提供了一种核部署的调整装置,包括:Embodiments of the present application also provide an apparatus for adjusting nuclear deployment, including:
接收模块用于,接收核部署调整请求;核部署调整请求指示了目标内核对应的所有待卸载的动态库和目标内核对应的所有待加载的动态库;The receiving module is used to receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
部署调整模块用于,根据核部署调整请求,将所有待卸载的动态库从目标内核上卸载,并从文件系统中获得所有待加载的动态库预链接后的可执行文件,将所有待加载的动态库预链接后的可执行文件加载到目标内核;The deployment adjustment module is used to unload all the dynamic libraries to be unloaded from the target kernel according to the core deployment adjustment request, obtain the pre-linked executable files of all the dynamic libraries to be loaded from the file system, and load all the dynamic libraries to be loaded. The executable file pre-linked by the dynamic library is loaded into the target kernel;
所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。The pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
从以上技术方案可以看出,本申请实施例至少具有以下优点:As can be seen from the above technical solutions, the embodiments of the present application at least have the following advantages:
本申请提供的动态库加载方法,当在目标内核加载第一应用时,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件;所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件。其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。对所有待加载的动态库的可执行文件分别预链接,获得所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入文件 系统中;从文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到目标内核。在一些场景中,目标内核的应用通常是频繁切换的,例如频繁从第二应用切换至第一应用,频繁从第一应用切换至第二应用。在本申请技术方案中,由于上述的每个待加载的动态库预链接后的可执行文件被存入于文件系统,因此在后续每次需要在目标内核上切换加载第一应用时,可以直接从文件系统获得这些待加载的动态库预链接后的可执行文件,而不需要每次执行预链接的操作。如此,提升了动态库的加载速度。此外,由于首次预链接是在目标内核加载第一应用时进行的,因此,可以基于平台的最新动态库版本关联的动态库的可执行文件进行预链接。如此,预链接后的可执行文件与平台的最新动态库版本兼容匹配,避免了动态库加载失败的问题。In the dynamic library loading method provided by the present application, when the first application is loaded in the target kernel, the executable files of all the dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system; the executable files of all the dynamic libraries to be loaded include: : the executable file of the dynamic library associated with the first service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version. The first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application. Pre-link the executable files of all the dynamic libraries to be loaded separately, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and pre-link each dynamic library to be loaded. The executable file is stored in the file system; the pre-linked executable file of each dynamic library to be loaded is obtained from the file system, and the pre-linked executable file of each dynamic library to be loaded is loaded into the target kernel. In some scenarios, the application of the target kernel is usually switched frequently, for example, frequently switching from the second application to the first application, and frequently switching from the first application to the second application. In the technical solution of the present application, since the pre-linked executable file of each dynamic library to be loaded is stored in the file system, when the first application needs to be switched and loaded on the target kernel in the future, it can be directly The pre-linked executable files of these dynamic libraries to be loaded are obtained from the file system, without performing the pre-linking operation every time. In this way, the loading speed of the dynamic library is improved. In addition, since the first pre-linking is performed when the target kernel loads the first application, pre-linking can be performed based on the executable file of the dynamic library associated with the latest dynamic library version of the platform. In this way, the pre-linked executable file is compatible with the latest dynamic library version of the platform, avoiding the problem of dynamic library loading failure.
附图说明Description of drawings
图1为本申请实施例提供的一种动态库加载方法流程示意图;1 is a schematic flowchart of a dynamic library loading method provided by an embodiment of the present application;
图2为本申请实施例提供的一种内存编排前和内存编排后动态库预链接后可执行文件的存储效果对比示意图;2 is a schematic diagram comparing the storage effects of executable files after dynamic library pre-linking before memory arrangement and after memory arrangement according to an embodiment of the present application;
图3为本申请实施例提供的一种文件系统的结构示意图;3 is a schematic structural diagram of a file system according to an embodiment of the present application;
图4为本申请实施例提供的一种核部署的调整方法流程示意图;FIG. 4 is a schematic flowchart of a method for adjusting core deployment provided by an embodiment of the present application;
图5为本申请实施例提供的一种核部署的调整方法应用场景示意图;FIG. 5 is a schematic diagram of an application scenario of a method for adjusting core deployment provided by an embodiment of the present application;
图6为本申请实施例提供的另一种文件系统的结构示意图;FIG. 6 is a schematic structural diagram of another file system provided by an embodiment of the present application;
图7A为本申请实施例提供的一种动态库加载方法的信令图;7A is a signaling diagram of a dynamic library loading method provided by an embodiment of the present application;
图7B为本申请实施例提供的一种核部署调整方法的信令图;7B is a signaling diagram of a method for adjusting core deployment provided by an embodiment of the present application;
图8为本申请实施例提供的一种动态库加载装置结构示意图;FIG. 8 is a schematic structural diagram of a dynamic library loading apparatus provided by an embodiment of the present application;
图9为本申请实施例提供的一种核部署的调整装置结构示意图。FIG. 9 is a schematic structural diagram of an apparatus for adjusting core deployment according to an embodiment of the present application.
具体实施方式Detailed ways
在介绍本申请实施例之前,为了更好地理解本申请实施例所提供的方案,下面先对本申请中出现的几个技术术语进行解释。Before introducing the embodiments of the present application, in order to better understand the solutions provided by the embodiments of the present application, several technical terms appearing in the present application are explained below.
动态库:可重定位的目标文件以一种特定的方式打包成一个单独的文件,并且在链接生成可执行文件时,从这个单独的文件中“拷贝”它自己需要的内容到最终的可执行文件中,且不需要在链接时将需要的内容的二进制代码全部都“拷贝”到可执行文件中,而是仅仅“拷贝”一些重定位和符号表信息,这些信息可以在程序运行时完成真正的链接过程。这个单独的文件,称为动态库。Dynamic library: relocatable object files are packaged into a single file in a specific way, and when linking to generate an executable file, "copy" what it needs from this single file to the final executable file, and it is not necessary to "copy" all the binary code of the required content into the executable file at link time, but only "copy" some relocation and symbol table information, which can be completed when the program is running. the linking process. This separate file is called a dynamic library.
全局偏移表(Global Offset Table,GOT)表:用于定位全局变量和函数的一个表。Global Offset Table (GOT) table: A table used to locate global variables and functions.
预链接(Pre-Link):是一种通过在启动之前解析库符号来优化应用程序加载时间的方法。Pre-Link (Pre-Link): is a method to optimize application load time by resolving library symbols before startup.
正如前文描述,目前的动态库加载方法预链接过程是在编译阶段进行的,如果支持业务应用运行的平台发生动态库版本更新,则此前预链接得到的动态库的可执行文件的版本与平台实际最新的动态库版本并不兼容,导致动态库加载失败的问题时有发生。目前还可 以采用一种利用GOT表加载动态库的技术方案。该方案中应用都需要通过GOT表进行跳转访问,增加了运行的消耗,从而影响了系统的性能。As described above, the pre-linking process of the current dynamic library loading method is carried out in the compilation stage. If the version of the dynamic library is updated on the platform that supports the operation of the business application, the version of the executable file of the dynamic library obtained by the previous pre-linking will be the same as the actual version of the platform. The latest dynamic library version is not compatible, and the problem that the dynamic library loading fails sometimes occurs. At present, a technical solution of using GOT table to load dynamic library can also be adopted. In this scheme, all applications need to perform jump access through the GOT table, which increases the running consumption and thus affects the performance of the system.
为解决上述的问题,本申请提供了一种动态库加载方法、核部署的调整方法及相关装置,能够在提升动态库加载速度的基础上保证动态库成功加载。并且相比于GOT表加载动态库的方案,不会额外增加运行消耗,因此对于系统的性能不会造成负面影响。为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请实施例作进一步详细的说明。参见图1,该图是本申请实施例提供的一种动态库加载方法流程示意图。如图1所示,本申请实施例所提供的动态库加载方法,包括如下步骤S101至S103:In order to solve the above problems, the present application provides a dynamic library loading method, an adjustment method for core deployment, and a related device, which can ensure the successful loading of the dynamic library on the basis of improving the loading speed of the dynamic library. And compared with the GOT table loading dynamic library scheme, there will be no additional running consumption, so it will not have a negative impact on the performance of the system. In order to make the above objects, features and advantages of the present application more clearly understood, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings and specific implementation manners. Referring to FIG. 1 , this figure is a schematic flowchart of a dynamic library loading method provided by an embodiment of the present application. As shown in FIG. 1 , the dynamic library loading method provided by the embodiment of the present application includes the following steps S101 to S103:
S101:当在目标内核加载第一应用时,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件;所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。S101: When the first application is loaded on the target kernel, obtain executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system; the executable files of all dynamic libraries to be loaded include: a first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
本申请技术方案实现场景中,具体是对多内核处理器的至少一个内核加载动态库。目标内核就是需要加载动态库的至少一个内核之一。向目标内核加载动态库的原因包括多种,下面通过示例对加载原因进行介绍。In the implementation scenario of the technical solution of the present application, the dynamic library is loaded to at least one core of the multi-core processor. The target kernel is one of at least one kernel that needs to load dynamic libraries. There are various reasons for loading the dynamic library into the target kernel, and the reasons for loading are described below with examples.
一种示例原因是:目标内核空闲,其他已加载第一应用的内核不足以支持第一应用当前的业务量。需要将目标内核从空闲状态转换为支持第一应用相关业务的工作状态。为此,需要向目标内核加载与第一应用相关的动态库。An example reason is that the target kernel is idle, and other kernels loaded with the first application are insufficient to support the current traffic of the first application. The target kernel needs to be converted from an idle state to a working state supporting services related to the first application. For this purpose, a dynamic library related to the first application needs to be loaded into the target kernel.
另一种示例原因是:目标内核在此前加载了其他应用的相关动态库,但是由于核部署的调整,需要将目标内核从其他应用切换为第一应用。为此,需要向目标内核加载与第一应用相关的动态库。Another example reason is that the target kernel has previously loaded relevant dynamic libraries of other applications, but due to the adjustment of the kernel deployment, the target kernel needs to be switched from other applications to the first application. For this purpose, a dynamic library related to the first application needs to be loaded into the target kernel.
文件系统是处理器之外的可存储所有与动态库相关的文件的系统,其独立于内存。具体地,文件系统可以存储平台相关的动态库和业务相关的动态库的文件系统。其中,与目标内核的应用切换关联最为密切的便是业务相关的动态库。平台具体是指支持该第一应用加载和运行的系统,例如,可以是指操作系统。平台相关的动态库可能发生版本更新,类似地,业务相关的动态库也可能发生版本更新,动态库的版本更新具体体现在文件系统中。The file system is a system outside the processor that stores all dynamic library-related files, independent of memory. Specifically, the file system may store the platform-related dynamic library and the file system of the service-related dynamic library. Among them, the business-related dynamic library is most closely related to the application switching of the target kernel. The platform specifically refers to a system that supports loading and running of the first application, for example, an operating system. Platform-related dynamic libraries may undergo version updates. Similarly, business-related dynamic libraries may also undergo version updates. The version updates of dynamic libraries are embodied in the file system.
在本申请技术方案中假设需要将目标内核切换为支持第一应用相关业务的工作状态。为实现此目的,在加载第一应用时,处理器从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件。其中,既包括第一业务动态库版本关联的动态库的可执行文件,也包括第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。In the technical solution of the present application, it is assumed that the target kernel needs to be switched to a working state that supports services related to the first application. To achieve this purpose, when loading the first application, the processor obtains executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system. Wherein, it includes both the executable file of the dynamic library associated with the first service dynamic library version, and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version supports the loading of the first application The latest dynamic library version for the platform.
第一业务动态库版本是指,为了加载第一应用,所有与业务相关的待加载的动态库的可执行文件汇集构成的动态库版本。第一平台动态库版本是指,为了加载第一应用,所有与平台相关的最新动态库的可执行文件汇集构成的动态库版本。The first service dynamic library version refers to a dynamic library version formed by a collection of executable files of all service-related dynamic libraries to be loaded in order to load the first application. The first platform dynamic library version refers to a dynamic library version formed by a collection of executable files of all the latest platform-related dynamic libraries in order to load the first application.
需要说明的是,如果要加载的应用发生了变化,例如从第一应用切换为加载第二应用,则目标内核对应的所有待加载的动态库的可执行文件可能发生变化。其中,业务相关的动 态库可能发生变化;平台相关的动态库可能发生变化,也可能不变。作为示例,其所有待加载的动态库的可执行文件包括:第二业务动态库版本关联的动态库的可执行文件和第二平台动态库版本关联的动态库的可执行文件。其中,第二业务动态库版本是指,为了加载第二应用,所有与业务相关的待加载的动态库的可执行文件汇集构成的动态库版本。第二平台动态库版本是指,为了加载第二应用,所有与平台相关的最新动态库的可执行文件汇集构成的动态库版本。It should be noted that if the application to be loaded changes, for example, switching from the first application to loading the second application, the executable files of all dynamic libraries to be loaded corresponding to the target kernel may change. Among them, business-related dynamic libraries may change; platform-related dynamic libraries may change or remain unchanged. As an example, all the executable files of the dynamic library to be loaded include: the executable file of the dynamic library associated with the second service dynamic library version and the executable file of the dynamic library associated with the second platform dynamic library version. The second service dynamic library version refers to a dynamic library version formed by a collection of executable files of all service-related dynamic libraries to be loaded in order to load the second application. The second platform dynamic library version refers to a dynamic library version formed by a collection of executable files of all the latest platform-related dynamic libraries in order to load the second application.
在一些实施例中,第一业务动态库版本关联的动态库与第二业务动态库版本关联的动态库可能存在部分相同,也可能完全不同。In some embodiments, the dynamic library associated with the first service dynamic library version and the dynamic library associated with the second service dynamic library version may be partially the same, or may be completely different.
S102:对所有待加载的动态库的可执行文件分别预链接,获得所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入文件系统中。S102: Pre-link the executable files of all the dynamic libraries to be loaded respectively, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and pre-link each dynamic library to be loaded. The linked executable is stored in the file system.
对动态库的可执行文件进行预链接属于本领域比较成熟的技术,故此处不对预链接的实现方式做出限定,也不对预链接的实现过程加以赘述。区别与已有的预链接技术的发生时段(在编译阶段),本申请实施例中,预链接技术的发生时段在第一应用加载过程中实现。第一应用加载过程中,即便平台关联的动态库版本发生实时调整更新,也可以及时响应,避免了预链接后与平台版本不兼容的问题。Pre-linking an executable file of a dynamic library is a relatively mature technology in the art, so the implementation manner of pre-linking is not limited here, and the implementation process of pre-linking is not described in detail. Different from the occurrence period (in the compilation stage) of the existing pre-link technology, in the embodiment of the present application, the occurrence period of the pre-link technology is implemented in the first application loading process. During the loading process of the first application, even if the dynamic library version associated with the platform is adjusted and updated in real time, it can respond in time, avoiding the problem of incompatibility with the platform version after pre-linking.
S103:从文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到目标内核。S103: Acquire the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
作为示例,步骤S101中,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件包括动态库p1、p2和p3的可执行文件以及动态库s1、s2、s3和s4的可执行文件,其中,动态库p1-p3为第一业务动态库版本关联的动态库,动态库s1-s4为第一平台动态库版本关联的动态库。步骤S101对动态库p1-p3以及s1-s4的可执行文件分别预链接,并将动态库p1-p3以及s1-s4各自预链接后的可执行文件导入文件系统。本步骤S103为了加载这些动态库,将动态库p1-p3以及s1-s4各自预链接后的可执行文件从文件系统中取出,加载到目标内核中。上述p1-p3以及s1-s4未在图中示出。As an example, in step S101, the executable files of all dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system, including the executable files of the dynamic libraries p1, p2 and p3 and the executable files of the dynamic libraries s1, s2, s3 and s4. The execution file, wherein the dynamic libraries p1-p3 are dynamic libraries associated with the first service dynamic library version, and the dynamic libraries s1-s4 are dynamic libraries associated with the first platform dynamic library version. Step S101 pre-links the executable files of the dynamic libraries p1-p3 and s1-s4 respectively, and imports the pre-linked executable files of the dynamic libraries p1-p3 and s1-s4 into the file system. In this step S103, in order to load these dynamic libraries, the pre-linked executable files of the dynamic libraries p1-p3 and s1-s4 are taken out from the file system and loaded into the target kernel. The above-mentioned p1-p3 and s1-s4 are not shown in the figure.
由上述可知,本申请实施例所提供的动态库加载方法,通过对待加载的动态库的可执行文件进行预链接,且将预链接后的可执行文件存入文件系统,以方便再次取用,提升了动态库的加载速度。此外,由于首次预链接是在目标内核加载第一应用时进行的,因此,可以基于当时平台的动态库版本关联的动态库的可执行文件进行预链接,从而使得预链接后的平台动态库的版本是最新的,如此,避免了预链接后的可执行文件与平台的最新动态库版本不匹配的问题,保证了兼容性能。As can be seen from the above, in the dynamic library loading method provided by the embodiments of the present application, the executable file of the dynamic library to be loaded is pre-linked, and the pre-linked executable file is stored in the file system, so as to facilitate the retrieval again, Improved the loading speed of dynamic libraries. In addition, since the first pre-linking is performed when the target kernel loads the first application, pre-linking can be performed based on the executable file of the dynamic library associated with the dynamic library version of the platform at that time, so that the pre-linked platform dynamic library can be pre-linked. The version is the latest. In this way, the problem that the pre-linked executable file does not match the latest dynamic library version of the platform is avoided, and the compatibility performance is guaranteed.
在本申请实施例中,在从文件系统中获得所有待加载的动态库的可执行文件之前,还可以接收动态库加载请求;动态库加载请求指示了所有待加载的动态库和目标内核。需要说明的是,在本申请实施例中,可以根据动态库加载请求本身可以直接获得所有待加载的动态库和目标内核的信息,也可以根据动态库加载请求中指示所有待加载的动态库和目标内核的ID信息获得所有待加载的动态库和目标内核,本申请实施例在此不做限定。作为一个示例:本申请实施例提供的方法可以根据动态库加载请求中的ID信息001和ID信息与 动态库的映射关系获得待加载的动态库为动态库A,根据ID信息002和ID信息与动态库的映射关系可以获得待加载的动态库为动态库B。In this embodiment of the present application, before obtaining the executable files of all dynamic libraries to be loaded from the file system, a dynamic library loading request may also be received; the dynamic library loading request indicates all the dynamic libraries to be loaded and the target kernel. It should be noted that, in this embodiment of the present application, the information of all dynamic libraries to be loaded and the target kernel can be directly obtained according to the dynamic library loading request itself, or all the dynamic libraries to be loaded and the target kernel can be indicated according to the dynamic library loading request. The ID information of the target kernel obtains all dynamic libraries to be loaded and the target kernel, which is not limited in this embodiment of the present application. As an example: the method provided by the embodiment of the present application can obtain the dynamic library to be loaded as dynamic library A according to the ID information 001 in the dynamic library loading request and the mapping relationship between the ID information and the dynamic library, according to the ID information 002 and the ID information and the dynamic library A From the mapping relationship of the dynamic library, the dynamic library to be loaded can be obtained as dynamic library B.
为加载动态库预链接后的可执行文件至内存,申请的存储粒度是固定值。例如:申请的存储粒度为4k时,每次申请的存储粒度4k的整数倍。加载动态库的顺序是一定的,在依次加载动态库预链接后的可执行文件的动作完成后,内存中可能存在较大的空洞,如此导致动态库预链接后的可执行文件在加载后整体占用的内存较多,或者内存空间浪费的问题。To load the pre-linked executable file of the dynamic library into memory, the requested storage granularity is a fixed value. For example: when the storage granularity of the application is 4k, the storage granularity of each application is an integer multiple of 4k. The order of loading the dynamic library is certain. After the action of loading the pre-linked executable files of the dynamic library in sequence is completed, there may be a large hole in the memory, so that the executable file after the dynamic library pre-linking is loaded as a whole. Occupy a lot of memory, or the problem of wasting memory space.
因为本申请实施例所提供的方法是对于所有待加载的可执行文件进行预链接,因此可以基于这些链接后的可执行文件,对这些文件在内存的存储地址进行统筹安排,以减小内存的空洞。本申请实施例所提供的方法,在对所有待加载的动态库的可执行文件分别预链接时,还可以根据内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排。此处依据每个待加载的动态库的可执行文件的段大小编排存储地址是因为预链接前后对应的段大小不发生明显变化。在本申请实施例中,动态库的可执行文件的段大小具体包括:代码段的大小和数据段的大小。代码段和数据段具有不同的属性。需要说明的是,可执行文件的本质为描述文件,可执行文件本身的大小并不代表其加载到内存中后所占内存的大小。可执行文件的格式可以是ELF(Executable and Linkable Format)格式。Because the method provided by the embodiment of the present application is to pre-link all executable files to be loaded, the storage addresses of these files in the memory can be arranged based on these linked executable files, so as to reduce the memory usage. Empty. In the method provided by this embodiment of the present application, when pre-linking the executable files of all dynamic libraries to be loaded respectively, according to the storage granularity of the memory and the segment size of the executable files of each dynamic library to be loaded, The storage address of the pre-linked executable file of each dynamic library to be loaded is arranged. Here, the storage addresses are arranged according to the segment size of the executable file of each dynamic library to be loaded because the corresponding segment size does not change significantly before and after pre-linking. In this embodiment of the present application, the segment size of the executable file of the dynamic library specifically includes: the size of the code segment and the size of the data segment. Code segments and data segments have different properties. It should be noted that the essence of an executable file is a description file, and the size of the executable file itself does not represent the size of the memory occupied by the executable file after it is loaded into the memory. The format of the executable file can be ELF (Executable and Linkable Format) format.
在对内存进行编排时,可以基于不同的属性分别进行内存编排。例如,依据待加载的动态库1的可执行文件中数据段的大小和待加载的动态库2的可执行文件中数据段的大小统一做内存编排;依据待加载的动态库1的可执行文件中代码段的大小和待加载的动态库2的可执行文件中代码段的大小统一做内存编排。When organizing memory, memory can be organized separately based on different attributes. For example, according to the size of the data segment in the executable file of the dynamic library 1 to be loaded and the size of the data segment in the executable file of the dynamic library 2 to be loaded, the memory arrangement is unified; according to the executable file of the dynamic library 1 to be loaded The size of the code segment and the size of the code segment in the executable file of the dynamic library 2 to be loaded are unified for memory arrangement.
为了展示本申请技术方案中对内存进行编排的技术效果,首先通过图2展示一种内存编排前的动态库预链接后可执行文件的存储效果(参见2a部分)以及依照本申请技术方案进行内存编排后动态库预链接后可执行文件的存储效果(参见2b部分)。在该示例中,动态库的加载顺序是规定好的,需要依次加载动态库0、动态库1、动态库2和动态库3。首先,先介绍图2中的2a部分,如图2的2a部分,2a部分所示的内存加载动态库2时,由于动态库0的剩余存储空间大于动态库2预链接后的可执行文件的段大小,于是动态库2将会存入动态库0的剩余存储空间中;加载动态库3时,由于动态库0~2的剩余空间小于动态库3预链接后的可执行文件的段大小,于是动态库3将会重新申请一个粒度内存以存入其中。由于2b部分展示的是本申请技术方案的技术效果,下面将会先介绍本申请实施提供的技术方案和技术方案应用的示例。In order to demonstrate the technical effect of memory arrangement in the technical solution of the present application, firstly, Fig. 2 shows the storage effect of a pre-linked executable file of a dynamic library before memory arrangement (see section 2a) and the memory arrangement according to the technical solution of the present application. The storage effect of the pre-linked executable after the orchestration dynamic library (see section 2b). In this example, the loading order of the dynamic library is predetermined, and it is necessary to load the dynamic library 0, the dynamic library 1, the dynamic library 2, and the dynamic library 3 in sequence. First, introduce part 2a in Figure 2. When dynamic library 2 is loaded into memory as shown in part 2a of Figure 2, the remaining storage space of dynamic library 0 is larger than the pre-linked executable file of dynamic library 2. segment size, then dynamic library 2 will be stored in the remaining storage space of dynamic library 0; when loading dynamic library 3, since the remaining space of dynamic libraries 0 to 2 is smaller than the segment size of the executable file pre-linked by dynamic library 3, Then the dynamic library 3 will re-apply for a granular memory to store in it. Since part 2b shows the technical effects of the technical solutions of the present application, the following will first introduce the technical solutions provided by the implementation of the present application and examples of application of the technical solutions.
在本申请实施例中,可以根据内存的存储粒度和每个待加载的动态库预链接后的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排。下面提供一则示例实现方式。可以理解的是,以下示例不构成对本申请所提供方法的限定。In this embodiment of the present application, the storage address of the pre-linked executable file of each dynamic library to be loaded may be stored according to the storage granularity of the memory and the segment size of the pre-linked executable file of each dynamic library to be loaded. Make arrangements. An example implementation is provided below. It should be understood that the following examples do not constitute a limitation on the methods provided in the present application.
作为一种可能的实施方式,根据内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排,可以具体包括:As a possible implementation manner, according to the storage granularity of the memory and the segment size of the executable file of each dynamic library to be loaded, the storage address of the executable file after pre-linking of each dynamic library to be loaded is arranged, Can specifically include:
根据内存的存储粒度和最新编排好存储地址的动态库的可执行文件的段大小,确定最新编排好存储地址的动态库的可执行文件的剩余存储空间;确定出加载顺序靠前的n个存储地址未编排的动态库,并确定n个存储地址未编排的动态库的可执行文件的段大小;n为正整数(例如n取3,此处对n不做限定,n也可以为所有剩余的未编排存储地址的动态库的总数);从n个存储地址未编排的动态库中确定出可存入剩余存储空间且可执行文件的段大小与剩余存储空间最接近的一个动态库,对该动态库预链接后的可执行文件的存储地址编排至剩余存储空间的地址范围内。如果n个存储地址未编排的动态库的可执行文件的段大小中最小的都无法存入剩余的存储空间,则可以重新申请存储粒度,或者扩大n的取值。如此,可以保证每一个粒度内存中的剩余空间都被最大可能地利用,从而可以使待加载的所有动态库预链接后的可执行文件所占的内存减小,内存加载动态库和卸载动态库的速度提高。According to the storage granularity of the memory and the segment size of the executable file of the dynamic library whose storage address is newly arranged, determine the remaining storage space of the executable file of the dynamic library whose storage address is newly arranged; The dynamic library whose address is not arranged, and determine the segment size of the executable file of n storage addresses of the dynamic library whose address is not arranged; n is a positive integer (for example, n is 3, n is not limited here, and n can also be all remaining The total number of dynamic libraries with unprogrammed storage addresses); determine a dynamic library that can be stored in the remaining storage space and the segment size of the executable file is the closest to the remaining storage space from the n dynamic libraries with unprogrammed storage addresses. The storage address of the executable file pre-linked by the dynamic library is programmed into the address range of the remaining storage space. If the smallest segment size of the executable files of the dynamic library whose storage addresses are not arranged cannot be stored in the remaining storage space, the storage granularity can be re-applied, or the value of n can be enlarged. In this way, it can be ensured that the remaining space in each granular memory can be used to the greatest extent possible, so that the memory occupied by the pre-linked executable files of all the dynamic libraries to be loaded can be reduced, and the dynamic libraries can be loaded and unloaded from the memory. speed increased.
参见图2,图2中的2b部分为一种编排后的动态库预链接后的可执行文件在内存中的存储效果示意图。2b部分所示的内存在加载前根据内存的存储粒度对每个待加载的动态库预链接后的可执行文件的存储地址进行编排后,再根据编排结果加载动态库预链接后的可执行文件。由于动态库3的可执行文件的段大小大于动态库2的可执行文件的段大小,动态库1的可执行文件的段大小则相对而言过大,且动态库0对应的剩余存储空间大于动态库3的可执行文件的段大小,因此为了更充分地利用动态库0对应的剩余空间,在编排的过程中将动态库3加载到动态库0对应的剩余空间中。动态库1和2将被加载到新申请的内存的粒度内存中。由上述可知,编排前动态库3被加载到新申请的粒度内存中,而编排后动态库3被加载到动态库0对应的剩余空间中。如图2所示,动态库3的段大小大于动态库2的段大小,因此,从整体上来说排后的动态库0、动态库1、动态库2和动态库3占用的内存更少。Referring to FIG. 2 , part 2b in FIG. 2 is a schematic diagram of the storage effect of the pre-linked executable file of the arranged dynamic library in the memory. The memory shown in part 2b arranges the storage address of each pre-linked executable file of the dynamic library to be loaded according to the storage granularity of the memory before loading, and then loads the pre-linked executable file of the dynamic library according to the arrangement result. . Since the segment size of the executable file of dynamic library 3 is larger than the segment size of the executable file of dynamic library 2, the segment size of the executable file of dynamic library 1 is relatively too large, and the remaining storage space corresponding to dynamic library 0 is larger than The segment size of the executable file of the dynamic library 3, so in order to more fully utilize the remaining space corresponding to the dynamic library 0, the dynamic library 3 is loaded into the remaining space corresponding to the dynamic library 0 during the programming process. Dynamic libraries 1 and 2 will be loaded into the granular memory of the newly allocated memory. It can be seen from the above that the dynamic library 3 is loaded into the newly applied granular memory before the arrangement, and the dynamic library 3 is loaded into the remaining space corresponding to the dynamic library 0 after the arrangement. As shown in FIG. 2 , the segment size of dynamic library 3 is larger than that of dynamic library 2. Therefore, on the whole, dynamic library 0, dynamic library 1, dynamic library 2, and dynamic library 3 occupy less memory.
在上述技术方案中,由于所有待加载的动态库的可执行文件是统一预链接的(例如同一时段同步预链接),而非一次又一次分时段预链接的,因此使上述对于内存的编排操作成为可能。In the above technical solution, since the executable files of all the dynamic libraries to be loaded are pre-linked uniformly (for example, pre-linked in the same period of time), rather than pre-linked in different periods of time again and again, the above-mentioned arrangement operation for memory is made. become possible.
为了尽可能地利用申请的内存,节省内存的消耗,提高加载动态库和卸载动态库的速度,作为一种可能的实施方式,在本申请实施例中,在将每个待加载的动态库预链接后的可执行文件加载到处理器的目标内核时,本申请实施例所提供的方法还可以包括:以预先编排的存储地址,将每个待加载的动态库预链接后的可执行文件存入内存中目标内核对应的存储空间中。In order to utilize the requested memory as much as possible, save memory consumption, and improve the speed of loading and unloading dynamic libraries, as a possible implementation manner, in this embodiment of the present application, each dynamic library to be loaded is pre- When the linked executable file is loaded into the target kernel of the processor, the method provided by the embodiment of the present application may further include: storing the pre-linked executable file of each dynamic library to be loaded into a pre-arranged storage address. into the storage space corresponding to the target kernel in memory.
由上述可知,本申请实施例所提供的方法,根据内存的存储粒度和可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排,缩小了可执行文件在内存中存储时的内存空洞,从而可以使预链接后的可执行文件所占的内存减小,内存性能提升,内存加载动态库和卸载动态库的速度提高。It can be seen from the above that the method provided by the embodiment of the present application arranges the storage address of the pre-linked executable file of each dynamic library to be loaded according to the storage granularity of the memory and the segment size of the executable file, which reduces the size of the executable file. The memory hole when the execution file is stored in the memory can reduce the memory occupied by the pre-linked executable file, improve the memory performance, and improve the speed of loading and unloading the dynamic library in the memory.
下面对本申请实施例中的文件系统进行详细介绍:The file system in the embodiment of the present application is described in detail below:
本申请实施例所提供的文件系统包括:至少一个动态库版本容器;The file system provided by the embodiment of the present application includes: at least one dynamic library version container;
具体地,至少一个动态库版本容器包括:动态库版本第一容器;动态库版本第一容器 中包括与第一应用加载相关的所有动态库的可执行文件;与第一应用加载相关的所有动态库的可执行文件包括:目标内核对应的所有待加载的动态库的可执行文件。从而,本申请实施例中,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件,具体包括:从动态库版本第一容器中获得目标内核对应的所有待加载的动态库的可执行文件。本申请实施例所提供的文件系统还包括:与每个动态库版本容器对应的动态库预链接版本容器,其中包括与动态库版本第一容器对应的动态库预链接版本第一容器。从而,本申请实施中,将每个待加载的动态库预链接后的可执行文件存入文件系统中,具体包括:将每个待加载的动态库预链接后的可执行文件存入动态库预链接版本第一容器。本申请实施例中,从文件系统获取每个待加载的动态库预链接后的可执行文件,具体包括:从动态库预链接版本第一容器获取每个待加载的动态库预链接后的可执行文件。Specifically, the at least one dynamic library version container includes: a first dynamic library version container; the first dynamic library version container includes executable files of all dynamic libraries related to loading the first application; all dynamic library versions related to loading the first application The executable files of the library include: executable files of all dynamic libraries to be loaded corresponding to the target kernel. Therefore, in the embodiment of the present application, obtaining executable files of all dynamic libraries to be loaded corresponding to the target kernel from the file system specifically includes: obtaining all the dynamic libraries to be loaded corresponding to the target kernel from the first container of the dynamic library version executable file. The file system provided by the embodiment of the present application further includes: a dynamic library pre-linked version container corresponding to each dynamic library version container, including a dynamic library pre-linked version first container corresponding to the dynamic library version first container. Therefore, in the implementation of the present application, storing the pre-linked executable file of each dynamic library to be loaded into the file system specifically includes: storing the pre-linked executable file of each dynamic library to be loaded into the dynamic library Pre-linked version of the first container. In the embodiment of the present application, acquiring the pre-linked executable file of each dynamic library to be loaded from the file system specifically includes: acquiring the pre-linked executable file of each dynamic library to be loaded from the first container of the pre-linked version of the dynamic library executable file.
作为一个示例,参见图3,该图为本申请实施例提供的一种文件系统的结构示意图。As an example, refer to FIG. 3 , which is a schematic structural diagram of a file system provided by an embodiment of the present application.
如图3所示,在数字信号处理器1000(Digital Signal Processor,DSP)中的加载模块100获得动态库加载请求后,加载模块100从动态库版本第一容器300中获得目标内核对应的所有待加载的动态库的可执行文件。然后,加载模块100将每个待加载的动态库预链接后的可执行文件存入动态库预链接版本第一容器400。DSP处理器1000中的加载模块100从动态库预链接版本第一容器400获取每个待加载的动态库预链接后的可执行文件。此外,相应地,本申请中将每个待加载的动态库预链接后的可执行文件加载到目标内核,还可以包括:DSP处理器1000中的加载模块100将每个待加载的动态库预链接后的可执行文件加载到目标内核。As shown in FIG. 3 , after the loading module 100 in the digital signal processor 1000 (Digital Signal Processor, DSP) obtains the dynamic library loading request, the loading module 100 obtains all the pending files corresponding to the target kernel from the first container 300 of the dynamic library version. Loaded dynamic library executable. Then, the loading module 100 stores the pre-linked executable file of each dynamic library to be loaded into the first container 400 of the pre-linked version of the dynamic library. The loading module 100 in the DSP processor 1000 obtains the pre-linked executable file of each dynamic library to be loaded from the first container 400 of the dynamic library pre-linked version. In addition, correspondingly, loading the pre-linked executable file of each dynamic library to be loaded into the target kernel in this application may further include: the loading module 100 in the DSP processor 1000 pre-loads each dynamic library to be loaded. The linked executable is loaded into the target kernel.
在实际的应用中,当将预链接后的可执行文件加载到目标内核后,很可能会需要再次加载之前已经加载过的可执行文件,此时,如果重新将每个待加载的动态库链接成可执行文件将会开销大量的计算资源。因此,在将每个待加载的动态库预链接后的可执行文件加载到处理器的目标内核时,本申请实施例所提供的方法还可以包括:当再次在目标内核加载第一应用时,从文件系统直接获取目标内核对应的所有待加载的动态库预链接后的可执行文件,将其中每个待加载的动态库预链接后的可执行文件加载到目标内核。由上述可知,本申请实施例所提供的方法,通过将每个待加载的动态库预链接后的可执行文件存入文件系统中,当需要再次加载曾经加载过的可执行文件时,可以从文件系统中直接加载,如此,省去了再次每个待加载的动态库链接成可执行文件的操作,节省了计算资源,同时,也提高了目标内核应用切换时加载动态库的速度。In practical applications, when the pre-linked executable file is loaded into the target kernel, it may be necessary to load the previously loaded executable file again. At this time, if each dynamic library to be loaded is re-linked Converting it into an executable file will cost a lot of computing resources. Therefore, when the pre-linked executable file of each dynamic library to be loaded is loaded into the target kernel of the processor, the method provided by this embodiment of the present application may further include: when the first application is loaded on the target kernel again, All pre-linked executable files of the dynamic library to be loaded corresponding to the target kernel are directly obtained from the file system, and each pre-linked executable file of the dynamic library to be loaded is loaded into the target kernel. It can be seen from the above that in the method provided by the embodiment of the present application, by storing the pre-linked executable file of each dynamic library to be loaded into the file system, when the executable file that has been loaded needs to be loaded again, it can be loaded from the file system. It is directly loaded in the file system, thus eliminating the need to link each dynamic library to be loaded into an executable file again, saving computing resources, and at the same time improving the speed of loading dynamic libraries when the target kernel application is switched.
根据上述提供的动态库的加载方法,本申请实施例还提供了一种核部署的调整方法。According to the above-mentioned method for loading a dynamic library, an embodiment of the present application further provides a method for adjusting core deployment.
参见图4,该图是本申请实施例提供的一种核部署的调整方法流程示意图。如图4所示,本申请实施例提供的核部署的调整方法包括以下步骤S401至S403:Referring to FIG. 4 , this figure is a schematic flowchart of a method for adjusting core deployment provided by an embodiment of the present application. As shown in FIG. 4 , the method for adjusting core deployment provided by this embodiment of the present application includes the following steps S401 to S403:
S401:接收核部署调整请求;核部署调整请求指示了目标内核对应的所有待卸载的动态库和目标内核对应的所有待加载的动态库。S401: Receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel.
S402:根据核部署调整请求,将所有待卸载的动态库从目标内核上卸载,并从文件系统中获得所有待加载的动态库预链接后的可执行文件,将所有待加载的动态库预链接后的可执行文件加载到目标内核。S402: Unload all dynamic libraries to be unloaded from the target kernel according to the core deployment adjustment request, obtain pre-linked executable files of all dynamic libraries to be loaded from the file system, and pre-link all dynamic libraries to be loaded After the executable is loaded into the target kernel.
在本申请实施例中,所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。In the embodiment of the present application, the pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include : the executable file of the dynamic library associated with the first service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest update of the platform that supports the loading of the first application library version.
接下来将以一个具体的示例来介绍本申请实施例所提供的核部署的调整方法,参见图5,该图为本申请实施例提供的一种核部署的调整方法应用场景示意图。Next, a specific example will be used to introduce the method for adjusting core deployment provided by the embodiment of the present application. Referring to FIG. 5 , this figure is a schematic diagram of an application scenario of the method for adjusting core deployment provided by the embodiment of the present application.
如图5所示,本申请提供的核部署调整方法可以将图中的处理器5核中核3进行重新部署,以核3为示例进行说明:具体地,本申请提供的方法将的APP(Application,应用程序)0从核3上卸载,并从文件系统中获得APP1相关的所有待加载的预链接后的可执行文件,将所有APP1相关的待加载的预链接后的可执行文件加载到核3,如此,可以将原本部署在APP0的核3部署至APP1。相应地,本申请提供的方法也可以将APP1相关的所有待加载的预链接后的可执行文件从核3上卸载,并从文件系统中获得APP0相关的所有待加载的预链接后的可执行文件,将APP0相关的所有待加载的预链接后的可执行文件加载到核3,如此,可以将原本部署在APP1的核3部署给APP0。可以理解的是,本申请实施例提供的方法所部署的核不仅限于上述示例的核3,而是包括任意一个或多个可部署的核。同时,本申请中的平台和应用不对核部署调整的动态库进行限制。作为一个示例,本申请所提供的核部署的方法也可以应用于,信号基站中对部署在4G业务的核与部署在5G业务之间的重新调整部署。As shown in FIG. 5 , the core deployment adjustment method provided by the present application can redeploy the core 3 in the processor 5 cores in the figure, and the core 3 is used as an example to illustrate: Specifically, the method provided by the present application will , application) 0 is unloaded from the core 3, and obtains all pre-linked executable files related to APP1 to be loaded from the file system, and loads all the pre-linked executable files related to APP1 to be loaded into the core 3. In this way, the core 3 originally deployed in APP0 can be deployed to APP1. Correspondingly, the method provided by the present application can also unload all pre-linked executable files related to APP1 to be loaded from core 3, and obtain all pre-linked executable files related to APP0 to be loaded from the file system. file, load all pre-linked executable files related to APP0 to be loaded into core 3, so that core 3 originally deployed in APP1 can be deployed to APP0. It can be understood that the cores deployed by the methods provided in the embodiments of the present application are not limited to the core 3 in the above example, but include any one or more deployable cores. Meanwhile, the platform and application in this application do not limit the dynamic library for core deployment adjustment. As an example, the method for core deployment provided by the present application can also be applied to the readjustment and deployment of the core deployed in the 4G service and the core deployed in the 5G service in the signal base station.
参见图6,该图是本申请实施例提供的另一种文件系统的结构示意图。如图6所示,DSP1000中的部署调整模块200接收核部署调整请求后,部署调整模块200根据核部署调整请求,将所有待卸载的动态库从目标内核上卸载,并从动态库预链接版本第一容器400中获得所有待加载的动态库预链接后的可执行文件,将所有待加载的动态库预链接后的可执行文件加载到目标内核。Referring to FIG. 6 , this figure is a schematic structural diagram of another file system provided by an embodiment of the present application. As shown in FIG. 6 , after the deployment adjustment module 200 in the DSP 1000 receives the core deployment adjustment request, the deployment adjustment module 200 unloads all the dynamic libraries to be uninstalled from the target kernel according to the core deployment adjustment request, and pre-links the version from the dynamic library The first container 400 obtains all pre-linked executable files of the dynamic library to be loaded, and loads all the pre-linked executable files of the dynamic library to be loaded into the target kernel.
为了更加直观地展示本申请实施例所提供的动态库加载方法和核部署调整方法,接下来将上述方法以信令图的形式展示。In order to more intuitively show the dynamic library loading method and the core deployment adjustment method provided by the embodiments of the present application, the above methods are shown in the form of a signaling diagram next.
参见图7A,该图为本申请实施例提供的一种动态库加载方法的信令图。Referring to FIG. 7A , this figure is a signaling diagram of a dynamic library loading method provided by an embodiment of the present application.
如图7A所示,在外部触发了加载模块的加载后,加载模块通过动态库版本第一容器获取所有动态库的版本;加载模块将所有动态库一起进行预链接,将动态库预链接后的版本发送至动态库预链接版本第一容器进行保存。然后,加载模块从动态库预链接版本第一容器从获取存入的动态库预链接后的版本(包含所有待加载的动态库预链接后的可执行文件),并将动态库预链接后的版本的可执行文件加载到目标内核上。As shown in FIG. 7A , after the loading of the loading module is triggered externally, the loading module obtains the versions of all dynamic libraries through the first container of the dynamic library version; the loading module pre-links all the dynamic libraries together, and pre-links the The version is sent to the first container of the dynamic library pre-linked version for storage. Then, the loading module obtains the pre-linked version of the dynamic library stored in the first container from the pre-linked version of the dynamic library (including all pre-linked executable files of the dynamic library to be loaded), and loads the pre-linked version of the dynamic library. version of the executable is loaded onto the target kernel.
参见图7B,该图为本申请实施例提供的一种核部署调整方法的信令图。Referring to FIG. 7B , this figure is a signaling diagram of a method for adjusting core deployment provided by an embodiment of the present application.
如图7B所示,在外部触发了部署调整模块的调整后,部署调整模块将卸载对应的目标内核上的动态库,并从动态库预链接版本第一容器中获取动态库预链接后的版本,并将动态库预链接后的版本的可执行文件加载至目标内核上。As shown in FIG. 7B , after the adjustment of the deployment adjustment module is triggered externally, the deployment adjustment module will unload the dynamic library on the corresponding target kernel, and obtain the pre-linked version of the dynamic library from the first container of the pre-linked version of the dynamic library , and load the executable file of the pre-linked version of the dynamic library into the target kernel.
例如,卸载的动态库是与第一应用以外的其他应用相关联的动态库,此处当需要将内核从其他应用切换调整为第一应用时,可以将其他应用关联的动态库卸载,再加载与第一 应用相关的所有动态库预连接后的可执行文件。For example, the unloaded dynamic library is a dynamic library associated with other applications other than the first application. Here, when the kernel needs to be switched from another application to the first application, the dynamic library associated with the other application can be unloaded, and then loaded again. The executable file after all dynamic libraries related to the first application are pre-linked.
需要说明的是,本申请实施例中的APP可以是终端上的应用程序,还可以是不同制式下的应用。例如,可以是APP0可以是4G LTE制式的应用,APP1可以是5G NR制式的应用。此处对应用的形式不做限定。It should be noted that, the APP in the embodiment of the present application may be an application program on a terminal, and may also be an application under different standards. For example, APP0 can be an application of 4G LTE standard, and APP1 can be an application of 5G NR standard. The form of application is not limited here.
由上述可知,本申请实施例所提供的方法,通过对待加载的动态库的可执行文件进行预链接,且将预链接后的可执行文件存入文件系统,以方便再次取用,提升了动态库的加载速度的同时避免了预链接后的可执行文件与平台的最新动态库版本不匹配的问题。进一步地,本申请实施例提供的方法还根据内存的存储粒度和可执行文件的段大小,对可执行文件的存储地址进行编排,从而可以使预链接后的可执行文件所占的内存减小,内存性能提升,内存加载动态库和卸载动态库的速度提高。It can be seen from the above that the method provided by the embodiments of the present application pre-links the executable file of the dynamic library to be loaded, and stores the pre-linked executable file in the file system, so as to facilitate the retrieval again and improve the dynamic performance. The loading speed of the library also avoids the problem that the pre-linked executable file does not match the latest dynamic library version of the platform. Further, the method provided by the embodiment of the present application also arranges the storage address of the executable file according to the storage granularity of the memory and the segment size of the executable file, so that the memory occupied by the pre-linked executable file can be reduced. , memory performance improvement, memory loading dynamic library and unloading dynamic library speed increase.
根据上述方法实施例提供的动态库加载方法,本申请实施例还提供的一种动态库加载装置。参见图8,该图为本申请实施例提供的一种动态库加载装置结构示意图。如图8所示,本申请实施例提供的动态库加载装置包括:According to the dynamic library loading method provided by the above method embodiments, an embodiment of the present application further provides a dynamic library loading apparatus. Referring to FIG. 8 , this figure is a schematic structural diagram of a dynamic library loading apparatus provided by an embodiment of the present application. As shown in FIG. 8 , the dynamic library loading device provided by the embodiment of the present application includes:
获取模块801用于,当在目标内核加载第一应用时,从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件;所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本;The obtaining module 801 is used to, when the first application is loaded in the target kernel, obtain from the file system the executable files of all the dynamic libraries to be loaded corresponding to the target kernel; the executable files of all the dynamic libraries to be loaded include: the first The executable file of the dynamic library associated with the service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application;
预链接模块802用于,对所有待加载的动态库的可执行文件分别预链接,获得所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入文件系统中;The pre-linking module 802 is used to pre-link the executable files of all the dynamic libraries to be loaded respectively, obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and link each dynamic library to be loaded. The pre-linked executable file of the loaded dynamic library is stored in the file system;
加载模块803用于,从文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到目标内核。The loading module 803 is used to obtain the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
作为一种可能的实施方式,在从文件系统中获得所有待加载的动态库的可执行文件之前,本申请实施例提供的动态库加载装置还包括:接收模块用于,接收动态库加载请求;动态库加载请求指示了所有待加载的动态库和目标内核。As a possible implementation manner, before obtaining the executable files of all the dynamic libraries to be loaded from the file system, the dynamic library loading apparatus provided in this embodiment of the present application further includes: a receiving module configured to receive a dynamic library loading request; The dynamic library load request indicates all dynamic libraries and target kernels to be loaded.
作为一种可能的实施方式,加载模块803还用于:以预先编排的存储地址,将每个待加载的动态库预链接后的可执行文件存入内存中目标内核对应的存储空间中。As a possible implementation manner, the loading module 803 is further configured to: store the pre-linked executable file of each dynamic library to be loaded into the storage space corresponding to the target kernel in the memory with a pre-programmed storage address.
作为一种可能的实施方式,在对所有待加载的动态库的可执行文件分别预链接时,本申请实施例提供的动态库加载装置还包括:编排模块用于,根据内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排。As a possible implementation manner, when all executable files of the dynamic library to be loaded are pre-linked, the dynamic library loading apparatus provided in this embodiment of the present application further includes: an orchestration module for, according to the storage granularity of the memory and each The segment size of the executable file of each dynamic library to be loaded is arranged, and the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
作为一种可能的实施方式,编排模块具体用于:根据内存的存储粒度和最新编排好存储地址的动态库的可执行文件的段大小,确定最新编排好存储地址的动态库的可执行文件的剩余存储空间;确定出加载顺序靠前的n个存储地址未编排的动态库,并确定n个存储地址未编排的动态库的可执行文件的段大小;n为正整数;从n个存储地址未编排的动态库中确定出可存入剩余存储空间且可执行文件的段大小与剩余存储空间最接近的一个动态 库,对该动态库预链接后的可执行文件的存储地址编排至剩余存储空间的地址范围内。As a possible implementation manner, the orchestration module is specifically configured to: determine, according to the storage granularity of the memory and the segment size of the executable file of the dynamic library whose storage address is newly arranged Remaining storage space; determine the dynamic libraries with the unarranged n storage addresses at the top of the loading order, and determine the segment size of the executable file of the dynamic libraries with n storage addresses unarranged; n is a positive integer; from n storage addresses A dynamic library that can be stored in the remaining storage space and the segment size of the executable file is closest to the remaining storage space is determined from the unprogrammed dynamic library, and the storage address of the executable file pre-linked to the dynamic library is arranged to the remaining storage space. within the address range of the space.
作为一种可能的实施方式,本申请实施例提供的动态库加载装置,还包括:直接获取模块用于,当再次在目标内核加载第一应用时,从文件系统直接获取目标内核对应的所有待加载的动态库预链接后的可执行文件,将其中每个待加载的动态库预链接后的可执行文件加载到目标内核。As a possible implementation manner, the dynamic library loading apparatus provided in the embodiment of the present application further includes: a direct acquisition module for directly acquiring all pending files corresponding to the target kernel from the file system when the first application is loaded on the target kernel again. Loading the pre-linked executable file of the loaded dynamic library, and loading the pre-linked executable file of each dynamic library to be loaded into the target kernel.
根据上述方法实施例提供的核部署调整方法,本申请实施例还提供的一种核部署的调整装置。参见图9,该图为本申请实施例提供的一种核部署的调整装置结构示意图。如图9所示,本申请实施例提供的核部署的调整装置包括:According to the method for adjusting nuclear deployment provided by the above method embodiments, an embodiment of the present application further provides an apparatus for adjusting nuclear deployment. Referring to FIG. 9 , this figure is a schematic structural diagram of an apparatus for adjusting core deployment provided by an embodiment of the present application. As shown in FIG. 9 , the apparatus for adjusting core deployment provided by the embodiment of the present application includes:
接收模块901用于,接收核部署调整请求;核部署调整请求指示了目标内核对应的所有待卸载的动态库和目标内核对应的所有待加载的动态库;The receiving module 901 is configured to receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
部署调整模块902用于,根据核部署调整请求,将所有待卸载的动态库从目标内核上卸载,并从文件系统中获得所有待加载的动态库预链接后的可执行文件,将所有待加载的动态库预链接后的可执行文件加载到目标内核;The deployment adjustment module 902 is configured to, according to the core deployment adjustment request, unload all the dynamic libraries to be unloaded from the target kernel, obtain the pre-linked executable files of all the dynamic libraries to be loaded from the file system, and load all the dynamic libraries to be loaded. The pre-linked executable file of the dynamic library is loaded into the target kernel;
所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,第一平台动态库版本为支持第一应用加载的平台的最新动态库版本。The pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first service dynamic library version The executable file of the associated dynamic library and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library version of the platform that supports the loading of the first application.
以上方案中提供的动态库加载方法、核部署的调整方法及相关装置具体可以应用在多内核的处理器上。The method for loading a dynamic library, the method for adjusting core deployment, and the related apparatus provided in the above solution can be specifically applied to a multi-core processor.
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The recorded technical solutions are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims (12)

  1. 一种动态库加载方法,其特征在于,包括:A method for loading a dynamic library, comprising:
    当在目标内核加载第一应用时,从文件系统中获得所述目标内核对应的所有待加载的动态库的可执行文件;所述所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,所述第一平台动态库版本为支持所述第一应用加载的平台的最新动态库版本;When the first application is loaded in the target kernel, the executable files of all the dynamic libraries to be loaded corresponding to the target kernel are obtained from the file system; the executable files of all the dynamic libraries to be loaded include: the first service dynamic The executable file of the dynamic library associated with the library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest dynamic library supporting the platform loaded by the first application Version;
    对所述所有待加载的动态库的可执行文件分别预链接,获得所述所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入所述文件系统中;Prelink the executable files of all the dynamic libraries to be loaded respectively, obtain the prelinked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and link each dynamic library to be loaded. The executable file after library pre-linking is stored in the file system;
    从所述文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到所述目标内核。Acquire a pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  2. 根据权利要求1所述的动态库加载方法,其特征在于,在所述从文件系统中获得所有待加载的动态库的可执行文件之前,还包括:The method for loading a dynamic library according to claim 1, characterized in that before obtaining the executable files of all dynamic libraries to be loaded from the file system, the method further comprises:
    接收动态库加载请求;所述动态库加载请求指示了所有待加载的动态库和所述目标内核。A dynamic library loading request is received; the dynamic library loading request indicates all dynamic libraries to be loaded and the target kernel.
  3. 根据权利要求1所述的动态库加载方法,其特征在于,在所述将每个待加载的动态库预链接后的可执行文件加载到处理器的目标内核时,所述方法还包括:The dynamic library loading method according to claim 1, wherein when the pre-linked executable file of each dynamic library to be loaded is loaded into the target kernel of the processor, the method further comprises:
    以预先编排的存储地址,将每个待加载的动态库预链接后的可执行文件存入内存中所述目标内核对应的存储空间中。The pre-linked executable file of each dynamic library to be loaded is stored in the memory space corresponding to the target kernel in the memory with the pre-arranged storage address.
  4. 根据权利要求3所述的动态库加载方法,其特征在于,在所述对所述所有待加载的动态库的可执行文件分别预链接时,所述方法还包括:The dynamic library loading method according to claim 3, wherein when the executable files of all the dynamic libraries to be loaded are pre-linked respectively, the method further comprises:
    根据所述内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排。According to the storage granularity of the memory and the segment size of the executable file of each dynamic library to be loaded, the storage address of the pre-linked executable file of each dynamic library to be loaded is arranged.
  5. 根据权利要求4所述的动态库加载方法,其特征在于,所述根据所述内存的存储粒度和每个待加载的动态库的可执行文件的段大小,对每个待加载的动态库预链接后的可执行文件的存储地址进行编排,具体包括:The method for loading a dynamic library according to claim 4, wherein, according to the storage granularity of the memory and the segment size of the executable file of each dynamic library to be loaded, each dynamic library to be loaded is pre-loaded. The storage address of the linked executable file is arranged, including:
    根据所述内存的存储粒度和最新编排好存储地址的动态库的可执行文件的段大小,确定所述最新编排好存储地址的动态库的可执行文件的剩余存储空间;According to the storage granularity of the memory and the segment size of the executable file of the dynamic library whose storage addresses are newly arranged, determine the remaining storage space of the executable file of the dynamic library whose storage addresses are newly arranged;
    确定出加载顺序靠前的n个存储地址未编排的动态库,并确定所述n个存储地址未编排的动态库的可执行文件的段大小;所述n为正整数;Determine the dynamic libraries whose loading order is not arranged in the top n storage addresses, and determine the segment size of the executable files of the dynamic libraries whose storage addresses are not arranged; the n is a positive integer;
    从所述n个存储地址未编排的动态库中确定出可存入所述剩余存储空间且可执行文件的段大小与所述剩余存储空间最接近的一个动态库,对该动态库预链接后的可执行文件的存储地址编排至所述剩余存储空间的地址范围内。A dynamic library that can be stored in the remaining storage space and the segment size of the executable file is closest to the remaining storage space is determined from the n dynamic libraries whose storage addresses are not arranged, and the dynamic library is pre-linked after the The storage address of the executable file is programmed into the address range of the remaining storage space.
  6. 根据权利要求3或4所述的动态库加载方法,其特征在于,所述动态库的可执行文件的段大小包括:所述动态库的可执行文件中代码段的大小和数据段的大小。The method for loading a dynamic library according to claim 3 or 4, wherein the segment size of the executable file of the dynamic library includes: the size of the code segment and the size of the data segment in the executable file of the dynamic library.
  7. 根据权利要求1-5任一项所述的动态库加载方法,其特征在于,所述文件系统包括:至少一个动态库版本容器;The dynamic library loading method according to any one of claims 1-5, wherein the file system comprises: at least one dynamic library version container;
    所述至少一个动态库版本容器包括:动态库版本第一容器;所述动态库版本第一容器中包括与所述第一应用加载相关的所有动态库的可执行文件;所述与所述第一应用加载相关的所有动态库的可执行文件包括:目标内核对应的所有待加载的动态库的可执行文件;The at least one dynamic library version container includes: a first container for a dynamic library version; the first container for a dynamic library version includes executable files of all dynamic libraries related to loading of the first application; An executable file of all dynamic libraries related to application loading includes: executable files of all dynamic libraries to be loaded corresponding to the target kernel;
    所述从文件系统中获得目标内核对应的所有待加载的动态库的可执行文件,具体包括:The executable files of all to-be-loaded dynamic libraries corresponding to the target kernel obtained from the file system specifically include:
    从所述动态库版本第一容器中获得所述目标内核对应的所有待加载的动态库的可执行文件。The executable files of all dynamic libraries to be loaded corresponding to the target kernel are obtained from the first container of the dynamic library version.
  8. 根据权利要求7所述的动态库加载方法,其特征在于,所述文件系统还包括:与每个动态库版本容器对应的动态库预链接版本容器,其中包括与所述动态库版本第一容器对应的动态库预链接版本第一容器;The dynamic library loading method according to claim 7, wherein the file system further comprises: a dynamic library pre-linked version container corresponding to each dynamic library version container, including a first container corresponding to the dynamic library version The first container of the corresponding dynamic library pre-linked version;
    所述将每个待加载的动态库预链接后的可执行文件存入所述文件系统中,具体包括:The storing of the pre-linked executable file of each dynamic library to be loaded into the file system specifically includes:
    将每个待加载的动态库预链接后的可执行文件存入所述动态库预链接版本第一容器;storing the pre-linked executable file of each dynamic library to be loaded into the first container of the pre-linked version of the dynamic library;
    所述从所述文件系统获取每个待加载的动态库预链接后的可执行文件,具体包括:The obtaining of the pre-linked executable file of each dynamic library to be loaded from the file system specifically includes:
    从所述动态库预链接版本第一容器获取每个待加载的动态库预链接后的可执行文件。The pre-linked executable file of each dynamic library to be loaded is obtained from the first container of the dynamic library pre-linked version.
  9. 根据权利要求1-5任一项所述的动态库加载方法,其特征在于,还包括:当再次在所述目标内核加载所述第一应用时,从所述文件系统直接获取所述目标内核对应的所有待加载的动态库预链接后的可执行文件,将其中每个待加载的动态库预链接后的可执行文件加载到所述目标内核。The dynamic library loading method according to any one of claims 1-5, further comprising: when the first application is loaded on the target kernel again, directly acquiring the target kernel from the file system Corresponding to the pre-linked executable files of all the dynamic libraries to be loaded, the pre-linked executable files of each of the dynamic libraries to be loaded are loaded into the target kernel.
  10. 一种核部署的调整方法,其特征在于,包括:A method for adjusting nuclear deployment, comprising:
    接收核部署调整请求;所述核部署调整请求指示了目标内核对应的所有待卸载的动态库和所述目标内核对应的所有待加载的动态库;receiving a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
    根据所述核部署调整请求,将所述所有待卸载的动态库从所述目标内核上卸载,并从文件系统中获得所述所有待加载的动态库预链接后的可执行文件,将所述所有待加载的动态库预链接后的可执行文件加载到所述目标内核;According to the core deployment adjustment request, all the dynamic libraries to be unloaded are unloaded from the target kernel, and the pre-linked executable files of all the dynamic libraries to be loaded are obtained from the file system, and the All pre-linked executable files of the dynamic library to be loaded are loaded into the target kernel;
    所述所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所述所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,所述第一平台动态库版本为支持所述第一应用加载的平台的最新动态库版本。The pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first The executable file of the dynamic library associated with the service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest version of the platform that supports the loading of the first application Dynamic library version.
  11. 一种动态库加载装置,其特征在于,包括:A dynamic library loading device, comprising:
    获取模块用于,当在目标内核加载第一应用时,从文件系统中获得所述目标内核对应的所有待加载的动态库的可执行文件;所述所有待加载的动态库的可执行文件包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,所述第一平台动态库版本为支持所述第一应用加载的平台的最新动态库版本;The obtaining module is used to, when the first application is loaded in the target kernel, obtain the executable files of all the dynamic libraries to be loaded corresponding to the target kernel from the file system; the executable files of all the dynamic libraries to be loaded include: : the executable file of the dynamic library associated with the first service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the one that supports the loading of the first application The latest dynamic library version of the platform;
    预链接模块用于,对所述所有待加载的动态库的可执行文件分别预链接,获得所述所有待加载的动态库中每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件存入所述文件系统中;The pre-linking module is used to pre-link the executable files of all the dynamic libraries to be loaded, respectively, to obtain the pre-linked executable files of each dynamic library to be loaded in all the dynamic libraries to be loaded, and to The pre-linked executable file of each dynamic library to be loaded is stored in the file system;
    加载模块用于,从所述文件系统获取每个待加载的动态库预链接后的可执行文件,并将每个待加载的动态库预链接后的可执行文件加载到所述目标内核。The loading module is used to obtain the pre-linked executable file of each dynamic library to be loaded from the file system, and load the pre-linked executable file of each dynamic library to be loaded into the target kernel.
  12. 一种核部署的调整装置,其特征在于,包括:An adjustment device for nuclear deployment, comprising:
    接收模块用于,接收核部署调整请求;所述核部署调整请求指示了目标内核对应的所有待卸载的动态库和所述目标内核对应的所有待加载的动态库;The receiving module is configured to receive a core deployment adjustment request; the core deployment adjustment request indicates all dynamic libraries to be unloaded corresponding to the target kernel and all dynamic libraries to be loaded corresponding to the target kernel;
    部署调整模块用于,根据所述核部署调整请求,将所述所有待卸载的动态库从所述目标内核上卸载,并从文件系统中获得所述所有待加载的动态库预链接后的可执行文件,将所述所有待加载的动态库预链接后的可执行文件加载到所述目标内核;The deployment adjustment module is configured to, according to the core deployment adjustment request, unload all the dynamic libraries to be unloaded from the target kernel, and obtain the pre-linked executables of all the dynamic libraries to be loaded from the file system. an executable file, which loads the pre-linked executable files of all the dynamic libraries to be loaded into the target kernel;
    所述所有待加载的动态库预链接后的可执行文件为依据所有待加载的动态库的可执行文件预链接后获得的;所述所有待加载的动态库的可执行文件,包括:第一业务动态库版本关联的动态库的可执行文件和第一平台动态库版本关联的动态库的可执行文件,其中,所述第一平台动态库版本为支持所述第一应用加载的平台的最新动态库版本。The pre-linked executable files of all the dynamic libraries to be loaded are obtained after pre-linking the executable files of all the dynamic libraries to be loaded; the executable files of all the dynamic libraries to be loaded include: the first The executable file of the dynamic library associated with the service dynamic library version and the executable file of the dynamic library associated with the first platform dynamic library version, wherein the first platform dynamic library version is the latest version of the platform that supports the loading of the first application Dynamic library version.
PCT/CN2021/115233 2020-11-13 2021-08-30 Dynamic library loading method, kernel deployment adjustment method, and related apparatuses WO2022100208A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011268494.3A CN114489827B (en) 2020-11-13 2020-11-13 Dynamic library loading method, core deployment adjusting method and related devices
CN202011268494.3 2020-11-13

Publications (1)

Publication Number Publication Date
WO2022100208A1 true WO2022100208A1 (en) 2022-05-19

Family

ID=81489915

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/115233 WO2022100208A1 (en) 2020-11-13 2021-08-30 Dynamic library loading method, kernel deployment adjustment method, and related apparatuses

Country Status (2)

Country Link
CN (1) CN114489827B (en)
WO (1) WO2022100208A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234963A (en) * 2023-11-14 2023-12-15 海马云(天津)信息技术有限公司 Dynamic library processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363436B1 (en) * 1997-01-27 2002-03-26 International Business Machines Corporation Method and system for loading libraries into embedded systems
US20050144608A1 (en) * 2003-12-26 2005-06-30 Hiroshi Oyama Operating system allowing running of real-time application programs, control method therefor, and method of loading dynamic link libraries
CN110471690A (en) * 2019-06-25 2019-11-19 珠海格力电器股份有限公司 Loading method, device and the storage medium of dynamic link library SO file
CN111813423A (en) * 2020-08-31 2020-10-23 腾讯科技(深圳)有限公司 Application installation package processing method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147743A (en) * 2011-03-28 2011-08-10 博视联(苏州)信息科技有限公司 Method for accelerating startup of embedded system application program
US9170940B2 (en) * 2011-12-07 2015-10-27 Intel Corporation Techniques to prelink software to improve memory de-duplication in a virtual system
US10025602B2 (en) * 2014-06-03 2018-07-17 Mentor Graphics Corporation Prelinked embedding
CN110765493B (en) * 2018-12-28 2021-05-25 北京安天网络安全技术有限公司 File baseline defense method and device based on Linux pre-link and storage equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363436B1 (en) * 1997-01-27 2002-03-26 International Business Machines Corporation Method and system for loading libraries into embedded systems
US20050144608A1 (en) * 2003-12-26 2005-06-30 Hiroshi Oyama Operating system allowing running of real-time application programs, control method therefor, and method of loading dynamic link libraries
CN110471690A (en) * 2019-06-25 2019-11-19 珠海格力电器股份有限公司 Loading method, device and the storage medium of dynamic link library SO file
CN111813423A (en) * 2020-08-31 2020-10-23 腾讯科技(深圳)有限公司 Application installation package processing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234963A (en) * 2023-11-14 2023-12-15 海马云(天津)信息技术有限公司 Dynamic library processing method and device
CN117234963B (en) * 2023-11-14 2024-01-23 海马云(天津)信息技术有限公司 Dynamic library processing method and device

Also Published As

Publication number Publication date
CN114489827A (en) 2022-05-13
CN114489827B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
US20170308369A1 (en) Data processing method and device of preset application after upgrading
US7657886B1 (en) Mobile device with a MMU for faster firmware updates in a wireless network
CN107832100B (en) APK plug-in loading method and terminal thereof
US5511192A (en) Method and apparatus for managing thread private data in a parallel processing computer
US20090144756A1 (en) Conflict resolution apparatus
US9710288B2 (en) Method and device for loading application program
CN104182255A (en) Method and terminal for upgrading library files of system application
US8739147B2 (en) Class isolation to minimize memory usage in a device
US20040098427A1 (en) Device memory management during electronic file updating
CN111045714B (en) Firmware updating method and device, earphone and computer readable storage medium
US9405697B2 (en) Memory management method and apparatus
KR100871778B1 (en) Dynamic addressing da using a centralized da manager
CN109614167B (en) Method and system for managing plug-ins
US10224972B2 (en) Systems, methods, and computer-readable media for tracking updates and loading data
WO2022100208A1 (en) Dynamic library loading method, kernel deployment adjustment method, and related apparatuses
CN111258587A (en) Method, device, equipment and storage medium for realizing android application plug-in
CN113204353B (en) Big data platform assembly deployment method and device
CN109634840A (en) Method for testing software, device, equipment and storage medium
CN114077460A (en) Method, equipment and medium for calling Android dynamic library HAL interface by software operating system
US7296265B1 (en) Class loading in a virtual machine for a platform having minimal resources
US20030037323A1 (en) Method for upgrading data
JP2007510211A (en) Mapping dynamic link libraries on computer equipment
US20230359450A1 (en) Cloud application engine deployment method for shielding web framework from users and apparatus, device and storage medium thereof
CN114679465A (en) Resource operation method and device, electronic equipment and storage medium
CN115374083A (en) Data source switching method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21890737

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21890737

Country of ref document: EP

Kind code of ref document: A1