Summary of the invention
In view of this, the invention provides a kind of application program launching scheme, in start-up course, can't shorten the problem of the time that loads dynamic base in order to application program in the solution prior art.
According to an aspect of the present invention, provide a kind of application program launching method, be used to adopt the portable terminal of dynamic link mode to start application program.
According to application program launching method of the present invention, comprising:
After the application program launching device receives the startup request for the treatment of application program started, determine after start, once to start this application program;
The application program launching device selects to duplicate according to first process that starts this application program this application program of second process initiation of establishment, wherein, first process is the last process that starts this application program, has loaded the dynamic library file of this application program in second process.
Further, starting first under the situation of this application program after the start determining, said method also comprises:
The application program launching device starts in the default first kind selects any one first kind to start process in the process collection, and sends the startup command that starts this application program to first kind startup process, and the indication first kind starts this application program of process initiation.
Preferably, first kind startup process initiation application program comprises:
After first kind startup process receives startup command, improve the priority that the first kind starts process, and resolve the startup command that receives;
The first kind starts process according to the startup command after resolving, and obtains the dynamic library file for the treatment of application program started, and loads dynamic library file, and wherein, dynamic library file comprises the initialize routine of application program;
First kind startup process is duplicated new second class startup process of creating, and the second class startup process that will create is recorded in default second class startup process collection, wherein, second class starts the process number of record second class startup process in the process collection and the filename that second class starts the application program of process initiation, and filename comprises the path of application program in cell phone system;
First kind startup process is carried out the initialize routine of dynamic library file, is finished, and the priority of recovering first kind startup process is normal priority;
The application program launching device is created with normal priority and is started a new first kind and starts process, and will create new first kind startup process and record in the first kind startup process collection.
Further, the application program launching device judges that whether application program once started, and comprising after start:
Filename according to described application program to be started, inquire about second class start the filename that whether exists in the process collection with above-mentioned application program corresponding second class start process, if exist, represent that then this application program once started after start, otherwise, represent that this application program starts first after start.
Further, the application program launching device selects the above-mentioned application program of second process initiation to comprise:
The application program launching device starts in second class selects second class corresponding with the filename of this application program to start process as second process in the process collection;
The application program launching device sends the startup command that starts this application program to the second class startup process of selecting, and indicates second class to start this application program of process initiation.
Preferably, above-mentioned second class startup process initiation application program comprises:
After the second class startup process receives startup command, improve the priority that second class starts process;
The second class startup process is duplicated new second class startup process of creating, and the second new class startup process that will create is recorded in default second class startup process collection, wherein, second class starts the process number of record second class startup process in the process collection and the filename that second class starts the application program of process initiation, and filename comprises the path of application program in cell phone system;
The second class startup process is carried out the initialize routine that second class starts the dynamic library file of process, is finished, and the priority of recovering second class startup process is normal priority.
Further, after the first kind started process or second class startup process transmission startup command, said method also comprises: the application program launching device reduced the priority of application program launching device place process at the application program launching device.
Further, after the first kind started process initiation application program or second class startup process initiation application program, said method also comprises: the application program launching device recovered the priority of application program launching device place process.
Preferably, to start the first kind startup process that process collection comprises be the process with following attribute for the above-mentioned first kind:
Finished the execution of the public operation of all application programs, go forward side by side in the incoming event major cycle, in the incident major cycle, wait for the startup command of the startup application program that receives the application program launching device, after receiving startup command, only need to load the dynamic library file for the treatment of application program started and the initialize routine of carrying out dynamic library file;
The second class startup process that second class startup process collection comprises is the process with following attribute:
Finished the execution of the public operation of all application programs, loaded the dynamic library file of described application program to be started, go forward side by side in the incoming event major cycle, in the incident major cycle, wait for the startup command of the startup application program that receives the application program launching device, after receiving startup command, only need to carry out the initialize routine of dynamic library file;
Wherein, public operation comprises: load shared library that the operation of all application programs all needs, initialization graphics subsystem, initialization time processing subsystem and initialization use communication subsystem.
According to another aspect of the present invention, provide a kind of application program launching device, be used to adopt the portable terminal of dynamic link mode to start application program.
According to application program launching device of the present invention, comprising: receiver module, arbitration modules, second select module and second to start module, and wherein, receiver module is used to receive the startup request for the treatment of application program started; Arbitration modules is used for determining whether application program started after start; Second selects module, is used to select second process of duplicating according to first process that starts application program; Second starts module, is used for the second process initiation application program of duplicating according to first process that starts application program.
Further, above-mentioned application program launching device also comprises: first selects module, first to start module, wherein, first selects module, be used for determining to start under the situation of application program any one first kind startup process of selection in default first kind startup process collection after the start first; First starts module, is used for sending the startup command that starts application program to first kind startup process, and the indication first kind starts the process initiation application program.
Further, above-mentioned application program launching device also comprises: priority is provided with module, is used to reduce or recover the priority of application program launching device place process.
By above-mentioned at least one scheme of the present invention, can start a plurality of application programs at short notice, particularly when the user starts the application program that once started once more after once starting shooting, do not need to load once more the dynamic base of this application program, thereby accelerated to start once more the toggle speed of this application program, promoted user's Experience Degree.
Other features and advantages of the present invention will be set forth in the following description, and, partly from instructions, become apparent, perhaps understand by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the instructions of being write, claims and accompanying drawing.
Embodiment
Functional overview
In embodiments of the present invention, the application program launching device is once starting first or is starting once more after the start by the application program of judgement portable terminal to be started, and selects the first kind startup process or second class to start the above-mentioned application program of process initiation.If this application program is once starting after the start first, then select the first kind to start this application program of process initiation, only need load the dynamic base of this application program, and carry out the setup code in the dynamic base; If this application program was once starting after the start, then select second class to start this application program of process initiation, do not need to load the dynamic base of this application program, only carry out the setup code in the dynamic base, thereby shortened the start-up time of the application program of portable terminal, remedied deficiency of the prior art.
In embodiments of the present invention, the scheme of the startup application program that provides is applicable to the portable terminal that adopts the dynamic link mode, comprise mobile phone, PDA, music portable terminal such as video player, be example all in the embodiment of the invention, describe concrete startup scheme in detail with the handset starting application program.
Under the situation of not conflicting, embodiment and the feature among the embodiment among the application can make up mutually.
Below in conjunction with accompanying drawing the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein only is used for description and interpretation the present invention, and be not used in qualification the present invention.
According to the embodiment of the invention, at first provide a kind of method that starts application program.
For realizing the method for the startup application program that the embodiment of the invention provides, need in cell phone system, set in advance two classes and start process collection, be that the first kind starts process collection, second class starts process collection, start process collection in above-mentioned two classes of specific implementation process and adopt the process chained list to manage, promptly be set to the first kind and start process chained list, second class startup process chained list.
The first kind that the first kind starts in the process chained list starts process (quicklauncher process), has following attribute: carried out the public operation that all application programs all will be carried out when starting, go forward side by side in the incoming event major cycle, in this major cycle, wait for and accept the quick startup background process that application manager starts application command.Analysis by the front as can be known, first kind quicklauncher process possesses becomes any ability that will the application program started process, highly versatile.
Second class that second class starts in the process chained list starts process (quicklauncher process), have following attribute: and the second class quicklauncher process is on the basis of first kind quicklauncher process, further loaded will the application program started specific needs dynamic library file, the incoming event major cycle of going forward side by side waits for that application manager sends the process that its startup is notified in order.At this moment, this process is also carried out the setup code in will the application program started dynamic library file.When the user reuses identical application program after once starting shooting, second class of platform inquiry Dynamic Maintenance starts the process chained list, if when having the second class quicklauncher corresponding in this chained list with this application program, select it also to control the setup code of its direct executive utility dynamic base, can more further shorten start-up time.
Application manager is created simultaneously in cell phone system initialization start-up course and is started the individual first kind of N (N is a natural number) with normal priority and starts process.
Fig. 1 is the process flow diagram according to the application program launching method of the embodiment of the invention, and as shown in Figure 1, this method comprises following flow process (step 102-step 106):
After step 102, application program launching device receive the startup request for the treatment of application program started, judge that this application program is to start first or once started, if start first, then execution in step 104, if once started then execution in step 106.
In concrete implementation process, the application program launching device is according to the filename for the treatment of application program started, inquire about second class and start whether there be the second class startup process corresponding in the process chained list with the filename of described application program, if exist, represent that then described application program once started after start, otherwise, represent that described application program starts first after start.
Step 104, application program launching device select any one first kind to start process in default quick startup process chained list, and send the startup command that starts this application program to this first kind startup process, indicate this first kind to start the process initiation application program.
Step 106, application program launching device select to duplicate according to first process that starts above-mentioned application program this application program of second process initiation of establishment, wherein, first process is the last process that starts application program, has loaded the dynamic library file of this application program in second process.
Particularly, the application program launching device selects second class corresponding with the filename of described application program to start process as described second process in second class startup process chained list; The application program launching device sends the startup command that starts application program to this second class startup process of selecting, indicates this second class to start the process initiation application program.
Further, after the first kind started process or second class startup process transmission startup command, the application program launching device reduced the priority of described application program launching device place process at the application program launching device.
Flow process to first kind startup process initiation application program describes in detail below.
Fig. 2 is the process flow diagram that starts the process initiation application program according to the first kind of the embodiment of the invention, and as shown in Figure 2, the flow process that the first kind starts the process initiation application program comprises (step 202-step 210):
After step 202, first kind startup process receive startup command, improve the priority that the first kind starts process, and resolve the startup command that receives;
Step 204, the first kind start process according to the startup command after resolving, and obtain the dynamic library file for the treatment of application program started, and load this dynamic library file, and wherein, this dynamic library file comprises the initialize routine of application program;
Step 206, first kind startup process are duplicated new second class startup process of creating, and the second class startup process that will create is recorded in default second class startup process chained list, wherein, second class starts the process number of record second class startup process in the process chained list and the filename that second class starts the application program of process initiation, and this document name comprises the path of application program in cell phone system;
Particularly, the first kind starts process duplicates according to self attribute and creates second a new class and start process, when above-mentioned application program starts next time, just can use new this application program of second class startup process initiation of this establishment.Because mobile phone resources is limited, in specific implementation process, cell phone system should dispose the maximum quantity that the second class startup process allows existence, is made as M (M is a natural number) at this.Therefore, when if current second class startup process number has reached maximum permissible value M, must adopt a kind of replacement policy, this strategy can flexible configuration, for example: LRU strategy (least recently used Replacement Strategy) replaces with the second new class with the least-recently-used second old class startup process and starts process.
Step 208, first kind startup process are carried out the initialize routine of above-mentioned dynamic library file, are finished, and the priority of recovering first kind startup process is normal priority;
Step 210, application program launching device are created with normal priority and are started a new first kind and start process, and will create new first kind startup process and record in the first kind startup process chained list.
Particularly,, therefore need to create a new first kind and start process replenishing, and record the first kind and start in the process chained list because after step 208 was finished, the first kind started the process that process has become above-mentioned application program.
Flow process to second class startup process initiation application program describes in detail below.
Fig. 3 is the process flow diagram that starts the process initiation application program according to second class of the embodiment of the invention, and as shown in Figure 3, the flow process that second class starts the process initiation application program comprises (step 302-step 306):
After step 302, the second class startup process receive startup command, improve the priority that second class starts process;
Step 304, startup process are duplicated new second class startup process of creating, and the second new class startup process that will create is recorded in default second class startup process chained list, wherein, second class starts the process number of record second class startup process in the process chained list and the filename that second class starts the application program of process initiation, and filename comprises the path of application program in cell phone system;
Step 306, the second class startup process are carried out the initialize routine that second class starts the dynamic library file of process, are finished, and the priority of recovering second class startup process is normal priority.
Further, after the first kind started process initiation application program or second class startup process initiation application program, the application program launching device recovered the priority of application program launching device place process.
Below in conjunction with accompanying drawing, describe the method for the startup application program that the embodiment of the invention provides in detail by specific embodiment.
The application program launching device that provides in the embodiment of the invention can be provided with separately, also can be provided with the application manager unification, embodiment in following examples all adopts application program launching device and application manager unification to be provided with, so the application manager of mentioning in following examples all has the startup function of application program launching device.
Embodiment one
Fig. 4 is that as shown in Figure 4, this flow process may further comprise the steps (step 401-step 414) according to the quick process flow diagram that starts of the application program of mobile phone of the embodiment of the invention one:
Step 401, at the cell phone software platform, quick startup application program is provided;
Application manager in step 402, the cell phone software platform starts the individual first kind of N (N is a natural number) simultaneously with normal priority and starts process, i.e. first kind quicklauncher process in cell phone system initialization start-up course;
Wherein the N value can be by system's flexible configuration.Such as being configured to: possibility application program started number in the start-up time of first kind quicklauncher process self, and N is more than or equal to 2.
After step 403, application manager received the application start request, the request arbitration modules was to choose the first kind or the second class quicklauncher process that is fit to current system state;
In this step, arbitration modules is analyzed current system running state, and method is described with preamble.
Step 404, the whether first kind quicklauncher process of judging that arbitration modules chooses.If, execution in step 405; Otherwise, execution in step 413;
Step 405, application manager send to the first kind quicklauncher process of selecting and start utility command, the priority of application manager reduction self place process;
After step 406, this first kind quicklauncher process are received startup command, improve self priority, resolve the startup command of receiving;
The dynamic library file that step 407, this first kind quicklauncher process loading application programs need;
Step 408, this first kind quicklauncher process duplicate according to strategy that to create second a new class quicklauncher process standby;
In this step, concrete implementation strategy such as preamble are described, and for example adopt lru algorithm.Like this, when the user reused identical application program after once starting shooting, the arbitration modules of step 403 then entered step 412 if check in the quick startup process that exists in the second class quicklauncher process chained list at this application program.
The setup code of step 409, this first kind quicklauncher process executive utility dynamic base recovers self priority then;
After this step executed, this first kind quicklauncher process had promptly become program process, and the startup of application program is finished.
Step 410, application manager start a new first kind quicklauncher process;
In this step, a new quicklauncher process that starts is identical with the first kind quicklauncher process that starts in the step 402, be used for remedying that quicklauncher process, thereby have N available first kind quicklauncher process in the assurance system in step 406 loss.
The priority of step 411, application manager recovery self place process, the processing of selecting first kind quicklauncher to start application program leaves it at that;
Step 412, application manager send to the second class quicklauncher process of selecting and start utility command, the priority of application manager reduction self place process;
After step 413, this second class quicklauncher process are received startup command, improve self priority, duplicate and create second a new class quicklauncher process, with standby;
The setup code of step 414, this second class quicklauncher process executive utility recovers self priority then.Last execution in step 411 allows application manager recover the priority of self place process, and the processing of selecting the second class quicklauncher to start application program leaves it at that.
Below by specific embodiment, introduce establishment of mentioning in the step 402 of the foregoing description one and the step 410 and the idiographic flow that starts first kind quicklauncher process in detail.
Embodiment two
In the present embodiment, adopting (SuSE) Linux OS with portable terminal is example (portable terminal is not limited to adopt (SuSE) Linux OS), and the flow process of creating and start first kind quicklauncher process is introduced.
Fig. 5 is that as shown in Figure 5, this flow process may further comprise the steps (step 501-step 506) according to the process flow diagram of the establishment of the embodiment of the invention two and startup first kind quicklauncher process:
The fork () of step 501, application manager call operation system calls and creates a new subprocess;
The rreturn value that step 502, judgement fork () call, if equal 0, the subprocess that this new establishment is described is exactly that first kind quickluancher will be in the process of this operation, then execution in step 503; If be not equal to 0, explanation is to move execution in step 505 in the former process at application manager place;
Step 503, application manager are provided with process running environment for the first kind quickiuancher process that will move, such as for the signal Processing of this process setting operation system, close and unnecessary inherit system resource of getting off and the system resource of opening needs for this process etc. from parent process;
Step 504, in subprocess execv (...) function of call operation system, carry out the code of first kind quicklauncher application program, the processing that application manager starts first kind quicklauncher process leaves it at that;
Step 505, application manager just call the subprocess sign ID that returns to fork () and are recorded in the ID chained list of the first kind quicklauncher process of himself safeguarding, the content of each node in this chained list has been represented current available first kind quicklauncher process in the system;
Step 506, application manager continue other processing.
Particularly, when system start-up, application manager need repeat above flow process N time.
Below by specific embodiment, introduce establishment of mentioning in the step 408 of the foregoing description one and the step 413 and the idiographic flow that starts the second class quicklauncher process in detail.
Embodiment three
In the present embodiment, adopting (SuSE) Linux OS with portable terminal is example (portable terminal is not limited to adopt (SuSE) Linux OS), and the flow process of creating and start the second class quicklauncher process is introduced.
Fig. 6 is according to the establishment of the embodiment of the invention three and starts the process flow diagram of the second class quicklauncher process that as shown in Figure 6, this flow process may further comprise the steps (step 601-step 603):
Step 601, create new subprocess by the first kind quicklauncher process at current place or the second class quicklauncher process transfer fork ();
The rreturn value that step 602, judgement fork () call, if equal 0, the subprocess that this new establishment is described is exactly that the second class quickluancher will be in the process of this operation, processing leaves it at that; If be not equal to 0, explanation is to move in the former process at the first kind quicklauncher process or the second class quicklauncher process place, changes step 603 over to;
Step 603, notice application manager bundle process ID and title (containing application program in the cell phone system absolute path) that will application program started record in the second class quicklauncher chained list of application manager.
Below in conjunction with specific embodiment, introduce the first kind in detail from the angle of process and start process, second class startup process idiographic flow of startup fast.
Embodiment four
Fig. 7 is the process flow diagram that the first kind startup process according to the embodiment of the invention four starts fast, and as shown in Figure 7, this flow process may further comprise the steps (step 701-step 709):
Step 701, first kind quicklauncher process load in all platforms all application programs operations all needs the shared library used;
Step 702, the system that all will use all application programs carry out initialization.For example, the initialization in graphics subsystem storehouse, event handling subsystem library, application communication subsystem storehouse etc.;
Step 703, enter the incident major cycle, in this circulation, wait for the application start order that application manager sends over;
Step 704, after this first kind quicklauncher process is received startup command, improve self priority, withdraw from the incident major cycle, promptly no longer receive and handle other outside incident;
Step 705, this first kind quicklauncher process are resolved startup command;
Step 706, this first kind quicklauncher process load the corresponding application dynamic base according to the analysis result of startup command;
Step 707, this first kind quicklauncher process are duplicated the new first kind quicklauncher process corresponding with it of creating according to strategy;
Step 708, this first kind quicklauncher process are carried out the application initializes code in the application program dynamic base that loads, and recover self priority then;
Step 709, this first kind quicklauncher process enter the incident major cycle once more, since the application initializes function to should with execution environment be provided with again according to oneself needs, therefore, in the incident major cycle that enters specifically, to the reception of incident with to handle all be that flow process according to the logic of new application has been handled, be the process that original first kind qulckiauncher process has become the function of finishing new application, just new application process.
Embodiment five
Fig. 8 is the process flow diagram that the second class startup process according to the embodiment of the invention five starts fast, and as shown in Figure 8, this flow process may further comprise the steps (step 801-step 805):
Step 801, this second class quicklauncher process are being created laggard incoming event major cycle, wait for the startup utility command that application manager sends in this circulation;
Step 802, after this second class quicklauncher process is received startup command, improve self priority, withdraw from the incident major cycle, promptly no longer receive and handle other outside incident;
Step 803, this second class quicklauncher duplicate and create second a new class quicklauncher process, with standby;
The setup code of step 804, this second class quicklauncher process executive utility recovers self process priority;
Step 805, this second class quicklauncher process enter the incident major cycle once more.
According to the embodiment of the invention, a kind of application program launching device also is provided, be used to adopt the portable terminal of dynamic link mode to start application program.
Fig. 9 is the structural representation of following according to the application program launching device of the embodiment of the invention, as shown in Figure 9, this device comprises: receiver module 91, arbitration modules 92, second select module 93 and second to start module 94, wherein, receiver module 91 is used to receive the startup request for the treatment of application program started; Arbitration modules 92 is used for determining whether application program started after start; Second selects module 93, is used to select second process of duplicating according to first process that starts application program; Second starts module 94, is used for the second process initiation application program of duplicating according to first process that starts application program.
Preferably, application program launching device according to the embodiment of the invention also comprises: first selects module 95, first to start module 96, wherein, first selects module 95, be used for determining to start under the situation of application program any one first kind startup process of selection in default first kind startup process collection after the start first; First starts module 96, is used for sending the startup command that starts application program to described first kind startup process, and the indication first kind starts the process initiation application program.
Preferably, the application program launching device according to the embodiment of the invention also comprises: priority is provided with module 97, is used to reduce or recover the priority of application program launching device place process.
As mentioned above, the technical scheme that provides by the embodiment of the invention, a plurality of as can be seen first kind start process or second class starts the existence of process in system, can both find the available first kind to start process when having guaranteed a plurality of application program of quick startup or second class starts process, thereby make each application program start process or second class startup process realization startup fast by the first kind, particularly when the user reuses the application program that once started after once starting shooting, can obtain to start first this and use toggle speed faster.Start in the startup command process of process or second class startup process processing application manager in the first kind in addition, assurance moves with high priority, thereby make the start-up course of each application program without disturbance, avoided because the application program launching process that the influence of other incident causes in the system is slack-off.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.