WO2022042363A1 - 一种共享库的复用方法及电子设备 - Google Patents
一种共享库的复用方法及电子设备 Download PDFInfo
- Publication number
- WO2022042363A1 WO2022042363A1 PCT/CN2021/112853 CN2021112853W WO2022042363A1 WO 2022042363 A1 WO2022042363 A1 WO 2022042363A1 CN 2021112853 W CN2021112853 W CN 2021112853W WO 2022042363 A1 WO2022042363 A1 WO 2022042363A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- shared library
- inode
- electronic device
- app
- file data
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 107
- 238000004422 calculation algorithm Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 13
- 230000006870 function Effects 0.000 description 60
- 238000012545 processing Methods 0.000 description 58
- 238000013461 design Methods 0.000 description 34
- 238000004891 communication Methods 0.000 description 23
- 238000007726 management method Methods 0.000 description 13
- 238000009434 installation Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 238000010295 mobile communication Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 8
- 238000012544 monitoring process Methods 0.000 description 7
- 239000002699 waste material Substances 0.000 description 7
- 101100264195 Caenorhabditis elegans app-1 gene Proteins 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000013478 data encryption standard Methods 0.000 description 2
- 238000011900 installation process Methods 0.000 description 2
- 230000005855 radiation Effects 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 210000000988 bone and bone Anatomy 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000006837 decompression Effects 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010348 incorporation Methods 0.000 description 1
- 230000006386 memory function Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/544—Buffers; Shared memory; Pipes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/176—Support for shared access to files; File sharing support
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/543—Local
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/62—Uninstallation
Definitions
- the embodiments of the present application relate to the technical field of electronic devices, and in particular, to a method for multiplexing a shared library and an electronic device.
- each APP includes executable programs and multiple shared libraries.
- the shared library includes a dynamic link library in a Windows operating system, a shared object in a Linux operating system, and the like. That is to say, after a user installs an APP in an electronic product, the executable program and multiple shared libraries of the APP will be stored in the electronic product.
- the embodiment of the present application provides a method for multiplexing a shared library, which can enable different APPs to call the same shared library when running, thereby improving the utilization rate of the storage space of electronic products.
- an embodiment of the present application provides a method for multiplexing a shared library, and the method can be applied to an electronic device in which multiple APPs are installed, and each APP in the multiple APPs includes at least one shared library.
- the at least one shared library may include the second shared library.
- the electronic device can determine whether there is a second shared library in the electronic device that has the same file data as the first shared library of the first APP.
- the first shared library is any shared library in the first APP. If the second shared library exists in the electronic device, the correspondence between the first inode and the file name of the first shared library is saved, and the file data of the first shared library is deleted from the electronic device.
- the first inode is allocated by the electronic device for the second shared library, and the first inode may indicate a first storage area for storing file data of the second shared library. That is to say, the electronic device can determine, according to the first inode, the first storage area in the electronic device in which the file data of the second shared library is stored. After that, when the electronic device runs the first APP to call the first shared library, the electronic device can search for the first inode corresponding to the file name of the first shared library to read the second shared library stored in the storage area indicated by the first inode Library file data.
- the electronic device may also save the correspondence between the first inode and the file name of the first shared library. In this way, when the electronic device runs the first APP to call the first shared library, the electronic device does not need to call the file data of the first shared library, but only needs to search the first inode through the file name of the first shared library to read the second The file data of the shared library can ensure the normal operation of the APP.
- the shared library can be mapped into the memory, and then the shared library can be called from the memory. In this way, the performance of the electronic device can be improved.
- the electronic device runs multiple APPs (such as the first APP and the second APP including the second shared library)
- the first shared library and the second shared library are respectively mapped into the memory, because the mapped data If the amount is large, it will not only affect the I/O performance, but also cause a waste of memory space.
- the electronic device only maps the second shared library into the memory, and both the first APP and the second APP can call the file data of the second shared library from the memory when running. In this way, not only the amount of data mapped to the memory is reduced, the I/O performance is improved, but also the space occupied by the memory can be reduced, and the utilization rate of the memory can be improved.
- the above-mentioned method for "the electronic device determines whether there is a second shared library that is the same as the file data of the first shared library of the first APP" in the electronic device includes: an electronic device When the first APP is installed, the electronic device determines whether there is a second shared library in the electronic device that has the same file data as the first shared library of the first APP; or, when the electronic device finishes running the first APP, the electronic device determines whether the electronic device Whether there is a second shared library that is the same as the file data of the first shared library of the first APP.
- the electronic device when the APP (such as the first APP) in the electronic device is downloaded from the platform to the electronic device, the electronic device can monitor the installation process of the first APP, and when the first APP is installed on the electronic device, detect the electronic device. Whether the device stores the second shared library with the same file data as the first shared library, so that the electronic device can find out in time whether the same shared library is stored. In addition, the electronic device performs detection when the first APP is installed, which can prevent the operation of the first APP from being affected.
- the APP such as the first APP
- the electronic device cannot monitor the copying process of the first APP. Therefore, only when the copied first APP is running, the electronic device can monitor it to detect whether it stores the second shared library that is the same as the file data of the first shared library, so that the electronic device can find out in time whether there are stored the same shared library. In addition, the electronic device detects when the first APP is finished running, which can prevent the running of the APP from being affected.
- the APP eg, the first APP
- the above when the electronic device finishes running the first APP, the electronic device determines whether there is a second file in the electronic device that is the same as the file data of the first shared library of the first APP.
- "Shared library” may include: when the electronic device finishes running the first APP for the first time, the electronic device determines whether there is a second shared library in the electronic device that is identical to the file data of the first shared library of the first APP.
- the electronic device determines that there is a second shared library in the electronic device that is the same as the file data of the first shared library of the first APP, the electronic device can delete the file data of the first shared library. Then, after the electronic device finishes running the first APP for the first time, the electronic device can delete the file data of the first shared library. Therefore, after the electronic device runs the first APP again, it is no longer necessary to determine that there is a second shared library in the electronic device that is the same as the file data of the first shared library of the first APP. In this way, the computing pressure of the electronic device can be reduced.
- the method further includes: if the second shared library does not exist in the electronic device, the electronic device allocates a second inode to the first shared library, and saves the second inode and the Correspondence between file names of the first shared library.
- the second inode indicates a second storage area for storing file data of the first shared library.
- the electronic device can store the first shared library. In this way, when the electronic device runs the first APP to call the first shared library, the electronic device can search for the second inode through the file name of the first shared library, so as to read the file data of the first shared library to ensure the APP's normal operation.
- the method further includes: if the second shared library exists in the electronic device, adding 1 to the link number of the first inode by the electronic device; wherein , the link number of the first inode is the number of shared libraries corresponding to the first inode; if the second shared library does not exist in the electronic device, the electronic device is the link number of the second inode plus the number of 1; wherein, the link number of the second inode is the number of shared libraries corresponding to the second inode, and the initial value of the link number of each inode is 0.
- the electronic device determines the number of shared libraries to be replaced by the second shared library according to the number of links of the first inode.
- the electronic device changes the link number of the second inode by adding 1 to the link number of the second inode, thereby updating the number of shared libraries corresponding to the second inode, so that the electronic device can determine the first shared library according to the link number of the second inode Number of alternate shared libraries.
- the method further includes: when the electronic device deletes the second APP, searching for a third inode corresponding to the file name of the third shared library; if the third inode The number of links is equal to 1, then delete the file data of the third shared library, the third inode, and the correspondence between the file name of the third shared library and the third inode from the electronic device relationship; if the number of links of the third inode is greater than 1, the number of links of the third inode is reduced by 1.
- the link number of the third inode is equal to 1, it means that the third shared library does not need to replace other shared libraries, that is, the APPs other than the second APP will not call the third shared library when running.
- the electronic device after the electronic device deletes the second APP, there is no APP in the electronic device to call the third shared library. Therefore, when the electronic device deletes the second APP, the electronic device can delete the file data of the third shared library, the third inode, and the third shared library. The correspondence between the file names of the three shared libraries and the third inode, thereby saving the storage space of the electronic device.
- the electronic device cannot delete the third shared library.
- the electronic device since the electronic device will delete the second APP, that is, the number of APPs that call the third shared library is reduced, the electronic device changes the number of links of the third inode, thereby updating the number of shared libraries corresponding to the third inode, so that the electronic device can The link count of the third inode determines the number of shared libraries that the third shared library replaces.
- the above-mentioned method for "the electronic device to determine whether there is a second shared library that is the same as the file data of the first shared library of the first APP" in the electronic device includes: The electronic device uses a preset algorithm according to the file data of the first shared library to generate the first identification of the first shared library, and determines whether the first identification and the second identification are the same; wherein, the second identification is the The electronic device is generated by using the preset algorithm according to the file data of any shared library in the electronic device.
- the first identifier is the same as the second identifier, it is determined that the second shared library with the same file data as the first shared library exists in the electronic device; if the first identifier Different from the second identification, it is determined that the second shared library that is the same as the file data of the first shared library does not exist in the electronic device.
- the method further includes: the first identifier is different from the second identifier, and the electronic device saves the correspondence between the first identifier and the second inode.
- the difference between the first identifier and the second identifier indicates that the second shared library that is the same as the file data of the first shared library does not exist in the electronic device. Therefore, the electronic device needs to save the correspondence between the first identifier and the second inode, so that after storing the first shared library, it can determine whether the file data of other shared libraries stored in the electronic device is the same as the first shared library according to the first identifier. same.
- the method further includes: the link number of the third inode is equal to 1, then deleting the third inode and the third identifier from the electronic device
- the third identifier is generated by the electronic device using the preset algorithm according to the file data of the third shared library.
- the link number of the third inode is equal to 1, it means that the third shared library does not need to replace other shared libraries, that is, the APPs other than the second APP will not call the third shared library when running. Also, after the electronic device deletes the second APP, there is no APP in the electronic device to call the third shared library. Therefore, when the electronic device deletes the second APP, the electronic device deletes the correspondence between the third inode and the third identifier, thereby Save storage space for electronic devices.
- the method further includes: the electronic device compares the file data of the first shared library with the file data of each shared library in the electronic device, and determines the electronic device Whether the second shared library with the same file data as the first shared library exists in the device.
- an embodiment of the present application provides an electronic device in which multiple application programs are installed, each of the multiple APPs includes at least one shared library, and the electronic device includes: a processing unit and a storage unit.
- the processing unit is configured to determine whether there is a second shared library with the same file data as the first shared library of the first APP in the storage unit, where the first shared library is any shared library in the first APP.
- the storage unit is further configured to save the correspondence between the inode of the first index node and the file name of the first shared library if there is a second shared library in the storage unit, where the first inode is the processing unit for the second shared library Allocated, the first inode indicates a first storage area for storing file data of the second shared library.
- the processing unit is further configured to delete the file data of the first shared library from the storage unit.
- the processing unit is further configured to search for the first inode corresponding to the file name of the first shared library when running the first APP to call the first shared library, and read the file of the second shared library stored in the storage area indicated by the first inode data.
- the processing unit is specifically configured to: when the first APP is installed, determine whether there is a first APP that is the same as the file data of the first shared library of the first APP in the storage unit. two shared libraries; or, when the first APP is finished running, determine whether there is a second shared library in the storage unit that has the same file data as the first shared library of the first APP.
- the processing unit is specifically configured to: when the first APP is finished running for the first time, determine whether there is a file in the storage unit with the first shared library of the first APP A second shared library with the same data.
- the processing unit is further configured to allocate a second inode to the first shared library if the second shared library does not exist in the storage unit; wherein, the second inode indicates the use of The second storage area is used to store the file data of the first shared library; the storage unit is also used to store the correspondence between the second inode and the file name of the first shared library.
- the processing unit is further configured to search for the second inode corresponding to the file name of the first shared library when running the first APP to call the first shared library, and read the first shared library stored in the second storage area indicated by the second inode file data.
- the processing unit is further configured to: if there is a second shared library in the storage unit, add 1 to the link number of the first inode; wherein, the link of the first inode The number is the number of shared libraries corresponding to the first inode; if there is no second shared library in the storage unit, the number of links of the second inode plus 1; wherein, the number of links of the second inode is the shared library corresponding to the second inode ; where the initial value of the number of links per inode is 0.
- the processing unit is further configured to: when the second APP is deleted, find the third inode corresponding to the file name of the third shared library; if the number of links of the third inode is equal to 1, the file data of the third shared library, the third inode, and the correspondence between the file name of the third shared library and the third inode are deleted from the storage unit; if the number of links of the third inode is greater than 1, it is The link count of the third inode is decreased by 1.
- the processing unit is specifically configured to: generate a first identifier of the first shared library by using a preset algorithm according to the file data of the first shared library, and determine the first identifier Whether it is the same as the second identification; wherein, the second identification is generated by the processing unit using a preset algorithm according to the file data of any shared library in the storage unit; wherein, if the first identification is the same as the second identification, then determine the storage unit in the There is a second shared library with the same file data as the first shared library; if the first identification is different from the second identification, it is determined that there is no second shared library with the same file data as the first shared library in the storage unit.
- the storage unit is further configured to store the correspondence between the first identifier and the second inode if the first identifier is different from the second identifier.
- the processing unit is also used to delete the correspondence between the third inode and the third identifier from the storage unit if the link number of the third inode is equal to 1;
- the third identifier is generated by the processing unit using a preset algorithm according to the file data of the third shared library.
- the processing unit is specifically configured to compare the file data of the first shared library with the file data of each shared library in the storage unit, and determine whether there is a file in the storage unit that is different from the first shared library.
- the file data of the shared library is the same as the second shared library.
- an embodiment of the present application provides an electronic device, in which a plurality of application programs APPs are installed, and each APP in the above-mentioned plurality of APPs includes at least one shared library; the electronic device includes: a memory and a processor , the above-mentioned memory is coupled with the above-mentioned processor; the above-mentioned at least one shared library is stored in the memory, and the memory is also used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are executed by the processor, the electronic device is executed.
- the method as described in the first aspect and any possible design manners thereof.
- an embodiment of the present application provides a chip system, the chip system is applied to an electronic device, a plurality of APPs are installed in the electronic device, and each APP of the plurality of APPs includes at least one shared library.
- the chip system includes one or more interface circuits and one or more processors.
- the interface circuit and the processor are interconnected by wires.
- the interface circuit is used to receive signals from the memory of the electronic device and send the signals to the processor, the signals including computer instructions stored in the memory.
- the processor executes the computer instructions
- the electronic device executes the method described in the first aspect and any possible design manners thereof.
- an embodiment of the present application provides a computer storage medium, where the computer storage medium includes computer instructions, when the computer instructions are executed on an electronic device, the electronic device is made to perform the first aspect and any one thereof. possible design methods described.
- an embodiment of the present application provides a computer program product, which, when the computer program product runs on a computer, causes the computer to execute the method described in the first aspect and any possible design manners thereof.
- the electronic device described in the second aspect and any possible design manner thereof provided above the electronic device described in the third aspect, the chip system described in the fourth aspect, and the computer described in the fifth aspect
- the beneficial effects that can be achieved by the computer program product described in the sixth aspect may refer to the beneficial effects in the first aspect and any possible design manners thereof, which will not be repeated here.
- FIG. 1 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
- 2A is a system frame diagram of an electronic device provided by an embodiment of the present application.
- FIG. 2B is a system frame diagram of another electronic device provided by an embodiment of the present application.
- 2C is a flowchart of a method for multiplexing a shared library provided by an embodiment of the present application
- FIG. 2D is a system frame diagram of another electronic device provided by an embodiment of the present application.
- FIG. 3 is a flowchart of another method for multiplexing a shared library provided by an embodiment of the present application.
- FIG. 4 is a flowchart of another method for multiplexing a shared library provided by an embodiment of the present application.
- 5A is a schematic diagram of the relationship between an APP, a shared library, an inode, and a storage area provided by an embodiment of the present application;
- 5B is a schematic diagram of the relationship between another APP, a shared library, an inode, and a storage area provided by an embodiment of the present application;
- FIG. 6 is a schematic diagram of the composition of a shared library multiplexing apparatus provided by an embodiment of the present application.
- FIG. 7 is a schematic structural composition diagram of a chip system according to an embodiment of the present application.
- first and second are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features.
- a feature defined as “first” or “second” may expressly or implicitly include one or more of that feature.
- plural means two or more.
- An embodiment of the present application provides a method for multiplexing a shared library, and the method can be applied to an electronic device installed with multiple APPs.
- Each APP in the multiple APPs eg, a first APP and a second APP
- the APP in this embodiment of the present application may be a downloadable application program installed in an electronic device.
- a downloadable application is an application that can provide its own Internet Protocol Multimedia Subsystem (IMS) connection, the downloadable application can be pre-installed in an electronic device or can be downloaded and installed by the user on Third-party applications (such as the first APP and the second APP) in the electronic device.
- IMS Internet Protocol Multimedia Subsystem
- the first APP may be an application such as "calendar”, “notepad”, etc. that are pre-installed in the electronic device
- the second APP may be a payment application, a video application, etc. downloaded by the user and installed in the electronic device. third-party usage.
- the electronic device when the electronic device has installed the first APP, it can execute the shared library multiplexing method provided by the embodiment of the present application.
- the above-mentioned electronic device may have an operating system of Android ( ), the above-mentioned first APP may be a shopping application.
- the shopping application When the shopping application is installed on the mobile phone, the mobile phone completes the Android application package ( Application package, APK) decompression process, and the executable program of the shopping application is stored in the mobile phone, and the method can be executed when the executable program needs to call the first shared library and the third shared library.
- Android application package Application package, APK
- the electronic device can The installation process is monitored, and when the electronic device has installed the first APP, the method is executed, so that the electronic device can discover in time whether the same shared library is stored.
- the electronic device when the electronic device finishes running the first APP, it can execute the shared library multiplexing method provided by the embodiment of the present application.
- the above electronic device may have an operating system of mobile phone
- the above-mentioned first APP may be a shopping application.
- the method can be executed when the mobile phone runs the shopping application until the process of the shopping application is closed, that is, when the mobile phone stops running the shopping application for the first time.
- the electronic device when the APP (eg, the first APP) in the electronic device is copied to the electronic device from other removable storage devices, the electronic device cannot monitor the copying process of the first APP. Therefore, only when the copied first APP is running, the electronic device can monitor it to detect whether it stores the second shared library that is the same as the file data of the first shared library, so that the electronic device can find out in time whether there are stored the same shared library. In addition, the electronic device detects when the first APP is finished running, which can prevent the running of the APP from being affected.
- the APP eg, the first APP
- the electronic device when it finishes running the first APP for the first time, it may execute the shared library multiplexing method provided by the embodiment of the present application.
- the electronic device can delete the file data of the first shared library. Then, after the electronic device finishes running the first APP for the first time, the electronic device can delete the file data of the first shared library. Therefore, after the electronic device runs the first APP again, it is no longer necessary to determine that there is a second shared library in the electronic device that is the same as the file data of the first shared library of the first APP. In this way, the computing pressure of the electronic device can be reduced.
- the shared library (such as the first shared library) that is the same as the file data of the shared library (such as the second shared library) stored in the electronic device can be deleted, and the utilization rate of the storage space of the electronic device can be improved; and , the second shared library replaces the first shared library, so that different APPs can call the same shared library, thereby ensuring that the APP can run normally.
- the electronic device in the embodiment of the present application may be a tablet computer, a mobile phone, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular Phones, personal digital assistants (PDAs), augmented reality (AR) ⁇ virtual reality (VR) devices, in-vehicle devices, etc. are installed with multiple APPs (each APP in the multiple APPs includes at least one shared library), the specific form of the electronic device is not particularly limited in this embodiment of the present application.
- the execution body of the shared library multiplexing method provided by the present application may be a shared library multiplexing apparatus (hereinafter referred to as "multiplexing apparatus"), and the multiplexing apparatus may be the electronic device shown in FIG. 1 . Meanwhile, the multiplexing device may also be a central processing unit (Central Processing Unit, CPU) of the electronic device, or a control module in the electronic device for multiplexing a shared library.
- CPU Central Processing Unit
- the method for multiplexing a shared library executed by an electronic device is used as an example to describe the method for multiplexing a shared library provided by the embodiment of the present application.
- the electronic device provided by the present application is introduced by taking the electronic device as the mobile phone 100 shown in FIG. 1 as an example.
- the mobile phone 100 shown in FIG. 1 is only an example of an electronic device, and the mobile phone 100 may have more or less components than those shown in the figure, two or more components may be combined, or Available in different parts configurations.
- the various components shown in FIG. 1 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
- the mobile phone 100 may include: a processor 110 , an external memory interface 120 , an internal memory 121 , a universal serial bus (USB) interface 130 , a charging management module 140 , a power management module 141 , and a battery 142 , Antenna 1, Antenna 2, Mobile Communication Module 150, Wireless Communication Module 160, Audio Module 170, Speaker 170A, Receiver 170B, Microphone 170C, Headphone Interface 170D, Sensor Module 180, Key 190, Motor 191, Indicator 192, Camera 193 , a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
- a processor 110 an external memory interface 120
- an internal memory 121 a universal serial bus (USB) interface 130
- USB universal serial bus
- the aforementioned sensor module 180 may include sensors such as pressure sensors, gyroscope sensors, air pressure sensors, magnetic sensors, acceleration sensors, distance sensors, proximity light sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, and bone conduction sensors.
- sensors such as pressure sensors, gyroscope sensors, air pressure sensors, magnetic sensors, acceleration sensors, distance sensors, proximity light sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, and bone conduction sensors.
- the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone 100 .
- the cell phone 100 may include more or fewer components than shown, or some components may be combined, or some components may be split, or a different arrangement of components.
- the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 is the control center of the mobile phone 100, uses various interfaces and lines to connect various parts of the mobile phone 100, and executes the mobile phone by running or executing the application program stored in the internal memory 121 and calling the data stored in the internal memory 121. 100 various functions and processing data.
- processor 110 may include one or more processing units.
- the above-mentioned processor 110 may further include a program execution chip for running an executable program and a shared library of an APP.
- the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
- application processor application processor, AP
- modem processor graphics processor
- graphics processor graphics processor
- ISP image signal processor
- controller memory
- video codec digital signal processor
- DSP digital signal processor
- NPU neural-network processing unit
- the controller may be the nerve center and command center of the cell phone 100 .
- the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
- a memory may also be provided in the processor 110 for storing instructions and data.
- the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
- the processor 110 may include one or more interfaces.
- the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- PCM pulse code modulation
- UART universal asynchronous transceiver
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- SIM subscriber identity module
- USB universal serial bus
- the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration, and does not constitute a structural limitation of the mobile phone 100 .
- the mobile phone 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
- the charging management module 140 is used to receive charging input from the charger.
- the charger may be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
- the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
- the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
- the power management module 141 and the charging management module 140 may also be provided in the same device.
- the wireless communication function of the mobile phone 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
- the antenna 1 of the mobile phone 100 is coupled with the mobile communication module 150
- the antenna 2 is coupled with the wireless communication module 160, so that the mobile phone 100 can communicate with the network and other devices through wireless communication technology.
- the mobile phone 100 may send the above-mentioned first account number and login password to other devices through a wireless communication technology.
- Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
- Each antenna in handset 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
- the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
- the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the mobile phone 100 .
- the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
- the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
- LNA low noise amplifier
- the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
- the wireless communication module 160 can provide applications on the mobile phone 100 including wireless local area networks (WLAN) (such as (wireless fidelity, Wi-Fi) networks), bluetooth (BT), global navigation satellite system (global navigation satellite system) Satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
- WLAN wireless local area networks
- BT wireless fidelity, Wi-Fi
- BT global navigation satellite system Satellite system
- GNSS global navigation satellite system Satellite system
- frequency modulation frequency modulation, FM
- NFC near field communication technology
- infrared technology infrared, IR
- the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
- the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
- the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
- the mobile phone 100 realizes the display function through the GPU, the display screen 194, and the application processor.
- the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
- the GPU is used to perform mathematical and geometric calculations for graphics rendering.
- Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
- Display screen 194 is used to display images, videos, and the like.
- the display screen 194 includes a display panel.
- the display screen 194 may be used to display the application interface of the above-mentioned first APP, such as a device sharing interface, a device search interface, and a two-dimensional code scanning interface.
- the mobile phone 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
- the ISP is used to process the data fed back by the camera 193 .
- Camera 193 is used to capture still images or video.
- the mobile phone 100 may include one or N cameras 193 , where N is a positive integer greater than one.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100 .
- the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
- the internal memory 121 is used to store application programs and data, and the processor 110 executes various functions of the mobile phone 100 and data processing by running the application programs and data stored in the internal memory 121 .
- the internal memory 121 mainly includes a storage program area and a storage data area, wherein the storage program area can store binary files such as operating systems, executable programs, and shared libraries; the storage data area can store the correspondence between data.
- the internal memory 121 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory, such as a magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
- RAM Random Access Memory
- the internal memory 121 may store various operating systems.
- the above-mentioned internal memory 121 may be independent and connected to the processor 110 through the above-mentioned communication bus; the internal memory 121 may also be integrated with the processor 110 .
- the mobile phone 100 can implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor. Such as music playback, recording, etc.
- the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
- the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
- the SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the mobile phone 100 by being inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 .
- the mobile phone 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
- the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on.
- the mobile phone 100 may also use a flashlight, a pico-projection device, a near field communication (Near Field Communication, NFC) device, etc., which will not be repeated here.
- a flashlight a pico-projection device
- a near field communication (Near Field Communication, NFC) device etc., which will not be repeated here.
- the present application takes the electronic device as the mobile phone 100 as an example to introduce the system architecture of the electronic device provided by the present application.
- the system architecture of the mobile phone 100 may include: an application layer, an operating system (Operating System, OS) (such as Android system), kernel layer, hardware layer.
- OS Operating System
- OS operating System
- kernel layer hardware layer.
- the application layer can include a series of application packages.
- APP(A), APP(B), etc. by
- the shared library files in the system are all so files (*.so).
- APP(A) includes A1.so, A2.so, A3.so, etc.
- APP(B) includes B1.so, B2.so, B3.so, and the like.
- the system is a computer program that manages hardware and software resources of the mobile phone 100 .
- the system needs to handle basic tasks such as managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating the network, and managing the file system.
- the system may also provide an operating interface that enables the user to interact with the system.
- the system includes an installation package manager service (Package Manager Service, PMS).
- PMS is One of the system services, mainly responsible for management
- the application of the system provides installation, uninstallation, optimization and query services for various APK files.
- the PMS includes an APP monitoring component
- the APP monitoring component runs in the PMS, can monitor the installation, update, and deletion of the APP, and sends a notification message to the multiplexing component.
- the APP monitoring component will send a notification message to the multiplexing component to inform the multiplexing component APP(A) that the installation has been completed.
- the kernel layer is the layer between hardware and software.
- the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
- the kernel layer further includes a file system and a memory operating system.
- the file system is used to manage data stored in the internal memory 121 .
- the file system can abstract the data stored in the internal memory 121 into specific files, and provide operations such as adding, deleting, and modifying files.
- the file system may store the executable program A, the first shared library, and the second shared library in the first APP, as well as the executable program B and the third shared library in the second APP, in the in the internal memory 121.
- the processor 110 calls the shared library through the file system.
- the Memory Operating System is used to manage memory. Because the memory access speed is faster than the hardware layer. Therefore, when the processor 110 runs the APP, the shared library of the APP needs to be loaded into the memory operating system to improve the running speed of the APP.
- the file system includes a multiplexing component, and the multiplexing component can realize the multiplexing of shared libraries in the file system. Exemplarily, the file data of A1.so and B1.so are the same, the file data of A2.so and B2.so are the same, and the multiplexing component can make APP(A) and APP(B) call B1.so together , B2.so.
- Hardware layer including memory (eg flash memory).
- the flash memory can keep data for a long time even without current supply, and its storage characteristic is equivalent to that of a hard disk.
- Exemplarily, S1.so, S2.so, S3.so, etc. are stored in the Flash memory.
- system architecture of the electronic device shown in FIG. 2A can support the electronic device to execute the shared library multiplexing method provided by the embodiment of the present application when the electronic device completes the installation of the first APP.
- FIG. 2C a flowchart of a method for multiplexing a shared library provided by an embodiment of the present application.
- the method for multiplexing the shared library in the embodiment of the present application is introduced.
- the file data of A1.so is the same as that of B1.so
- the file data of A2.so is the same as that of B2.so.
- the APP monitoring component sends a notification message to the multiplexing component.
- the multiplexing component detects the existence of B1.so with the same file data as A1.so and B2.so with the same file data as A2.so in the hardware layer (eg, the internal memory 121 ), and deletes A1.so and A2.so.
- the mobile phone 100 runs APP(A) or APP(B) calls a shared library (eg B1.so)
- the memory operating system maps B1.so into the memory, so that the processor 110 calls B1.so in the memory.
- the electronic device is the mobile phone 100 as an example to introduce the system architecture of another electronic device provided in this application.
- the system architecture of the mobile phone 100 includes: an application layer, a kernel layer, and a hardware layer.
- the application layer for the introduction of the application layer, reference may be made to the above-mentioned introduction to the application layer in FIG. 2A , which will not be repeated here.
- the kernel layer in addition to the above description of the kernel layer in FIG. 2A , the memory operating system of the kernel layer also includes a monitoring component.
- the monitoring component runs on the memory operating system, can monitor the calls made by the mobile phone 100 to the shared library, and sends a notification message to the multiplexing component.
- the multiplexing component detects that the mobile phone 100 stops calling B1.so, and sends a notification message to the multiplexing component to inform the multiplexing component that the process of APP(A) is closed.
- the hardware layer for the introduction of the hardware layer, reference may be made to the above-mentioned introduction to the hardware layer in FIG. 2A , which will not be repeated here.
- system architecture of the electronic device shown in FIG. 2D can support the electronic device to execute the shared library multiplexing method provided by the embodiment of the present application when the electronic device finishes running the first APP.
- the multiplexing method of the shared library in the embodiment of the present application is introduced.
- the file data of A1.so is the same as that of B1.so
- the file data of A2.so is the same as that of B2.so.
- the APP monitoring component sends a notification message to the multiplexing component.
- the multiplexing component detects the existence of B1.so with the same file data as A1.so and B2.so with the same file data as A2.so in the hardware layer (eg, the internal memory 121 ), and deletes A1.so and A2.so.
- the memory operating system maps B1.so into the memory, so that the processor 110 calls B1.so in the memory.
- the methods in the following embodiments can all be implemented in an electronic device having the above-mentioned hardware structure and the above-mentioned system architecture.
- the above-mentioned electronic device is a mobile phone 100 as an example to describe the methods of the embodiments of the present application.
- a plurality of APPs are installed in the mobile phone 100, and each APP in the plurality of APPs includes at least one shared library.
- the first APP can be a shopping application 1, and the shopping application 1 includes a shared library a and a shared library b; the second APP can be a shopping application 2, and the shopping application 2 includes a shared library c; the third APP can be a payment application,
- the payment application includes a shared library d, a shared library e, and a shared library f.
- each APP in the mobile phone 100 includes an executable program and at least one shared library.
- the file data of each shared library contains multiple library functions.
- the executable program will call the library function in the shared library to complete a certain function of the APP.
- the first APP is a shopping application
- the shopping application includes an executable program a, a shared library b, and a shared library c.
- the executable program a may be run first.
- the mobile phone 100 maps the shared library b and the shared library c into the memory, so that the executable program a can access the library from the memory function.
- the following three relationships may exist between any shared library in the first APP and any shared library in the second APP.
- the first APP and the second APP are any shared libraries in the mobile phone 100 .
- Relationship 1 The two shared libraries are different.
- the two shared libraries are different, which specifically means that the file data of the two shared libraries are different.
- the file data of the two shared libraries is different, which means that the binary files of the two shared libraries are different.
- the mobile phone 100 compiles the file data of the two shared libraries respectively to obtain two different secondary files.
- the shared library a in the first APP includes library function 1 , library function 2 and library function 3
- the shared library b in the second APP includes library function 4 and library function 5
- the library function 1, the library function 2, the library function 3, the library function 4 and the library function 5 are different in pairs. So shared library a is completely different from shared library b.
- the shared library a in the first APP includes library function 1, library function 2, and library function 3, and the shared library b in the second APP includes library function 3, library function 4, and library function 5.
- the library function 1, the library function 2, the library function 3, the library function 4 and the library function 5 are different in pairs. So shared library a is partially different from shared library b.
- file names of two different shared libraries may be the same or different.
- Relationship 2 The two shared libraries are the same.
- the two shared libraries are the same, which specifically means that the file data of the two shared libraries are the same.
- the file data of the two shared libraries is the same, which means that the binary files of the two shared libraries are the same.
- the library functions included in the two shared libraries are the same, and the mobile phone 100 respectively compiles the file data of the two shared libraries, two identical secondary files can be obtained.
- file names of two identical shared libraries may be the same or different.
- each shared library in an APP is different.
- the first APP includes a shared library a, a shared library b, and a shared library c
- the shared library a includes a first library function
- the shared library b includes a second library function and a third library function
- the shared library c includes a fourth library function.
- the file name of shared library a is "shared library a"
- the file data of shared library a is the first library function
- the file name of shared library b is "shared library b”
- the file data of shared library b is the second library function and the third library function
- the file name of the shared library c is "shared library c”
- the file data of the shared library c is the fourth library function. That is, the file names and file data of the shared library a, the shared library b, and the shared library c are different. Therefore, shared library a, shared library b, and shared library c are different.
- An embodiment of the present application provides a method for multiplexing a shared library. As shown in FIG. 3 , the method for multiplexing a shared library may include S301-S304.
- the mobile phone 100 determines whether there is a second shared library in the mobile phone 100 that has the same file data as the first shared library of the first APP.
- the first APP includes at least one shared library, and the first shared library is any shared library in the first APP.
- the first APP includes three shared libraries, and the three shared libraries are shared library a, shared library b, and shared library c, respectively.
- the first shared library may be either a shared library a, a shared library b, or a shared library c.
- the mobile phone 100 may execute the method of the embodiment of the present application for each shared library of the first APP.
- the mobile phone 100 can determine whether there is a second shared library in the mobile phone 100 that has the same file data as the first shared library of the first APP in the following two ways.
- Manner 1 The mobile phone 100 uses a preset algorithm according to the file data of the first shared library to generate the first identifier of the first shared library.
- the preset algorithm may be Secure Hash Algorithm 1 (SHA-1), MD5 Message-Digest Algorithm (MD5), or Data Encryption Standard (Data Encryption) Standard, DES) algorithm, etc., which are not limited in this embodiment of the present application.
- SHA-1 Secure Hash Algorithm 1
- MD5 Message-Digest Algorithm MD5 Message-Digest Algorithm
- DES Data Encryption Standard
- the mobile phone 100 may use SHA-1 according to the file data of the first shared library to generate a hash value of 6cd7a for the file data of the first shared library.
- the cell phone 100 determines whether the first identification and the second identification are the same.
- the second identifier is generated by the mobile phone 100 using a preset algorithm according to the file data of any shared library in the mobile phone 100 .
- the method for the mobile phone 100 to determine whether the first identification and the second identification are the same may include: the mobile phone 100 searches the first data table whether there is an identification that is the same as the first identification.
- the first data table is used to store the correspondence between the identifier of the shared library and the number (Number) of the inode. In the first data table, each identification is different.
- the inode corresponding to the identifier of the shared library is allocated by the mobile phone 100 for the shared library. For the specific allocation process, reference may be made to the description in step 302, which will not be repeated here.
- Table 1 it shows the correspondence between the inode allocated to the shared library by the mobile phone 100 and the identification (Identification) of the shared library.
- the first inode and the identification a of the shared library a the number of the first inode is 01, and the identification a is e908;
- the second inode and the identification b of the shared library b the second inode is The number is 02, and the identifier b is 6cd7a;
- the first data table can be called a ShareMap table.
- the mobile phone 100 stores the correspondence between the inode number and the identifier of the shared library in the first data table, and can store the correspondence between the inode and the identifier of the shared library.
- the mobile phone 100 may also store the correspondence between the number of the inode and the identifier of the shared library in other data tables , the embodiments of the present application do not limit this.
- the mobile phone 100 may also store the correspondence between the number of the inode and the identifier of the shared library in a tree structure, which is not limited in this embodiment of the present application.
- the mobile phone 100 stores the correspondence between the number of the inode and the identifier of the shared library in the first data table as an example to describe the method of the embodiment of the present application.
- the mobile phone 100 determines that there is a second shared library in the mobile phone 100 that has the same file data as the first shared library.
- the mobile phone 100 uses SHA-1 according to the file data of the shared library c, and determines that the identifier c of the shared library c is e908.
- the mobile phone 100 traverses the identifiers in the first data table, and determines that the identifier a is e908. Therefore, the identity c is the same as the identity a.
- both the first identifier and the second identifier are generated by the mobile phone 100 using a preset algorithm according to the file data of the shared library, therefore, when the first identifier and the second identifier are the same, the mobile phone 100 determines that the mobile phone 100 There is a second shared library that has the same file data as the first shared library.
- the mobile phone 100 determines that there is no second shared library in the mobile phone 100 that is the same as the file data of the first shared library. It can be understood that, since both the first identifier and the second identifier are generated by the mobile phone 100 according to the file data of the shared library using a preset algorithm, therefore, in the case where the first identifier and the second identifier are different, the mobile phone 100 determines that the mobile phone 100 There is no second shared library that has the same file data as the first shared library.
- the mobile phone 100 saves the correspondence between the first identifier and the second inode.
- the correspondence between the first identifier and the second inode stored by the mobile phone 100 reference may be made to the description of step 401, which will not be repeated here.
- the difference between the first identifier and the second identifier indicates that the second shared library that is the same as the file data of the first shared library does not exist in the electronic device. Therefore, the electronic device needs to save the correspondence between the first identifier and the second inode, so that after storing the first shared library, it can determine whether the file data of other shared libraries stored in the electronic device is the same as the first shared library according to the first identifier. same.
- Method 2 The mobile phone 100 compares the file data of the first shared library with the file data of each shared library in the mobile phone 100 to determine whether there is a second shared library in the mobile phone 100 that is the same as the file data of the first shared library.
- the mobile phone 100 compares the file data of the first shared library with the file data of each shared library in the mobile phone 100 through a preset comparison algorithm or a preset comparison tool, and determines whether there is any file data in the mobile phone 100.
- a second shared library with the same file data as the first shared library.
- the mobile phone 100 may compare the file data of the first shared library with the file data of a shared library in the mobile phone 100 each time.
- the mobile phone 100 includes a shared library a, a shared library b, a shared library c, and a shared library d.
- the mobile phone 100 compares the file data of the first shared library with the file data of the shared library a through a preset comparison tool, and determines The file data of the first shared library is different from the file data of the shared library a; after that, the mobile phone 100 compares the file data of the first shared library with the file data of the shared library b to determine the file data of the first shared library and the shared library The file data of b are different; after that, the mobile phone 100 compares the file data of the first shared library with the file data of the shared library c, and determines that the file data of the first shared library is the same as the file data of the shared library c.
- the mobile phone 100 stops comparing the file data of the first shared library with the file data of the shared library of the mobile phone 100 , that is, the mobile phone 100 no longer compares the file data of the first shared library with the file data of the shared library d.
- the mobile phone 100 may compare the file data of the first shared library with the file data of multiple shared libraries in the mobile phone 100 at the same time.
- the mobile phone 100 includes a shared library a, a shared library b, a shared library c, and a shared library d, and the mobile phone 100 compares the file data of the first shared library with the shared library a, shared library b, and The file data of the shared library c is compared, and it is determined that the file data of the first shared library is the same as the file data of the shared library c. Then the mobile phone 100 stops comparing the file data of the first shared library with the file data of the shared library of the mobile phone 100 , that is, the mobile phone 100 no longer compares the file data of the first shared library with the file data of the shared library d.
- the mobile phone 100 executes step 302; if the second shared library does not exist in the mobile phone 100, the mobile phone 100 executes step 401.
- the mobile phone 100 saves the correspondence between the first index node inode and the file name of the first shared library.
- the first inode is allocated by the mobile phone 100 for the second shared library.
- the mobile phone 100 may save the correspondence between the first inode and the file names of the second shared library. Specifically, the mobile phone 100 saves the correspondence between the first inode and the file name of the second shared library by saving the correspondence between the number of the first inode and the file name of the second shared library.
- the mobile phone 100 stores the correspondence between the serial number of the first inode and the file name of the second shared library in the second data table.
- Table 2 it shows the correspondence between the number of the inode allocated by the mobile phone 100 for the shared library and the file name (File name) of the shared library.
- the number of the first inode is 01
- the file name of the second shared library is the shared library a
- the second data table is the Directory table.
- the mobile phone 100 may also store the correspondence between the inode number and the file name of the shared library.
- the relationship is stored in other data tables, which is not limited in this embodiment of the present application.
- the mobile phone 100 may also store the correspondence between the inode number and the file name of the shared library in a tree structure, which is not limited in this embodiment of the present application.
- the method of the embodiment of the present application is described by taking the mobile phone 100 storing the correspondence between the inode number and the file name of the shared library in the second data table as an example.
- the first inode indicates a first storage area for storing file data of the second shared library.
- each shared library meta information includes: creation time (Creation time), file size (File size), storage location (Storage location), and the like.
- creation time Create time
- file size File size
- Storage location Storage location
- the number of the first inode is 01
- the file name of the second shared library is shared library a
- the creation date of the second shared library is "2020-08-10 09:00”
- the file size of the second shared library is It is "100 kilobytes (Kilobyte, kb)”
- the storage location of the second shared library is "/data/app1/”.
- the first inode can be "Number: 01, File name: Shared library a, Creation time: 2020-08-10 09:00, File size: 100, Storage location: /data/app1/".
- the mobile phone 100 can determine the inode corresponding to the file name through the file name of the shared library. In this way, the mobile phone 100 can obtain the storage location of the shared library from the inode, and read the file data of the shared library from the storage location.
- the mobile phone 100 determines that there is a second shared library in the mobile phone 100 that is the same as the file data of the first shared library of the first APP, the first APP has been stored in the mobile phone 100 . That is, the file data of the first shared library has been stored in the mobile phone 100 .
- the mobile phone 100 allocates a second inode to the first shared library, the mobile phone 100 saves the correspondence between the file name of the first shared library and the second inode, and the second inode stores the meta information of the first shared library.
- Table 2 shows the correspondence between the number of the inode allocated by the mobile phone 100 for the shared library and the file name (File name) of the shared library.
- the number of the second inode is 02, the file name of the first shared library is shared library b, and the second data table is the Directory table.
- the mobile phone 100 determines the number of the first inode corresponding to the second identification from the first data table according to the second identification of the second shared library, that is, the first inode number.
- the number of the first inode corresponding to the second shared library save the correspondence between the number of the first inode and the file name of the first shared library, and delete the correspondence between the number of the second inode and the file name of the first shared library relation.
- Table 3 as shown in Table 4, it is the correspondence between the number of the inode and the file name (File name) of the shared library.
- the number of the first inode is 01
- the file name of the second shared library is shared library a
- the file name of the first shared library is shared library b
- the second data table is the Directory table.
- the mobile phone 100 determines the number of the first inode corresponding to the second shared library according to the file data of the second shared library, and uses the file name of the first shared library The corresponding relationship with the number of the second inode is modified to the corresponding relationship between the file name of the first shared library and the number of the first inode.
- the mobile phone 100 saves the correspondence between the first inode and the file name of the first shared library. Therefore, when the mobile phone 100 runs the first APP to call the first shared library, the mobile phone 100 can find the first inode according to the file name of the first shared library. In addition, since the first inode indicates the first storage area for storing the file data of the second shared library, the mobile phone 100 can read the file data of the second shared library according to the first inode, that is, the mobile phone 100 actually calls the file data at this time.
- the shared library is the second shared library. Since the file data of the second shared library is the same as the file data of the first shared library, the mobile phone 100 can still ensure the normal operation of the first APP by calling the second shared library.
- the mobile phone 100 deletes the file data of the first shared library.
- the mobile phone 100 searches the second inode corresponding to the first shared library through the second data table according to the file name of the first shared library.
- the mobile phone 100 determines, according to the second inode, a second storage area for storing the file data of the first shared library.
- the mobile phone 100 deletes the file data of the first shared library according to the second storage area.
- the mobile phone 100 may also search the tree structure for the second inode corresponding to the first shared library, which is not limited in this embodiment of the present application.
- deleting the file data of the first shared library by the mobile phone 100 not only does not affect the normal operation of the first APP, but also saves the storage space of the electronic device, avoids storing multiple identical shared libraries in the electronic device, and improves the performance of the electronic device. Utilization of storage space for electronic products.
- the mobile phone 100 needs to delete the file data of the first shared library according to the corresponding relationship between the file name of the first shared library and the second inode. Therefore, the mobile phone 100 needs to delete the file data of the first shared library before deleting or modifying the correspondence between the file name of the first shared library and the second inode. Under the condition that this condition is satisfied, this embodiment of the present application does not limit the order in which step 302 and step 303 are performed by the mobile phone 100 . That is, the mobile phone 100 may perform step 302 first, and then perform step 303; or, the mobile phone 100 may perform step 303 first, and then perform step 302; or, the mobile phone 100 may perform step 302 and step 303 at the same time.
- the mobile phone 100 runs the first APP to call the first shared library, the mobile phone 100 searches for the first inode corresponding to the file name of the first shared library, and reads the file of the second shared library stored in the storage area indicated by the first inode data.
- the mobile phone 100 when the mobile phone 100 runs the first APP to call the first shared library, the mobile phone 100 searches the first inode corresponding to the first shared library through the second data table according to the file name of the first shared library. The mobile phone 100 determines, according to the first inode, a first storage area for storing the file data of the second shared library. After that, the mobile phone 100 reads the file data of the second shared library in the first storage area according to the first storage area.
- the first inode is "Number: 01, File name: shared library a, Creation time: 2020-08-1009:00, File size: 100, Storage location: /data/app1/".
- the mobile phone 100 searches the second data table for the inode number 01 corresponding to the shared library b, and determines the first inode number 01. After that, the mobile phone 100 determines the storage location as "/data/app1/" according to the first inode, and reads the file data of the second shared library from "/data/app1/".
- the mobile phone 100 may also search for the first inode corresponding to the first shared library through the tree structure, which is not limited in this embodiment of the present application.
- the mobile phone 100 runs the first APP to call the first shared library
- what the mobile phone 100 actually calls is the second shared library.
- the electronic device only maps the second shared library into the memory, and both the first APP and the second APP can call the second APP from the memory
- the file data of the shared library reduces the space occupied by the memory and improves the utilization of the memory.
- the electronic device may also save the correspondence between the first inode and the file name of the first shared library. In this way, when the electronic device runs the first APP to call the first shared library, the electronic device does not need to call the file data of the first shared library, but only needs to search the first inode through the file name of the first shared library to read the second The file data of the shared library can ensure the normal operation of the APP.
- the electronic device runs the APP to call the shared library
- the shared library can be mapped into the memory, and then the shared library can be called from the memory.
- the performance of the electronic device can be improved.
- the electronic device runs multiple APPs (such as the first APP and the second APP including the second shared library)
- the first shared library and the second shared library are respectively mapped into the memory, because the mapped data If the amount is large, it will not only affect the I/O performance, but also cause a waste of memory space.
- the electronic device only maps the second shared library into the memory, and both the first APP and the second APP can call the file data of the second shared library from the memory when running. In this way, not only the amount of data mapped to the memory is reduced, the I/O performance is improved, but also the space occupied by the memory can be reduced, and the utilization rate of the memory can be improved.
- an embodiment of the present application provides a method for multiplexing a shared library. As shown in FIG. 4 , after S301 , the method for multiplexing a shared library may further include S401 to S403 .
- the mobile phone 100 allocates a second inode for the first shared library.
- the second inode indicates a second storage area for saving the file data of the first shared library.
- the mobile phone 100 allocates a second inode to the first shared library, so that when the first APP runs and calls the first shared library, the mobile phone 100 can read the file data of the first shared library according to the second inode , to ensure the normal operation of the first APP.
- the mobile phone 100 saves the correspondence between the first identifier and the second inode. Specifically, the mobile phone 100 determines the number of the second inode allocated to the first shared library, and stores the first identifier and the number of the second inode in the first data table.
- the mobile phone 100 saves the correspondence between the second inode and the file name of the first shared library.
- the mobile phone 100 saves the correspondence between the second inode and the file name of the first shared library, so that when the first APP runs and calls the first shared library, the mobile phone 100 can search for the first shared library according to the file name of the first shared library.
- the corresponding second inode and read the file data of the first shared library according to the second inode, so as to ensure the normal operation of the first APP.
- the mobile phone 100 when the mobile phone 100 runs the first APP to electrophorese the first shared library, the mobile phone 100 searches the second inode corresponding to the first shared library through the second data table according to the file name of the first shared library. The mobile phone 100 determines, according to the second inode, a second storage area for storing the file data of the first shared library. After that, the mobile phone reads the file data of the first shared library in the second storage area according to the second storage area.
- the electronic device needs to store the first shared library. In this way, when the electronic device runs the first APP to call the first shared library, the electronic device can search for the second inode through the file name of the first shared library, thereby reading the file of the first shared library data to ensure the normal operation of the APP.
- the inode in addition to storing the meta information of the shared library corresponding to the inode, the inode also includes the number of links (Links).
- the number of inode links is the number of shared libraries corresponding to the inode.
- the shared library corresponding to the first inode includes the second shared library, the number of shared libraries corresponding to the first inode is 1, and the number of links of the first inode is 1;
- the shared library corresponding to the second inode includes The number of shared libraries corresponding to the first shared library and the second inode is 1, and the number of links of the second inode is 1.
- the shared library corresponding to the first inode includes a first shared library and a second shared library, the number of shared libraries corresponding to the first inode is 2, and the number of links of the first inode is 2.
- the initial value of the number of links per inode is 0. That is, when the mobile phone 100 has not allocated an inode to a shared library, the number of shared libraries corresponding to the inode is 0. Therefore, the initial value of the link count of the inode is 0.
- the mobile phone 100 adds 1 to the link number of the first inode.
- the number of links of the first inode is the number of shared libraries corresponding to the first inode. Exemplarily, in combination with Table 3 and Table 4, before the file name of the first shared library is established with the first inode, the number of links of the first inode is 1; the file name of the first shared library is established with the first inode. After the correspondence, the number of links of the first inode is 2.
- the mobile phone 100 determines the first inode corresponding to the second identifier of the second shared library.
- the mobile phone 100 stores the file name of the first shared library and the number of the first inode in the second data table according to the file name and the first inode of the first shared library, and adds 1 to the link number of the first inode.
- the mobile phone 100 changes the link number of the first inode by adding 1 to the link number of the first inode, thereby updating the shared library corresponding to the first inode. The number enables the mobile phone 100 to determine the number of shared libraries to be replaced by the second shared library according to the number of links of the first inode.
- the mobile phone 100 adds 1 to the link number of the second inode.
- the number of links of the second inode is the number of shared libraries corresponding to the second inode.
- the mobile phone 100 creates a second inode. At this time, the second inode has no corresponding shared library, and the link number of the second inode is 0.
- the shared library corresponding to the second inode includes the first shared library, and the link number of the second inode is 1.
- the mobile phone 100 changes the link number of the second inode by adding 1 to the link number of the second inode, thereby updating the number of shared libraries corresponding to the second inode, so that the mobile phone 100 can determine the first shared library according to the link number of the second inode Number of alternate shared libraries.
- the above embodiments are only for adding an APP (eg, a first APP including a first shared library) in the mobile phone 100 , that is, for adding a first shared library in the mobile phone 100 , and related steps performed by the mobile phone 100 .
- the following embodiments of the present application provide a method for multiplexing a shared library, and the method for multiplexing the shared library is introduced in combination with an application scenario where the mobile phone 100 deletes an APP.
- the method of this embodiment of the present application may further include S601-S604.
- the mobile phone 100 may perform S601-S604 before executing the above method process, during the process of executing the above method process, or after executing the above method process.
- the mobile phone 100 searches for the third inode corresponding to the file name of the third shared library.
- the third shared library is any one of the at least one shared library included in the second APP.
- the second APP includes a shared library a, a shared library b, and a shared library c
- the third shared library may be a shared library a, a shared library b, or a shared library c.
- the mobile phone 100 may execute the methods of the embodiments of the present application for each shared library of the second APP.
- the mobile phone 100 determines the file name of the third shared library of the second APP, and searches the second data table for the third shared library corresponding to the file name of the third shared library. inodes.
- Table 5 it shows the correspondence between the number of the inode allocated by the mobile phone 100 for the shared library and the file name of the shared library.
- the number of the third inode is 03
- the file name of the third shared library is the shared library c
- the second data table is the Directory table.
- the mobile phone 100 determines a third inode corresponding to the number of the third inode according to the number of the third inode.
- the mobile phone 100 determines whether the link number of the third inode is equal to 1.
- the mobile phone 100 performs step 503; if the link number of the third inode is greater than 1, the mobile phone 100 performs step 504.
- the third inode since the correspondence between the third inode and the shared library is stored in the mobile phone 100 at this time, the third inode corresponds to at least one shared library. Therefore, the link count of the third inode will not be less than 1, that is, the link count of the third inode will not be equal to 0.
- the mobile phone 100 deletes the file data of the third shared library, the third inode, and the correspondence between the file name of the third shared library and the third inode from the mobile phone 100.
- the mobile phone 100 determines the storage area of the file data of the third shared library according to the storage location of the third shared library in the inode, and deletes the storage area of the third shared library. file data.
- the mobile phone 100 deletes the correspondence between the file name of the third shared library and the third inode in the second data table according to the file name of the third shared library; or, the mobile phone 100 deletes the second data table according to the number of the third inode
- the mobile phone 100 deletes the third inode according to the number of the third inode.
- the mobile phone 100 deletes the correspondence between the number of the third inode and the third identifier from the first data table according to the number of the third inode.
- the mobile phone 100 deletes the correspondence between the third inode and the third identifier from the mobile phone 100 .
- the link number of the third inode is equal to 1, it means that the shared library corresponding to the third inode is only the third shared library. That is to say, the third shared library does not need to replace other shared libraries, that is, the APPs other than the second APP will not call the third shared library when running. Also, after the mobile phone 100 deletes the second APP, no APP in the mobile phone 100 calls the third shared library. Therefore, when the mobile phone 100 deletes the second APP, the mobile phone 100 deletes the file data, the third inode, the third shared library, and the third shared library. The correspondence between the file name of the shared library and the third inode, and the correspondence between the third inode and the third identifier, thereby saving the storage space of the mobile phone 100 .
- APP(A) includes shared library a
- APP(B) includes shared library b
- APP(C) includes shared library c
- the file data of shared library a, shared library b, and shared library c are all the same.
- the shared library corresponding to the third inode includes: shared library a, shared library b, and shared library c, therefore, the number of links of the third inode is 3.
- the mobile phone 100 calls the shared library a, the shared library b, or the shared library c
- the mobile phone 100 calls the file data of the shared library a.
- the mobile phone 100 deletes APP (C) the mobile phone 100 does not delete the file data of the shared library c, but only reduces the number of links of the third inode by 1.
- the shared library corresponding to the third inode includes the shared library a and the shared library b.
- the third inode corresponds to the shared library a and the shared library b.
- the number of inode links is 2.
- the link number of the third inode determines the number of shared libraries that the third shared library replaces.
- the electronic device can determine whether there is still APP in the electronic device that needs to call the file data of the shared library (such as the third shared library) according to the link number of the inode (for example, the third inode), so as to determine whether the third shared library can be deleted.
- the file data of the shared library corresponding to the three inodes, the third inode, and the correspondence between the file name of the third shared library and the third inode. In this way, it can not only reduce the waste of storage space, but also ensure that the APP in the electronic device will not fail to run normally due to the lack of the shared library.
- the electronic device can not only store the executable program of the APP and at least one shared library, but also store information data in the APP such as text files, pictures, audio, etc.
- the executable program can call the information data in the APP, and display the information data (such as pictures) to the user.
- the electronic device will repeatedly store the picture a, which only results in a waste of storage space.
- the shared library multiplexing method provided by the embodiment of the present application is not only applicable to the management of the shared library in the electronic device, but also can be used to manage the information data of the APP in the electronic device, which is not limited in the embodiment of the present application.
- the specific multiplexing method of information data reference may be made to the descriptions in the foregoing embodiments, which will not be repeated here.
- the attribute of the information data in the electronic device is a read-only attribute. In this way, the information data can be prevented from being tampered with, thereby ensuring that the information data of the APP will not change.
- the electronic device includes corresponding hardware structures and/or software modules for executing each function.
- the steps of a method for multiplexing a shared library in each example described in conjunction with the embodiments disclosed in this application can be implemented in hardware or in a combination of hardware and computer software. Whether a function is performed by hardware or electronic device software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
- the multiplexing device of the shared library may be divided into functional modules or functional units according to the foregoing method examples.
- each functional module or functional unit may be divided corresponding to each function, or two or more functions may be divided into two or more functional units.
- integrated in a processing module can be implemented in the form of hardware, and can also be implemented in the form of software function modules or functional units.
- the division of modules or units in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
- FIG. 6 shows a schematic diagram of an apparatus for multiplexing a shared library provided by an embodiment of the present application.
- the apparatus for multiplexing the shared library may be a functional module in the above-mentioned electronic device (eg, the mobile phone 100 ) for implementing the method of the embodiment of the present application.
- the apparatus for multiplexing the shared library may include: a processing unit 601 and a storage unit 602 .
- the storage unit 602 is used for saving at least one shared library.
- the storage unit may be used to store the shared library a.
- the processing unit 601 is configured to determine whether there is a second shared library in the storage list 602 that has the same file data as the first shared library of the first APP, where the first shared library is any shared library in the first APP.
- the processing unit 601 may be configured to perform S301.
- the storage unit 602 is further configured to save the correspondence between the inode of the first index node and the file name of the first shared library if the second shared library exists in the storage unit, wherein the first inode is the processing unit for the second shared library For the library allocation, the first inode indicates a first storage area for storing file data of the second shared library.
- the processing unit 601 may be configured to perform S302.
- the processing unit 601 is further configured to delete the file data of the first shared library from the storage unit.
- the processing unit 601 is further configured to search for the first inode corresponding to the file name of the first shared library when the first shared library is called from the first APP, and read the second shared library stored in the storage area indicated by the first inode file data.
- the processing unit 601 may also be used to perform S304.
- the processing unit 601 is specifically configured to, when the first APP is installed, determine whether there is a second shared library that is identical to the file data of the first shared library of the first APP in the storage unit; In the case of an APP, it is determined whether there is a second shared library that is identical to the file data of the first shared library of the first APP in the storage unit.
- the mobile phone 100 downloads and stores the APK of the first APP in the storage unit 602 through the network; when the APK of the first APP is decompressed, that is, when the first APP is installed, the processing unit 601 determines whether there is an APK with the first APP in the storage unit.
- the file data of the first shared library of the APP is the same as the second shared library.
- processing unit 601 is further specifically configured to determine whether there is a second shared library with the same file data as the first shared library of the first APP in the storage unit when the first APP is finished running for the first time.
- the processing unit 601 is further configured to allocate a second inode for the first shared library if the second shared library does not exist in the storage unit 602; wherein the second inode indicates the file data used to save the first shared library the second storage area.
- the processing unit 601 may also be used to perform S401.
- the storage unit 602 is further configured to save the correspondence between the second inode and the file name of the first shared library.
- the storage unit 602 may also be used to perform S402.
- the processing unit 601 is further configured to search the second inode corresponding to the file name of the first shared library when running the first APP to call the first shared library, and read the first shared storage area stored in the second storage area indicated by the second inode Library file data.
- the processing unit 601 may also be used to perform S403.
- the processing unit 601 is further configured to add 1 to the link number of the first inode if there is a second shared library in the storage unit; wherein, the link number of the first inode is the number of shared libraries corresponding to the first inode ; If there is no second shared library in the storage unit, then add 1 to the number of links of the second inode; wherein, the number of links of the second inode is the number of shared libraries corresponding to the second inode; wherein, the number of links of each inode The initial value of is 0.
- the processing unit 601 is further configured to search the storage unit 602 for the third inode corresponding to the file name of the third shared library when the second APP is deleted.
- the processing unit 601 may perform S601 in the foregoing method embodiments.
- the processing unit 601 is further configured to determine whether the link number of the third inode is equal to 1. For example, the processing unit 601 may perform S602 in the foregoing method embodiments.
- the processing unit 601 is further configured to delete the file data of the third shared library, the third inode, and the relationship between the file name of the third shared library and the third inode from the storage unit 602 if the link number of the third inode is equal to 1 corresponding relationship.
- the processing unit 601 may perform S603 in the above method embodiments.
- the processing unit 601 is further configured to reduce the link number of the third inode by 1 if the link number of the third inode is greater than 1.
- the processing unit 601 may perform S604 in the above method embodiments.
- the processing unit 601 is specifically configured to use a preset algorithm according to the file data of the first shared library to generate the first identification of the first shared library, and to determine whether the first identification and the second identification are the same; wherein, the second identification
- the identifier is generated by the processing unit using a preset algorithm according to the file data of any shared library in the storage unit; wherein, if the first identifier is the same as the second identifier, it is determined that there is a file data identical to the file data of the first shared library in the storage unit.
- the second shared library if the first identification is different from the second identification, it is determined that there is no second shared library with the same file data as the first shared library in the storage unit.
- the storage unit 602 is further configured to save the correspondence between the first identifier and the second inode if the first identifier is different from the second identifier.
- the processing unit 601 is further configured to delete the correspondence between the third inode and the third identifier from the storage unit 602 if the number of links of the third inode is equal to 1;
- the file data of the third shared library is generated using a preset algorithm.
- the processing unit 601 is further specifically configured to compare the file data of the first shared library with the file data of each shared library in the storage unit, and determine whether there is a first shared library in the storage unit 602 that is the same as the file data of the first shared library. Two shared libraries.
- an electronic device such as the mobile phone 100 shown in FIG. 1
- multiple APPs are installed in the electronic device, and each APP in the multiple APPs includes at least one shared library.
- the at least one shared library may include the second shared library.
- the electronic device may include: memory and one or more processors.
- the memory is coupled to the processor.
- the electronic device may also include a camera. Alternatively, the electronic device may be externally connected to a camera.
- the memory is used to store computer program code comprising computer instructions.
- the processor executes the computer instructions, the electronic device can execute various functions or steps executed by the mobile phone in the foregoing method embodiments.
- the chip system includes at least one processor 701 and at least one interface circuit 702 .
- the processor 701 and the interface circuit 702 may be interconnected by wires.
- the interface circuit 702 may be used to receive signals from other devices, such as the memory of an electronic device.
- the interface circuit 702 may be used to send signals to other devices (eg, the processor 701).
- the interface circuit 702 can read the instructions stored in the memory and send the instructions to the processor 701 .
- the electronic device such as the mobile phone 100 as shown in FIG. 1 can be made to execute each step in the above embodiment.
- the chip system may also include other discrete devices, which are not specifically limited in this embodiment of the present application.
- An embodiment of the present application further provides a computer storage medium, where the computer storage medium includes computer instructions, when the computer instructions are executed on the above electronic device (the mobile phone 100 shown in FIG. 1 ), the electronic device is made to execute the above method. Each function or step performed by the mobile phone in the embodiment.
- Embodiments of the present application further provide a computer program product, which, when the computer program product runs on a computer, enables the computer to perform various functions or steps performed by the mobile phone in the above method embodiments.
- the disclosed apparatus and method may be implemented in other manners.
- the device embodiments described above are only illustrative.
- the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be Incorporation may either be integrated into another device, or some features may be omitted, or not implemented.
- the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place, or may be distributed to multiple different places . Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium.
- the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, which are stored in a storage medium , including several instructions to make a device (may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application.
- the aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Stored Programmes (AREA)
Abstract
Description
Number | Identification |
01 | e908 |
02 | 6cd7a |
Number | File name |
01 | 共享库a |
Number | File name |
01(即第一inode) | 共享库a(即第二共享库) |
02(即第二inode) | 共享库b(即第一共享库) |
Number | File name |
01(即第一inode) | 共享库a(即第二共享库) |
01(即第一inode) | 共享库b(即第一共享库) |
Number | File name |
03 | 共享库c |
Claims (21)
- 一种共享库的复用方法,其特征在于,应用于电子设备,所述电子设备中安装有多个应用程序APP,所述多个APP中的每个APP包括至少一个共享库,所述复用方法包括:确定所述电子设备中是否存在与第一APP的第一共享库的文件数据相同的第二共享库,所述第一共享库为所述第一APP中任意一个共享库;若所述电子设备中存在所述第二共享库,则保存第一索引节点inode与所述第一共享库的文件名称之间的对应关系,并从所述电子设备中删除所述第一共享库的文件数据;其中,所述第一inode是所述电子设备为所述第二共享库分配的,所述第一inode指示用于保存所述第二共享库的文件数据的第一存储区域;当所述电子设备运行所述第一APP调用所述第一共享库时,查找所述第一共享库的文件名称对应的所述第一inode,并读取所述第一inode指示的存储区域保存的所述第二共享库的文件数据。
- 根据权利要求1所述的共享库的复用方法,其特征在于,所述确定所述电子设备中是否存在与第一APP的第一共享库的文件数据相同的第二共享库,包括:所述电子设备安装完所述第一APP时,确定所述电子设备中是否存在与所述第一APP的所述第一共享库的文件数据相同的第二共享库;或者,所述电子设备在运行完所述第一APP时,确定所述电子设备中是否存在与所述第一APP的所述第一共享库的文件数据相同的第二共享库。
- 根据权利要求1或2所述的共享库的复用方法,其特征在于,所述方法还包括:若所述电子设备中不存在所述第二共享库,则为所述第一共享库分配第二inode;其中,所述第二inode指示用于保存所述第一共享库的文件数据的第二存储区域;保存所述第二inode与所述第一共享库的文件名称之间的对应关系;当所述电子设备运行所述第一APP调用所述第一共享库时,查找所述第一共享库的文件名称对应的所述第二inode,并读取所述第二inode指示的第二存储区域保存的所述第一共享库的文件数据。
- 根据权利要求3所述的共享库的复用方法,其特征在于,所述方法还包括:若所述电子设备中存在所述第二共享库,则为所述第一inode的链接数加1;其中,所述第一inode的链接数为所述第一inode对应的共享库的数量;若所述电子设备中不存在所述第二共享库,则为所述第二inode的链接数加1;其中,所述第二inode的链接数为所述第二inode对应的共享库的数量;其中,每个inode的链接数的初始值为0。
- 根据权利要求3或4所述的共享库的复用方法,其特征在于,所述方法还包括:所述电子设备删除第二APP时,查找第三共享库的文件名称对应的第三inode;若所述第三inode的链接数等于1,则从所述电子设备中删除所述第三共享库的文件数据、所述第三inode、以及所述第三共享库的文件名称与所述第三inode之间的对应关系;若所述第三inode的链接数大于1,为所述第三inode的链接数减1。
- 根据权利要求3-5中任一项所述的共享库的复用方法,其特征在于,所述确定所述 电子设备中是否存在与第一APP的第一共享库的文件数据相同的第二共享库,包括:根据所述第一共享库的文件数据采用预设算法,生成所述第一共享库的第一标识,并确定所述第一标识与第二标识是否相同;其中,所述第二标识是所述电子设备根据所述电子设备中任一个共享库的文件数据采用所述预设算法生成的;其中,若所述第一标识与所述第二标识相同,则确定所述电子设备中存在与所述第一共享库的文件数据相同的所述第二共享库;若所述第一标识与第二标识不同,则确定所述电子设备中不存在与所述第一共享库的文件数据相同的所述第二共享库。
- 根据权利要求6所述的共享库的复用方法,其特征在于,所述方法还包括:若所述第一标识与第二标识不同,保存所述第一标识与所述第二inode的对应关系。
- 根据权利要求5所述的共享库的复用方法,其特征在于,所述方法还包括:若所述第三inode的链接数等于1,则从所述电子设备中删除所述第三inode与所述第三标识之间的对应关系;其中,所述第三标识是所述电子设备根据所述第三共享库的文件数据采用所述预设算法生成的。
- 根据权利要求1-5中任一项所述的共享库的复用方法,其特征在于,所述确定所述电子设备中是否存在与第一APP的第一共享库的文件数据相同的第二共享库,包括:对比所述第一共享库的文件数据与所述电子设备中每一个共享库的文件数据,确定所述电子设备中是否存在与所述第一共享库的文件数据相同的所述第二共享库。
- 一种电子设备,其特征在于,所述电子设备中安装有多个应用程序APP,所述多个APP中的每个APP包括至少一个共享库;所述电子设备包括存储器和处理器,所述存储器与所述处理器耦合;所述至少一个共享库保存在所述存储器中,所述存储器还用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令被所述处理器执行时,使得所述电子设备执行以下操作:确定所述存储器中是否存在与第一APP的第一共享库的文件数据相同的第二共享库,所述第一共享库为所述第一APP中任意一个共享库;若所述存储器中存在所述第二共享库,则保存第一索引节点inode与第一共享库的文件名称之间的对应关系,并从所述存储器中删除所述第一共享库的文件数据;其中,所述第一inode是所述处理器为所述第二共享库分配的,所述第一inode指示所述存储器中用于保存所述第二共享库的文件数据的第一存储区域;当运行所述第一APP从所述存储器调用所述第一共享库时,查找所述第一共享库的文件名称对应的所述第一inode,并读取所述第一inode指示的存储区域保存的所述第二共享库的文件数据。
- 根据权利要求10所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:当安装完所述第一APP时,确定所述存储器中是否存在与所述第一APP的所述第一共享库的文件数据相同的第二共享库;或者,当运行完所述第一APP时,确定所述存储器中是否存在与所述第一APP的所述第一共享库的文件数据相同的第二共享库。
- 根据权利要求10或11所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:若所述存储器中不存在所述第二共享库,则为所述第一共享库分配第二inode;其中,所述第二inode指示用于保存所述第一共享库的文件数据的第二存储区域;保存所述第二inode与所述第一共享库的文件名称之间的对应关系;当运行所述第一APP调用所述第一共享库时,查找所述第一共享库的文件名称对应的所述第二inode,并读取所述第二inode指示的第二存储区域保存的所述第一共享库的文件数据。
- 根据权利要求12所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:若所述存储器中存在所述第二共享库,则为所述第一inode的链接数加1;其中,所述第一inode的链接数为所述第一inode对应的共享库的数量;若所述存储器中不存在所述第二共享库,则为所述第二inode的链接数加1;其中,所述第二inode的链接数为所述第二inode对应的共享库的数量;其中,每个inode的链接数的初始值为0。
- 根据权利要求12或13所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:当删除第二APP时,查找第三共享库的文件名称对应的第三inode;若所述第三inode的链接数等于1,则从所述存储器中删除所述第三共享库的文件数据、所述第三inode、以及所述第三共享库的文件名称与所述第三inode之间的对应关系;若所述第三inode的链接数大于1,为所述第三inode的链接数减1。
- 根据权利要求12-14中任一项所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:根据所述第一共享库的文件数据采用预设算法,生成所述第一共享库的第一标识,并确定所述第一标识与第二标识是否相同;其中,所述第二标识是所述处理器根据所述存储器中任一个共享库的文件数据采用所述预设算法生成的;其中,若所述第一标识与所述第二标识相同,则确定所述存储器中存在与所述第一共享库的文件数据相同的所述第二共享库;若所述第一标识与第二标识不同,则确定所述存储器中不存在与所述第一共享库的文件数据相同的所述第二共享库。
- 根据权利要求15所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:若所述第一标识与第二标识不同,保存所述第一标识与所述第二inode的对应关系。
- 根据权利要求16所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:若所述第三inode的链接数等于1,则从所述存储器中删除所述第三inode与所述第三标识之间的对应关系;其中,所述第三标识是所述处理器根据所述第三共享库的文件数据采用所述预设算法生成的。
- 根据权利要求17所述的电子设备,其特征在于,当所述计算机指令被所述一个或多个处理器执行时,使得所述电子设备还执行以下步骤:对比所述第一共享库的文件数据与所述存储器中每一个共享库的文件数据,确定所述存储器中是否存在与所述第一共享库的文件数据相同的所述第二共享库。
- 一种芯片系统,其特征在于,所述芯片系统应用于电子设备,所述电子设备中安装有多个APP,所述多个APP中的每个APP包括至少一个共享库;所述芯片系统包括一个或多个接口电路和一个或多个处理器;所述接口电路和所述处理器通过线路互联;所述接口电路用于从所述电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括所述存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,所述电子设备执行如权利要求1-9中任一项所述的方法。
- 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-9中任一项所述的方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-9中任一项所述的方法。
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2023513836A JP2023539879A (ja) | 2020-08-31 | 2021-08-16 | 共有ライブラリを再利用するための方法および電子デバイス |
US18/042,980 US20230350738A1 (en) | 2020-08-31 | 2021-08-16 | Method for Reusing Shared Library and Electronic Device |
EP21860201.9A EP4191409A4 (en) | 2020-08-31 | 2021-08-16 | MULTIPLEX METHOD FOR COMMON LIBRARY AND ELECTRONIC DEVICE |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010899468.4 | 2020-08-31 | ||
CN202010899468.4A CN114116072A (zh) | 2020-08-31 | 2020-08-31 | 一种共享库的复用方法及电子设备 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022042363A1 true WO2022042363A1 (zh) | 2022-03-03 |
Family
ID=80354593
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/112853 WO2022042363A1 (zh) | 2020-08-31 | 2021-08-16 | 一种共享库的复用方法及电子设备 |
Country Status (5)
Country | Link |
---|---|
US (1) | US20230350738A1 (zh) |
EP (1) | EP4191409A4 (zh) |
JP (1) | JP2023539879A (zh) |
CN (1) | CN114116072A (zh) |
WO (1) | WO2022042363A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116048562B (zh) * | 2022-05-30 | 2023-10-27 | 荣耀终端有限公司 | 一种数据更新方法、电子设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102854853A (zh) * | 2012-08-13 | 2013-01-02 | 北京和利时系统工程有限公司 | 一种跨平台轻量级的分布式控制系统 |
US20130103744A1 (en) * | 2011-10-24 | 2013-04-25 | Electronics And Telecommunications Research Institute | Method and apparatus for executing web service program based on javascript |
CN106203006A (zh) * | 2016-08-31 | 2016-12-07 | 北京鼎源科技有限公司 | 基于dex与so文件动态执行的Android应用加固方法 |
CN106897089A (zh) * | 2017-01-19 | 2017-06-27 | 上海帝联信息科技股份有限公司 | 系统操作执行方法及装置 |
CN107102888A (zh) * | 2017-04-25 | 2017-08-29 | 华中科技大学 | 一种基于硬件虚拟化技术的共享库隔离保护方法及系统 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6389433B1 (en) * | 1999-07-16 | 2002-05-14 | Microsoft Corporation | Method and system for automatically merging files into a single instance store |
US8190835B1 (en) * | 2007-12-31 | 2012-05-29 | Emc Corporation | Global de-duplication in shared architectures |
US8706703B2 (en) * | 2011-06-27 | 2014-04-22 | International Business Machines Corporation | Efficient file system object-based deduplication |
-
2020
- 2020-08-31 CN CN202010899468.4A patent/CN114116072A/zh active Pending
-
2021
- 2021-08-16 EP EP21860201.9A patent/EP4191409A4/en active Pending
- 2021-08-16 JP JP2023513836A patent/JP2023539879A/ja active Pending
- 2021-08-16 US US18/042,980 patent/US20230350738A1/en active Pending
- 2021-08-16 WO PCT/CN2021/112853 patent/WO2022042363A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130103744A1 (en) * | 2011-10-24 | 2013-04-25 | Electronics And Telecommunications Research Institute | Method and apparatus for executing web service program based on javascript |
CN102854853A (zh) * | 2012-08-13 | 2013-01-02 | 北京和利时系统工程有限公司 | 一种跨平台轻量级的分布式控制系统 |
CN106203006A (zh) * | 2016-08-31 | 2016-12-07 | 北京鼎源科技有限公司 | 基于dex与so文件动态执行的Android应用加固方法 |
CN106897089A (zh) * | 2017-01-19 | 2017-06-27 | 上海帝联信息科技股份有限公司 | 系统操作执行方法及装置 |
CN107102888A (zh) * | 2017-04-25 | 2017-08-29 | 华中科技大学 | 一种基于硬件虚拟化技术的共享库隔离保护方法及系统 |
Non-Patent Citations (1)
Title |
---|
See also references of EP4191409A4 |
Also Published As
Publication number | Publication date |
---|---|
EP4191409A1 (en) | 2023-06-07 |
JP2023539879A (ja) | 2023-09-20 |
EP4191409A4 (en) | 2024-01-10 |
CN114116072A (zh) | 2022-03-01 |
US20230350738A1 (en) | 2023-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7873758B2 (en) | Cellular phone and portable storage device using the same | |
WO2020211712A1 (zh) | 补丁方法、相关装置及系统 | |
US12118128B2 (en) | Running a trusted application using a dynamic library | |
WO2021027630A1 (zh) | 补丁方法、相关装置及系统 | |
CN112055424B (zh) | 电子装置以及切换电子装置的方法 | |
WO2022057742A1 (zh) | 一种跨设备调用应用的方法及电子设备 | |
CN112119623B (zh) | 基于帐户组共享内容的方法和执行该方法的电子装置 | |
WO2021022729A1 (zh) | root权限的分配方法、装置、存储介质及终端设备 | |
CN114968384B (zh) | 一种功能调用方法和装置 | |
WO2022156535A1 (zh) | 分布式应用的处理方法和装置 | |
WO2022042363A1 (zh) | 一种共享库的复用方法及电子设备 | |
WO2022063037A1 (zh) | 一种补丁包安装方法和装置 | |
WO2023109607A1 (zh) | 应用界面跨设备显示方法、设备系统 | |
CN114253737B (zh) | 电子设备及其内存回收方法、介质 | |
CN115756868A (zh) | 内存分配方法、装置、设备、存储介质及计算机程序产品 | |
WO2023142696A1 (zh) | 缩略图存储方法及电子设备 | |
WO2024140279A1 (zh) | 传输文件的方法及电子设备 | |
WO2024037006A1 (zh) | 升级包的生成方法、安装方法、设备及存储介质 | |
WO2023088090A1 (zh) | 文件验证方法及相关设备 | |
WO2023088289A1 (zh) | 补丁方法及相关设备 | |
WO2024007944A1 (zh) | 扩展内存隔离域的方法和电子设备 | |
WO2023066036A1 (zh) | 一种跨设备文件显示方法、设备及系统 | |
EP4436265A1 (en) | Control method for cellular network, and electronic device | |
CN117520279A (zh) | 文件存储的方法及电子设备 | |
CN116257486A (zh) | 一种访问请求的处理方法以及相关设备 |
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: 21860201 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2023513836 Country of ref document: JP Kind code of ref document: A |
|
WWE | Wipo information: entry into national phase |
Ref document number: 202317014178 Country of ref document: IN |
|
ENP | Entry into the national phase |
Ref document number: 2021860201 Country of ref document: EP Effective date: 20230301 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |