CN115994003A - Processing method and processing device for shared object in operating system - Google Patents

Processing method and processing device for shared object in operating system Download PDF

Info

Publication number
CN115994003A
CN115994003A CN202310126585.0A CN202310126585A CN115994003A CN 115994003 A CN115994003 A CN 115994003A CN 202310126585 A CN202310126585 A CN 202310126585A CN 115994003 A CN115994003 A CN 115994003A
Authority
CN
China
Prior art keywords
shared object
current application
file
application image
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310126585.0A
Other languages
Chinese (zh)
Inventor
顾权
印凤行
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Eswin Computing Technology Co Ltd
Original Assignee
Beijing Eswin Computing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Eswin Computing Technology Co Ltd filed Critical Beijing Eswin Computing Technology Co Ltd
Priority to CN202310126585.0A priority Critical patent/CN115994003A/en
Publication of CN115994003A publication Critical patent/CN115994003A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The present disclosure provides a processing method and a processing device for a shared object in an operating system, an electronic device, and a computer readable medium, where the method includes: generating a shared object and a current application image; obtaining a shared object on which the current application mirror image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application mirror image; generating a file system according to the plurality of shared objects, the current application mirror image and the dependent file, and mounting the file system on an operating system node when the operating system is started; before running the current application mirror image, analyzing the dependent file, and sequentially installing the shared object recorded in the dependent file to the memory where the current application mirror image is located; and unloading the shared object recorded in the dependent file from the memory after the current application image is finished.

Description

