CN108132844B - Plug-in downloading method and device - Google Patents

Plug-in downloading method and device Download PDF

Info

Publication number
CN108132844B
CN108132844B CN201611093571.XA CN201611093571A CN108132844B CN 108132844 B CN108132844 B CN 108132844B CN 201611093571 A CN201611093571 A CN 201611093571A CN 108132844 B CN108132844 B CN 108132844B
Authority
CN
China
Prior art keywords
plug
file lock
downloading
installing
host application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611093571.XA
Other languages
Chinese (zh)
Other versions
CN108132844A (en
Inventor
李龙彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201611093571.XA priority Critical patent/CN108132844B/en
Publication of CN108132844A publication Critical patent/CN108132844A/en
Application granted granted Critical
Publication of CN108132844B publication Critical patent/CN108132844B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation

Abstract

The invention discloses a plug-in downloading method and device, and belongs to the technical field of computers. The method comprises the following steps: when the second process requests to download and install the plug-in, detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in; the process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process; when the process ID file latches and stores the process ID of the first process, inquiring whether the first process exists in the operating system according to the process ID of the first process; when the first process does not exist, determining that the first process exits abnormally, and modifying the process ID stored in the process ID file lock into the process ID of the second process; and continuing to execute the downloading and installing process of the plug-in. According to the method and the device, the process is locked by writing the process ID into the process ID file lock, so that when the first process is abnormally quitted, the second process can continue to execute the downloading and installing process of the plug-in, and the problem of deadlock is solved.

Description

Plug-in downloading method and device
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a plug-in downloading method and device.
Background
In order to avoid the overlarge installation package, some extended functions of the application program are realized by dynamically downloading the plug-in. Taking the android system as an example, the plug-in is a program written by an application program interface according to a certain specification, and is used for realizing an extended function on the basis of an original function of the application program, and the plug-in can only run depending on the application program and cannot run normally only depending on the plug-in.
When a plurality of processes in an application need to use the functions provided by the same plug-in, and the plug-in is not downloaded and installed, the situation that the plug-in is downloaded and installed by the plurality of processes at the same time occurs. Because the same plug-in is downloaded and installed in the same application program in the same path, if two processes download the same plug-in at the same time, the problem of downloading error can occur. In the prior art, the problem of downloading errors caused by multi-process parallel downloading is solved through a file lock mechanism. Specifically, a file lock is provided for each process, the file lock having the ability to lock the process, a first process that obtains the file lock executes a plug-in download installation procedure after locking, and a second process that does not obtain the file lock is suspended, i.e., is in a waiting state.
Because the locking is started from the first process, in the process of finishing the execution of the plug-in downloading and installing process of the first process, other waiting second processes are automatically suspended, if the first process makes a mistake and abnormally quits in the executing process, the file lock cannot be unlocked by the first process, the waiting second processes are continuously suspended, and the second processes cannot continue to execute or re-execute the plug-in downloading and installing process, so that the deadlock problem is caused.
Disclosure of Invention
In order to solve the problem that deadlock occurs because a waiting process is continuously suspended and a downloading and installing process of a plug-in cannot be continuously executed or re-executed after a locked process abnormally exits in an execution process in the prior art, the embodiment of the invention provides a plug-in downloading method and a plug-in downloading device. The technical scheme is as follows:
in a first aspect, a plug-in downloading method is provided, the method including:
when a second process requests to download and install a plug-in, detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in; the process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process;
when the process ID file latches and stores the process ID of the first process, inquiring whether the first process exists in an operating system according to the process ID of the first process;
when the first process does not exist, determining that the first process exits abnormally, and modifying the process ID stored in the process ID file lock into the process ID of the second process;
and continuing to execute the downloading and installing process of the plug-in.
In a second aspect, there is provided a plug-in download apparatus, the apparatus comprising:
the first detection module is used for detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in when the second process requests to download and install the plug-in; the process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process;
the query module is used for querying whether the first process exists or not to an operating system according to the process ID of the first process when the first detection module detects that the process ID of the first process is stored in the process ID file latch;
the first modification module is used for determining that the first process exits abnormally when the inquiry module inquires that the first process does not exist, and modifying the process ID stored in the process ID file lock into the process ID of the second process;
and the downloading module is used for continuously executing the downloading and installing process of the plug-in.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the first process is locked by writing the process ID of the first process into the process ID file lock, so that a second process needing to download the same plug-in can search whether the first process exists in the operating system according to the process ID in the process ID file lock, if the first process does not exist, the first process is indicated to be abnormally quitted in the midway, the process ID of the second process is written into the second process again to be locked, the downloading and installing process of the plug-in is continuously executed, the situation that other second processes are hung and the downloading and installing process of the plug-in cannot be continuously executed after the locked first process abnormally quits is avoided, and the problem that the file lock in the prior art can be deadlocked is solved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method of plug-in download provided in one embodiment of the present invention;
FIG. 2A is a flowchart of a method for downloading plug-ins provided in another embodiment of the present invention;
FIG. 2B is a flowchart of a method for a second process to continue to execute a process of downloading and installing plug-ins, according to an embodiment of the present invention;
FIG. 2C is a schematic diagram of an exemplary plug-in download method provided in one embodiment of the present invention;
fig. 3 is a block diagram showing the construction of a plug-in download apparatus provided in an embodiment of the present invention;
fig. 4 is a block diagram showing the configuration of a plug-in download apparatus provided in some embodiments of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
To facilitate an understanding of the embodiments of the present invention, the terms used are first explained:
plug-in components: the system is a program written by an application program interface following a certain specification and is used for realizing the extended functions of the application program.
And (4) process ID: for uniquely identifying a process among a plurality of processes of an operating system.
Process ID file lock: the locking device is used for storing the process ID and locking the process corresponding to the stored process ID. Specifically, when the process ID is written, the process ID file lock locks the process corresponding to the process ID, and when the process ID is deleted or modified, the process ID file lock unlocks the process corresponding to the process ID.
The host application program: an application having the right to download an installation plug-in. When a plug-in is downloaded and installed, the host application obtains extended functions on the basis of the original functions.
Non-host applications: an application program that does not have the right to download and install a plug-in can obtain extended functionality by sharing a plug-in that the host application program has already installed.
Sharing the memory: is the storage space where different processes implement interprocess communication. When one process writes data in the shared memory, another process can read the data in the shared memory.
Fig. 1 is a flowchart of a method for downloading a plug-in provided in an embodiment of the present invention. The present embodiment is exemplified by applying the plug-in download method to a terminal installed with a host application, or a terminal installed with a host application and a non-host application. As shown in fig. 1, the plug-in download method includes:
step 101, when the second process requests to download and install the plug-in, detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in.
The process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process.
A plug-in corresponds to a process ID file lock, and the naming of the process ID file lock is typically associated with the plug-in, such as by using the K value of the plug-in to name the corresponding process ID file lock. The first process to download and install the plug-in usually needs to create a process ID file lock corresponding to the plug-in and name the process ID file lock according to a predetermined naming rule, and then other processes needing to download the plug-in can find the corresponding process ID file lock according to the name of the process ID file lock.
The process ID file lock stores a process ID indicating that a locked process exists in the process ID file lock. If the process ID file lock stores a preset value (such as-1), the plug-in download and installation by the first process is completed, and the process ID file lock is normally quitted, and when the second process needs to use the plug-in, the installed plug-in can be directly used without downloading and installing again.
Step 102, when the process ID file latches and stores the process ID of the first process, inquiring whether the first process exists in the operating system according to the process ID of the first process.
Under normal conditions, when the plug-in is downloaded and installed by the first process, the process ID of the first process is written into the process ID file lock, and the process ID file lock locks the first process; and after the first process finishes downloading and installing, erasing the process ID of the first process from the process ID file lock, and unlocking the first process by the process ID file lock. However, if the first process exits abnormally in the middle of the process, the process ID of the first process may remain in the process ID lock and not be erased in time.
When the process ID file lock stores the process ID of the first process, the second process can continuously inquire whether the first process exists or not from the operating system according to the first process ID, so that whether the first process is in a normal running state or not is determined. If the first process exists in the operating system, the first process is in a normal running state, and the second process exits; if the first process does not exist in the operating system, it indicates that the first process exits abnormally in the middle, and step 103 is entered.
And 103, when the first process does not exist, determining that the first process exits abnormally, and modifying the process ID stored in the process ID file lock into the process ID of the second process.
When the first process exits, whether normal or abnormal, the first process cannot be queried in the operating system.
Therefore, if the process ID in the process ID file lock exists, but the second process inquires the operating system that the first process does not exist according to the process ID, the first process is indicated to be abnormally quitted in the middle.
And the second process writes the process ID of the second process into the process ID file lock, and covers the originally stored process ID of the first process, so that the process ID file lock unlocks the first process and locks the second process again.
And step 104, continuing to execute the downloading and installing process of the plug-in.
Because the first process is abnormally exited and part of the data of the plug-in can be downloaded, after the second process is locked, the plug-in can be continuously downloaded and installed according to the downloaded data without completely downloading the plug-in again.
In summary, the plug-in downloading method provided in the embodiment of the present invention locks the first process by writing the process ID of the first process into the process ID file lock, so that the second process that needs to download the same plug-in can search whether the first process exists in the operating system according to the process ID in the process ID file lock, and if the process ID does not exist, which indicates that the first process has abnormally exited midway, the process ID of the second process is written into the lock again to continue executing the plug-in download and installation process, thereby avoiding a situation that after the locked first process abnormally exits, other second processes are suspended and cannot continue executing the plug-in download and installation process, and thus solving the problem in the prior art that the file lock is deadlocked.
Fig. 2A is a flowchart of a method for downloading plug-ins according to another embodiment of the present invention. The present embodiment is exemplified by applying the plug-in download method to a terminal installed with a host application, or a terminal installed with a host application and a non-host application. As shown in fig. 2A, the plug-in download method includes:
step 201, when the second process requests to download the installation plug-in, detecting whether the application program corresponding to the second process is the host application program.
Since the host application has the right to download the installation plug-in, the non-host application does not have the right to download the installation plug-in. Therefore, when the second process requests the operating system to download and install the plug-in, the operating system firstly determines whether the application program corresponding to the second process is the host application program or not so as to determine whether the second process has the right to download and install the plug-in.
Step 202, when the application program corresponding to the second process is the host application program, detecting whether the plug-in is installed in the host application program.
And when the application program corresponding to the second process is the host application program, indicating that the second process has the authority of downloading and installing the plug-in. At this point, the operating system allows the second process to download and install the plug-in. Before downloading and installing the plug-in, the second process detects whether the plug-in is already installed in the host application program; the second process may directly use the plug-in when it is detected that the plug-in has been installed in the host application.
When the plug-in is not already installed in the host application, step 203 is performed.
Step 203, when the plug-in is not installed in the host application program, detecting whether a process ID file lock corresponding to the plug-in exists.
Because one plug-in corresponds to one process ID file lock, the second process detects whether a process ID file lock corresponding to the plug-in exists; if there is no process ID file lock corresponding to the plug-in, go to step 204; if there is a process ID file lock corresponding to the plug-in, then step 205 is entered.
And 204, when the process ID file lock corresponding to the plug-in does not exist, creating the process ID file lock, writing the process ID of the second process into the created process ID file lock, and executing the downloading and installing process of the plug-in.
When the process ID file lock corresponding to the plug-in does not exist, the plug-in is not downloaded, so the second process creates the process ID file lock corresponding to the plug-in and names the process ID file lock according to a preset naming rule. The naming of the process ID file locks is typically associated with the plug-in, such as the K value of the plug-in may be used to name the corresponding process ID file lock.
And after the second process creates the process ID file lock, writing the process ID of the second process into the process ID file lock to lock the second process.
Step 205, when there is a process ID file lock corresponding to the plug-in, it is detected whether a process ID is stored in the process ID file lock corresponding to the plug-in.
The process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process.
If the process ID file lock exists, the plug-in is indicated to be downloaded or is being downloaded, if the first process normally executes the downloading and installing process of the plug-in, the first process deletes the process ID in the process ID file lock or modifies the process ID to a preset value (such as-1) when the first process exits, therefore, if the second process detects that the process ID does not exist in the process ID file lock or the preset value is stored, the plug-in is indicated to be downloaded and installed by the first process, and the plug-in normally exits, and when the second process needs to use the plug-in, the installed plug-in can be directly used without downloading and installing again.
In step 206, when the process ID file stores the process ID of the first process, the operating system is queried whether the first process exists according to the process ID of the first process.
Under normal conditions, when the plug-in is downloaded and installed by the first process, the process ID of the first process is written into the process ID file lock, and the process ID file lock locks the first process; and after the first process finishes downloading and installing, erasing the process ID of the first process from the process ID file lock, and unlocking the first process by the process ID file lock. However, if the first process exits abnormally in the middle of the process, the process ID of the first process may remain in the process ID lock and not be erased in time.
When the process ID file lock stores the process ID of the first process, the second process can continuously inquire whether the first process exists or not from the operating system according to the first process ID, so that whether the first process is in a normal running state or not is determined. If the first process exists in the operating system, the first process is in a normal running state, and the second process exits; if the first process does not exist in the operating system, it indicates that the first process exits abnormally in the middle, and step 207 is entered.
And step 207, when the first process does not exist, determining that the first process exits abnormally, and modifying the process ID stored in the process ID file lock into the process ID of the second process.
After the first process is locked, if the first process is abnormally quitted in the process of executing the plug-in downloading and installing process, the first process cannot execute the operation of deleting or modifying the process ID in the process ID file lock, so that the process ID in the process ID file lock still exists, and the process ID file lock is still in a locked state, but the plug-in downloading and installing process is interrupted.
When the first process exits, whether normal or abnormal, the first process cannot be queried in the operating system. Therefore, if the process ID in the process ID file lock exists, but the second process inquires the operating system that the first process does not exist according to the process ID, the first process is indicated to be abnormally exited.
And the second process writes the process ID of the second process into the process ID file lock, and covers the originally stored process ID of the first process, so that the process ID file lock unlocks the first process and locks the second process again.
And step 208, continuing to execute the downloading and installing process of the plug-in.
Because the first process is abnormally exited and part of the data of the plug-in can be downloaded, after the second process is locked, the second process can continue to download and install the plug-in according to the downloaded data without downloading the plug-in again.
Optionally, the second process continues to execute the plug-in download and installation process, which may include the steps shown in fig. 2B:
in step 208a, the plug-in download installation progress of the first process is obtained through the shared memory.
The shared memory is a storage space for the first process and the second process to realize the inter-process communication.
Shared memory is one implementation way of implementing inter-process communication mechanism among different processes of an operating system.
In the process of executing the downloading and installing process of the plug-in, the first process stores the downloading and installing progress of the plug-in to the shared memory, and when the first process exits abnormally, the second process can obtain the downloading and installing progress of the plug-in of the first process from the shared memory.
And step 208b, continuing downloading and installing the plug-in according to the acquired plug-in downloading and installing progress.
After the second process obtains the downloading and installing progress of the plug-in, the plug-in can be continuously downloaded and installed according to the downloaded data. For example, the first process exits abnormally when the plug-in is downloaded to 50%, and the second process continues to download the following data from 50%.
And step 208c, recording the downloading and installing progress of the plug-in into the shared memory.
And the second process also stores the downloading and installing progress of the plug-in to the shared memory when executing the downloading and installing process of the plug-in.
Optionally, when the third process requests downloading of the plug-in, if the third process detects that the second process is executing the downloading and installing process of the plug-in, the third process may efficiently obtain the downloading and installing progress of the plug-in by accessing the shared memory.
And if the second process normally executes the downloading and installing process of the plug-in, the second process unlocks the process ID file lock. Optionally, the second process completes the unlocking by means of step 209 or step 210.
Step 209, when the execution of the download installation process is completed, the process ID of the second process in the process ID file lock is deleted.
The second process deletes the process ID in the process ID file lock.
Step 210, when the execution of the download installation process is completed, modifying the process ID of the second process in the process ID file lock to a predetermined value.
And the second process modifies the process ID in the process ID file lock, namely the process ID is modified to a preset value, and the preset value is used for indicating that the downloading and installing process is completely executed. Optionally, the predetermined value is a process ID value that does not actually exist, such as-1.
In practical applications, only the host application has the right to download and install the plug-in, but when the non-host application needs to use the plug-in, please refer to the description of steps 211 to 212 for the process of how the non-host application uses the plug-in.
In step 211, when the application corresponding to the second process is a non-host application, it is detected whether the plug-in is already installed in the host application.
Since the non-host application does not have the right to download the installed plug-in, but can share the plug-in already installed in the host application, the second process detects whether the host application installs the plug-in.
At step 212, the plug-in is shared from the host application when the plug-in has been installed in the host application.
If the plug-in is not installed by the host application, the plug-in cannot be used by the non-host application.
For the plug-in downloading method in the present embodiment, a schematic diagram of the plug-in downloading method shown in fig. 2C may be combined. Firstly, executing S201 to judge whether the application program is a host application program; if the judgment result of the S201 is yes, executing S202 to judge whether the plug-in is installed; if the judgment result of the S202 is negative, executing S203, and judging whether a process ID file lock exists; if the judgment result of the S203 is yes, executing S204 to judge whether the process ID exists; if the judgment result in the step S204 is yes, executing step S205 to judge whether a process corresponding to the process ID exists; if the judgment result in the step S205 is yes, executing step S211, and sharing the download and installation progress of the memory storage plug-in; if the judgment result of the S201 is negative, executing S206, and inquiring whether the host application program installs the plug-in; if the judgment result of the S206 is yes, executing S207, sharing the installed plug-in, and finishing successfully; if the judgment result of the S206 is negative, the failure is ended; if the judgment result of the S203 is negative, executing S208, creating a process ID file lock, writing the process ID file lock into the process ID lock, then executing S210, executing a plug-in downloading and installing process, then executing S211, and sharing the memory to store the plug-in downloading and installing progress; if the determination result in S205 is no, S209 is executed, the process ID is written to be locked, then S210 is executed, the plug-in download installation process is executed, and then S211 is executed, and the download installation progress of the plug-in is shared.
In summary, the plug-in downloading method provided in the embodiment of the present invention locks the first process by writing the process ID of the first process into the process ID file lock, so that the second process that needs to download the same plug-in can search whether the first process exists in the operating system according to the process ID in the process ID file lock, and if the process ID does not exist, which indicates that the first process has abnormally exited midway, the process ID of the second process is written into the lock again to continue executing the plug-in download and installation process, thereby avoiding a situation that after the locked first process abnormally exits, other second processes are suspended and cannot continue executing the plug-in download and installation process, and thus solving the problem in the prior art that the file lock is deadlocked.
In addition, whether a process ID file lock corresponding to the plug-in exists or not is detected, if not, the second process can quickly determine that no other process downloads and installs the plug-in, and then the second process can create the process ID file lock and execute the downloading and installing process of the plug-in.
In addition, whether the second process has the downloading and installing authority of the plug-in can be determined by detecting whether the application program corresponding to the second process is the host application program.
In addition, whether the plug-in is installed by the host application program is detected when the application program corresponding to the second process is the non-host application program, and if the plug-in is installed by the host application program, the non-host application program can share and use the plug-in.
In addition, the downloading and installing progress of the plug-in is written into the shared memory while the downloading and installing process of the plug-in is executed, so that other processes needing to use the plug-in can efficiently acquire the downloading and installing progress information of the plug-in by accessing the shared memory. And when the first process exits abnormally, the second process acquires the downloading and installing progress of the plug-in from the shared memory, and can continue downloading and installing the plug-in according to the acquired downloading and installing progress.
In addition, when the downloading and installing process is executed, the process ID in the process ID file lock is deleted or modified, so that other processes needing to use the plug-in determine that the plug-in is downloaded and installed when the process ID in the process ID file lock is detected to be absent or is a preset value.
In an actual application scenario, a web browser can provide a web browsing service for a third-party application program, the web browsing service can provide a basic web browsing function for the third-party application program, and can also provide other extended functions for the third-party application program, such as video playing, word document opening, pdf document opening and the like, for opening various files, in order to avoid an oversize installation package of the web browsing service, the extended functions are realized in a dynamic plug-in downloading mode, that is, when the third-party application program needs to use a certain extended function, a terminal can send a plug-in downloading request corresponding to the extended function to a server of the web browser, the server of the web browser sends the installation package of the plug-in to the terminal, and after the plug-in is downloaded and installed, the third-party application program can use the extended function.
A terminal as referred to herein may include a smart phone, a tablet computer, a laptop portable computer, a desktop computer, etc., and the terminal may run various applications including a hosted application and a non-hosted application.
The server of the web browser is a network platform for providing a web browsing function and other extended functions, the server may be one server or a server cluster composed of a plurality of servers, and data between the servers in the server cluster may be shared or may be a cloud computing service center. The embodiment of the invention does not limit the physical implementation mode of the server.
The terminal is connected with the server through a communication network. Optionally, the communication network is a wired network or a wireless network.
Because only the host application program has the right to download and install the plug-in, the third-party application program capable of downloading and installing the plug-in is the host application program, in addition, only the host application program has the right to download and install the kernel of the web browsing service, and the installed kernel of the web browsing service can be shared. The non-host application can also use the web browsing service, but use a web browsing service kernel shared by the host application and an installed plug-in for the host application.
It should be noted that plug-ins between the host applications are not shared, that is, each host application downloads the installation plug-in individually, and does not share plug-ins using other host applications.
Optionally, the host application includes an instant messaging application.
In an instant messaging application program, a plurality of processes browse a webpage by using a webpage browsing service, and when the plurality of processes use a function which needs to be realized by a certain plug-in component concurrently and the plug-in component is not downloaded and installed, the plug-in component can be downloaded and installed by the plurality of processes. In the same application program, the download and installation paths of the same plug-in are the same, and when a plurality of processes download and install the plug-in simultaneously, a download error can be caused.
In order to avoid a plug-in download error, a first process executing a plug-in download installation process creates a process ID file lock corresponding to the plug-in, writes the process ID of the first process into the process ID file lock to be locked, executes the plug-in download installation process, simultaneously stores the plug-in download installation process into a shared memory, deletes or modifies the process ID in the process ID file lock to a preset value to be unlocked after the first process executes the plug-in download installation process, and then other processes can directly use the installed plug-in without downloading again when needing to use the plug-in.
If a first process makes a mistake in the process of executing the downloading and installing process of the plug-in, the first process exits abnormally, then when a second process needs to use the function realized by the plug-in, a second process which needs to download and install the same plug-in enters, because the first process creates a process ID file lock corresponding to the plug-in, the second process detects that a process ID file lock corresponding to the plug-in exists and also detects that a process ID exists in the process ID file lock, the existing process ID is the process ID which is not erased because the first process is not unlocked when the first process exits abnormally, the second process inquires whether the first process corresponding to the process ID exists or not to an operating system according to the process ID, because the first process exits abnormally, the inquiry result is that the first process corresponding to the process ID does not exist, the second process writes the process ID of the second process into the process ID file lock to be locked, and continuing to execute the downloading and installing process of the plug-in. Because the first process already executes the downloading and installing process of the plug-in before the error exit occurs, and possibly downloads part of data of the plug-in, the second process can acquire the downloading and installing progress of the plug-in from the shared memory and continue downloading the plug-in according to the downloading and installing progress. And in the downloading and installing process of the plug-in, the second process simultaneously stores the downloading and installing progress of the plug-in to the shared memory. And after the second process finishes the downloading and installing process of the plug-in, the second process deletes or modifies the process ID of the second process in the process ID file lock into a preset value for unlocking, and then other processes can directly use the installed plug-in when the plug-in needs to be used without downloading the plug-in again.
Fig. 3 is a block diagram showing the configuration of a plug-in download apparatus according to an embodiment of the present invention. The present embodiment is exemplified by the case where the plug-in download apparatus is applied to a terminal in which a host application is installed, or is exemplified by the case where the plug-in download apparatus is applied to a terminal in which a host application and a non-host application are installed. As shown in fig. 3, the plug-in download apparatus includes: a first detection module 310, a query module 320, a first modification module 330, and a download module 340.
A first detection module 310, configured to implement the above step 101, step 205, and any other implicit or disclosed detection related functions.
Query module 320 for implementing steps 102, 206, and any other implicit or public query-related functions described above.
A first modification module 330, configured to implement the above step 103, step 207, and any other implicit or disclosed modification related functions.
A download module 340 for implementing the above-mentioned step 104, step 208, and any other implicit or public download-related functions.
Optionally, the apparatus further comprises: the system comprises a second detection module, a creation module, a third detection module, a fourth detection module, a fifth detection module, a sharing module, a deletion module and a second modification module.
A second detection module, configured to implement step 203 and any other implicit or disclosed detection-related functions.
A creation module for implementing the above step 204 and any other implicit or disclosed creation related functions.
A third detection module, configured to implement the foregoing step 201 and any other implicit or disclosed detection-related functions.
A fourth detection module, configured to implement the foregoing step 202 and any other implicit or disclosed detection-related functions.
A fifth detection module, configured to implement the foregoing step 211 and any other implicit or disclosed detection-related functions.
A sharing module for implementing the above step 212 and any other implicit or disclosed sharing-related functions.
A deletion module for implementing the above step 209 and any other implicit or disclosed deletion related functions.
A second modification module for implementing the above step 210 and any other implicit or disclosed detection related functions.
Optionally, the downloading module 340 includes: the device comprises an acquisition unit, a downloading unit and a recording unit.
An obtaining unit, configured to implement the step 208a and any other implicit or disclosed obtaining related functions.
A downloading unit for implementing the step 208b and any other implicit or public downloading related functions.
A recording unit for implementing the above step 208c and any other implicit or disclosed recording related functions.
It should be noted that: the plug-in downloading device provided in the above embodiment is only illustrated by dividing the functional modules when downloading the plug-in, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the plug-in downloading device and the plug-in downloading method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Referring to fig. 4, a block diagram of a plug-in downloading device provided in some embodiments of the present invention is shown. The plug-in downloading device 400 is used for implementing the plug-in downloading method provided by the above embodiment. The apparatus 400 of the present invention may include one or more of the following components: a processor for executing computer program instructions to perform the various processes and methods, Random Access Memory (RAM) and Read Only Memory (ROM) for information and storing program instructions, memory for storing data and information, I/O devices, interfaces, antennas, and the like. Specifically, the method comprises the following steps:
the apparatus 400 may include RF (Radio Frequency) circuitry 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a WiFi (wireless fidelity) module 470, a processor 480, a power supply 482, a camera 490, and the like. Those skilled in the art will appreciate that the plug-in download arrangement configuration shown in fig. 4 does not constitute a limitation of the terminal and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The various components of the apparatus 400 are described in detail below with reference to fig. 4:
the RF circuit 410 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 480; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuitry 410 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 420 may be used to store software programs and modules, and the processor 480 executes various functional applications and data processing of the apparatus 400 by operating the software programs and modules stored in the memory 420. The memory 420 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the apparatus 400, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus 400. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also called a touch screen, may collect touch operations of a user on or near the touch panel 431 (e.g., operations of the user on or near the touch panel 431 using any suitable object or accessory such as a finger or a stylus) and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 431 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 480, and receives and executes commands sent from the processor 480. In addition, the touch panel 431 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 430 may include other input devices 432 in addition to the touch panel 431. In particular, other input devices 432 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 440 may be used to display information input by or provided to the user and various menus of the apparatus 400. The Display unit 440 may include a Display panel 441, and optionally, the Display panel 441 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch panel 431 may cover the display panel 441, and when the touch panel 431 detects a touch operation on or near the touch panel 431, the touch panel is transmitted to the processor 480 to determine the type of the touch event, and then the processor 480 provides a corresponding visual output on the display panel 441 according to the type of the touch event. Although in fig. 4, the touch panel 431 and the display panel 441 are two separate components to implement the input and output functions of the apparatus 400, in some embodiments, the touch panel 431 and the display panel 441 may be integrated to implement the input and output functions of the apparatus 400.
The apparatus 400 may also include at least one sensor 450, such as a gyroscope sensor, a magnetic induction sensor, an optical sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 441 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 441 and/or the backlight when the device 400 is moved to the ear. As one type of motion sensor, the acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of electronic equipment, and related functions (such as pedometer and tapping) for vibration recognition; other sensors such as barometers, hygrometers, thermometers, infrared sensors, etc. may also be configured with the apparatus 400 and will not be described in detail herein.
Audio circuit 460, speaker 461, microphone 462 may provide an audio interface between a user and device 400. The audio circuit 460 may transmit the electrical signal converted from the received audio data to the speaker 461, and convert the electrical signal into a sound signal for output by the speaker 461; on the other hand, the microphone 462 converts the collected sound signal into an electric signal, which is received by the audio circuit 460 and converted into audio data, which is then processed by the audio data output processor 480, and then transmitted to, for example, another terminal via the RF circuit 410, or output to the memory 420 for further processing.
WiFi belongs to short-range wireless transmission technology, and the apparatus 400 can help the user send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 470, which provides the user with wireless broadband internet access. Although fig. 4 illustrates WiFi module 470, it is understood that it is not an essential component of apparatus 400 and may be omitted entirely as needed within the scope that does not alter the nature of the disclosure.
The processor 480 is a control center of the apparatus 400, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the apparatus 400 and processes data by operating or executing software programs and/or modules stored in the memory 420 and calling data stored in the memory 420, thereby performing overall monitoring of the electronic device. Optionally, processor 480 may include one or more processing units; preferably, the processor 480 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 480.
The apparatus 400 further includes a power supply 482 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 480 via a power management system to manage charging, discharging, and power consumption via the power management system.
The camera 490 is generally composed of a lens, an image sensor, an interface, a digital signal processor, a CPU, a display screen, and the like. The lens is fixed above the image sensor, and the focusing can be changed by manually adjusting the lens; the image sensor is equivalent to the 'film' of a traditional camera and is the heart of a camera for acquiring images; the interface is used for connecting the camera with the main board of the electronic equipment by using a flat cable, a board-to-board connector and a spring type connection mode, and sending the acquired image to the memory 420; the digital signal processor processes the acquired image through a mathematical operation, converts the acquired analog image into a digital image, and transmits the digital image to the memory 420 through an interface.
Although not shown, the apparatus 400 may further include a bluetooth module, etc., which will not be described herein.
The apparatus 400 includes, in addition to the one or more processors 480, memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be a computer-readable storage medium contained in the memory in the foregoing embodiment; or it may be a separate computer-readable storage medium not incorporated in the terminal. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the plug-in download method.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (13)

1. A method for plug-in download, the method comprising:
when a second process requests to download and install a plug-in, detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in; the process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process;
when the process ID file is latched with the process ID of a first process, inquiring whether the first process exists in an operating system according to the process ID of the first process, wherein the first process and the second process are processes in the same application program;
when the first process does not exist, determining that the first process exits abnormally, and modifying the process ID stored in the process ID file lock into the process ID of the second process;
and continuing to execute the downloading and installing process of the plug-in.
2. The method of claim 1, wherein prior to the detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in, the method further comprises:
detecting whether the process ID file lock corresponding to the plug-in exists or not;
when the process ID file lock corresponding to the plug-in exists, the step of detecting whether a process ID is stored in the process ID file lock corresponding to the plug-in is executed;
and when the process ID file lock corresponding to the plug-in does not exist, creating the process ID file lock, and writing the process ID of the second process into the process ID file lock.
3. The method of claim 2, wherein prior to the detecting whether the process ID file lock corresponding to the plug-in exists, the method further comprises:
detecting whether an application program corresponding to the second process is a host application program, wherein the host application program has the authority of downloading and installing the plug-in;
when the application program corresponding to the second process is the host application program, detecting whether the plug-in is installed in the host application program;
performing the step of detecting whether the process ID file lock corresponding to the plug-in exists when the plug-in is not installed in the host application.
4. The method of claim 3, wherein after the detecting whether the process ID file lock corresponding to the plug-in exists, the method further comprises:
when the application program corresponding to the second process is a non-host application program, detecting whether the plug-in is installed in the host application program;
sharing the plug-in from the host application when the plug-in is already installed in the host application.
5. The method according to any one of claims 1 to 4, wherein the continuing the download installation process of the plug-in includes:
acquiring a plug-in downloading and installing progress of the first process through a shared memory, wherein the shared memory is a storage space for realizing inter-process communication between the first process and the second process;
continuing to download and install the plug-in according to the acquired plug-in downloading and installing progress;
and recording the downloading and installing progress of the plug-in into the shared memory.
6. The method according to any one of claims 1 to 4, further comprising, after the continuing the download installation process of the plug-in, the steps of:
when the downloading and installing process is executed, deleting the process ID of the second process in the process ID file lock;
alternatively, the first and second electrodes may be,
and when the downloading and installing process is executed, modifying the process ID of the second process in the process ID file lock into a preset value, wherein the preset value is used for indicating that the downloading and installing process is executed.
7. A plug-in download apparatus, the apparatus comprising:
the first detection module is used for detecting whether a process ID is stored in a process ID file lock corresponding to the plug-in when the second process requests to download and install the plug-in; the process ID file lock is used for locking a process corresponding to the stored process ID, and the process ID is used for identifying the process;
the query module is configured to query, according to the process ID of the first process, whether the first process exists in an operating system when the first detection module detects that the process ID of the first process is stored in the process ID file latch, where the first process and the second process are processes in the same application program;
the first modification module is used for determining that the first process exits abnormally when the inquiry module inquires that the first process does not exist, and modifying the process ID stored in the process ID file lock into the process ID of the second process;
and the downloading module is used for continuously executing the downloading and installing process of the plug-in.
8. The apparatus of claim 7, further comprising:
the second detection module is used for detecting whether the process ID file lock corresponding to the plug-in exists or not;
the first detection module is further configured to detect whether a process ID is stored in the process ID file lock corresponding to the plug-in when the second detection module detects that the process ID file lock corresponding to the plug-in exists;
and the creating module is used for creating the process ID file lock and writing the process ID of the second process into the process ID file lock when the second detection module detects that the process ID file lock corresponding to the plug-in does not exist.
9. The apparatus of claim 8, further comprising:
a third detection module, configured to detect whether an application corresponding to the second process is a host application, where the host application has an authority to download and install the plug-in;
a fourth detection module, configured to detect whether the plug-in is already installed in the host application program when the third detection module detects that the application program corresponding to the second process is the host application program;
the second detection module is further configured to detect whether the process ID file lock corresponding to the plug-in exists when the fourth detection module detects that the plug-in is not installed in the host application.
10. The apparatus of claim 9, further comprising:
a fifth detection module, configured to detect whether the plug-in is already installed in the host application when the third detection module detects that the application corresponding to the second process is a non-host application;
a sharing module, configured to share the plug-in from the host application when the fifth detection module detects that the plug-in has been installed in the host application.
11. The apparatus according to any one of claims 7 to 10, wherein the download module comprises:
an obtaining unit, configured to obtain a plug-in download installation progress of the first process through a shared memory, where the shared memory is a storage space where the first process and the second process implement inter-process communication;
the downloading unit is used for continuously downloading and installing the plug-in according to the plug-in downloading and installing progress acquired by the acquiring unit;
and the recording unit is used for recording the downloading and installing progress of the plug-in downloaded by the downloading unit into the shared memory.
12. The apparatus of any one of claims 7 to 10, further comprising:
the deleting module is used for deleting the process ID of the second process in the process ID file lock when the downloading and installing process is executed;
and the second modification module is used for modifying the process ID of the second process in the process ID file lock into a preset value when the downloading and installing process is completely executed, wherein the preset value is used for indicating that the downloading and installing process is completely executed.
13. A computer-readable storage medium, in which a program is stored, the program being loaded and executed by a processor to implement the plug-in download method according to any one of claims 1 to 6.
CN201611093571.XA 2016-12-01 2016-12-01 Plug-in downloading method and device Active CN108132844B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611093571.XA CN108132844B (en) 2016-12-01 2016-12-01 Plug-in downloading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611093571.XA CN108132844B (en) 2016-12-01 2016-12-01 Plug-in downloading method and device

Publications (2)

Publication Number Publication Date
CN108132844A CN108132844A (en) 2018-06-08
CN108132844B true CN108132844B (en) 2020-11-10

Family

ID=62388206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611093571.XA Active CN108132844B (en) 2016-12-01 2016-12-01 Plug-in downloading method and device

Country Status (1)

Country Link
CN (1) CN108132844B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111475171B (en) * 2019-01-23 2024-04-12 阿里巴巴集团控股有限公司 Application program component downloading method and device and electronic equipment
CN111552524B (en) * 2020-05-06 2023-10-13 Oppo(重庆)智能科技有限公司 Plug-in loading method and device and computer readable storage medium
CN112162795B (en) * 2020-10-09 2023-12-12 广州博冠信息科技有限公司 Plug-in starting method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1965281A (en) * 2004-06-09 2007-05-16 西姆毕恩软件有限公司 Computing device with multiple progress structure for operating inserter program code module
CN101126977A (en) * 2007-08-28 2008-02-20 激动集团股份有限公司 ISAPI based WEB static page generation method
CN102567097A (en) * 2011-12-29 2012-07-11 Tcl王牌电器(惠州)有限公司 Method and terminal for downloading multiple tasks
CN105278942A (en) * 2014-07-23 2016-01-27 腾讯科技(深圳)有限公司 Component management method and apparatus
CN105357266A (en) * 2015-09-30 2016-02-24 山东乾云启创信息科技股份有限公司 Universal SOCKET communication and process management platform applied to multiple scenes and method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6742135B1 (en) * 2000-11-07 2004-05-25 At&T Corp. Fault-tolerant match-and-set locking mechanism for multiprocessor systems
US8887167B2 (en) * 2010-07-30 2014-11-11 International Business Machines Corporation High performance locks
US8230429B2 (en) * 2008-05-30 2012-07-24 International Business Machines Corporation Detecting a deadlock condition by monitoring firmware inactivity during the system IPL process

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1965281A (en) * 2004-06-09 2007-05-16 西姆毕恩软件有限公司 Computing device with multiple progress structure for operating inserter program code module
CN101126977A (en) * 2007-08-28 2008-02-20 激动集团股份有限公司 ISAPI based WEB static page generation method
CN102567097A (en) * 2011-12-29 2012-07-11 Tcl王牌电器(惠州)有限公司 Method and terminal for downloading multiple tasks
CN105278942A (en) * 2014-07-23 2016-01-27 腾讯科技(深圳)有限公司 Component management method and apparatus
CN105357266A (en) * 2015-09-30 2016-02-24 山东乾云启创信息科技股份有限公司 Universal SOCKET communication and process management platform applied to multiple scenes and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
A Survey on Load Testing of Large-Scale Software Systems;Zhen Ming Jiang 等;《 IEEE Transactions on Software Engineering》;20150615;第41卷(第11期);1091-1118 *

Also Published As

Publication number Publication date
CN108132844A (en) 2018-06-08

Similar Documents

Publication Publication Date Title
US9800609B2 (en) Method, device and system for detecting malware in a mobile terminal
CN106502703B (en) Function calling method and device
US9823819B1 (en) Method for launching remote applications from a mobile device using cloud cache
CN108595218B (en) Method and device for loading dynamic library of system
CN107329901B (en) Data packet capturing method, terminal, server and storage medium
CN106775833B (en) Device driver loading method, terminal and system
WO2019076293A1 (en) Differential upgrading method, device and system
CN106843868B (en) Multi-account login method and device and mobile terminal
WO2018006841A1 (en) Qr code information transmission method, device and apparatus
US9588757B2 (en) Data update method, user terminal, and data update system
US11063962B2 (en) Malicious URL detection method and apparatus, terminal, and computer storage medium
CN103455348A (en) Subarea adjustment method, device, terminal, server and system
WO2019057155A1 (en) Method and device for dynamically managing kernel node
WO2021098360A1 (en) Application control method, electronic device, and server
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
CN108132844B (en) Plug-in downloading method and device
CN108090345B (en) Linux system external command execution method and device
US20160308879A1 (en) Application-Based Service Providing Method, Apparatus, and System
CN109144596B (en) Quick starting method, device, terminal, server and system
CN106933636B (en) Method and device for starting plug-in service and terminal equipment
CN106095423B (en) Method, terminal and server for providing browsing service
CN107463395B (en) Component calling method and device
CN110196662B (en) Method, device, terminal and storage medium for displaying synchronization state
CN107122204B (en) Application unloading state detection method and device
CN106933626B (en) Application association method and device

Legal Events

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