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 solve application program in the prior art.
According to an aspect of the present invention, provide a kind of application program launching method, be used for adopting the portable terminal of dynamic link mode to start application program.
According to application program launching method of the present invention, comprising:
The application program launching device receives after the startup request of the application program that starts, and determines once to start after start this application program;
This application program of the second process initiation that the application program launching Array selection creates according to the first process replication that starts this application program, wherein, the first process is the last process that starts this application program, has loaded the dynamic library file of this application program in the second process.
Further, starting first in 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 of application program to be started, and loads dynamic library file, and wherein, dynamic library file comprises the initialize routine of application program;
The first kind starts process replication and creates a new Equations of The Second Kind startup process, and the Equations of The Second Kind startup process that creates is recorded in default Equations of The Second Kind starts in the process collection, wherein, Equations of The Second Kind starts the process number of record Equations of The Second Kind startup process in the process collection and the filename that Equations of The Second Kind 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 creates with normal priority and starts a new first kind and starts process, and will create new first kind startup process and be recorded 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, the inquiry Equations of The Second Kind start the filename that whether exists in the process collection with above-mentioned application program corresponding Equations of The Second Kind 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 above-mentioned application program of application program launching Array selection the second process initiation comprises:
The application program launching device starts at Equations of The Second Kind selects the Equations of The Second Kind corresponding with the filename of this application program to start process as the second process in the process collection;
The application program launching device sends the startup command that starts this application program to the Equations of The Second Kind startup process of selecting, and the indication Equations of The Second Kind starts this application program of process initiation.
Preferably, above-mentioned Equations of The Second Kind startup process initiation application program comprises:
After Equations of The Second Kind startup process receives startup command, improve the priority that Equations of The Second Kind starts process;
Equations of The Second Kind starts process replication and creates a new Equations of The Second Kind startup process, and the new Equations of The Second Kind startup process that will create is recorded in the default Equations of The Second Kind startup process collection, wherein, Equations of The Second Kind starts the process number of record Equations of The Second Kind startup process in the process collection and the filename that Equations of The Second Kind starts the application program of process initiation, and filename comprises the path of application program in cell phone system;
Equations of The Second Kind startup process is carried out the initialize routine that Equations of The Second Kind starts the dynamic library file of process, is finished, and the priority of recovering Equations of The Second Kind startup process is normal priority.
Further, the application program launching device started process or Equations of The Second Kind startup process transmission startup command to the first kind after, said method also comprises: the application program launching device reduced the priority of application program launching device place process.
Further, after the first kind started process initiation application program or Equations of The Second Kind 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, startup command in the startup application program of event major cycle application program launching device medium to be received, after receiving startup command, the initialize routine that only needs to load the dynamic library file of application program to be started and carry out dynamic library file;
The Equations of The Second Kind startup process that Equations of The Second Kind 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, startup command in the startup application program of event major cycle application program launching device medium to be received, 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 for adopting 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 for receiving the startup request of application program to be started; Arbitration modules is used for determining whether application program started after start; Second selects module, is used for the second process that selective basis starts the first process replication of application program; Second starts module, is used for the second process initiation application program according to the first process replication 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 first in the situation of application program any one first kind startup process of selection in default first kind startup process collection after the start; 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 arranges module, for reducing or recover the priority of application program launching device place process.
By above-mentioned at least one scheme of the present invention, can start at short notice a plurality of application programs, particularly when the user starts the application program that once started again after once starting shooting, do not need again to load the dynamic base of this application program, thereby accelerated again to start 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 writing, claims and accompanying drawing.
Embodiment
Functional overview
In embodiments of the present invention, the application program launching device is once starting first or is again starting after the start by judging the application program wait the portable terminal that starts, and selects first kind startup process or Equations of The Second Kind 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 Equations of The Second Kind 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 adopt the portable terminal of dynamic link mode, comprise mobile phone, PDA, music the portable terminal such as video player, all take the handset starting application program as example, describe concrete startup scheme in detail in the embodiment of the invention.
In 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, is not intended to limit 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, Equations of The Second Kind starts process collection, start process collection in above-mentioned two classes of specific implementation process and adopt the process chained list to manage, namely be set to the first kind and start process chained list, Equations of The Second Kind 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, start the quick startup background process of application command at the medium application-managed device waiting of this major cycle.Analysis by the front as can be known, first kind quicklauncher process possesses the ability that becomes any program process that will start, highly versatile.
The Equations of The Second Kind that Equations of The Second Kind starts in the process chained list starts process (quicklauncher process), have following attribute: and Equations of The Second Kind quicklauncher process is on the basis of first kind quicklauncher process, further loaded the dynamic library file of the application program specific needs that will start, 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 not also carried out the setup code in the application program dynamic library file that will start.When the user reuses identical application program after once starting shooting, the Equations of The Second Kind of platform inquiry Dynamic Maintenance starts the process chained list, if when having the Equations of The Second Kind quicklauncher corresponding with this application program in this chained list, select it also to control the setup code of its direct executive utility dynamic base, can more further shorten start-up time.
Application manager creates simultaneously in cell phone system initialization start-up course and starts the individual first kind of N (N is as natural number) take 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, the method comprises following flow process (step 102-step 106):
Step 102, application program launching device receive after the startup request of the application program that starts, and 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 of application program to be started, the inquiry Equations of The Second Kind starts whether there be the Equations of The Second Kind startup process corresponding with the filename of described application program in the process chained list, 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.
This application program of the second process initiation that step 106, application program launching Array selection create according to the first process replication that starts above-mentioned application program, wherein, the first process is the last process that starts application program, has loaded the dynamic library file of this application program in the second process.
Particularly, the application program launching device selects the Equations of The Second Kind corresponding with the filename of described application program to start process as described the second process in Equations of The Second Kind startup process chained list; The application program launching device sends the startup command that starts application program to this Equations of The Second Kind startup process of selecting, indicates this Equations of The Second Kind to start the process initiation application program.
Further, the application program launching device started process or Equations of The Second Kind startup process transmission startup command to the first kind after, the application program launching device reduced the priority of described application program launching device place process.
The below describes in detail to the flow process that the first kind starts the process initiation application program.
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 of application program to be started, and load this dynamic library file, and wherein, this dynamic library file comprises the initialize routine of application program;
Step 206, the first kind start process replication and create a new Equations of The Second Kind startup process, and the Equations of The Second Kind startup process that creates is recorded in default Equations of The Second Kind starts in the process chained list, wherein, Equations of The Second Kind starts the process number of record Equations of The Second Kind startup process in the process chained list and the filename that Equations of The Second Kind starts the application program of process initiation, and this document name comprises the path of application program in cell phone system;
Particularly, first kind startup process copies new Equations of The Second Kind startup process of establishment according to the attribute of self, when above-mentioned application program startup next time, just can use new this application program of Equations of The Second Kind 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 Equations of The Second Kind startup process allows existence, is made as M (M is natural number) at this.Therefore, when if current Equations of The Second Kind 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 new Equations of The Second Kind with least-recently-used old Equations of The Second Kind 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 create with normal priority and start a new first kind and start process, and will create new first kind startup process and be recorded in the first kind startup process chained list.
Particularly, because after step 208 was finished, the first kind started the process that process has become above-mentioned application program, therefore need to create a new first kind and start process replenishing, and be recorded to the first kind and start in the process chained list.
The below describes in detail to the flow process that Equations of The Second Kind starts the process initiation application program.
Fig. 3 is the process flow diagram that starts the process initiation application program according to the Equations of The Second Kind of the embodiment of the invention, and as shown in Figure 3, the flow process that Equations of The Second Kind starts the process initiation application program comprises (step 302-step 306):
After step 302, Equations of The Second Kind startup process receive startup command, improve the priority that Equations of The Second Kind starts process;
Step 304, the new Equations of The Second Kind startup process of process replication establishment that starts, and the new Equations of The Second Kind startup process that will create is recorded in the default Equations of The Second Kind startup process chained list, wherein, Equations of The Second Kind starts the process number of record Equations of The Second Kind startup process in the process chained list and the filename that Equations of The Second Kind starts the application program of process initiation, and filename comprises the path of application program in cell phone system;
Step 306, Equations of The Second Kind startup process are carried out the initialize routine that Equations of The Second Kind starts the dynamic library file of process, are finished, and the priority of recovering Equations of The Second Kind startup process is normal priority.
Further, after the first kind started process initiation application program or Equations of The Second Kind 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 arrange separately, also can arrange with the application manager unification, embodiment in following examples all adopts application program launching device and application manager unification to arrange, so the application manager of mentioning in following examples all has the start-up performance 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 simultaneously the individual first kind of N (N is as natural number) take 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: the application program number that may start 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 Equations of The Second Kind quicklauncher process that is fit to the current system state;
In this step, arbitration modules is analyzed the current system running status, 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 copy according to strategy that to create a new Equations of The Second Kind quicklauncher process for subsequent use;
In this step, concrete implementation strategy such as preamble are described, and for example adopt lru algorithm.Like this, when the user reuses identical application program after once starting shooting, if the arbitration modules of step 403 checks in the quick startup process that exists in the Equations of The Second Kind quicklauncher process chained list for this application program, then enter step 412.
Then the setup code of step 409, this first kind quicklauncher process executive utility dynamic base recovers self priority;
After this step executed, this first kind quicklauncher process had namely 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, the first kind quicklauncher process that starts in the new quicklauncher Process Synchronization rapid 402 that starts is identical, be used for remedying that quicklauncher process in step 406 loss, thereby have N available first kind quicklauncher process in the assurance system.
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 Equations of The Second Kind quicklauncher process of selecting and start utility command, the priority of application manager reduction self place process;
After step 413, this Equations of The Second Kind quicklauncher process are received startup command, improve self priority, copy creating a new Equations of The Second Kind quicklauncher process, with for subsequent use;
Then the setup code of step 414, this Equations of The Second Kind quicklauncher process executive utility recovers self priority.Last execution in step 411 allows application manager recover the priority of self place process, and the processing of selecting Equations of The Second Kind quicklauncher to start application program leaves it at that.
Below by specific embodiment, introduce in detail the establishment of mentioning in the step 402 of above-described embodiment one and the step 410 and the idiographic flow that starts first kind quicklauncher process.
Embodiment two
In the present embodiment, adopt (SuSE) Linux OS as example (portable terminal is not limited to adopt (SuSE) Linux OS) take portable terminal, the flow process that creates 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 arrange process running environment for the first kind quickiuancher process that will move, process, close such as the signal for this process setting operation system and unnecessary inherit the 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 represented current available first kind quicklauncher process in the system;
Step 506, application manager continue other processing.
Particularly, when starting in system, application manager need to repeat above flow process N time.
Below by specific embodiment, introduce in detail the establishment of mentioning in the step 408 of above-described embodiment one and the step 413 and the idiographic flow that starts Equations of The Second Kind quicklauncher process.
Embodiment three
In the present embodiment, adopt (SuSE) Linux OS as example (portable terminal is not limited to adopt (SuSE) Linux OS) take portable terminal, the flow process that creates and start Equations of The Second Kind quicklauncher process is introduced.
Fig. 6 is that as shown in Figure 6, this flow process may further comprise the steps (step 601-step 603) according to the process flow diagram of the establishment of the embodiment of the invention three and startup Equations of The Second Kind quicklauncher process:
Step 601, create new subprocess by the first kind quicklauncher process at current place or Equations of The Second Kind 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 Equations of The Second Kind 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 first kind quicklauncher process or Equations of The Second Kind quicklauncher process place, changes step 603 over to;
The title (containing application program in the cell phone system absolute path) of step 603, notice application manager bundle process ID and the application program that will start is recorded in the Equations of The Second Kind quicklauncher chained list of application manager.
Below in conjunction with specific embodiment, introduce in detail the first kind from the angle of process and start the fast idiographic flow of startup of process, Equations of The Second Kind startup process.
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 event 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 event major cycle, namely no longer receive and process other outside event;
Step 705, this first kind quicklauncher process are resolved startup command;
Step 706, this first kind quicklauncher process load corresponding application program dynamic base according to the analysis result of startup command;
Step 707, this first kind quicklauncher process copy the new first kind quicklauncher process corresponding with it that creates 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 then recover self priority;
Step 709, this first kind quicklauncher process enter the event major cycle again, because the application initializes function has re-started setting to the execution environment of this application according to oneself needs, therefore, in the event major cycle that enters specifically, to the reception of event with to process all be that flow process according to the logic of new application has been processed, be the process that original first kind qulckiauncher process has become the function of finishing new application, new application process namely.
Embodiment five
Fig. 8 is the process flow diagram that the Equations of The Second Kind 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 Equations of The Second Kind 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 Equations of The Second Kind quicklauncher process is received startup command, improve self priority, withdraw from the event major cycle, namely no longer receive and process other outside event;
Step 803, this Equations of The Second Kind quicklauncher copy and create a new Equations of The Second Kind quicklauncher process, with for subsequent use;
The setup code of step 804, this Equations of The Second Kind quicklauncher process executive utility recovers self process priority;
Step 805, this Equations of The Second Kind quicklauncher process enter the event major cycle again.
According to the embodiment of the invention, a kind of application program launching device also is provided, be used for adopting 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 for receiving the startup request of application program to be started; Arbitration modules 92 is used for determining whether application program started after start; Second selects module 93, is used for the second process that selective basis starts the first process replication of application program; Second starts module 94, is used for the second process initiation application program according to the first process replication 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 first in the situation of application program any one first kind startup process of selection in default first kind startup process collection after the start; 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, also comprise according to the application program launching device of the embodiment of the invention: priority arranges module 97, for reducing 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, can find out that a plurality of first kind start process or Equations of The Second Kind starts the existence of process in system, can both find the available first kind to start process or Equations of The Second Kind startup process when having guaranteed a plurality of application program of quick startup, thereby make each application program start process or fast startup of Equations of The Second Kind startup process realization 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 faster toggle speed.Start in the startup command process of process or Equations of The Second Kind 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 impact of other event 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 modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.