Processing method and processing device for shared object in operating system
Technical Field
The present disclosure relates to the field of embedded operating systems, and in particular, to a method and apparatus for processing a shared object in an operating system, an electronic device, and a computer readable medium.
Background
In an operating system, an application may be represented as a Relocatable (REL) file, which typically contains code, data, and relocation information with an undetermined address, from which the REL file may be dynamically loaded to run at any address. After the REL file is loaded into the memory and the code and data in the REL file are relocated, the code and data in the REL file will have a certain address. The published operating system firmware can be easily expanded in the operating system through REL files.
REL files in an operating system mainly comprise a static link and a dynamic link, and when the REL files are formed by statically linking an intermediate target file and a static library, repeated codes exist in a plurality of REL files, which can certainly increase the consumption of a disk and a memory. In addition, static linking is not beneficial to the update of a module or library (such as a memory-related module or library, a network-related module or library, etc.) on which an application depends, if a module or library on which an application depends needs to be updated (such as a function in a network library needs to be changed), all applications need to be compiled and linked again with the latest module or library to generate a final application, so that when part of codes are modified, the whole REL file needs to be linked again, which makes the version upgrade of the application more complicated; the REL file and the shared object (shared library) can be separated by using dynamic link, the shared object is loaded when the REL file is operated, so that only one share of the shared object code is in the disk and the memory, and the shared object can be upgraded without modifying the REL file.
In the related art, nuttX is a real-time Embedded operating system (Embedded RTOS), which is one of the mainstream Embedded operating systems on the market, but supports only statically linked REL files for firmware expansion, and does not support dynamic links, so that only statically linked REL files can be used when the firmware of the operating system is to be expanded, which undoubtedly increases the consumption of disk and memory space.
Disclosure of Invention
The disclosure provides a processing method and a processing device for a shared object in an operating system, electronic equipment and a computer readable medium.
In a first aspect, an embodiment of the present disclosure provides a method for processing a shared object in an operating system, including:
generating a shared object and a current application image;
obtaining a shared object on which the current application image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application image;
generating a file system according to the plurality of shared objects, the current application image and the dependent file, and mounting the file system on an operating system node when the operating system is started;
before running the current application mirror image, analyzing the dependent file, and sequentially installing the shared object recorded in the dependent file to the memory where the current application mirror image is located;
and unloading the shared object recorded in the dependent file from the memory after the current application image operation is finished.
In some embodiments, the shared object is in an executable and linkable format, the shared object is of a relocatable type, and the current application image is in a relocatable format.
In some embodiments, the shared object includes a symbol array including at least one symbol and an initialization function; a step of generating a shared object, comprising:
compiling a plurality of source code files in the source codes to be processed into first target files respectively, and linking the first target files corresponding to the source code files respectively to obtain an initial sharing object;
extracting symbols from the initial shared object, and writing the symbols in the initial shared object into a symbol array in a preset symbol file, wherein the symbol array is used for recording the symbols in the initial shared object;
generating an initialization function corresponding to the initial shared object according to the symbol array and the number of symbols in the symbol array;
compiling the symbol array and the initialization function into second target files respectively corresponding to the symbol array and the initialization function;
and linking a second target file corresponding to the symbol array and a second target file corresponding to the initializing function with the initial shared object to generate the shared object.
In some embodiments, the step of obtaining the shared object on which the current application image depends from the generated multiple shared objects to generate the dependent file corresponding to the current application image includes:
extracting undefined symbols in the current application image;
comparing the undefined symbol with the symbols in each shared object;
and recording the names of the sharing objects with the matched comparison results in the dependent files corresponding to the current application mirror images.
In some embodiments, before the step of parsing the dependent file, the processing method further comprises: loading the current application image into the memory;
after the step of sequentially installing the shared object recorded in the dependent file to the memory where the current application image is located, the processing method further includes:
repositioning the current application image in the memory;
and after the relocation is finished, creating the task of the current application image, and running the current application image.
In some embodiments, after the current application image is finished, before unloading the shared object recorded in the dependent file from the memory, the processing method further includes:
judging whether the shared object recorded in the dependent file is currently used by other application images or not;
and if the shared object recorded in the dependent file is not currently used by other application images, executing the step of unloading the shared object recorded in the dependent file from the memory.
In a second aspect, an embodiment of the present disclosure provides a processing apparatus for sharing an object in an operating system, including:
a generation unit configured to generate a shared object and a current application image;
the recording unit is configured to acquire a shared object on which the current application image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application image;
a mount unit configured to generate a file system according to the plurality of shared objects, the current application image, and the dependent file, and mount the file system on an operating system node when an operating system is started;
the installation unit is configured to analyze the dependent file before running the current application image, and sequentially install the shared object recorded in the dependent file to the memory where the current application image is located;
and the unloading unit is configured to unload the shared object recorded in the dependent file from the memory after the current application image operation is finished.
In some embodiments, the recording unit is configured to:
extracting undefined symbols in the current application image;
comparing the undefined symbol with the symbols in each shared object;
and recording the names of the sharing objects with the matched comparison results in the dependent files corresponding to the current application mirror images.
In some embodiments, the processing device further includes a determining unit configured to determine, after the current application image is run, whether the shared object recorded in the dependent file is currently used by another application image;
the uninstalling unit is configured to uninstall the shared object recorded in the dependent file from the memory if the shared object recorded in the dependent file is not currently used by other application images.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores one or more computer programs executable by the at least one processor, one or more of the computer programs being executable by the at least one processor to enable the at least one processor to perform the processing method as described in the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the processing method according to the first aspect.
In the embodiment of the disclosure, the processing method of the shared object in the operating system is used for realizing the management of the shared object in the operating system, and the shared object relied on by the application image is recorded by relying on the file when the application program is compiled, so that the shared object can be automatically installed and uninstalled according to the service condition of the application image on the shared object, the active installation of an encoder is not needed, the use of the shared object is simpler and more flexible, the expansion of the firmware of the operating system is facilitated, the firmware of the operating system is more simple and flexible to expand, the consumption of the memory of the operating system can be effectively reduced, and the memory space of the operating system is saved.
Drawings
FIG. 1 is a flow chart of a method for processing a shared object in an operating system according to at least one embodiment of the present disclosure;
FIG. 2 is a flow diagram of one manner of generating a shared object according to an embodiment of the present disclosure;
FIG. 3 is a flow diagram of one manner of generating a dependent file according to an embodiment of the present disclosure;
fig. 4 is a block diagram of a processing device for sharing objects in an operating system according to at least one embodiment of the present disclosure.
Detailed Description
The following describes in detail a processing method and a processing device for a shared object in an operating system, an electronic device, and a computer readable medium provided in the present disclosure with reference to the accompanying drawings.
The present disclosure will be described more fully hereinafter with reference to the accompanying drawings, but the embodiments shown may be embodied in different forms and should not be construed as limited to the embodiments set forth in the disclosure. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The present disclosure may be described with reference to plan and/or cross-sectional views with the aid of idealized schematic diagrams of the present disclosure. Accordingly, the example illustrations may be modified in accordance with manufacturing techniques and/or tolerances.
Embodiments of the disclosure and features of embodiments may be combined with each other without conflict.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The term "and/or" as used in this disclosure includes any and all combinations of one or more of the associated listed items. As used in this disclosure, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The term "comprises/comprising" as used in this disclosure is taken to specify the presence of stated features, integers, steps, operations, elements, and/or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
In the related art, although NuttX supports shared objects, there is a limitation on the use of shared objects, and an encoder needs to know which shared objects are used by an application program in advance and encode the use of the shared objects in source code, which is not convenient and flexible.
The embodiment of the disclosure provides a processing method and a processing device for a shared object in an operating system, which aim to effectively solve the technical problems in the related art.
In a first aspect, an embodiment of the present disclosure provides a method for processing a shared object in an operating system.
Fig. 1 illustrates an alternative implementation of a method for processing a shared object in an operating system according to an embodiment of the disclosure. As shown in fig. 1, a method for processing a shared object in an operating system according to an embodiment of the disclosure includes:
step S11, generating a shared object and a current application mirror image.
In the disclosed embodiments, the operating system may be an embedded operating system, such as a Nuttx embedded operating system, the shared object is a shared library in the operating system, i.e., a library or module ending in ". So" in the operating system, and the application image is an application program (APP).
In the embodiment of the disclosure, the shared object can be obtained and generated according to the source code of the operating system, and the current application image can be generated according to the source code of the application program (APP) to be loaded.
And step S12, acquiring the shared object on which the current application mirror image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application mirror image.
The shared object on which the current application image depends is the shared object required to be used by normal loading of the current application image, the dependent file contains information of the shared object on which the current application image depends, for example, the name of the shared object, the dependent file can be in a romafs format, wherein the file content records the name of the shared object on which the current application image depends, and the romafs is a read-only file system which is relatively simple and occupies less space.
And S13, generating a file system according to the plurality of shared objects, the current application mirror image and the dependent file, and mounting the file system on an operating system node when the operating system is started.
The generated multiple shared objects, current application images and dependent files are integrated into a file system, which is a method and a data structure for an operating system to explicitly store files on a device (commonly a magnetic disk and also a solid state disk based on NAND Flash) or a partition.
Mount (mount) refers to a process by which a computer file and directory on a storage device (such as a hard disk, CD-ROM, or shared resource) is made available to a user for access through the computer's file system by the operating system.
The operating system node is a device node of the operating system, for the operating system, all IO resources are files, including files, catalogues, hard disks, devices and the like, in the operating system, all devices are usually stored under an "/dev" catalog in the form of files and are usually accessed in the form of files, the position and information of hardware devices are recorded under the "/dev" catalog, the device node is abstraction of devices by an operating system kernel, namely, the operating system abstracts the devices into files, one device node is one file, an application program usually executes access devices through a group of standardized calls, and the device node is a bridge between the application program and a device driver.
The file system integrating the shared object, the current application image and the dependent file is mounted to the operating system node at operating system start-up to run the current application image at operating system runtime.
And S14, before the current application mirror image is operated, analyzing the dependent file, and sequentially installing the shared object recorded in the dependent file to the memory where the current application mirror image is located.
The open function can be used for opening the dependent file to obtain the name of the shared object on which the current application image depends, so that the shared object on which the current application image depends is determined, and program codes of the shared object on which the current application image depends are sequentially installed to the memory in which the current application image is located, and the memory in which the current application image is located is the memory of the operating system.
Before running the current application mirror image, the shared object on which the current application mirror image is installed to the memory where the current application mirror image is located, so that the current application mirror image is repositioned and normally run later.
And S15, unloading the shared object recorded in the dependent file from the memory after the current application image operation is finished.
And unloading the shared object recorded in the dependent file from the memory after the current application mirror image operation is finished, so that the consumption of the memory of the operating system is reduced, and the memory space of the operating system is saved.
In the embodiment of the disclosure, the processing method of the shared object in the operating system is used for realizing the management of the shared object in the operating system, and the shared object relied on by the application image is recorded by relying on the file when the application program is compiled, so that the shared object can be automatically installed and uninstalled according to the service condition of the application image on the shared object, the active installation of an encoder is not needed, the use of the shared object is simpler and more flexible, the expansion of the firmware of the operating system is facilitated, the firmware of the operating system is more simple and flexible to expand, the consumption of the memory of the operating system can be effectively reduced, and the memory space of the operating system is saved.
In the disclosed embodiment, the shared object is in executable and linkable (Executable and Linkable Format, ELF) format, the shared object is of Relocatable (REL) type, and the current application image is in Relocatable (REL) format. ELF is a file format that has two types, one is REL type, and running REL type ELF files requires a relocation step; one type is a directly operable type that does not require a relocation step to operate an ELF file of that type.
In some embodiments, the shared object comprises a symbol array comprising at least one symbol representing a function or variable in the shared object, such as a summing function add (a, b) and a difference function sub (a, b), etc., wherein a and b represent variables in the function, and an initialization function. Fig. 2 is a flowchart illustrating a manner of generating a shared object according to an embodiment of the disclosure, in some embodiments, as shown in fig. 2, in step S11, the step of generating the shared object may further include:
and S21, compiling a plurality of source code files in the source codes to be processed into first target files respectively, and linking the first target files corresponding to the source code files respectively to obtain an initial sharing object.
Dividing the source code to be processed into a plurality of mutually independent modules according to the functional modules, wherein each module is used as a source code file, for example, a part related to a network is used as a module, the graphic display is used as a module, functions among different modules are different, one is related to the network, and the other is the graphic display of a display screen.
In step S21, a compiler may be used to compile a plurality of source code files in the source code to be processed into first target files, each source code file is correspondingly compiled into a first target file, and then a linker is used to link the first target files corresponding to the source code files respectively, so as to generate an initial sharing object. The source code file is a C file, the C is a file with the suffix, the compiler compiles the C suffix source code file into an O suffix target file, and links a plurality of O suffix target files to generate an ELF format initial sharing object through a linker. The ". O" file is an object file, i.e. an executable file, and is a type of a returnable file, and is typically stored in an ELF format.
Specifically, the linker may combine a plurality of first target files according to the link script to generate an initial shared object in an ELF format, where the first target file has a link address, and indicates a storage address of a section in the first target file.
Step S22, extracting symbols from the initial shared object, and writing the symbols in the initial shared object into a symbol array in a preset symbol file, wherein the symbol array is used for recording the symbols in the initial shared object.
A GCC (GNU Compiler Collection, GNU compiler set) tool riscv-unknown-elf-nm may be used to extract a symbol table from the initial shared object, where symbols in the initial shared object are recorded, and write the symbols in the initial shared object into a preset symbol file, where the symbol file is a C file, where symbol names of the initial shared object are saved by a symbol array, and the symbols in the initial shared object are recorded.
Step S23, generating an initialization function corresponding to the initial shared object according to the number of symbols in the symbol array.
The shell script can be used, commands such as echo (response protocol) are used in the script, the generated symbol array pointer of the initial shared object is assigned to the symbol structure pointer in the initialization function, the symbol number of the initial shared object is assigned to the symbol data variable in the initialization function, and therefore an initialization file is generated, the initialization file is a C file, and the initialization file contains the initialization function.
And S24, compiling the symbol array and the initialization function into second target files respectively corresponding to the symbol array and the initialization function.
And compiling the symbol array and the initialization function by using a compiler respectively to generate a second target file with the suffix of 'o'.
Step S25, linking the second target file corresponding to the symbol array and the second target file corresponding to the initializing function with the initial shared object to generate the shared object.
And linking the second target file corresponding to the symbol array and the second target file corresponding to the initialization function with the initial shared object by using a linker, thereby generating the shared object.
In step S11, the step of generating the current application image may further include: and compiling the source code of the application program by using a compiler to generate a third target file with o as a suffix, and linking the third target file by using a linker to generate the current application image in REL format.
FIG. 3 is a flowchart illustrating a method for generating a dependent file according to an embodiment of the present disclosure, as shown in FIG. 3, in some embodiments, the step of obtaining a shared object on which a current application image depends from a plurality of generated shared objects to generate a dependent file corresponding to the current application image may further include:
and S31, extracting undefined symbols in the current application image.
The Undefined symbol in the current application image is obtained from the current application image, and the Undefined symbol refers to a symbol (i.e., a function or a variable) in which the called address in the current application image is Undefined (e.g., the address is 0), that is, a symbol in which shared object is not explicitly called.
And S32, comparing the undefined symbol with the symbols in each shared object, and recording the names of the shared objects with the matched comparison results in the dependent files corresponding to the current application mirror images.
Comparing the undefined symbol with the symbols in each shared object to determine whether the undefined symbol is matched with the symbols in the shared object, namely, whether the undefined symbol in the current application image exists in the shared object or not is determined, further, the shared object on which the current application image depends is determined, and the name of the shared object on which the current application image depends is recorded in a dependent file corresponding to the current application image. For example, if an undefined symbol a exists in the current application image and the symbol a exists in the shared object B, it is stated that the current application image depends on the shared object B.
In some embodiments, before the step of parsing the dependent file, i.e., before step S14, the processing method may further include: and loading the current application image into the memory. And then analyzing the dependent file, and sequentially installing the shared object recorded in the dependent file to the memory where the current application mirror image is located.
In some embodiments, after the step of sequentially installing the shared object recorded in the dependent file to the memory where the current application image is located, the processing method may further include: repositioning a current application image in the memory; and creating a Task (Task) of the current application image after the relocation is finished, and running the current application image. Running the current application image in the operating system requires creating a Task (Task) for managing the current application image.
And then, after the current application mirror image operation is finished, unloading the shared object recorded in the dependent file from the memory. In some embodiments, after the current application image is finished, before unloading the shared object recorded in the dependent file from the memory, the processing method may further include: judging whether the shared object recorded in the dependent file is currently used by other application images or not; if the shared object recorded in the dependent file is not currently used by other application images, executing the step of unloading the shared object recorded in the dependent file from the memory; if the shared object recorded in the dependent file is currently used by other application images, the shared object is not unloaded.
In the embodiment of the disclosure, the shared object has a global variable in the operating system, and whether the shared object is used by other modules or other application programs APP can be recorded, so that whether the shared object recorded in the dependent file is currently used by other application images can be judged through the global variable of the shared object.
In a second aspect, an embodiment of the present disclosure provides a processing apparatus for sharing an object in an operating system.
FIG. 4 illustrates an alternative implementation of a processing apparatus for sharing objects in an operating system provided by an embodiment of the present disclosure. As shown in fig. 4, a processing apparatus 400 for sharing objects in an operating system according to an embodiment of the present disclosure includes: a generation unit 401, a recording unit 402, a mounting unit 403, an installation unit 404, and an unloading unit 405.
Wherein the generating unit 401 is configured to generate a shared object and a current application image; a recording unit 402 configured to acquire a shared object on which the current application image depends from the generated plurality of shared objects, so as to generate a dependent file corresponding to the current application image; a mount unit 403 configured to generate a file system according to the plurality of shared objects, the current application image, and the dependent file, and mount the file system onto an operating system node when the operating system is started; the installation unit 404 is configured to parse the dependent file and sequentially install the shared object recorded in the dependent file to the memory where the current application image is located before the current application image is run; and the unloading unit 405 is configured to unload the shared object recorded in the dependent file from the memory after the current application image is run.
In some embodiments, the shared object comprises a symbol array comprising at least one symbol and an initialization function; the generating unit 401 is configured to: compiling a plurality of source code files in the source codes to be processed into first target files respectively, and linking the first target files corresponding to the source code files respectively to obtain an initial sharing object; extracting symbols from the initial shared object, writing the symbols in the initial shared object into a symbol array in a preset symbol file, wherein the symbol array is used for recording the symbols in the initial shared object; generating an initialization function corresponding to the initial shared object according to the symbol array and the number of symbols in the symbol array; compiling the symbol array and the initialization function into second target files respectively corresponding to the symbol array and the initialization function; and linking the second target file corresponding to the symbol array and the second target file corresponding to the initializing function with the initial shared object to generate the shared object.
In some embodiments, recording unit 402 includes: an extraction subunit configured to extract undefined symbols in the current application image; a comparison subunit configured to compare the undefined symbol with the symbols in each shared object; and the recording subunit is configured to record the names of the sharing objects with the matching comparison results in the dependent files corresponding to the current application image.
In some embodiments, the processing device 400 further comprises: the system comprises a loading unit and a repositioning and running unit, wherein the loading unit is configured to load the current application image into the memory before the installation unit 404 parses the dependent file.
The relocation and operation unit is configured to: after the step of sequentially installing the shared objects recorded in the dependent file to the memory where the current application image is located by the installation unit 404, repositioning the current application image in the memory; and after the relocation is finished, creating a Task (Task) of the current application image, and running the current application image.
In some embodiments, the processing apparatus 400 further includes a determining unit configured to determine, after the current application image is run, whether the shared object recorded in the dependent file is currently used by the other application image; the uninstall unit 405 is configured to execute the step of uninstalling the shared object recorded in the dependent file from the memory if the shared object recorded in the dependent file is not currently used by other application images.
The processing device provided in the embodiments of the present disclosure is configured to implement the above processing method, and specific descriptions thereof may be referred to the descriptions related to the above processing method, which are not repeated herein.
In a third aspect, embodiments of the present disclosure further provide an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executable by the at least one processor to enable the at least one processor to perform the processing methods described above.
In a fourth aspect, the disclosed embodiments also provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the above-described processing method.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, functional modules/units in the apparatus disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
In a hardware implementation, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed cooperatively by several physical components.
Some or all of the physical components may be implemented as software executed by a processor, such as a Central Processing Unit (CPU), digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer readable media (or non-transitory media) and communication media (or transitory media). The term computer readable media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer-readable media includes, but is not limited to, random access memory (RAM, more particularly SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), FLASH memory (FLASH), or other magnetic disk storage; a compact disk read-only (CD-ROM), digital Versatile Disk (DVD) or other optical disk storage; magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage; any other medium that can be used to store the desired information and that can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.
The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted in a generic and descriptive sense only and not for purpose of limitation. In some instances, it will be apparent to one skilled in the art that features, characteristics, and/or elements described in connection with a particular embodiment may be used alone or in combination with other embodiments unless explicitly stated otherwise. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the disclosure as set forth in the appended claims.

