CN105335171A - Method and device for long residence of application program in background of operating system - Google Patents

Method and device for long residence of application program in background of operating system Download PDF

Info

Publication number
CN105335171A
CN105335171A CN201410287640.5A CN201410287640A CN105335171A CN 105335171 A CN105335171 A CN 105335171A CN 201410287640 A CN201410287640 A CN 201410287640A CN 105335171 A CN105335171 A CN 105335171A
Authority
CN
China
Prior art keywords
keep
host
alive
alive process
operating system
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.)
Granted
Application number
CN201410287640.5A
Other languages
Chinese (zh)
Other versions
CN105335171B (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.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410287640.5A priority Critical patent/CN105335171B/en
Priority to PCT/CN2015/082075 priority patent/WO2015196967A1/en
Publication of CN105335171A publication Critical patent/CN105335171A/en
Application granted granted Critical
Publication of CN105335171B publication Critical patent/CN105335171B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine

Abstract

The invention discloses a method and a device for the long residence of an application program in the background of an operating system. The method comprises the following steps: receiving a target application program startup request, creating a main process for a target application program corresponding to the target application program startup request; calling a function by the main process to create a host keep-alive process; calling the function by the host keep-alive process to create the keep-alive process, and carrying out collocation of the keep-alive process to the operating system after the keep-alive process is created; constructing connection between the main process and the keep-alive process, and triggering the main process and the keep-alive process to mutually monitor on the basis of the constructed connection; and after a monitoring result shows that the main process or the keep-alive process is closed, starting the closed process. When the method and the device are applied, the long residence of the application program in the background of the operating system can be realized.

Description

The method on application program resident operating system backstage and device
Technical field
The present invention relates to interapplication communications technology, be specifically related to a kind of method and device of application program resident operating system backstage.
Background technology
Universal along with internet, more and more stronger according to patience to network communication services of user, there has also been more and more higher requirement to the service characteristic of the stability of network communication services system, responding ability and uninterrupted (zero-downtime).Communication facilities, as the carrier of bearer network communication service, by installing operating system, and based on the operating system installation application program (App, Application) of installing, thus provides Internet service easily for user.
For Android (Android) operating system, Android operation system is a kind of operating system being applied to mobile communication equipment, provides source code to customize to all big enterprises by google, and application program is mounted in the executable program on Android.Under current Android operation system environment, some third party App, due to the needs of task run, need to reside in operating system backstage, such as, for instant messaging class application program, need in real time from server update latest news, to ensure normal service.Again such as, for electronic market class application program, need the peace loading, unloading situation of other application programs in background monitoring communication facilities, the peace loading, unloading data of application program in above facsimile communication equipment, thus the hobby behavioural characteristic of user is analyzed.Again such as, for positioning service (LBS, LocationBasedServices) class application program, need the geographical location information of monitoring communications equipment, to realize the accurate input of operator's advertisement.Therefore, how to realize third party App resident operating system backstage and become technical matters in the urgent need to address.
In prior art, because Android operation system allows the system-level application program resident operating system backstage (abbreviation backstage) of third party developer's exploitation, thus, by root (Root) authority of operating system on obtaining communication equipment, in retouching operation system/configuration information of system/build.prop file, third party App can be realized resident on operating system backstage, namely the leak of operating system configuration file is utilized, thus it is resident to realize backstage, idiographic flow is as follows:
First, operating system Root authority is obtained; Then, under retouching operation system /configuration information of system/build.prop file, in the configuration information of this build.prop file, add sys.keep_App_1=xxx.xxx.xxx, wherein, xxx.xxx.xxx is third party App bag name; Then, come into force after restarting communication facilities, and built for the parent process of this third party App and the subprocess directly related with parent process by bifurcated function (fork).Like this, due under an operating system /configuration information of system/build.prop file adds third party App relevant information, the parent process that operating system can be built this third party App and subprocess manage and control, after third party App exits operating system, the parent process that third party App is corresponding and subprocess still can reside at backstage, thus realize third party App resident operating system backstage.
But the method on above-mentioned application program resident operating system backstage, first, need communication facilities to have Root function, but according to incompletely statistics, the ratio of current Root is roughly 20%, and application is restricted, applicability is wideless, secondly, Android operation system is provided with task manager, the information such as the memory source that the parent process corresponding for records application program and the subprocess directly related with parent process take, owing to being that trustship is to operating system based on the process in Android operation system, thus, more in the application program of operating system running background, take a large amount of memory source and cause operating system memory inadequate resource, when needing to carry out cleaned system, the parent process corresponding due to the third party App by obtaining operating system Root authority structure and subprocess are undertaken managing and controlling by operating system, by query task manager, according to the rule pre-set, such as, parent process corresponding to (kill) some application programs and the subprocess directly related with parent process is closed according to memory source occupancy or application priorities, thus stop the operation of this application program, and memory source that this application program takies can be reclaimed to ensure the normal operation of operating system, the subprocess of the parent process that the third party App causing residing at backstage is corresponding and association may be disposed with releasing memory resource by operating system, or the antivirus software installed in communication facilities carries out in the process of killing poison, the parent process that third party App is corresponding and the subprocess directly related with parent process also may be eliminated.When third party App is eliminated, only have by restarting communication facilities, and run this third party App, again third party App could be placed in running background mode.
From above-mentioned, the method on existing application resident operating system backstage, because the application program that resides at backstage is when operating system memory inadequate resource or be eliminated in the process of killing poison, resident (such as 24 hours) the operating system backstage of third party App can not be realized, application program is made to reside the reliability on backstage lower, thus make troubles to the normal communications traffic of user, and affect normally carrying out of user communication business, the communication service reducing user is experienced.And restart loading application programs to restart the resident backstage of the process be switched off by communication facilities, not only operating process is comparatively loaded down with trivial details, realize application program resident backstage required time longer, more can cause the interruption of whole communication apparatus communication, impact be experienced on the communication service of user larger.
Summary of the invention
In view of the above problems, the present invention is proposed to provide a kind of overcoming the problems referred to above or the method on application program resident operating system backstage solved the problem at least in part and device.
According to one aspect of the present invention, provide the method on application program resident operating system backstage, the method comprises:
The request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Described host process call function creates host's keep-alive process;
Host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Build host process to be connected with keep-alive process, trigger described host process and keep-alive process is monitored mutually based on the connection built;
Listening to after host process or keep-alive process be closed, start pent process.
Preferably, described operating system includes but not limited to Android operation system, (SuSE) Linux OS, Saipan operating system.
Preferably, described destination application is stored in the startup list pre-set, after communication facilities starts at every turn, automatic triggering is initiated destination application to operating system and is started request, operating system starts request according to the destination application received, obtain the startup list pre-set, automatically load the application program started in list, and for starting the corresponding host process of each application assigned in list.
Preferably, self is placed in closed condition by described host's keep-alive process, to make the trustship of described keep-alive process to operating system.
Preferably, describedly self be placed in closed condition comprise:
Host process is when creating host's keep-alive process, and for the described host's keep-alive process created arranges life cycle, after the life cycle arranged terminates, described host's keep-alive process is closed naturally.
Preferably, describedly self be placed in closed condition comprise:
Host's keep-alive process after receiving keep-alive process creation successful information, by the life cycle zero setting of self.
Preferably, described structure host process is connected with keep-alive process and comprises:
Host process creates ServerSocket, keep-alive process creation client socket;
Binding server side socket word address, and monitor client socket by ServerSocket;
Wait client socket connects;
Client socket and ServerSocket are set up socket and are connected.
Preferably, described client socket and ServerSocket are set up socket and are connected and comprise:
Host process creates keep-alive process host object by ServerSocket, and is that described keep-alive process host object distributes corresponding keep-alive process identification (PID);
Host process uses the keep-alive process host object created to start keep-alive process, and sends resurrection instruction to described keep-alive process, and described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation also receives the resurrection instruction from host process;
Described keep-alive process creates corresponding keep-alive process object by client socket, and keep-alive process object described in initialization;
Described keep-alive process object sends to described host process and starts response message, and described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
After host process receives the startup response message of keep-alive process, determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
Preferably, described after setting up socket connection, described method comprises further:
Described host process receives the data from keep-alive process by host process communication interface handle, and passes through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object;
Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
Preferably, listen to host process or keep-alive process described in be closed and to comprise:
First process is closed, and is in closed condition;
The listening components that first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to 0;
The second process connected by socket reads the first state of a process parameter identification;
Second process determines that the first state of a process parameter identification is 0, determines that the other side's process is closed.
Preferably, listen to host process or keep-alive process described in be closed and to comprise:
Host process and keep-alive process use socket to be connected and monitor mutually, determine that virtual socket connects and disconnect, determine that host process or keep-alive process are closed.
Preferably, describedly listening to after host process or keep-alive process be closed, starting pent process and comprise:
Host process listens to keep-alive process and is closed, and calls and brings back to life instruction startup keep-alive process.
Preferably, describedly listening to after host process or keep-alive process be closed, starting pent process and comprise:
Keep-alive process listens to host process and is closed, and calls to bring back to life instruction and start host process and trigger the host process started and perform the flow process that described call function creates host keep-alive process, and starts successfully in host process self is placed in closed condition.
Preferably, described keep-alive process starts host process in non-Android life cycle, and uses am instruction in linux-C process initiation host process.
Preferably, described function is bifurcated function.
Preferably, described host process and described host's keep-alive process are father and son's process relation, and described host's keep-alive process and described keep-alive process are father and son's process relation.
Preferably, described pent process is started by not pent described keep-alive process or described host process.
Provide a kind of device of application program resident operating system backstage according to another aspect of the present invention; this device comprises: host process creation module, host's keep-alive process creation module, keep-alive process creation module, link block and monitoring processing module; wherein
Host process creation module, for the request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Host's keep-alive process creation module, creates host's keep-alive process for triggering host process call function;
Keep-alive process creation module, for triggering host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Link block, is connected with keep-alive process for building host process, triggers described host process and keep-alive process is monitored mutually based on the connection built;
Monitoring processing module, for listening to after host process or keep-alive process be closed, starting pent process.
Preferably, described keep-alive process creation module comprises: keep-alive process creation unit, life cycle setting unit and life cycle running unit, wherein,
Keep-alive process creation unit, for triggering host's keep-alive process transfer function creation keep-alive process;
Life cycle setting unit, arranges life cycle for the described host's keep-alive process for creating;
Life cycle running unit, for running the life cycle of setting, after the life cycle arranged terminates, triggering described host's keep-alive process and naturally closing.
Preferably, described link block comprises: connect pretreatment unit, linkage unit and monitoring unit, wherein,
Connecting pretreatment unit, creating ServerSocket, keep-alive process creation client socket for triggering host process; Make host process bind server side socket word address, and monitor client socket by ServerSocket; Wait client socket connects;
Linkage unit, sets up socket for trigger clients socket and ServerSocket and is connected;
Monitoring unit, triggers described host process and keep-alive process is monitored mutually based on the connection built.
Preferably, described linkage unit comprises: keep-alive process host object creates subelement, promoter unit, keep-alive process initiation subelement, initialization subelement, response subelement and reply process subelement, wherein,
Keep-alive process host object creates subelement, creates keep-alive process host object, and be that described keep-alive process host object distributes corresponding keep-alive process identification (PID) for triggering host process by ServerSocket;
Promoter unit, use the keep-alive process host object created to start keep-alive process for triggering host process, and send resurrection instruction to described keep-alive process, described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation subelement, for triggering keep-alive process initiation and receiving the resurrection instruction from host process;
Initialization subelement, creates corresponding keep-alive process object for triggering described keep-alive process by client socket, and keep-alive process object described in initialization;
Response subelement, send startup response message for triggering described keep-alive process object to described host process, described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
Reply process subelement; receive the startup response message of keep-alive process for triggering host process after; determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
Preferably, described linkage unit comprises further: data transmission unit, for triggering described host process by the data of host process communication interface handle reception from keep-alive process, and pass through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object; Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
Preferably, described monitoring processing module comprises: state parameter mark setting unit, state parameter mark reading unit, state parameter mark determining unit and process restart unit, wherein,
State parameter mark setting unit, for being closed in the first process, after being in closed condition, the listening components that the first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to closed condition;
State parameter mark reading unit, the second process for being connected by socket reads the first state of a process parameter identification;
State parameter mark determining unit, for determining that in the second process the first state of a process parameter identification is closed condition, determines that the first process is closed;
Process restarts unit, for starting pent first process.
The method on application according to the present invention program resident operating system backstage and device; after operating system is application program establishment host process; host process creates host's keep-alive process by calling bifurcated function f ork () again; host's keep-alive process is set and creates keep-alive process by calling bifurcated function f ork () again; and after the success of keep-alive process creation, terminate the life cycle of self.Thus by two-stage process separate users process, after host's keep-alive process is closed, direct correlation relation is there is not between the host process making same application corresponding and keep-alive process, solve operating system or antivirus software to carry out killing according to direct correlation relation and cause application program can not reside the technical matters on backstage, achieve the process being started closedown by not pent process, thus make application program still can reside in backstage, can meet well must the business demand of application program of 7x24h running background, promote the beneficial effect that application program resides the reliability on backstage, further, no matter the method can use on the communication facilities that Root is also non-Root, and reload configuration file to make process resident without the need to waiting for that communication facilities restarts, operating process is comparatively simple, realizes application program resident backstage required time short, does not affect communication apparatus communication, and the communication service improving user is experienced.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to technological means of the present invention can be better understood, and can be implemented according to the content of instructions, and can become apparent, below especially exemplified by the specific embodiment of the present invention to allow above and other objects of the present invention, feature and advantage.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit will become cheer and bright for those of ordinary skill in the art.Accompanying drawing only for illustrating the object of preferred implementation, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts by identical reference symbol.In the accompanying drawings:
Fig. 1 shows the method flow on embodiment of the present invention application program resident operating system backstage;
Fig. 2 shows the method idiographic flow on embodiment of the present invention application program resident operating system backstage; And,
Fig. 3 shows the apparatus structure on embodiment of the present invention application program resident operating system backstage.
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Existing by obtaining operating system root authority, the configuration information of then in retouching operation system/system/build.prop file, the parent process that builds based on fork function and the subprocess directly related with parent process is made to be hosted in operating system and to realize the method that application program resides backstage, after application program exits foreground, the parent process of front stage operation and running background still can be in state of activation with the subprocess of parent process direct correlation, but reside at the application program on backstage when operating system memory inadequate resource or in the process of killing poison, be in the parent process of state of activation and may be eliminated with the subprocess of parent process direct correlation, resident (such as 24 hours) the operating system backstage of third party App can not be realized, and restart loading application programs to restart the resident backstage of the process be switched off by communication facilities, not only operating process is comparatively loaded down with trivial details, realizes application program resident backstage required time longer, more can cause the interruption of whole communication apparatus communication.
Because application program is by fork function creation parent process and the subprocess with parent process direct correlation, application program resident operating system backstage can be realized, if can a process in two processes that application program is corresponding after being closed by operating system or antivirus software, the process of closedown can be started in time by another process, like this, can guarantee the timely resurrection of rev down process rev on operating system backstage, the application program making process corresponding can be recovered and reside in backstage.But owing to there is direct correlation relation between the existing parent process for application program establishment and subprocess, thus, when task manager releasing memory resource, the resource that parent process and the subprocess that there is direct correlation relation take together can be discharged, thus parent process and subprocess are closed simultaneously, make not exist the situation that the process in two processes corresponding to application program is closed by operating system or antivirus software.
Bifurcated function f ork () comes from operating system (OS, OperationSystem) needs of multithreading task in, application program is after foreground initiation, first operating system be this application assigned process, and called by operating system, create one and former process (parent process) almost identical process (subprocess).Wherein, two processes can perform identical function, also can perform different functions.After parent process calls fork () function, operating system first gives new process (subprocess) Resources allocation, such as, store the space of data and code; Then all resources of former process are all copied in new new process, certainly, after completing fork, also can revise the resource be replicated voluntarily.Like this, after fork function is finished, occur two processes, one is subprocess, and one is parent process.In subprocess, fork function returns 0, and in parent process, fork returns the new process ID creating subprocess.Thus, after application program exits, subprocess can reside in backstage.
In the embodiment of the present invention, consider that operating system is by calling bifurcated function f ork () for after parent process establishment subprocess, then by calling bifurcated function f ork () for subprocess establishment subordinate subprocess.Like this, direct correlation relation is there is not between parent process and subordinate's subprocess, after subprocess is closed, then subordinate's subprocess becomes orphan's process, thus in trustly can give operating system process, and due to all corresponding same application of subordinate's subprocess and subprocess, thus, in follow-up use, at system memory resource, not enough or antivirus software is in killing poison process, because parent process and subordinate's subprocess do not exist direct correlation relation, thus, when task manager carries out process closing process according to incidence relation, two processes are removed by operating system or lower by the probability of antivirus software killing simultaneously simultaneously, like this, the process of closedown can be started by not pent process, thus make parent process and subordinate's subprocess to reside in backstage, thus ensure that application program is at backstage continuous service, can meet well must the business demand of (third party) application program of 7x24h running background.Compare the technical scheme adopting Root, no matter the embodiment of the present invention can use on the communication facilities that Root is also non-Root, and substantially not by antivirus software (killing soft) impact, and power consumption is very low.
Fig. 1 shows the method flow on embodiment of the present invention application program resident operating system backstage.See Fig. 1, this flow process comprises:
Step 101, the request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
In this step, destination application is the application program needing resident operating system backstage, such as, and instant messaging class application program, electronic market class application program and positioning service class application program etc., wherein, instant messaging class application program can be QQ, micro-letter, microblogging etc.
In the embodiment of the present invention, as embodiment, by the request of operating system receiving target application program launching, operating system includes but not limited to Android operation system, (SuSE) Linux OS, Saipan operating system etc.
In the embodiment of the present invention, operating system backstage refers to that foreground application is after closedown, and resident position residing is in an operating system operating system backstage.
In practical application, can will the application program on resident operating system backstage be needed to be set in the startup list of communication facilities starting up in advance.Namely described destination application is stored in the startup list pre-set.Like this, after communication facilities starts at every turn, automatic triggering is initiated destination application to operating system and is started request, operating system starts request according to the destination application received, obtain the startup list pre-set, automatic loading starts the application program in list, and for starting the corresponding host process of each application assigned in list.
Certainly, as embodiment, also can be by user after starting communication facilities, click the application program needing the resident operating system backstage started, trigger and initiate destination application startup request to operating system.Like this, user according to self actual needs, can choose the one or more application programs needing resident operating system backstage.
In the embodiment of the present invention, the flow process creating host process for destination application is known technology, omits detailed description at this.
Step 102, described host process call function creates host's keep-alive process;
In this step, as embodiment, function is bifurcated function.For host process and host's keep-alive process, the corresponding parent process of host process, the corresponding subprocess of host's keep-alive process.
In the embodiment of the present invention, parent process is called fork function and is produced subprocess, and subprocess has the resource identical with parent process.
Step 103, host's keep-alive process transfer bifurcated function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
In this step, the flow process of host's keep-alive process transfer bifurcated function creation keep-alive process is identical with the flow process that host process calls bifurcated function creation host keep-alive process, omits detailed description at this.
In the embodiment of the present invention, for host's keep-alive process and keep-alive process, the corresponding parent process of host's keep-alive process, the corresponding subprocess of keep-alive process.
In host process, host's keep-alive process and keep-alive process, be provided with state parameter mark, such as, when state parameter is designated 1, expression process is in normal condition; When state parameter is designated 0, expression process is in closed condition.That is, if process is in closed condition, then the state parameter mark that this process is corresponding is set to 0.Like this, in subsequent applications, opposite end process, by reading state parameter mark corresponding to this process, makes described opposite end process on one's own initiative, can know whether this end process survives or be closed in time in life cycle.Certainly, in practical application, also can arrange when state parameter is designated 0, expression process is in normal condition; When state parameter is designated 1, expression process is in closed condition.
In the embodiment of the present invention, for (SuSE) Linux OS, on (SuSE) Linux OS; when host's keep-alive process is closed, keep-alive process becomes orphan's process, simultaneously; the keep-alive process becoming orphan's process can be in trust to fork process out, i.e. operating system process the earliest.Like this; by two-stage process separate users process; can make there is not direct correlation relation between host process and keep-alive process, thus when can effectively prevent task manager or antivirus software from carrying out killing according to direct correlation relation to process, avoid host process and keep-alive process all by killing.That is; such as; task manager or antivirus software are in killing to host process and when needing to remove host process; according to the direct correlation relation of this host process stored; inquire host's keep-alive process; but because this host's keep-alive process is closed; thus; host process is closed with releasing memory resource; when subsequent keep-alive process is not arrived by killing; not by killing to keep-alive process can bring back to life by the host process of killing, make host process and application program corresponding to keep-alive process still can reside at operating system backstage.
As embodiment, self is placed in closed condition by described host's keep-alive process, to make the trustship of described keep-alive process to operating system.
Wherein, self is placed in closed condition to comprise:
Host process is when creating host's keep-alive process, and for the described host's keep-alive process created arranges life cycle, after the life cycle arranged terminates, described host's keep-alive process is closed naturally.
In this step; host process is when the described host's keep-alive process for creating arranges life cycle; consider the time needed for follow-up host's keep-alive process creation keep-alive process, make the life cycle arranged be more than or equal to time needed for host's keep-alive process creation keep-alive process.
As another embodiment, self is placed in closed condition and also can comprises:
Host's keep-alive process after receiving keep-alive process creation successful information, by the life cycle zero setting of self.
In this step; host process is when the described host's keep-alive process for creating arranges life cycle; be defaulted as the maximal value that operating system is arranged; namely giving tacit consent to life cycle is endless; host's keep-alive process creation keep-alive process; keep-alive process is creating successfully, returns establishment successful information to host's keep-alive process.Thus, host's keep-alive process can be set after receiving keep-alive process creation successful information, by the life cycle zero setting of self, to make the natural death of host's keep-alive process.
Step 104, builds host process and is connected with keep-alive process, trigger described host process and keep-alive process is monitored mutually based on the connection built;
In this step, as embodiment, structure host process is connected with keep-alive process and comprises:
A11, host process creates ServerSocket (LocalServerSocket), keep-alive process creation client socket (LocalSocket);
In this step, when connecting based on multiple transmission control protocol (TCP, TransmissionControlProtocol) carrying out or there is multiple program process, may need by same Transmission Control Protocol port transmission data.In order to distinguish different program process and connection, computer operating system is that application program and TCP/IP (TCP/IP, TransferControlProtocol/InternetProtocol) provide the interface being called socket (Socket) alternately.Wherein, socket is for distinguishing network service between different application process and connection, it is the basic operation unit of the network service supporting ICP/IP protocol, it is the end points that process between different main frame carries out two-way communication, that is, two sides of communication can complete communication process by the related function in socket.
In the embodiment of the present invention, host process and keep-alive process adopt client-side/server-side (C/S, Client/Service) pattern to communicate.Host process creates server end Unix territory socket; namely LocalServerSocket uses as service end; set up socket and monitor client-requested, keep-alive process creation client socket (LocalSocket), client socket operates in keep-alive process.
In the embodiment of the present invention, to create ServerSocket, filec descriptor is adopted to create the ServerSocket existed, such as, ServerSocket resource address dev/socket/ is specified in init.rc ..., create the socket as service end, program code segments is as follows:
LocalServerSocketsocket=newLocalServerSocket(createFileDescriptor(fileDesc))。
As embodiment, in the embodiment of the present invention, the Socket type based on ICP/IP protocol can comprise: Stream Socket (SOCK_STREAM), Datagram Socket (SOCK_DGRAM) and raw socket (SOCK_RAW).Be known technology about Socket type, omit detailed description at this.
Socket content comprises: the object IP address of communication, the transport layer protocol of use, such as, and Transmission Control Protocol or User Datagram Protoco (UDP) (UDP, UserDatagramProtocol), and the port numbers used.
A12, binding server side socket word address, and monitor client socket by ServerSocket;
In this step, the client socket that ServerSocket delocalization is concrete, but the state to be connected such as to be in, and monitoring state of network in real time.
Binding server side socket word address, and can be as follows by the program segment code of ServerSocket monitoring client socket:
// bind address
localAddress=newLocalSocketAddress(name);
impl.bind(localAddress);
// monitor
impl.listen(LISTEN_BACKLOG);
A13, waits for that client socket connects;
In this step, client arranges link address, and connects.Specifically, the client socket of keep-alive process sends connection request, and carry communication objective IP address, this communication objective IP address is server side socket.That is, first client socket describes the server socket needing to connect, the address of write server socket and port numbers, and then sends connection request to server side socket.
The program code segments arranging link address can be as follows:
LocalSocketAddressaddress=newLocalSocketAddress("installd",LocalSocketAddress.Namespace.RESERVED);
/ connect
mSocket.connect(address);
A14, client socket and ServerSocket are set up socket and are connected.
In this step; after server side socket is monitored or is received the connection request of client socket transmission; the request of customer in response end socket; set up a new thread; and the keep-alive process sending to client socket corresponding the information of server side socket, keep-alive process confirms that this socket connects.Specifically, this step comprises:
A01, host process creates keep-alive process host object by ServerSocket, and is that described keep-alive process host object distributes corresponding keep-alive process identification (PID);
In this step, host process creates and manages keep-alive process host object, the corresponding keep-alive process of each keep-alive process host object, and has the keep-alive process identification (PID) identical with corresponding keep-alive process.
A02, host process uses the keep-alive process host object created to start keep-alive process, and sends resurrection instruction to described keep-alive process, and described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
In this step, in keep-alive process host object, provide the method creating and start keep-alive process, and provide data communication interface to bring back to life instruction for sending to keep-alive process.Specifically, host process creates a new keep-alive process in the mode of order line by the process creation method called keep-alive process host object and provide, and described order line comprises described resurrection instruction.
A03, keep-alive process initiation also receives the resurrection instruction from host process;
A04, described keep-alive process creates corresponding keep-alive process object by client socket, and keep-alive process object described in initialization;
In this step, in initialization procedure, keep-alive process is preserved command line parameters such as the keep-alive process identification (PID) of carrying in the resurrection instruction received, host process communication interface handles.
A05, described keep-alive process object sends to described host process and starts response message, and described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
In this step, after completing initialization, keep-alive process object uses interprocess communication (IPC, Inter-ProcessCommunication) to send startup response message to host process.
A06, after host process receives the startup response message of keep-alive process, determines corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and is that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
Like this, the keep-alive process host object in host process just has the keep-alive process communication socket handle of the keep-alive process object corresponding with it, and keep-alive process also obtain the communication interface handle of corresponding host process.Based on the keep-alive process communication socket handle obtained; keep-alive process host object externally provides the communication interface of carrying out interprocess communication with corresponding keep-alive process object, make host process can by call keep-alive process from described communication interface to correspondence send data.
After setting up socket connection, host process and keep-alive process are all in listening state, monitor the state of the other side.
Further, after setting up socket connection, the method can further include:
A15, host process and keep-alive process are set up communication port and are carried out data transmission.
This step can specifically comprise:
Described host process receives the data from keep-alive process by host process communication interface handle, and passes through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object;
Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
Step 105, listening to after host process or keep-alive process be closed, starts pent process.
In this step, host process and keep-alive process the other side's process each other, namely listening to after the other side's process is closed, starts pent process.
As embodiment, listen to the other side's process and be closed and comprise:
B11, the first process is closed, and is in closed condition;
In this step, the first process both can be host process, also can be keep-alive process.Process is closed, and may be because operating system is when memory source is not enough, needs releasing memory resource and this process closed; Also may be antivirus software in killing poison process, this process of killing and this process is closed; It may be also rev down process rev under other situation.
B12, the listening components that the first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to 0;
B13, the second process connected by socket reads the first state of a process parameter identification;
In this step, if the first process is host process, then the second process is keep-alive process; If the first process is keep-alive process, then the second process is host process.
B14, the second process determines that the first state of a process parameter identification is 0, determines that the other side's process is closed.
As another embodiment, listen to the other side's process and be closed and comprise:
Host process and keep-alive process use socket to be connected and monitor mutually, determine that virtual socket connects and disconnect, determine that the other side's process is closed.
In the embodiment of the present invention, adopt socket to connect and monitor mutually, power consumption is little and stable, not easily makes mistakes.
Preferably, after operating system or antivirus software rev down process rev, all resources of the described rev down process rev of release further, thus make operating system can the system resource such as internal memory, CPU that takies of this rev down process rev of the automatic recovery.
As embodiment, listening to after the other side's process is closed, starting the process of closing can comprise:
Host process listens to keep-alive process and is closed, and calls and brings back to life instruction startup keep-alive process.
As another embodiment, listening to after the other side's process is closed, starting the process of closing can also comprise:
Keep-alive process listens to host process and is closed, call bring back to life instruction start host process and trigger the host process started perform described in call the flow process of bifurcated function creation host keep-alive process, and start successfully in host process self be placed in closed condition.
In this step, for avoiding the host process of bringing back to life by creating host's keep-alive process, and importing resurrection instruction establishment keep-alive process into, making operating system there is the keep-alive process of redundancy, thus taking unnecessary operating system memory.Thus, when after keep-alive process initiation host process, terminate the life cycle of self, exit operating system backstage.
Preferably, keep-alive process starts host process in non-Android life cycle, and uses am instruction in linux-C process initiation host process, thus recovers the service of Android, makes application program can reside in operating system backstage.
Fig. 2 shows the method idiographic flow on embodiment of the present invention application program resident operating system backstage.See Fig. 2, be closed for host process, this flow process comprises:
Step 201, host process calls fork function creation host keep-alive process after starting, and imports resurrection instruction into the host's keep-alive process created, and instruction starts keep-alive process;
Step 202, host's keep-alive process receives the resurrection instruction of importing into, calls fork function creation keep-alive process;
In this step, by the fork instruction in the fork function in call operation system, copy keep-alive process, thus create out keep-alive process.
Step 203, host's keep-alive process lifetime terminates, natural death;
In this step, after life cycle terminates, host's keep-alive process closes oneself.
Step 204, host process create LocalServerSocket and etc. to be connected;
Step 205, keep-alive process is connected to host process, and monitors mutually;
This step, keep-alive process and host process monitor the state of the other side, namely read the state parameter mark of the other side.
Step 206, keep-alive process listens to host process and is killed (closedown), calls and brings back to life instruction resurrection host process;
In this step, keep-alive process listens to and disconnects with the connection of host process, then call and bring back to life instruction resurrection host process, return and perform step 201.
Step 207, keep-alive process lifetime terminates, natural death.
In this step; at the end of the life cycle of keep-alive process; exit operating system backstage; to avoid the host process of bringing back to life by creating host's keep-alive process; and import resurrection instruction establishment keep-alive process into; make operating system there is the keep-alive process of redundancy, thus take unnecessary operating system memory.
In the embodiment of the present invention; operating system is after application program creates host process; host process creates host's keep-alive process by calling bifurcated function f ork () again; host's keep-alive process creates keep-alive process by calling bifurcated function f ork () again; and after the success of keep-alive process creation, terminate the life cycle of self.Like this, by two-stage process separate users process, after host's keep-alive process is closed, then keep-alive process becomes orphan's process, thus in trustly can give operating system process, and makes there is not direct correlation relation between host process and keep-alive process.Thus; in subsequent applications; in a pent situation of process in host process and keep-alive process; because host process and keep-alive process do not exist direct correlation relation; the probability that another process of carrying out killing according to direct correlation relation is closed simultaneously is lower, like this, can be started the process of closedown by not pent process; thus make application program still can reside in backstage, can meet well must the business demand of application program of 7x24h running background.Compare the technical scheme adopting Root (namely obtaining super administrator right), no matter the method for the embodiment of the present invention can use on the communication facilities that Root is also non-Root, applied widely, and power consumption is very low, thus realize third party application with lower cost and reside running background, the application combined for those soft or hards must residing backstage is even more important, and makes application program reside the reliability on backstage high; Further, because host process does not exit, all resources all do not change, and the keep-alive process of generation inherits the resource of host process, can guarantee that keep-alive process resource is constant, thus guarantee application program reliability service; And, when the process that application program is corresponding is closed, immediately can be brought back to life by another process that this application program is corresponding, without the need to restarting loading application programs to restart the resident backstage of the process be switched off by communication facilities, not only operating process is comparatively simple, realize application program resident backstage required time short, more can not cause the interruption of whole communication apparatus communication, the communication service effectively improving user is experienced.
Fig. 3 shows the apparatus structure on embodiment of the present invention application program resident operating system backstage.See Fig. 3, this device is communication facilities, comprising: host process creation module, host's keep-alive process creation module, keep-alive process creation module, link block and monitoring processing module, wherein,
Host process creation module, for the request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
In the embodiment of the present invention, the request of operating system receiving target application program launching, and create host process, include but not limited to Android operation system, (SuSE) Linux OS, Saipan operating system etc.
As embodiment, destination application is stored in the startup list pre-set.Like this, after communication facilities starts at every turn, automatic triggering is initiated destination application to operating system and is started request, operating system starts request according to the destination application received, obtain the startup list pre-set, automatic loading starts the application program in list, and for starting the corresponding host process of each application assigned in list.
Host's keep-alive process creation module, creates host's keep-alive process for triggering host process call function;
In the embodiment of the present invention, function is bifurcated function.
Keep-alive process creation module, for triggering host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
In the embodiment of the present invention, host process, host's keep-alive process and keep-alive process are provided with for representing whether process is in the state parameter mark of closed condition.
As embodiment, keep-alive process creation module comprises: keep-alive process creation unit, life cycle setting unit and life cycle running unit (not shown), wherein,
Keep-alive process creation unit, for triggering host's keep-alive process transfer bifurcated function creation keep-alive process;
Life cycle setting unit, arranges life cycle for the described host's keep-alive process for creating;
Life cycle running unit, for running the life cycle of setting, after the life cycle arranged terminates, triggers the natural death of described host's keep-alive process.
In the embodiment of the present invention; host process is when the described host's keep-alive process for creating arranges life cycle; consider the time needed for follow-up host's keep-alive process creation keep-alive process, make the life cycle arranged be more than or equal to time needed for host's keep-alive process creation keep-alive process.
Link block, is connected with keep-alive process for building host process, triggers described host process and keep-alive process is monitored mutually based on the connection built;
As embodiment, link block comprises: connect pretreatment unit, linkage unit and monitoring unit (not shown), wherein,
Connecting pretreatment unit, creating ServerSocket, keep-alive process creation client socket for triggering host process; Make host process bind server side socket word address, and monitor client socket by ServerSocket; Wait client socket connects;
Linkage unit, sets up socket for trigger clients socket and ServerSocket and is connected;
In the embodiment of the present invention, linkage unit comprises: keep-alive process host object creates subelement, promoter unit, keep-alive process initiation subelement, initialization subelement, response subelement and reply process subelement, wherein,
Keep-alive process host object creates subelement, creates keep-alive process host object, and be that described keep-alive process host object distributes corresponding keep-alive process identification (PID) for triggering host process by ServerSocket;
Promoter unit, use the keep-alive process host object created to start keep-alive process for triggering host process, and send resurrection instruction to described keep-alive process, described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation subelement, for triggering keep-alive process initiation and receiving the resurrection instruction from host process;
Initialization subelement, creates corresponding keep-alive process object for triggering described keep-alive process by client socket, and keep-alive process object described in initialization;
Response subelement, send startup response message for triggering described keep-alive process object to described host process, described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
Reply process subelement; receive the startup response message of keep-alive process for triggering host process after; determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
As embodiment, linkage unit can further include:
Data transmission unit, for triggering described host process by the data of host process communication interface handle reception from keep-alive process, and passes through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object; Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
Monitoring unit, for triggering described host process and keep-alive process is monitored mutually based on the connection built.
Monitoring processing module, for listening to after the other side's process is closed, starting the process of closing.
In the embodiment of the present invention, monitor processing module and comprise: state parameter mark setting unit, state parameter mark reading unit, state parameter mark determining unit and process restart unit (not shown), wherein,
State parameter mark setting unit, for being closed in the first process, after being in closed condition, the listening components that the first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to closed condition;
In the embodiment of the present invention, the first process both can be host process, also can be keep-alive process.Process is closed, and may be because operating system is when memory source is not enough, needs releasing memory resource and this process closed; Also may be antivirus software in killing poison process, this process of killing and this process is closed; It may be also rev down process rev under other situation.
State parameter mark reading unit, the second process for being connected by socket reads the first state of a process parameter identification;
In the embodiment of the present invention, if the first process is host process, then the second process is keep-alive process; If the first process is keep-alive process, then the second process is host process.
State parameter mark determining unit, for determining that in the second process the first state of a process parameter identification is closed condition, determines that the first process is closed;
Process restarts unit, for starting the first process.
In the embodiment of the present invention, host process listens to keep-alive process and is closed, and calls and brings back to life instruction startup keep-alive process; Or,
Keep-alive process listens to host process and is closed, call bring back to life instruction start host process and trigger the host process started perform described in call the flow process of bifurcated function creation host keep-alive process, and start successfully in host process self be placed in closed condition.
Preferably, keep-alive process starts host process in non-Android life cycle, and uses am instruction in linux-C process initiation host process, thus recovers the service of Android, makes application program can reside in operating system backstage.
Intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with display at this algorithm provided.Various general-purpose system also can with use based on together with this teaching.According to description above, the structure constructed required by this type systematic is apparent.In addition, the present invention is not also for any certain programmed language.It should be understood that and various programming language can be utilized to realize content of the present invention described here, and the description done language-specific is above to disclose preferred forms of the present invention.
In instructions provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary array mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the some or all parts in the device on the application program resident operating system backstage of the embodiment of the present invention.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from Internet site server and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.
The invention discloses the method on an A1. application program resident operating system backstage, comprising:
The request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Described host process call function creates host's keep-alive process;
Host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Build host process to be connected with keep-alive process, trigger described host process and keep-alive process is monitored mutually based on the connection built;
Listening to after host process or keep-alive process be closed, start pent process.
A2. the method according to A1, described operating system includes but not limited to Android operation system, (SuSE) Linux OS, Saipan operating system.
A3. the method according to A1, described destination application is stored in the startup list pre-set, after communication facilities starts at every turn, automatic triggering is initiated destination application to operating system and is started request, operating system starts request according to the destination application received, obtain the startup list pre-set, automatically load the application program started in list, and for starting the corresponding host process of each application assigned in list.
A4. the method according to A1, self is placed in closed condition by described host's keep-alive process, to make the trustship of described keep-alive process to operating system.
A5. the method according to A4, is describedly placed in closed condition by self and comprises:
Host process is when creating host's keep-alive process, and for the described host's keep-alive process created arranges life cycle, after the life cycle arranged terminates, described host's keep-alive process is closed naturally.
A6. the method according to A4, is describedly placed in closed condition by self and comprises:
Host's keep-alive process after receiving keep-alive process creation successful information, by the life cycle zero setting of self.
A7. the method according to A1, described structure host process is connected with keep-alive process and comprises:
Host process creates ServerSocket, keep-alive process creation client socket;
Binding server side socket word address, and monitor client socket by ServerSocket;
Wait client socket connects;
Client socket and ServerSocket are set up socket and are connected.
A8. the method according to A7, described client socket and ServerSocket are set up socket and are connected and comprise:
Host process creates keep-alive process host object by ServerSocket, and is that described keep-alive process host object distributes corresponding keep-alive process identification (PID);
Host process uses the keep-alive process host object created to start keep-alive process, and sends resurrection instruction to described keep-alive process, and described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation also receives the resurrection instruction from host process;
Described keep-alive process creates corresponding keep-alive process object by client socket, and keep-alive process object described in initialization;
Described keep-alive process object sends to described host process and starts response message, and described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
After host process receives the startup response message of keep-alive process, determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
A9. the method according to A8, described after setting up socket connection, described method comprises further:
Described host process receives the data from keep-alive process by host process communication interface handle, and passes through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object;
Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
A10. the method according to A1, described in listen to host process or keep-alive process and be closed and comprise:
First process is closed, and is in closed condition;
The listening components that first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to 0;
The second process connected by socket reads the first state of a process parameter identification;
Second process determines that the first state of a process parameter identification is 0, determines that the other side's process is closed.
A11. the method according to A1, described in listen to host process or keep-alive process and be closed and comprise:
Host process and keep-alive process use socket to be connected and monitor mutually, determine that virtual socket connects and disconnect, determine that host process or keep-alive process are closed.
A12. the method according to A1, is describedly listening to after host process or keep-alive process be closed, and starts pent process and comprises:
Host process listens to keep-alive process and is closed, and calls and brings back to life instruction startup keep-alive process.
A13. the method according to A1, is describedly listening to after host process or keep-alive process be closed, and starts pent process and comprises:
Keep-alive process listens to host process and is closed, and calls to bring back to life instruction and start host process and trigger the host process started and perform the flow process that described call function creates host keep-alive process, and starts successfully in host process self is placed in closed condition.
A14. the method according to A12 or 13, described keep-alive process starts host process in non-Android life cycle, and uses am instruction in linux-C process initiation host process.
A15. the method according to A1, described function is bifurcated function.
A16. the method according to A1, described host process and described host's keep-alive process are father and son's process relation, and described host's keep-alive process and described keep-alive process are father and son's process relation.
A17. the method according to A1, starts described pent process by not pent described keep-alive process or described host process.
A18. the device on application program resident operating system backstage, this device comprises: host process creation module, host's keep-alive process creation module, keep-alive process creation module, link block and monitoring processing module, wherein,
Host process creation module, for the request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Host's keep-alive process creation module, creates host's keep-alive process for triggering host process call function;
Keep-alive process creation module, for triggering host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Link block, is connected with keep-alive process for building host process, triggers described host process and keep-alive process is monitored mutually based on the connection built;
Monitoring processing module, for listening to after host process or keep-alive process be closed, starting pent process.
A19. the device according to A18, described keep-alive process creation module comprises: keep-alive process creation unit, life cycle setting unit and life cycle running unit, wherein,
Keep-alive process creation unit, for triggering host's keep-alive process transfer function creation keep-alive process;
Life cycle setting unit, arranges life cycle for the described host's keep-alive process for creating;
Life cycle running unit, for running the life cycle of setting, after the life cycle arranged terminates, triggering described host's keep-alive process and naturally closing.
A20. the device according to A18, described link block comprises: connect pretreatment unit, linkage unit and monitoring unit, wherein,
Connecting pretreatment unit, creating ServerSocket, keep-alive process creation client socket for triggering host process; Make host process bind server side socket word address, and monitor client socket by ServerSocket; Wait client socket connects;
Linkage unit, sets up socket for trigger clients socket and ServerSocket and is connected;
Monitoring unit, triggers described host process and keep-alive process is monitored mutually based on the connection built.
A21. the device according to A20, described linkage unit comprises: keep-alive process host object creates subelement, promoter unit, keep-alive process initiation subelement, initialization subelement, response subelement and reply process subelement, wherein,
Keep-alive process host object creates subelement, creates keep-alive process host object, and be that described keep-alive process host object distributes corresponding keep-alive process identification (PID) for triggering host process by ServerSocket;
Promoter unit, use the keep-alive process host object created to start keep-alive process for triggering host process, and send resurrection instruction to described keep-alive process, described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation subelement, for triggering keep-alive process initiation and receiving the resurrection instruction from host process;
Initialization subelement, creates corresponding keep-alive process object for triggering described keep-alive process by client socket, and keep-alive process object described in initialization;
Response subelement, send startup response message for triggering described keep-alive process object to described host process, described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
Reply process subelement; receive the startup response message of keep-alive process for triggering host process after; determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
A22. the device according to A21, described linkage unit comprises further: data transmission unit, for triggering described host process by the data of host process communication interface handle reception from keep-alive process, and pass through the keep-alive process transmission data of keep-alive process communication socket handle to correspondence of keep-alive process host object; Described keep-alive process receives the data from host process by keep-alive process communication socket handle, and sends data by host process communication interface handle to host process.
A23. the device according to A18, described monitoring processing module comprises: state parameter mark setting unit, state parameter mark reading unit, state parameter mark determining unit and process restart unit, wherein,
State parameter mark setting unit, for being closed in the first process, after being in closed condition, the listening components that the first process end is corresponding obtains this first process and is in closed condition, and the first state of a process parameter identification is set to closed condition;
State parameter mark reading unit, the second process for being connected by socket reads the first state of a process parameter identification;
State parameter mark determining unit, for determining that in the second process the first state of a process parameter identification is closed condition, determines that the first process is closed;
Process restarts unit, for starting pent first process.

Claims (10)

1. the method on application program resident operating system backstage, comprising:
The request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Described host process call function creates host's keep-alive process;
Host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Build host process to be connected with keep-alive process, trigger described host process and keep-alive process is monitored mutually based on the connection built;
Listening to after host process or keep-alive process be closed, start pent process.
2. the method for claim 1, described operating system includes but not limited to Android operation system, (SuSE) Linux OS, Saipan operating system.
3. the method for claim 1, described destination application is stored in the startup list pre-set, after communication facilities starts at every turn, automatic triggering is initiated destination application to operating system and is started request, operating system starts request according to the destination application received, obtain the startup list pre-set, automatically load the application program started in list, and for starting the corresponding host process of each application assigned in list.
4. the method for claim 1, self is placed in closed condition by described host's keep-alive process, to make the trustship of described keep-alive process to operating system.
5. method as claimed in claim 4, is describedly placed in closed condition by self and comprises:
Host process is when creating host's keep-alive process, and for the described host's keep-alive process created arranges life cycle, after the life cycle arranged terminates, described host's keep-alive process is closed naturally.
6. method as claimed in claim 4, is describedly placed in closed condition by self and comprises:
Host's keep-alive process after receiving keep-alive process creation successful information, by the life cycle zero setting of self.
7. the method for claim 1, described structure host process is connected with keep-alive process and comprises:
Host process creates ServerSocket, keep-alive process creation client socket;
Binding server side socket word address, and monitor client socket by ServerSocket;
Wait client socket connects;
Client socket and ServerSocket are set up socket and are connected.
8. method as claimed in claim 7, described client socket and ServerSocket are set up socket and are connected and comprise:
Host process creates keep-alive process host object by ServerSocket, and is that described keep-alive process host object distributes corresponding keep-alive process identification (PID);
Host process uses the keep-alive process host object created to start keep-alive process, and sends resurrection instruction to described keep-alive process, and described keep-alive process identification (PID), host process communication interface handle are carried in described resurrection instruction;
Keep-alive process initiation also receives the resurrection instruction from host process;
Described keep-alive process creates corresponding keep-alive process object by client socket, and keep-alive process object described in initialization;
Described keep-alive process object sends to described host process and starts response message, and described startup response message carries keep-alive process communication socket handle corresponding to described keep-alive process object, keep-alive process identification (PID);
After host process receives the startup response message of keep-alive process, determine corresponding keep-alive process host object according to the keep-alive process identification (PID) in described startup response message, and be that described keep-alive process host object arranges corresponding keep-alive process communication socket handle.
9. the device on application program resident operating system backstage, this device comprises: host process creation module, host's keep-alive process creation module, keep-alive process creation module, link block and monitoring processing module, wherein,
Host process creation module, for the request of receiving target application program launching, creates host process for this destination application starts destination application corresponding to request;
Host's keep-alive process creation module, creates host's keep-alive process for triggering host process call function;
Keep-alive process creation module, for triggering host's keep-alive process transfer function creation keep-alive process, and after keep-alive process creation, by the trustship of described keep-alive process to operating system;
Link block, is connected with keep-alive process for building host process, triggers described host process and keep-alive process is monitored mutually based on the connection built;
Monitoring processing module, for listening to after host process or keep-alive process be closed, starting pent process.
10. device as claimed in claim 9, described keep-alive process creation module comprises: keep-alive process creation unit, life cycle setting unit and life cycle running unit, wherein,
Keep-alive process creation unit, for triggering host's keep-alive process transfer function creation keep-alive process;
Life cycle setting unit, arranges life cycle for the described host's keep-alive process for creating;
Life cycle running unit, for running the life cycle of setting, after the life cycle arranged terminates, triggering described host's keep-alive process and naturally closing.
CN201410287640.5A 2014-06-24 2014-06-24 The method and device on application program resident operating system backstage Expired - Fee Related CN105335171B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410287640.5A CN105335171B (en) 2014-06-24 2014-06-24 The method and device on application program resident operating system backstage
PCT/CN2015/082075 WO2015196967A1 (en) 2014-06-24 2015-06-23 Method and apparatus for application to permanently reside in background of operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410287640.5A CN105335171B (en) 2014-06-24 2014-06-24 The method and device on application program resident operating system backstage

Publications (2)

Publication Number Publication Date
CN105335171A true CN105335171A (en) 2016-02-17
CN105335171B CN105335171B (en) 2019-05-10

Family

ID=54936799

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410287640.5A Expired - Fee Related CN105335171B (en) 2014-06-24 2014-06-24 The method and device on application program resident operating system backstage

Country Status (2)

Country Link
CN (1) CN105335171B (en)
WO (1) WO2015196967A1 (en)

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930215A (en) * 2016-04-07 2016-09-07 珠海市魅族科技有限公司 Control method and control device for mobile terminal
CN106201690A (en) * 2016-07-07 2016-12-07 乐视控股(北京)有限公司 Application progress control method and device
CN106371911A (en) * 2016-09-06 2017-02-01 北京海誉动想科技股份有限公司 Method for rebooting guarded process by daemon processes
CN106648863A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Live keeping method and system of Android application installation package and application target process
CN106775652A (en) * 2016-11-24 2017-05-31 武汉斗鱼网络科技有限公司 The method and device waken up to the application program of terminal
CN106775642A (en) * 2016-11-24 2017-05-31 广州赛意信息科技股份有限公司 The unlimited backstage localization method and system of a kind of Mobile solution
CN107342981A (en) * 2017-06-07 2017-11-10 北京小鸟看看科技有限公司 Transmission method and device, the virtual reality helmet of sensing data
CN107341052A (en) * 2017-06-07 2017-11-10 努比亚技术有限公司 A kind of message treatment method and device
CN107391199A (en) * 2017-07-27 2017-11-24 珠海市魅族科技有限公司 Using startup method and device, terminal and computer-readable recording medium
CN107729128A (en) * 2017-07-24 2018-02-23 上海壹账通金融科技有限公司 Application data restoration methods, device, computer equipment and storage medium
CN108153620A (en) * 2017-12-27 2018-06-12 深圳豪客互联网有限公司 A kind of course control method and device
CN108287761A (en) * 2017-08-09 2018-07-17 珠海市魅族科技有限公司 Method for recovering internal storage and device, terminal device and computer readable storage medium
CN109240809A (en) * 2017-07-11 2019-01-18 阿里巴巴集团控股有限公司 Process maintenance management method, container maintaining method, device and operating system
CN109669838A (en) * 2018-11-14 2019-04-23 百度在线网络技术(北京)有限公司 Realize application resident method, apparatus, computer equipment and storage medium
CN109683974A (en) * 2018-12-26 2019-04-26 北京金山安全软件有限公司 Awakening method for application background service process in mobile terminal and related equipment
CN109992310A (en) * 2019-03-12 2019-07-09 中国平安财产保险股份有限公司 Application program keepalive method, device, computer equipment and storage medium
CN111399924A (en) * 2020-03-18 2020-07-10 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
CN111538541A (en) * 2019-12-06 2020-08-14 杭州当虹科技股份有限公司 Method for enabling Android App to stably run in background for long time
CN111782347A (en) * 2019-04-03 2020-10-16 安克创新科技股份有限公司 Mobile phone application keep-alive method, device and system and storage medium
CN112162783A (en) * 2020-09-27 2021-01-01 珠海格力电器股份有限公司 Music playing application keep-alive processing method and system, storage medium and electronic equipment
CN112860408A (en) * 2021-03-03 2021-05-28 苏州沁游网络科技有限公司 Process keep-alive method, device and system in cloud reality machine and storage medium
CN113377543A (en) * 2021-06-28 2021-09-10 上海商汤科技开发有限公司 Task processing system, electronic device, and storage medium
WO2022042237A1 (en) * 2020-08-31 2022-03-03 华为技术有限公司 Method for accelerating launching of application, electronic device, and computer storage medium
CN114697377A (en) * 2022-04-07 2022-07-01 深信服科技股份有限公司 Keep-alive method, system and device for client product and readable storage medium
CN114816546A (en) * 2022-04-28 2022-07-29 合肥高维数据技术有限公司 Client application program multi-keep-alive method and system
WO2023109310A1 (en) * 2021-12-13 2023-06-22 北京有竹居网络技术有限公司 Process management method and apparatus, and storage medium and electronic device

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11424931B2 (en) 2016-01-27 2022-08-23 Blackberry Limited Trusted execution environment
US10599409B2 (en) * 2016-02-02 2020-03-24 Blackberry Limited Application lifecycle operation queueing
CN106055365B (en) * 2016-05-31 2019-10-25 Oppo广东移动通信有限公司 A kind of closing application program method and apparatus
CN112445530B (en) * 2019-08-29 2023-03-14 成都鼎桥通信技术有限公司 Method and device for keeping third-party application program alive
CN110688319B (en) * 2019-09-30 2023-05-02 RealMe重庆移动通信有限公司 Application keep-alive capability test method and related device
CN110879726B (en) * 2019-10-24 2023-09-26 深圳数位大数据科技有限公司 Keep-alive method and keep-alive device for mobile terminal application program
CN112612589A (en) * 2020-12-26 2021-04-06 吉林亿联银行股份有限公司 Keep-alive method and device for application program
CN115113946A (en) * 2021-03-17 2022-09-27 广东小天才科技有限公司 Method and device for optimizing starting of camera
CN113741994B (en) * 2021-06-26 2022-07-12 荣耀终端有限公司 Keep-alive method of video application and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019980A1 (en) * 2012-07-10 2014-01-16 Sap Ag Thread Scheduling and Control Framework
CN103577224A (en) * 2013-10-21 2014-02-12 杭州魔品科技有限公司 Method for improving detection on upgrade of Android phone demons by PC terminal

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011040849A1 (en) * 2009-10-01 2011-04-07 Telefonaktiebolaget L M Ericsson (Publ) A method and arrangement for managing persistent rich internet applications
US20110252422A1 (en) * 2010-04-07 2011-10-13 Apple Inc. Opportunistic Multitasking
CN103324536A (en) * 2012-03-23 2013-09-25 宇龙计算机通信科技(深圳)有限公司 Terminal and application program protection method
US9092247B2 (en) * 2012-03-29 2015-07-28 Microsoft Technology Licensing, Llc Persistent and resilient worker processes

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019980A1 (en) * 2012-07-10 2014-01-16 Sap Ag Thread Scheduling and Control Framework
CN103577224A (en) * 2013-10-21 2014-02-12 杭州魔品科技有限公司 Method for improving detection on upgrade of Android phone demons by PC terminal

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSDN: "python写的linux平台双护进程", 《HTTP://BLOG.CSDN.NET/LIANGYUANNAO/ARTICLE/DETAILS/9672665》 *
JUPITERWANGQ: "Android实现双进程守护", 《HTTP://BLOG.CSDN.NET/ZTEMT_SW2/ARTICLE/DETAILS/27101681》 *
NOAHGIFT 等: "《PYTHON UNIX和LINUX系统管理指南》", 30 September 2009, 机械工业出版社 *
ROVAHOMOIMI: "6种进程防杀方案和源码", 《HTTPS://WWW.XUEBUYUAN.COM/839976.HTML》 *

Cited By (35)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930215A (en) * 2016-04-07 2016-09-07 珠海市魅族科技有限公司 Control method and control device for mobile terminal
CN106201690A (en) * 2016-07-07 2016-12-07 乐视控股(北京)有限公司 Application progress control method and device
CN106371911A (en) * 2016-09-06 2017-02-01 北京海誉动想科技股份有限公司 Method for rebooting guarded process by daemon processes
CN106775642B (en) * 2016-11-24 2018-03-13 广州赛意信息科技股份有限公司 The unlimited backstage localization method and system of a kind of Mobile solution
CN106775652A (en) * 2016-11-24 2017-05-31 武汉斗鱼网络科技有限公司 The method and device waken up to the application program of terminal
CN106775642A (en) * 2016-11-24 2017-05-31 广州赛意信息科技股份有限公司 The unlimited backstage localization method and system of a kind of Mobile solution
WO2018094908A1 (en) * 2016-11-24 2018-05-31 武汉斗鱼网络科技有限公司 Method and device for waking application program of terminal
CN106648863A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Live keeping method and system of Android application installation package and application target process
CN106648863B (en) * 2016-12-08 2020-01-03 武汉斗鱼网络科技有限公司 Android application installation package, application target process keep-alive method and system
CN107342981A (en) * 2017-06-07 2017-11-10 北京小鸟看看科技有限公司 Transmission method and device, the virtual reality helmet of sensing data
CN107341052A (en) * 2017-06-07 2017-11-10 努比亚技术有限公司 A kind of message treatment method and device
CN109240809A (en) * 2017-07-11 2019-01-18 阿里巴巴集团控股有限公司 Process maintenance management method, container maintaining method, device and operating system
CN107729128A (en) * 2017-07-24 2018-02-23 上海壹账通金融科技有限公司 Application data restoration methods, device, computer equipment and storage medium
CN107729128B (en) * 2017-07-24 2019-09-24 深圳壹账通智能科技有限公司 Application data restoration methods, device, computer equipment and storage medium
CN107391199A (en) * 2017-07-27 2017-11-24 珠海市魅族科技有限公司 Using startup method and device, terminal and computer-readable recording medium
CN108287761A (en) * 2017-08-09 2018-07-17 珠海市魅族科技有限公司 Method for recovering internal storage and device, terminal device and computer readable storage medium
CN108287761B (en) * 2017-08-09 2020-11-06 珠海市魅族科技有限公司 Memory recovery method and device, terminal equipment and computer readable storage medium
CN108153620A (en) * 2017-12-27 2018-06-12 深圳豪客互联网有限公司 A kind of course control method and device
CN109669838A (en) * 2018-11-14 2019-04-23 百度在线网络技术(北京)有限公司 Realize application resident method, apparatus, computer equipment and storage medium
CN109683974A (en) * 2018-12-26 2019-04-26 北京金山安全软件有限公司 Awakening method for application background service process in mobile terminal and related equipment
CN109683974B (en) * 2018-12-26 2022-05-31 北京金山安全软件有限公司 Awakening method for application background service process in mobile terminal and related equipment
CN109992310A (en) * 2019-03-12 2019-07-09 中国平安财产保险股份有限公司 Application program keepalive method, device, computer equipment and storage medium
CN109992310B (en) * 2019-03-12 2024-04-05 中国平安财产保险股份有限公司 Application program keep-alive method, device, computer equipment and storage medium
CN111782347A (en) * 2019-04-03 2020-10-16 安克创新科技股份有限公司 Mobile phone application keep-alive method, device and system and storage medium
CN111538541A (en) * 2019-12-06 2020-08-14 杭州当虹科技股份有限公司 Method for enabling Android App to stably run in background for long time
CN111399924B (en) * 2020-03-18 2023-06-16 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
CN111399924A (en) * 2020-03-18 2020-07-10 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
WO2022042237A1 (en) * 2020-08-31 2022-03-03 华为技术有限公司 Method for accelerating launching of application, electronic device, and computer storage medium
CN112162783A (en) * 2020-09-27 2021-01-01 珠海格力电器股份有限公司 Music playing application keep-alive processing method and system, storage medium and electronic equipment
CN112860408A (en) * 2021-03-03 2021-05-28 苏州沁游网络科技有限公司 Process keep-alive method, device and system in cloud reality machine and storage medium
CN113377543A (en) * 2021-06-28 2021-09-10 上海商汤科技开发有限公司 Task processing system, electronic device, and storage medium
WO2023109310A1 (en) * 2021-12-13 2023-06-22 北京有竹居网络技术有限公司 Process management method and apparatus, and storage medium and electronic device
CN114697377B (en) * 2022-04-07 2023-09-05 深信服科技股份有限公司 Keep-alive method, keep-alive system, keep-alive device and readable storage medium for client products
CN114697377A (en) * 2022-04-07 2022-07-01 深信服科技股份有限公司 Keep-alive method, system and device for client product and readable storage medium
CN114816546A (en) * 2022-04-28 2022-07-29 合肥高维数据技术有限公司 Client application program multi-keep-alive method and system

Also Published As

Publication number Publication date
CN105335171B (en) 2019-05-10
WO2015196967A1 (en) 2015-12-30

Similar Documents

Publication Publication Date Title
CN105335171A (en) Method and device for long residence of application program in background of operating system
CN108737270B (en) Resource management method and device for server cluster
US10545750B2 (en) Distributed upgrade in virtualized computing environments
WO2018103521A1 (en) Monitoring method for server, device, and storage medium
US9311200B1 (en) Method and system for providing high availability to computer applications
US8607225B2 (en) Managed upgrades of components in an integrated software and hardware system
CN108089913B (en) Virtual machine deployment method of super-fusion system
US20150242197A1 (en) Automatic Installing and Scaling of Application Resources in a Multi-Tenant Platform-as-a-Service (PaaS) System
CN111061491B (en) LXC container technology-based edge computing gateway management system and method
CN107741852B (en) Service deployment method based on cluster software
CN107911467B (en) Service operation management system and method for scripted operation
CA2511049A1 (en) System to automatically process components on a device
CN108984272A (en) The control method and device of OpenStack cloud computing management platform
CN105981332A (en) Broadcasting management information using fountain codes
GB2463370A (en) Method of allowing an application to run as a service application on a mobile computing device.
CN111045854A (en) Method, apparatus and computer program product for managing service containers
US20080183878A1 (en) System And Method For Dynamic Patching Of Network Applications
CN114553693B (en) Gateway upgrading method and device
CN104765624B (en) Method and device for updating application program of virtual machine
US20080263183A1 (en) Management of Kernel configurations for nodes in a clustered system
US7917614B2 (en) Fault tolerance in a client side pre-boot execution
CN114546588A (en) Task deployment method and device, storage medium and electronic device
JP5359835B2 (en) Information processing apparatus, distribution system, and reception method
CN101917458B (en) Method and device for sending network bootstrap program to client
US20230315505A1 (en) System and method for deploying a software-defined data center based on desired state specification from virtualization software

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190510

Termination date: 20210624