Claims (11)

1. A method for processing a shared object in an operating system, comprising:
generating a shared object and a current application image;
obtaining a shared object on which the current application image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application image;
generating a file system according to the plurality of shared objects, the current application image and the dependent file, and mounting the file system on an operating system node when the operating system is started;
before running the current application mirror image, analyzing the dependent file, and sequentially installing the shared object recorded in the dependent file to the memory where the current application mirror image is located;
and unloading the shared object recorded in the dependent file from the memory after the current application image operation is finished.
2. The processing method of claim 1, wherein the shared object is in an executable and linkable format, the shared object is of a relocatable type, and the current application image is in a relocatable format.
3. The processing method according to claim 1, wherein the shared object comprises a symbol array and an initialization function, the symbol array comprising at least one symbol; a step of generating a shared object, comprising:
compiling a plurality of source code files in the source codes to be processed into first target files respectively, and linking the first target files corresponding to the source code files respectively to obtain an initial sharing object;
extracting symbols from the initial shared object, and writing the symbols in the initial shared object into a symbol array in a preset symbol file, wherein the symbol array is used for recording the symbols in the initial shared object;
generating an initialization function corresponding to the initial shared object according to the symbol array and the number of symbols in the symbol array;
compiling the symbol array and the initialization function into second target files respectively corresponding to the symbol array and the initialization function;
and linking a second target file corresponding to the symbol array and a second target file corresponding to the initializing function with the initial shared object to generate the shared object.
4. The processing method according to claim 1, wherein the step of acquiring the shared object on which the current application image depends from the generated plurality of shared objects to generate the dependent file corresponding to the current application image includes:
extracting undefined symbols in the current application image;
comparing the undefined symbol with the symbols in each shared object;
and recording the names of the sharing objects with the matched comparison results in the dependent files corresponding to the current application mirror images.
5. The method of processing of claim 1, wherein prior to the step of parsing the dependent file, the method of processing further comprises: loading the current application image into the memory;
after the step of sequentially installing the shared object recorded in the dependent file to the memory where the current application image is located, the processing method further includes:
repositioning the current application image in the memory;
and after the relocation is finished, creating the task of the current application image, and running the current application image.
6. The processing method according to claim 1, wherein after the current application image is run, before unloading the shared object recorded in the dependent file from the memory, the processing method further comprises:
judging whether the shared object recorded in the dependent file is currently used by other application images or not;
and if the shared object recorded in the dependent file is not currently used by other application images, executing the step of unloading the shared object recorded in the dependent file from the memory.
7. A processing apparatus for sharing objects in an operating system, comprising:
a generation unit configured to generate a shared object and a current application image;
the recording unit is configured to acquire a shared object on which the current application image depends from the generated multiple shared objects so as to generate a dependent file corresponding to the current application image;
a mount unit configured to generate a file system according to the plurality of shared objects, the current application image, and the dependent file, and mount the file system on an operating system node when an operating system is started;
the installation unit is configured to analyze the dependent file before running the current application image, and sequentially install the shared object recorded in the dependent file to the memory where the current application image is located;
and the unloading unit is configured to unload the shared object recorded in the dependent file from the memory after the current application image operation is finished.
8. The processing apparatus according to claim 7, wherein the recording unit is configured to:
extracting undefined symbols in the current application image;
comparing the undefined symbol with the symbols in each shared object;
and recording the names of the sharing objects with the matched comparison results in the dependent files corresponding to the current application mirror images.
9. The processing apparatus according to claim 7, further comprising a judging unit configured to judge whether the shared object recorded in the dependent file is currently used by other application images after the end of the running of the current application image;
the uninstalling unit is configured to uninstall the shared object recorded in the dependent file from the memory if the shared object recorded in the dependent file is not currently used by other application images.
10. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores one or more computer programs executable by the at least one processor to enable the at least one processor to perform the processing method of any one of claims 1-6.
11. A computer readable medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the processing method according to any of claims 1-6.
CN202310126585.0A 2023-02-16 2023-02-16 Processing method and processing device for shared object in operating system Pending CN115994003A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310126585.0A CN115994003A (en) 2023-02-16 2023-02-16 Processing method and processing device for shared object in operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310126585.0A CN115994003A (en) 2023-02-16 2023-02-16 Processing method and processing device for shared object in operating system

Publications (1)

Publication Number Publication Date
CN115994003A true CN115994003A (en) 2023-04-21

Family

ID=85991982

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310126585.0A Pending CN115994003A (en) 2023-02-16 2023-02-16 Processing method and processing device for shared object in operating system

Country Status (1)

Country Link
CN (1) CN115994003A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501265A (en) * 2023-06-26 2023-07-28 中航金网(北京)电子商务有限公司 Multi-system file modification method, device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501265A (en) * 2023-06-26 2023-07-28 中航金网(北京)电子商务有限公司 Multi-system file modification method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109062617B (en) Application method of platform supporting multiple types of equipment and mobile terminal
KR100952251B1 (en) Servicing a component base software product
CN108847950B (en) Electronic device, cloud system software automatic deployment method and storage medium
CN107506221B (en) Application program upgrading method, device and equipment
US7814476B2 (en) Systems and methods for updating software
US20070006222A1 (en) Software installation method and computer system
CN107870769B (en) Installation method and device of operating system
CN100399267C (en) Method of managing software installation and unloading
CN107220074B (en) Method and device for accessing and upgrading supporting layer software function
CN112764766B (en) Method, device and equipment for butting k8s cluster and storage medium
US8898659B2 (en) Method and apparatus to customize and configure multiple operating systems on a server
CN111124288A (en) VPD storage management method, device, equipment and readable storage medium
CN115994003A (en) Processing method and processing device for shared object in operating system
US6523103B2 (en) Disablement of a write filter stored on a write-protected partition
CN107220085B (en) Method for automatically upgrading RAID card firmware
CN110750280A (en) Application upgrading method and system based on Android platform and storage medium
CN113867768A (en) Operating system processing method and device, electronic equipment and storage medium
CN114385251A (en) Operating system booting method, system, terminal and storage medium based on memory
CN116303099B (en) Cross-platform rapid deployment method, device, medium and equipment for automatic test environment
CN104991796A (en) Method and apparatus for continuous upgrade
US20200364040A1 (en) System and Method for Restoring a Previously Functional Firmware Image on a Non-Volatile Dual Inline Memory Module
CN113641389B (en) Software upgrading method, device and equipment based on OpenCPU
EP1710697A1 (en) Method and apparatus for executing application in system having NAND flash memory
GB2403303A (en) Software patch registry
CN115145595A (en) Dependency library installation method and device, server, electronic equipment and storage medium

Legal Events

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