WO2019061407A1 - 一种系统服务超时的处理方法及装置 - Google Patents

一种系统服务超时的处理方法及装置 Download PDF

Info

Publication number
WO2019061407A1
WO2019061407A1 PCT/CN2017/104795 CN2017104795W WO2019061407A1 WO 2019061407 A1 WO2019061407 A1 WO 2019061407A1 CN 2017104795 W CN2017104795 W CN 2017104795W WO 2019061407 A1 WO2019061407 A1 WO 2019061407A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
system service
application process
thread
target
Prior art date
Application number
PCT/CN2017/104795
Other languages
English (en)
French (fr)
Inventor
赵俊民
李煜
王森
许顺
蔺振超
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to JP2020517810A priority Critical patent/JP7006780B2/ja
Priority to KR1020217032666A priority patent/KR102460380B1/ko
Priority to CN201780067385.5A priority patent/CN109891392B/zh
Priority to EP17926719.0A priority patent/EP3678023B1/en
Priority to KR1020207011642A priority patent/KR102313664B1/ko
Priority to AU2017434691A priority patent/AU2017434691B2/en
Priority to PCT/CN2017/104795 priority patent/WO2019061407A1/zh
Priority to US16/651,909 priority patent/US11693701B2/en
Publication of WO2019061407A1 publication Critical patent/WO2019061407A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Definitions

  • the embodiments of the present invention relate to the field of communications technologies, and in particular, to a method and an apparatus for processing a system service timeout.
  • the terminal can monitor whether the system service provided in the terminal times out through a watchdog mechanism.
  • the watchdog can run in the form of a thread in the system server process.
  • the system server processes the threads of each system service, for example, the window manager server. , activity management system service (activity manager system service), etc., watchdog can monitor these threads in the system server process, if a thread is blocked, the watchdog will not trigger the response of the thread within the preset time will trigger the terminal to restart The entire Android system.
  • the watchdog once the watchdog detects that a thread in the system server is blocked, it will trigger the terminal to restart. This violent blocking recovery mode will cause the user to lose all current scene data, and the terminal restart will increase the waiting time of the user. .
  • the embodiment of the present invention provides a method and a device for processing a system service timeout.
  • the system service times out the probability of the terminal being blocked or frozen is reduced, and the user experience is improved.
  • an embodiment of the present application provides a method for processing a system service timeout.
  • the terminal that applies the method runs a system service process and at least one application process.
  • the system service process includes at least one system service thread.
  • the method includes: when the target system service thread in the at least one system service thread times out (the target system service thread timeout includes: the object lock occupied by the target system service thread is not released within a preset time, and the target system service thread is blocked
  • the terminal determines a first application process that communicates with the target system service thread (in particular, the first application process and the second application process are different from each other in the at least one application process) Application process); the terminal closes the first application process.
  • the target object lock occupied by the target system service thread with which it communicates can be released, the blocking phenomenon of the target system service thread will also be resolved, and the other system service threads running in the terminal are not Will be affected, thereby reducing the chance of blocking or freezing the terminal and improving the user experience.
  • the blocking of the target system service thread may include: the duration of the target system service thread communicating with the first application process is greater than a first preset value, and the duration of the target system service thread being suspended during execution is greater than At least one of the second preset values.
  • the above system service process also includes a watchdog thread
  • the method also The method includes: the watchdog thread sequentially sends an electrical signal to each of the system service threads; if the response signal fed back by the target system service thread in each system service thread is not received within a preset time, the terminal determines that the target system service thread times out. That is to say, the terminal can implement the processing method of the system service timeout provided by the present application based on the existing watchdog mechanism, thereby reducing implementation complexity and saving system resources.
  • the terminal determines a first application process that is in communication with the target system service thread, and includes: the terminal querying, in the stored registration information, a first application process that communicates with the target system service thread, the registration
  • the information record has a correspondence between the system service thread that performs the IPC and the first application process.
  • the method includes: the terminal restarting the first application process, so that the user can continue operations on the restarted first application process.
  • the method further includes: the terminal monitors the total number of the currently running binder threads N, N is an integer greater than or equal to 0; when the total number of binder threads is greater than the first preset value, the terminal determines N binders The application process of each binder thread service in the thread; further counting the number of binder threads occupied by each application process in all application processes; when the number of binder threads occupied by the first target application process is greater than the second preset value, indicating the first target The application process occupies too many binder resources, causing a large risk of terminal jamming or freezing screen. Then, the terminal can close the first target application process, release the binder thread occupied by the first target application process, and release the binder thread. Can be used by other processes (or threads) that are waiting for interprocess communication.
  • the priority of the second target application process is higher than the priority of the first target application process.
  • the method further includes: the terminal closing the second target application process; and the terminal restarting the second target application process. That is to say, when a plurality of terminals occupy more binder threads, the terminal can release the application process with lower priority, and the application process with higher priority can be retained to prevent the application process with higher priority from being closed (or After rebooting, it affects the running status and user experience of the terminal.
  • the method when the terminal closes the second target application process, the method further includes: the terminal records the running progress of the second target application process; wherein the terminal restarts the second target application process, including: the terminal According to the running progress, the second target application process is restored to the same running state as the running progress.
  • the terminal restarts the second target application process the second target application process can be restored to the pre-restart state according to the recorded running progress, so that the application process can be seamlessly connected before and after the restart, thereby improving the user experience.
  • the method further includes: the terminal statistics the number of binder threads M that provide the IPC service for the target application, M is an integer greater than or equal to 0; when the number of the binder threads M is greater than or equal to the first threshold , indicating the potential risk of the binder thread resource being exhausted, the terminal may stop creating a new binder thread for the target application, thereby preventing the binder thread resource from being exhausted.
  • the terminal stops creating a new binder thread for the target application, including: the terminal collects an API called by each binder thread of the M binder threads; When the number of times an API is called is greater than the second threshold, the pressure of the API is large, and there may be a risk that the binder thread maliciously calls the API. At this time, the binder thread resource is occupied to a higher degree, and the binder thread frequently calls a single API. Then, the terminal can stop responding to the target application to create a new binder thread request, preventing the binder thread resource from being maliciously occupied and exhausted.
  • the method further includes: when the number of binder threads M providing the IPC service for the target application is less than the first threshold, the terminal is the target The application creates a new binder thread.
  • the method further includes: the terminal displays a reason for the target system service thread timeout, or displays a prompt to close the first application process.
  • an embodiment of the present application provides a method for processing a system service timeout.
  • a terminal that applies the method runs a system service process and at least one application process, and the system service process includes at least one application process.
  • a system service thread specifically, the method includes: when the first system service thread occupies the target object lock, triggering the first timer to start timing, when the first timer expires, if the first system service thread still does not release the The target object lock triggers the terminal to acquire the identifier of the first system service thread that occupies the target object lock. Further, the terminal determines the target application process that communicates with the first system service thread according to the identifier of the first system service thread, and closes the target application process. Target application process.
  • an embodiment of the present application provides a method for processing a system service timeout.
  • a terminal that applies the method runs a system service process and at least one application process, where the system service process includes At least one system service thread, specifically, the method includes: the first system service thread communicates with the first application process, and when the second application process needs the system service provided by the first system service thread, triggering the second timer to start timing When the second timer expires, if the first system service thread is still communicating with the first application process, the terminal is triggered to close the first application process.
  • an embodiment of the present application provides a terminal that runs a system service process and at least one application process, where the system service process includes at least one system service thread, and the terminal includes: a timeout detecting unit, configured to: detect the at least Whether the target system service thread in a system service thread times out; determining unit, configured to: when the target system service thread times out, determine a first application process that communicates with the target system service thread, the target system service thread timeout includes: The object lock occupied by the target system service thread is not released within a preset time, and at least one of the target system service thread is blocked; the timeout processing unit is configured to: close the first application process.
  • the determining unit is specifically configured to: query, in the stored registration information, a first application process that communicates with the target system service thread, where the registration information records a system for performing inter-process communication IPC The correspondence between the service thread and the first application process.
  • the timeout processing unit is further configured to: restart the first application process.
  • the timeout detecting unit is further configured to: monitor a total number of binding binder threads currently running N, N is an integer greater than or equal to 0; the determining unit is further configured to: when the binder thread When the total number is greater than the first preset value, the application process of each of the N binder threads is determined; the number of binder threads occupied by each application process in all target application processes is counted; and the timeout processing unit is further used when: When the number of binder threads occupied by the first target application process is greater than the second preset value, the first target application process is closed.
  • the timeout processing unit is further configured to: close the second target application process; restart the second target application process.
  • the timeout processing unit is specifically configured to: record the second target application into The running progress of the process; according to the running progress, the second target application process is restored to the same running state as the running progress.
  • the determining unit is further configured to: count the number of binder threads M that provide an IPC service for the target application, and M is an integer greater than or equal to 0; the timeout processing unit is further configured to: when When the number of binder threads M is greater than or equal to the first threshold, stop creating a new binder thread for the target application.
  • the timeout processing unit is specifically configured to: count an application programming interface API invoked by each binder thread of the M binder threads; and stop when an API is called for a number of times greater than a second threshold. A request to create a new binder thread in response to the target application.
  • the timeout processing unit is further configured to: create a new binder thread for the target application when the number M of binder threads providing the IPC service for the target application is less than the first threshold.
  • the terminal further includes: a display unit, configured to: display a reason for the target system service thread timeout, or display a prompt to close the first application process.
  • an embodiment of the present application provides a terminal, including: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, and the processor is connected to the memory through the bus, when the terminal is running The processor executes the computer-executed instructions stored by the memory to cause the terminal to perform the processing method of any of the above system service timeouts.
  • an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores an instruction, when the instruction is run on any of the foregoing terminals, causing the terminal to execute any one of the foregoing system services. Timeout processing method.
  • an embodiment of the present application provides a computer program product, including an instruction, when the terminal runs on any of the foregoing terminals, causing the terminal to perform a processing method for any of the above system service timeouts.
  • FIG. 1 is a schematic structural diagram 1 of a terminal according to an embodiment of the present disclosure
  • FIG. 2 is a schematic structural diagram 1 of an Android system according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram 2 of an Android system according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic structural diagram 3 of an Android system according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic flowchart 1 of a method for processing a system service timeout according to an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram 1 of an application scenario of a method for processing a system service timeout according to an embodiment of the present disclosure
  • FIG. 7 is a schematic diagram 2 of an application scenario of a method for processing a system service timeout according to an embodiment of the present disclosure
  • FIG. 8 is a second schematic flowchart of a method for processing a system service timeout according to an embodiment of the present disclosure
  • FIG. 9 is a schematic flowchart 3 of a method for processing a system service timeout according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram 2 of a terminal according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram 3 of a terminal according to an embodiment of the present application.
  • first and second are used for descriptive purposes only and are not to be construed as indicating or implying Relative importance or implicit indication of the number of technical features indicated. Thus, features defining “first” and “second” may include one or more of the features either explicitly or implicitly. In the description of the embodiments of the present application, “multiple” means two or more unless otherwise stated.
  • a process is a basic activity of an application on a data set. It is the basic unit for resource allocation and scheduling by an operating system (such as Android). Each process occupies an address space, and the application runs on the operating system in the form of one or more processes to implement the corresponding functions.
  • an operating system such as Android
  • a thread is an entity of a process. It is a basic unit that can run independently of a process. A thread can share all the resources owned by that process with other threads belonging to the same process. One thread can create and revoke another thread, and multiple threads in the same process can execute concurrently.
  • An object lock is a mechanism that guarantees that only one thread accesses a method or variable at a time.
  • a thread accesses the code being synchronized, it must acquire the object lock to which the code belongs, otherwise the thread will wait (or block) until the object lock is released.
  • the code that is synchronized refers to the method or statement block modified by the keyword synchronized.
  • the object lock is a mutex, that is, at most one thread can obtain the lock.
  • thread A When thread A tries to obtain the object lock held by thread B, thread A must wait or block until thread B releases the lock. After that, thread A can obtain the object lock to access the corresponding method or variable.
  • Thread blocking is usually a timeout caused by a thread being paused for more than a preset value during execution. For example, thread A needs to execute the execution result of thread B as an input parameter in order to continue execution. If thread A does not get the execution result of thread B, the execution will be suspended. When thread A is delayed in the preset time. If the execution result of thread B is not enough, thread A will be blocked.
  • thread blocking can also refer to a phenomenon in which a thread is occupied by a process for a long time, causing the thread to fail to serve other processes.
  • the terminal can monitor certain thread and object locks in the operating system based on the watchdog mechanism. When a monitored thread is blocked, or a monitored object lock is not released, the terminal can be triggered to restart the entire operating system. To avoid jamming or freezing.
  • the Karton solution for restarting the entire operating system can solve the problem that the thread is blocked or the object lock is not released normally, but other normal running threads and object locks in the operating system will be forcibly closed, which will undoubtedly make The currently running application loses a lot of data while reducing the user experience.
  • the terminal when detecting that a monitored thread is blocked, or a monitored object lock is not released, the terminal may first determine and occur. An application process that is blocking or consuming the thread (or process) that the object lock is communicating with. In addition, the terminal can solve the problem that the current thread is blocked or the object lock cannot be released by stopping or restarting the recovery process of the application process. In this way, the running process of the thread that does not block or normally release the object lock in the operating system will not be affected. At the same time, the problem of the jam caused by the thread blocking or the object lock cannot be released can be solved, thereby greatly improving the user. The experience of using.
  • the application process may be a process of an application in the terminal application layer, or may be a daemon process running in the background.
  • the embodiment of the present application does not impose any limitation on this.
  • a system service timeout processing method provided by the embodiment of the present application can be applied to a mobile phone, a wearable device, an augmented reality (AR), a virtual reality (VR) device, a tablet computer, a notebook computer, and a super On any terminal such as an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), of course, in the following embodiments, the specific form of the terminal is not limited.
  • AR augmented reality
  • VR virtual reality
  • UMPC ultra-mobile personal computer
  • netbook a netbook
  • PDA personal digital assistant
  • the terminal in the embodiment of the present application may be the mobile phone 100.
  • the embodiment will be specifically described below by taking the mobile phone 100 as an example. It should be understood that the illustrated mobile phone 100 is only one example of the above terminal, and the mobile phone 100 may have more or fewer components than those shown in the figure, two or more components may be combined, or Has a different component configuration.
  • the mobile phone 100 may specifically include: a processor 101, a radio frequency (RF) circuit 102, a memory 103, a touch screen 104, a Bluetooth device 105, one or more sensors 106, and a wireless fidelity (wireless fidelity, Wi-Fi) device 107, positioning device 108, audio circuit 109, peripheral interface 110, and power system 111 and the like. These components can communicate over one or more communication buses or signal lines (not shown in Figure 1). It will be understood by those skilled in the art that the hardware structure shown in FIG. 1 does not constitute a limitation to a mobile phone, and the mobile phone 100 may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
  • RF radio frequency
  • the processor 101 is a control center of the mobile phone 100, and connects various parts of the mobile phone 100 by using various interfaces and lines, and executes the mobile phone 100 by running or executing an application stored in the memory 103 and calling data stored in the memory 103.
  • the processor 101 may include one or more processing units; for example, the processor 101 may be a Kirin 960 chip manufactured by Huawei Technologies Co., Ltd.
  • the processor 101 may further include a fingerprint verification chip for verifying the collected fingerprint.
  • the radio frequency circuit 102 can be used to receive and transmit wireless signals during transmission or reception of information or calls.
  • the radio frequency circuit 102 can process the downlink data of the base station and then process it to the processor 101; in addition, transmit the data related to the uplink to the base station.
  • radio frequency circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like.
  • the radio frequency circuit 102 can also communicate with other devices through wireless communication.
  • the wireless communication can use any communication standard or protocol, including but not limited to global mobile communication systems, general packet radio services, code division multiple access, wideband code division multiple access, long term evolution, email, short message service, and the like.
  • the memory 103 is used to store applications and data, and the processor 101 executes various functions and data processing of the mobile phone 100 by running applications and data stored in the memory 103.
  • the memory 103 mainly includes a storage program area and a storage data area, wherein the storage program area can store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.); the storage data area can be stored according to the use of the mobile phone. Data created at 100 o'clock (such as audio data, phone book, etc.).
  • the memory 103 may include a high speed random access memory (RAM), and may also include a nonvolatile memory such as a magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
  • the memory 103 can store various operating systems, for example, developed by Apple. Operating system, developed by Google Inc. Operating system, etc.
  • the above memory 103 may be independent and connected to the processor 101 via the above communication bus; the memory 103 may also be integrated with the processor 101.
  • the touch screen 104 may specifically include a touch panel 104-1 and a display 104-2.
  • the touch panel 104-1 can collect touch events on or near the user of the mobile phone 100 (for example, the user uses any suitable object such as a finger, a stylus, or the like on the touch panel 104-1 or on the touchpad 104.
  • the operation near -1), and the collected touch information is sent to other devices (for example, processor 101).
  • the touch event of the user in the vicinity of the touch panel 104-1 may be referred to as a hovering touch; the hovering touch may mean that the user does not need to directly touch the touchpad in order to select, move or drag a target (eg, an icon, etc.) And only the user is located near the terminal in order to perform the desired function.
  • the touch panel 104-1 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • a display (also referred to as display) 104-2 can be used to display information entered by the user or information provided to the user as well as various menus of the mobile phone 100.
  • the display 104-2 can be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the touchpad 104-1 can be overlaid on the display 104-2, and when the touchpad 104-1 detects a touch event on or near it, it is transmitted to the processor 101 to determine the type of touch event, and then the processor 101 may provide a corresponding visual output on display 104-2 depending on the type of touch event.
  • the touchpad 104-1 and the display 104-2 are implemented as two separate components to implement the input and output functions of the handset 100, in some embodiments, the touchpad 104- 1 is integrated with the display screen 104-2 to implement the input and output functions of the mobile phone 100. It is to be understood that the touch screen 104 is formed by stacking a plurality of layers of materials. In the embodiment of the present application, only the touch panel (layer) and the display screen (layer) are shown, and other layers are not described in the embodiment of the present application. .
  • the touch panel 104-1 may be disposed on the front surface of the mobile phone 100 in the form of a full-board
  • the display screen 104-2 may also be disposed on the front surface of the mobile phone 100 in the form of a full-board, so that the front of the mobile phone can be borderless. Structure.
  • the mobile phone 100 can also have a fingerprint recognition function.
  • the fingerprint reader 112 can be configured on the back of the handset 100 (eg, below the rear camera) or on the front side of the handset 100 (eg, below the touch screen 104).
  • the fingerprint collection device 112 can be configured in the touch screen 104 to implement the fingerprint recognition function, that is, the fingerprint collection device 112 can be integrated with the touch screen 104 to implement the fingerprint recognition function of the mobile phone 100.
  • the fingerprint capture device 112 is disposed in the touch screen 104 and may be part of the touch screen 104 or may be otherwise disposed in the touch screen 104.
  • the main component of the fingerprint collection device 112 in the embodiment of the present application is a fingerprint sensor, which can employ any type of sensing technology, including but not limited to optical, capacitive, piezoelectric or ultrasonic sensing technologies.
  • the mobile phone 100 can also include a Bluetooth device 105 for enabling data exchange between the handset 100 and other short-range terminals (eg, mobile phones, smart watches, etc.).
  • the Bluetooth device in the embodiment of the present application may be an integrated circuit or a Bluetooth chip or the like.
  • the handset 100 can also include at least one type of sensor 106, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the environment The light sensor can adjust the brightness of the display of the touch screen 104 according to the brightness of the ambient light, and the proximity sensor can turn off the power of the display when the mobile phone 100 moves to the ear.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.
  • the mobile phone 100 can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, here Let me repeat.
  • the Wi-Fi device 107 is configured to provide the mobile phone 100 with network access complying with the Wi-Fi related standard protocol, and the mobile phone 100 can access the Wi-Fi access point through the Wi-Fi device 107, thereby helping the user to send and receive emails, Browsing web pages and accessing streaming media, etc., it provides users with wireless broadband Internet access.
  • the Wi-Fi device 107 can also function as a Wi-Fi wireless access point, and can provide Wi-Fi network access to other terminals.
  • the positioning device 108 is configured to provide a geographic location for the mobile phone 100. It can be understood that the positioning device 108 can be specifically a receiver of a positioning system such as a global positioning system (GPS) or a Beidou satellite navigation system, and a Russian GLONASS. After receiving the geographical location transmitted by the positioning system, the positioning device 108 sends the information to the processor 101 for processing, or sends it to the memory 103 for storage. In still other embodiments, the positioning device 108 may also be an assisted global positioning system (AGPS) receiver, and the AGPS system assists the positioning device 108 in performing ranging and positioning services by acting as an auxiliary server.
  • AGPS assisted global positioning system
  • the secondary location server provides location assistance over a wireless communication network in communication with a location device 108, such as a GPS receiver, of the handset 100.
  • the positioning device 108 can also be a Wi-Fi access point based positioning technology. Since each Wi-Fi access point has a globally unique media access control (MAC) address, the terminal can scan and collect the surrounding Wi-Fi access points when Wi-Fi is turned on. Broadcast signals, so the MAC address broadcasted by the Wi-Fi access point can be obtained; the terminal sends the data (such as the MAC address) capable of indicating the Wi-Fi access point to the location server through the wireless communication network, and is retrieved by the location server. The geographic location of each Wi-Fi access point, combined with the strength of the Wi-Fi broadcast signal, calculates the geographic location of the terminal and sends it to the location device 108 of the terminal.
  • MAC media access control
  • the audio circuit 109, the speaker 113, and the microphone 114 can provide an audio interface between the user and the handset 100.
  • the audio circuit 109 can transmit the converted electrical data of the received audio data to the speaker 113 for conversion to the sound signal output by the speaker 113; on the other hand, the microphone 114 converts the collected sound signal into an electrical signal by the audio circuit 109. After receiving, it is converted into audio data, and then the audio data is output to the RF circuit 102 for transmission to, for example, another mobile phone, or the audio data is output to the memory 103 for further processing.
  • the peripheral interface 110 is used to provide various interfaces for external input/output devices (such as a keyboard, a mouse, an external display, an external memory, a subscriber identity module card, etc.). For example, it is connected to the mouse through a universal serial bus (USB) interface, and is connected with a subscriber identification module (SIM) card provided by the telecommunication operator through a metal contact on the card slot of the subscriber identification module. . Peripheral interface 110 can be used to couple the external input/output peripherals described above to processor 101 and memory 103.
  • USB universal serial bus
  • SIM subscriber identification module
  • the mobile phone 100 may further include a power supply device 111 (such as a battery and a power management chip) that supplies power to the various components.
  • the battery may be logically connected to the processor 101 through the power management chip to manage charging, discharging, and power management through the power supply device 111. And other functions.
  • the mobile phone 100 may further include a camera (front camera and/or rear camera), a flash, a micro projection device, a near field communication (NFC) device, and the like, and details are not described herein.
  • a camera front camera and/or rear camera
  • a flash a flash
  • micro projection device a micro projection device
  • NFC near field communication
  • the foregoing mobile phone 100 can run an operating system such as Android or IOS, and the embodiment of the present application does not impose any limitation on this.
  • the Android operating system can be divided into four layers, from the upper layer to the lower layer, respectively, the application layer 201 (ie, the APP layer), the application framework layer 202 (ie, the framework layer), and the system.
  • the runtime layer 203 i.e., the library layer
  • the Linux kernel layer 204 are run.
  • the Linux kernel layer 204 can be used to control the security, memory management, process management, network stack, driver model and the like of the mobile phone 100.
  • the Linux kernel layer 204 also serves as an abstraction layer between hardware (eg, CPU, network card, memory, etc.) and the software stack, which hides specific hardware details for the upper layer (system runtime layer 203, application framework layer 202, and applications).
  • Program layer 201) provides a unified service.
  • the system runtime layer 203 includes some C/C++ libraries, for example, a media library, a system C library, and a surface manager, which can be used by different components in the Android system, and the system runtime layer 203 can pass
  • the framework layer 202 provides services for developers.
  • the framework layer 202 provides developers with an application programming interface (API) framework that can be used to fully access the application. Specifically, the framework layer 202 provides a very large number of APIs for developing applications, and an APP that satisfies related business needs can be constructed by calling the corresponding API.
  • API application programming interface
  • the application layer 201 mainly includes an APP written in the Java language.
  • the user operates the operation interface on the APP, the user interacts with the system runtime layer 203 or the Linux kernel layer 204 by calling the related API in the framework layer 202.
  • the function corresponding to the operation interface is mainly included in the Java language.
  • the framework layer 202 runs a system server process, and the system server process can provide almost all system services for the mobile phone 100, for example, a power manager service (PMS), Activity manager service (AMS), window manager service (WMS), bluetooth service, network management service (NMS), and input manager service (IMS) )Wait.
  • PMS power manager service
  • AMS Activity manager service
  • WMS window manager service
  • NMS network management service
  • IMS input manager service
  • system service threads may be associated with processes or daemons of third party applications in application layer 201 (hereinafter referred to as system service threads) that may be associated with processes or daemons of third party applications in application layer 201 (
  • the daemon process implements inter-process communication (IPC).
  • IPC inter-process communication
  • the process of the WeChat application can communicate with the input manager service thread during the running process, thereby calling the API of the input manager service to provide an input method service in the WeChat application.
  • the above system service thread (such as the above input manager service thread) can specifically communicate with other application processes through a binder service or a socket (socket) service.
  • the binder service architecture provides three modules: the server, the binder driver, and the client.
  • the application process running by the APP layer 201 can serve as a client, and each system service provided by the framework layer 202 can serve as a server.
  • the binder driver can be located in the Linux kernel layer 204, which records the identity of each pair of processes (or threads) that communicate through the binder service.
  • the binder driver can be called by the transact() function, and the binder driver sends the call message to the server service thread of the server.
  • the server service thread of the server receives a call message sent by the binder driver, starts a binder thread, executes the service code of the server according to the parameters of the onTransact() function, and implements the corresponding system service.
  • system service thread When the system service thread communicates with other processes, it may cause the system service thread to block or the object lock that it occupies cannot be released. For example, when the process of the WeChat application is in an infinite loop during execution, the system service thread A that communicates with it will block at this time. If the existing watchdog mechanism is followed, the mobile phone 100 is triggered to restart, so that the mobile phone 100 is currently running. All data is lost.
  • the terminal when an object lock is occupied, the terminal may be triggered to start the first timer to start timing. When the first timer expires, if the object lock is still in the occupied state, then the The object lock has a timeout phenomenon. At this time, the terminal may be triggered to acquire the identifier of the system service thread (for example, the first system service thread) that occupies the object lock. Further, the terminal may determine, according to the identifier of the first system service thread, by using the binder driver. A target application process that communicates with the first system service thread and closes the target application process. After the target application process is closed, the first system service thread that communicates with it will be released, so the object lock occupied by the first system service thread is also released, so that other required system service threads can continue to use the object lock.
  • the binder driver A target application process that communicates with the first system service thread and closes the target application process. After the target application process is closed, the first system service thread that communicates with it will be released, so the object lock
  • a plurality of application processes can be run within the terminal, and the application processes can communicate with one or more system service threads to implement related system services.
  • the first application process communicates with a certain system service thread (eg, the first system service thread)
  • the first system service thread cannot provide services to other application processes (eg, the second application process)
  • the terminal may be triggered to start the second timer to start timing.
  • the second timer expires, if the first system service thread is still in the occupied state, that is, the first system service thread is blocked.
  • the terminal may be triggered to determine a specific process that communicates with the first system service thread at this time, that is, the first application process, and close the first application process. After the first application process is closed, the first system service thread with which it communicates will be released, and subsequent other required application processes can communicate with the released first system service thread to implement related system services.
  • the terminal runs a system service process and at least one application process
  • the system service process includes at least one system service thread
  • the terminal determines The first application process of the target system service thread communication, the target system service thread timeout includes: the object lock occupied by the target system service thread is not released within a preset time, And at least one of blocking the target system service thread; the terminal closes the first application process.
  • the embodiment of the present application provides a method for processing a system service timeout.
  • the system service thread timeout may refer to: the object lock occupied by a system service thread in the system server process is preset. If the time is not released, it may be that the duration of blocking of a system service thread in the system server process reaches a preset duration.
  • the method specifically includes:
  • the terminal monitors whether the target system service thread times out.
  • the target system service thread may be any system service thread running in the system server process, for example, a system service thread occupying a target object lock (for example, any object lock such as inputmanagerservice.this, activitymanagerservice.this), or may be
  • a target object lock for example, any object lock such as inputmanagerservice.this, activitymanagerservice.this
  • the system service thread that communicates with other threads (or processes) does not impose any limitation on this embodiment of the present application.
  • the terminal can follow the existing watchdog monitoring mechanism, and the terminal processor monitors certain system service threads and object locks occupied by the system service threads.
  • the processor can monitor whether the target object lock is released within a preset time (for example, 60 seconds) through the watchdog thread. If the target object lock is not released within 60 seconds, it means that the target object lock is held.
  • the system service thread that is, the target system service thread
  • times out that is, the target system service times out.
  • the processor may monitor whether the target system service thread is being occupied by an application process, and if the target system service thread is being occupied by an application process and the occupied duration is greater than or equal to a preset threshold, The target system service thread timeout can be determined.
  • the processor can also monitor whether a system service thread reports a blocking event through a watchdog thread.
  • the system service thread When receiving a blocking event reported by a system service thread, the system service thread is indicated (the system service thread is the target at this time). The system service thread) is blocked, that is, the target system service times out.
  • the watchdog thread in the terminal may sequentially poll each system service thread occupying the object lock. For example, currently five object locks are respectively occupied by different system service threads, and the watchdog thread sequentially goes to this. Five system service threads send an electrical signal (ie, feed dog), and the system service thread that receives the electrical signal needs to respond to the watchdog thread for a response within a preset time (ie, kick dog). After the response, the watchdog thread will feed the dog to the next system service thread. Then, if a system service thread (such as system service thread A) does not respond to the watchdog thread within a preset time, it can be determined that the object lock occupied by system service thread A has timed out. At this time, the system service thread A is the target system service thread, and the object lock occupied by the system service thread A is the target object lock.
  • a system service thread such as system service thread A
  • the watchdog thread in the terminal may poll each system service thread of the unoccupied object lock in turn to detect whether the system service thread is blocked. For example, the watchdog thread can sequentially send an electrical signal (ie, feed the dog) to the system service thread of the four unoccupied object locks currently running, and the system service thread receiving the electrical signal needs to respond to the watchdog thread within a preset time. (ie kicking the dog). Then, if a system service thread (such as system service thread B) does not respond to the watchdog thread within a preset time, it can be determined that system service thread B is blocked.
  • an electrical signal ie, feed the dog
  • the terminal acquires an identifier of the target system service thread.
  • the target system The service thread When the target system service thread times out due to blocking of the target system service thread, the target system The service thread will report the blocking event to the watchdog thread, and the blocking event may carry its own identifier, for example, the ID number of the target system service thread, so that the terminal obtains the identifier of the target system service thread. Alternatively, the terminal may also obtain the ID number of the target system service thread by calling the getThreadId() function.
  • the target system service thread timeout When the target system service thread timeout is caused by the target object lock timeout, it indicates that the target system service thread holding the target object lock always occupies system resources (such as memory resources) and is not released, and then other threads cannot obtain the target.
  • the object lock implements related services. At this time, the terminal is prone to jamming or even freezing.
  • the terminal can find the identifier of the specific target system service thread holding the target object lock by calling the Java Native Interface (JNI) interface.
  • JNI Java Native Interface
  • the processor of the terminal can call the GetLockOwnerThreadId() function in the JNI interface, and the return value of the function is the ID number of the target system service thread holding the target object lock (ie, the identifier of the target system service thread), for example,
  • the return value of the GetLockOwnerThreadId() function is 01, and 01 is the ID number of the window manager service thread, that is, the target system service thread is the window manager service thread.
  • the identifier of the target system service thread may also be a parameter of the target system service thread and the like, which may uniquely identify the parameter of the thread in the terminal, and the embodiment of the present application does not impose any limitation.
  • the terminal queries an application process that communicates with the target system service thread according to the identifier of the target system service thread.
  • the processor of the terminal may further query, in the memory, the specific application process that communicates with the target system service thread according to the identifier of the target system service thread.
  • each system service thread in the system server process can register with the binder driver in advance, and the binder driver records the registration information such as the ID number of each system service thread.
  • the window manager service thread when the window manager service thread registers with the binder driver, it can report the ID number of the window manager service thread and the function of the window manager service thread, for example, to create a Window (Window) creation function. Then, when the APP 1 process in the subsequent application layer 201 needs to use the creation function, an inter-process communication request for communication with the window manager service thread can be initiated to the binder driver. After receiving the inter-process communication request, the binder driver may request the window manager service thread to create a corresponding window according to the registration information, and complete the IPC communication process between the APP 1 process and the window manager service thread.
  • Window Window
  • the binder driver can be used to maintain the correspondence between each system service thread that performs IPC communication and the application process.
  • the binder driver can process the third-party application process (or daemon process) and the system with which it communicates after receiving an inter-process communication request from a third-party application process (or daemon process).
  • the correspondence between the service threads is recorded in the above registration information.
  • the terminal may obtain the registration information shown in Table 1.
  • the application process that is queried to communicate with the target system service thread (for example, the window manager service thread) is a WeChat application process, and the ID of the WeChat application process is 11.
  • System service thread identifier The identity of the third-party application process (or daemon process) 01 (window management service thread) 11 (WeChat application process) 02 (power management service thread) 10 (browser application process)
  • the target system service thread may not perform IPC communication, or the target system service thread may be through other methods (such as socket service) and third-party applications.
  • the process (or daemon process) communicates.
  • the above target system service thread may also communicate with the application process through the socket service.
  • the terminal when a system service thread communicates with an application process based on the socket service, the terminal may actively record the identifier of the application process. In this way, when the target system service times out, for example, when the target system service thread establishes a socket connection timeout with the application process, the terminal may query the recorded identifier of the application process that communicates with the target system service thread, thereby determining that the target system service timeout is caused. Specific application process.
  • the terminal closes the application process to solve the problem caused by the target system service thread timeout.
  • the processor of the terminal can kill the application process, and after the application process is closed, the target system service thread that communicates with the target system is released, so that the target system The target object lock occupied by the service thread can be released, and the originally blocked target system service thread can continue to provide the corresponding system service, thereby reducing the probability of blocking or freezing screen caused by the system service timeout.
  • the processor may also restart the application process, for example, restarting the WeChat application, so that the user can continue to operate on the restarted APP.
  • the target object lock occupied by the target system service thread that communicates with it can be released, and the blocking phenomenon of the target system service thread will also be solved, and the operation process of other system services in the terminal will not be solved. affected.
  • a person skilled in the art may also set a certain recovery strategy to recover the application process. For example, when multiple system service threads are timed out, the terminal can directly shut down the lower priority application process according to the priority of the application process, and restart the application process with higher priority.
  • the terminal can also record the running progress of the application process at this time, so that after the terminal restarts the application process, the application process can be restored to the state before the restart according to the recorded running progress.
  • the WeChat application process is used as an example of the application process.
  • the terminal closes the WeChat application process, the terminal can record the current chat information with the user A as the running progress. In this way, when the terminal restarts the WeChat application process, the WeChat application process can be restored to the state before the restart according to the running progress of the record, so that the application process can be seamlessly connected before and after the restart, thereby improving the user experience.
  • the terminal may also prompt the user through the UI interface, and the user is patiently waiting to prevent the user from mistakenly thinking that the terminal is stuck at this time. For example, as shown in (a) of FIG. 6, when the terminal restarts the application process, the terminal may notify the user that the application process is being restarted, as shown in FIG. 6. As shown in (b), after the terminal closes the application process, the user may be notified that the application service has timed out due to the application process, and thus the application process has been closed, or, as shown in (c) of FIG. 6, when determining After the application process that causes the target system service to time out, the terminal may also prompt the user to close the application process through a prompt box. If the user confirms that the application process is closed, the terminal closes the application process.
  • the terminal may also save the application interface snapshot presented by the current application process on the UI interface.
  • the WeChat process may be closed before the WeChat process is closed.
  • the WeChat application saves the snapshot of the application interface 71 displayed on the UI interface to the local.
  • the terminal restarts the WeChat process as shown in FIG. 7, the saved application interface snapshot 71 when the WeChat process is closed may be displayed first, and the WeChat process is started in the background, for example, displaying the application interface snapshot for 2 seconds. Restart the WeChat process while displaying the snapshot of the application interface. This will visually shorten the time for the WeChat process to restart and improve the user experience.
  • the terminal can record the specific system service and application process that triggers the timeout each time.
  • the timeout frequency caused by an application process is high, the risk of running the application process is stuttered.
  • the subsequent terminal can prevent the application process from causing a timeout by allocating additional system resources to the application process and cleaning up the current redundant process.
  • the terminal can also count the specific running scenarios that cause the timeout each time, such as the payment scenario, the call scenario, and the like, so that the terminal can predict the scenario in which the risk of the carding is high, so that the terminal has a high risk of the carding. Prevent the application process from causing a timeout in advance.
  • the terminal can report the specific system service and the application process that triggers the timeout record to the server as the historical data, and the server determines, according to the big data statistics, the application process or the prediction policy that needs to prevent the timeout phenomenon in advance.
  • the embodiment of the present application does not impose any limitation on this.
  • the action of the terminal in the above steps 501-504 may be performed by the processor 101 in the above-mentioned FIG. 1 running an instruction or software stored in the memory 103 to instruct the terminal to complete the processing method of the system service timeout.
  • the terminal allocates a binder thread to implement the communication between the processes.
  • the binder resource of the binder server is exhausted, resulting in the need.
  • Other processes that communicate between processes cannot apply for a binder thread.
  • the embodiment of the present application provides a method for processing a system service timeout, as shown in FIG. 8, including:
  • the terminal determines an application process of each binder thread service.
  • the processor of the terminal can count the total number of binder threads that provide the binder service in the current terminal.
  • the number of binder threads that the operating system can support is certain, for example, 16, then, when the total number of binder threads counted is 16 , that is, when the binder thread is full, the processor may be triggered to further determine the application process of each of the 16 binder threads.
  • the binder driver allocates one or more binder threads to the third-party application process (or daemon process) from the binder resource pool.
  • the binder driver records in the registration information in addition to the system service threads and third-party application processes that each pair communicates with (or In addition to the correspondence between the daemon processes, the identity of the binder thread that provides the IPC service for each pair of system service threads and third-party application processes can also be recorded.
  • the terminal can query the application process of each binder thread service in the registration information shown in Table 2.
  • the terminal counts the number of binder threads occupied by each application process in all application processes.
  • the processor can calculate the number of binder threads occupied by an application process according to the application process of each binder thread service. For example, in the above 16 binder threads, the WeChat application process occupies 8 binder threads, the music application process occupies 5 binder threads, and the browser application process occupies 3 binder threads.
  • the terminal closes at least one application process according to the number of binder threads occupied by each application process.
  • the terminal may close the application process that occupies the largest number of binder threads, for example, the WeChat application process is closed or restarted, thereby releasing the 8 binder threads occupied by the WeChat application process, and the released binder thread may wait for other processes.
  • the process (or thread) of the communication is used.
  • the terminal may also close or restart an application process that occupies a number of binder threads greater than a preset value to release the currently occupied binder thread.
  • the terminal may release the lower priority application process according to the priority of the application process, thereby releasing the binder thread occupied by the lower priority application process, and the higher priority application process may be retained to avoid After the application process with higher priority is shut down (or restarted), it affects the running status and user experience of the terminal.
  • the user can also manually set a whitelist or blacklist of application processes to be closed when the binder thread is full.
  • a whitelist or blacklist of application processes can be closed when the binder thread is full.
  • the application process recovery policy when the binder thread is full can be set according to the actual experience or the actual application scenario, and the embodiment of the present application does not impose any limitation on this.
  • the action of the terminal in the above steps 801-803 may be performed by the processor 101 in FIG. 1 executing the instruction or software stored in the memory 103 to instruct the terminal to complete the processing method of the system service timeout.
  • the embodiment of the present application further provides a processing method for the system service timeout, as shown in FIG.
  • the terminal counts the number of binder threads occupied by the target application process.
  • the target application process may be a process of any application installed in the terminal APP layer, and the embodiment of the present application does not impose any limitation on this.
  • a process usually includes multiple threads, so it may be necessary to execute the target application process
  • the process (for example, the system service process) communicates.
  • the target application process can implement the inter-process communication by means of the binder driver to create the binder thread.
  • the terminal can periodically collect the current target application through the processor. The number of binder threads occupied by the process.
  • the terminal may perform statistics on the binder thread created by the target application process at the entry of the transact() function in the IPC Thread State to obtain the number of binder threads occupied by the target application process.
  • the terminal starts to count the specific APIs invoked by the binder threads.
  • the above API refers to one or more predefined functions, the purpose is to provide the ability of the application and the developer to access a set of routines based on a certain software or hardware, so that the application does not need to access the source code, and the developer does not need to Understanding the details of the working mechanism inside the terminal can achieve the corresponding functions.
  • the above API may be any API in a Linux or Windows system, for example, an API for opening a file: open ⁇ , an API for writing: write ⁇ , and an API for accessing a message queue. :msgget ⁇ , etc., the embodiment of the present application does not impose any limitation on this.
  • the first threshold may be 8. That is to say, when the number of binder threads occupied in the target application process reaches 8, there is a potential risk that the binder thread resources are exhausted, then, in order to avoid the binder thread resources being exhausted, the terminal processor can count these binder threads.
  • the specific API called further determines whether the binder threads occupied by the current target application are maliciously occupied.
  • a counter can be set for each handler object, and the terminal calls the API by calling the handler object. Then, when the number of binder threads occupied in the target application process is greater than or equal to 8, the terminal can trigger the counter of each handler object to start. Counting, whenever the binder thread calls a handler object, the counter of the handler object is incremented by one, so that the number of times each API object is called can be counted.
  • the terminal may also record the correspondence between each binder thread and the API it invokes in the memory. Then, as shown in Table 3, the terminal may calculate, according to the correspondence, each binder thread occupied by the target application process. Which APIs are specifically called.
  • Binder thread identifier API identifier a API 1 b API 1 c API 2
  • the number of binder threads occupied by the target application process may be the number of binder threads occupied at the same time, or may be the number of binder threads occupied by the preset time period (for example, within 3 seconds). Any restrictions.
  • the terminal stops creating a new binder thread for the target application process.
  • the second threshold may be 16. That is to say, when the number of binder threads calling the same API (ie, the target API) is greater than 16, the pressure of the target API is large, and there may be a risk that the binder thread maliciously calls the target API, and the binder thread resource is occupied at this time. Higher degree and binder line The program frequently calls a single API. Therefore, in order to avoid blocking and jamming caused by the binder thread being full, when the target application process requests the binder driver to create a new binder thread, the binder driver can stop responding to the target application process. Request, and set the binder thread to be created to wait state, and wait for the binder thread resources to be more sufficient to create a new binder thread for the target application.
  • the terminal when the terminal sets the binder thread to be created to the waiting state, the terminal may also insert a log (log) to record the execution state of the newly created binder thread at this time, so that subsequent developers can locate the target according to the recorded log. The reason why the application process is stuck.
  • log log
  • the number of times the target API is called may be the number of times the target API is called at the same time, or may be the number of times the target API is called in the preset time period (for example, within 3 seconds), which is not limited by the embodiment of the present application. .
  • the terminal creates a new binder thread for the target application.
  • the terminal can set the state of the binder thread to be created, which is set to the waiting state, to the creation state, thereby waking up the binder thread waiting to be created in step 703, and starting to create the binder thread.
  • the binder thread to be created is always unable to be created, and then the target application process may be based on an ANR (Application Not Responding) mechanism. Prompts the user whether to let the target application process continue to run, or to force the target application process to be closed.
  • ANR Application Not Responding
  • the terminal can be directly triggered to perform step 703, that is, the newly created binder thread in the target application process is stopped, and the binder thread to be created is set to wait.
  • the state, waiting for the binder thread resource is more sufficient (for example, the number of binder threads occupied by the target application process is less than the first threshold), and then creating a new binder thread, which is not limited in this embodiment.
  • the action of the terminal in the above steps 901-904 may be performed by the processor 101 in FIG. 1 running the instruction or software stored in the memory 103 to instruct the terminal to complete the processing method of the system service timeout.
  • the above terminal and the like include hardware structures and/or software modules corresponding to each function.
  • the embodiments of the present application can be implemented in a combination of hardware or hardware and computer software in combination with the elements and algorithm steps of the various examples described in the embodiments disclosed herein. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
  • the embodiment of the present application may perform the division of the function module on the terminal or the like according to the foregoing method example.
  • each function module may be divided according to each function, or two or more functions may be integrated.
  • a processing module In a processing module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of the module in the embodiment of the present application is schematic, and is only a logical function division, and the actual implementation may have another division manner.
  • FIG. 10 is a schematic diagram of a possible structure of a terminal involved in the foregoing embodiment, where the terminal includes: a timeout detecting unit 1001, a determining unit 1002, and a timeout processing unit. 1003. And display unit 1004.
  • the timeout detecting unit 1001 is configured to support the terminal to perform the process 501 in FIG. 5; the determining unit 1002 is configured to support the terminal to perform the processes 502-503 in FIG. 5, the processes 801-802 in FIG. 8, and the process 901 in FIG. 902; the timeout processing unit 1003 is configured to support the terminal to perform the process 504 in FIG. 5, the process 803 in FIG. 8, and the processes 903-904 in FIG. 9.
  • the display unit 1004 is configured to display the reason for the timeout of the target system service thread. Or, display a prompt to close the target application process. All the related content of the steps involved in the foregoing method embodiments may be referred to the functional descriptions of the corresponding functional modules, and details are not described herein again.
  • the above-described timeout detecting unit 1001, the determining unit 1002, and the timeout processing unit 1003 may be integrated into a processing module, and the display unit 1004 may be used as a display module.
  • the processing module 1101 is configured to control and manage the action of the terminal.
  • the display module 1102 is for displaying information input by the user or information provided to the user and various menus of the terminal.
  • the terminal may further include a storage module 1103 for storing instructions or data, and a communication module 1104 and the like for communicating with other terminal devices.
  • the processing module 1101 may be a processor or a controller, for example, may be a central processing unit (CPU), a GPU, a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit. (Application-Specific Integrated Circuit, ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It is possible to implement or carry out the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processor may also be a combination of computing functions, for example, including one or more microprocessor combinations, a combination of a DSP and a microprocessor, and the like.
  • the display module 1102 can be a display, and specifically can be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • a touch panel can be integrated on the display for collecting touch events on or near the display, and transmitting the collected touch information to other devices (such as a processor, etc.).
  • the memory module 1103 may be a memory, which may include a high speed random access memory (RAM), and may also include a nonvolatile memory such as a magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
  • RAM high speed random access memory
  • nonvolatile memory such as a magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
  • the communication module 1104 can be a transceiver, a transceiver circuit, an input/output device, a communication interface, or the like.
  • the communication module 1303 may specifically be a Bluetooth device, a Wi-Fi device, a peripheral interface, or the like.
  • the processing module 1101 is a processor
  • the communication module 1104 is a radio frequency circuit
  • the storage module 1103 is a memory
  • the display module 1102 is a display
  • the terminal provided by the embodiment of the present application may be the mobile phone 100 shown in FIG. 1 .
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL), or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (such as a solid state disk (SSD)).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请的实施例提供一种系统服务超时的处理方法及装置,涉及通信技术领域,当系统服务超时时可降低终端发生卡顿或冻屏的几率,提高用户体验。该方法包括:当至少一个系统服务线程中的目标系统服务线程超时时,终端确定与该目标系统服务线程通信的第一应用进程,该目标系统服务线程超时包括:该目标系统服务线程占用的对象锁在预设时间内没有被释放,以及该目标系统服务线程发生阻塞中的至少一个,;该终端关闭该第一应用进程。

Description

一种系统服务超时的处理方法及装置 技术领域
本申请实施例涉及通信技术领域,尤其涉及一种系统服务超时的处理方法及装置。
背景技术
目前,用户对手机、可穿戴设备以及平板电脑等终端运行时的流畅度要求越来越高。而随着终端可实现的功能越来越多,应用在运行时占用的资源越来越碎片化,导致用户在使用终端时会出现卡顿,甚至出现冻屏现象,极大地影响了用户体验。
一般,终端可以通过看门狗(watchdog)机制来监控终端内提供的系统服务是否超时。以安卓系统为例,watchdog可以以一个线程(thread)的形式运行在系统服务(system server)进程中,system server进程中驻留有各个系统服务的线程,例如,窗口管理服务(window manager server)、活动管理系统服务(activity manager system service)等,watchdog可以对system server进程中的这些线程进行监测,如果某个线程发生阻塞,watchdog在预设时间内没有得到该线程的响应便会触发终端重启整个安卓系统。
也就是说,一旦watchdog检测到system server中的某个线程发生阻塞,便会触发终端重启,这种暴力的阻塞恢复方式会导致用户丢失当前所有的场景数据,同时终端重启会增加用户等待的时间。
发明内容
本申请的实施例提供一种系统服务超时的处理方法及装置,当系统服务超时时可降低终端发生阻塞或冻屏的几率,提高用户体验。
为达到上述目的,本申请的实施例采用如下技术方案:
第一方面,本申请的实施例提供一种系统服务超时的处理方法,应用该方法的终端内运行有系统服务进程和至少一个应用进程,该系统服务进程包括至少一个系统服务线程,具体的,该方法包括:当这至少一个系统服务线程中的目标系统服务线程超时(目标系统服务线程超时包括:目标系统服务线程占用的对象锁在预设时间内没有被释放,以及目标系统服务线程发生阻塞这两种情况中的至少一个)时,终端确定与该目标系统服务线程通信的第一应用进程(特别的,第一应用进程和第二应用进程为上述至少一个应用进程中不相同的两个应用进程);终端关闭该第一应用进程。
这样,第一应用进程被关闭后,与其通信的目标系统服务线程占用的目标对象锁可以被释放,目标系统服务线程的阻塞现象也将解决,并且,终端内运行的其他系统服务线程的也不会受到影响,从而降低终端发生阻塞或冻屏的几率,提高用户体验。
其中,上述目标系统服务线程发生阻塞具体可以包括:该目标系统服务线程与第一应用进程通信时的持续时间大于第一预设值,以及,该目标系统服务线程在执行过程中暂停的时长大于第二预设值中的至少一个。
在一种可能的设计方法中,上述系统服务进程中还包括watchdog线程,该方法还 包括:watchdog线程依次向上述各个系统服务线程发送电信号;若在预设时间内未收到上述各个系统服务线程中目标系统服务线程反馈的响应信号,则终端确定该目标系统服务线程超时。也就是说,终端可基于现有的watchdog机制实现本申请提供的系统服务超时的处理方法,从而降低实现复杂度,节省系统资源。
在一种可能的设计方法中,终端确定与该目标系统服务线程通信的第一应用进程,包括:终端在已存储的注册信息中查询与该目标系统服务线程通信的第一应用进程,该注册信息记录有进行IPC的系统服务线程与第一应用进程之间的对应关系。
在一种可能的设计方法中,在终端关闭该第一应用进程之后,包括:终端重新启动该第一应用进程,使得用户可在重新启动的第一应用进程上继续操作。
在一种可能的设计方法中,该方法还包括:终端监测当前运行的binder线程总数N,N为大于或等于0的整数;当binder线程总数大于第一预设值时,终端确定N个binder线程中每一个binder线程服务的应用进程;进而统计所有应用进程中每一个应用进程占用的binder线程数量;当第一目标应用进程占用的binder线程数量大于第二预设值时,说明第一目标应用进程占用的binder资源过多,引起终端卡顿或冻屏的风险较大,那么,终端可关闭该第一目标应用进程,将第一目标应用进程占用的binder线程释放,被释放的binder线程可为其他等待进行进程间通信的进程(或线程)使用。
在一种可能的设计方法中,当第二目标应用进程占用的binder线程数量大于该第二预设值时,该第二目标应用进程的优先级高于该第一目标应用进程的优先级,该方法还包括:终端关闭该第二目标应用进程;终端重新启动该第二目标应用进程。也就是说,当多个终端占用的binder线程较多时,终端可以释放优先级较低的应用进程,而优先级较高的应用进程可被保留,避免优先级较高的应用进程被关闭(或重启)后影响终端的运行状态和用户体验。
在一种可能的设计方法中,在终端关闭该第二目标应用进程时,还包括:终端记录该第二目标应用进程的运行进度;其中,终端重新启动该第二目标应用进程,包括:终端按照该运行进度,将该第二目标应用进程恢复至与该运行进度相同的运行状态。这样,当终端重启第二目标应用进程时,可以根据记录的运行进度将第二目标应用进程恢复为重启前的状态,使得应用进程在重启前后可以实现无缝对接,提高用户的使用体验。
在一种可能的设计方法中,该方法还包括:终端统计为目标应用提供IPC服务的binder线程数量M,M为大于或等于0的整数;当该binder线程数量M大于或等于第一阈值时,说明binder线程资源存在被耗尽的潜在风险,终端可停止为该目标应用创建新的binder线程,从而防止binder线程资源被耗尽。
在一种可能的设计方法中,当该binder线程数量大于第一阈值时,终端停止为该目标应用创建新的binder线程,包括:终端统计M个binder线程中每一个binder线程调用的API;当一个API被调用的次数大于第二阈值时,说明该API的压力较大,可能存在binder线程恶意调用API的风险,此时binder线程资源被占用的程度较高,且binder线程频繁调用单一的API,那么,终端可停止响应该目标应用创建新的binder线程的请求,防止binder线程资源被恶意占用而耗尽。
在一种可能的设计方法中,在终端停止为该目标应用创建新的binder线程之后,还包括:当为该目标应用提供IPC服务的binder线程数量M小于该第一阈值时,终端为该目标应用创建新的binder线程。
在一种可能的设计方法中,该方法还包括:终端显示该目标系统服务线程超时的原因,或者,显示关闭上述第一应用进程的提示。
在一种可能的设计方法中,本申请的实施例提供一种系统服务超时的处理方法,具体的,应用该方法的终端内运行有系统服务进程和至少一个应用进程,该系统服务进程包括至少一个系统服务线程,具体的,该方法包括:当第一系统服务线程占用目标对象锁时,触发第一定时器开始计时,当第一定时器超时时,若第一系统服务线程仍未释放该目标对象锁,则触发终端获取占用该目标对象锁的第一系统服务线程的标识,进而,终端根据第一系统服务线程的标识,确定与第一系统服务线程通信的目标应用进程,并关闭该目标应用进程。
在另一种可能的设计方法中,本申请的实施例提供一种系统服务超时的处理方法,具体的,应用该方法的终端内运行有系统服务进程和至少一个应用进程,该系统服务进程包括至少一个系统服务线程,具体的,该方法包括:第一系统服务线程与第一应用进程通信,当第二应用进程需要上述第一系统服务线程提供的系统服务时,触发第二定时器开始计时,当第二定时器超时时,若第一系统服务线程仍在与上述第一应用进程通信,则触发终端关闭该第一应用进程。
第二方面,本申请的实施例提供一种终端,运行有系统服务进程和至少一个应用进程,该系统服务进程包括至少一个系统服务线程,该终端包括:超时检测单元,用于:检测该至少一个系统服务线程中的目标系统服务线程是否超时;确定单元,用于:当该目标系统服务线程超时时,确定与该目标系统服务线程通信的第一应用进程,该目标系统服务线程超时包括:该目标系统服务线程占用的对象锁在预设时间内没有被释放,以及该目标系统服务线程发生阻塞中的至少一个;超时处理单元,用于:关闭该第一应用进程。
在一种可能的设计方法中,该确定单元,具体用于:在已存储的注册信息中查询与该目标系统服务线程通信的第一应用进程,该注册信息记录有进行进程间通信IPC的系统服务线程与第一应用进程之间的对应关系。
在一种可能的设计方法中,该超时处理单元,还用于:重新启动该第一应用进程。
在一种可能的设计方法中,该超时检测单元,还用于:监测当前运行的绑定binder线程总数N,N为大于或等于0的整数;该确定单元,还用于:当该binder线程总数大于第一预设值时,确定N个binder线程中每一个binder线程服务的应用进程;统计所有目标应用进程中每一个应用进程占用的binder线程数量;该超时处理单元,还用于:当第一目标应用进程占用的binder线程数量大于第二预设值时,关闭该第一目标应用进程。
在一种可能的设计方法中,当第二目标应用进程占用的binder线程数量大于该第二预设值时,该第二目标应用进程的优先级高于该第一目标应用进程的优先级,该超时处理单元,还用于:关闭该第二目标应用进程;重新启动该第二目标应用进程。
在一种可能的设计方法中,该超时处理单元,具体用于:记录该第二目标应用进 程的运行进度;按照该运行进度,将该第二目标应用进程恢复至与该运行进度相同的运行状态。
在一种可能的设计方法中,该确定单元,还用于:统计为目标应用提供IPC服务的binder线程数量M,M为大于或等于0的整数;该超时处理单元,还用于:当该binder线程数量M大于或等于第一阈值时,停止为该目标应用创建新的binder线程。
在一种可能的设计方法中,该超时处理单元,具体用于:统计M个binder线程中每一个binder线程调用的应用程序编程接口API;当一个API被调用的次数大于第二阈值时,停止响应该目标应用创建新的binder线程的请求。
在一种可能的设计方法中,该超时处理单元,还用于:当为该目标应用提供IPC服务的binder线程数量M小于该第一阈值时,为该目标应用创建新的binder线程。
在一种可能的设计方法中,终端还包括:显示单元,用于:显示该目标系统服务线程超时的原因,或者,显示关闭该第一应用进程的提示。
第三方面,本申请的实施例提供一种终端,包括:处理器、存储器、总线和通信接口;该存储器用于存储计算机执行指令,该处理器与该存储器通过该总线连接,当终端运行时,该处理器执行该存储器存储的该计算机执行指令,以使终端执行上述任一项系统服务超时的处理方法。
第四方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令在上述任一项终端上运行时,使得终端执行上述任一项系统服务超时的处理方法。
第五方面,本申请实施例提供一种包含指令的计算机程序产品,当其在上述任一项终端上运行时,使得终端执行上述任一项系统服务超时的处理方法。
其中,第二方面至第五方面中任一种设计方式所带来的技术效果可参见上述第一方面中不同设计方法所带来的技术效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种终端的结构示意图一;
图2为本申请实施例提供的一种安卓系统的架构示意图一;
图3为本申请实施例提供的一种安卓系统的架构示意图二;
图4为本申请实施例提供的一种安卓系统的架构示意图三;
图5为本申请实施例提供的一种系统服务超时的处理方法的流程示意图一;
图6为本申请实施例提供的一种系统服务超时的处理方法的应用场景示意图一;
图7为本申请实施例提供的一种系统服务超时的处理方法的应用场景示意图二;
图8为本申请实施例提供的一种系统服务超时的处理方法的流程示意图二;
图9为本申请实施例提供的一种系统服务超时的处理方法的流程示意图三;
图10为本申请实施例提供的一种终端的结构示意图二;
图11为本申请实施例提供的一种终端的结构示意图三。
具体实施方式
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示 相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
为清楚阐述本申请实施例提供的一种系统服务超时的处理方法,首先将介绍一些后续实施例中可能会出现的概念。
进程(process),是应用程序关于某数据集合上的一次运行活动,是操作系统(例如安卓系统)进行资源分配和调度的基本单位。每一个进程都会占用一块地址空间,应用程序以一个或多个进程的形式运行在操作系统上,实现相应的功能。
线程(thread),是进程的一个实体,它是比进程更小的能独立运行的基本单位。线程可与同属一个进程的其他的线程共享该进程所拥有的全部资源。一个线程可以创建和撤销另一个线程,同一个进程中的多个线程之间可以并发执行。
对象锁,是保证同一时间内只有一个线程访问方法或变量的一种机制。在Java语言中,当一个线程访问被同步的代码时,必须获取该代码所属的对象锁,否则该线程将等待(或阻塞),直到该对象锁被释放。其中,被同步的代码是指被关键字synchronized修饰的方法或语句块。
也就是说,对象锁是一个互斥锁,即最多只有一个线程能够获得该锁,当线程A尝试去获得线程B持有的对象锁时,线程A必须等待或者阻塞,直到线程B释放这个锁后,线程A才能够获取该对象锁访问相应的方法或变量。
线程阻塞,通常是指一个线程在执行过程中出现暂停的时长大于某一预设值引发的超时现象。例如,线程A在执行过程中需要将线程B的执行结果作为输入参数才能继续执行,那么,如果线程A没有得到线程B的执行结果则会暂停执行,当线程A在预设时间内迟迟得不到线程B的执行结果,则会造成线程A发生阻塞现象。或者,线程阻塞也可以是指某个线程与一个通信时长时间被该进程占用,导致该线程无法为其他进程提供服务的现象。
目前,终端可以基于watchdog机制监控操作系统中的某些线程和对象锁,当某个被监控的线程发生阻塞,或者某个被监控的对象锁迟迟没有释放时,可触发终端重启整个操作系统,避免发生卡死或冻屏现象。
但是,重启整个操作系统这种卡顿解决方法,虽然可以解决线程发生阻塞或者对象锁没有正常释放的问题,但是操作系统中其他正常运行的线程和对象锁也将被强制关闭,这无疑会使得当前运行的应用程序丢失大量数据,同时降低用户的使用体验。
对此,在本申请实施例中,基于现有的watchdog触发机制,当检测到某个被监控的线程发生阻塞,或者某个被监控的对象锁迟迟没有释放时,终端可首先确定与发生阻塞或占用该对象锁的线程(或进程)正在通信的应用进程。进而,终端可以通过关闭或重启该应用进程等恢复策略,解决当前线程发生阻塞或对象锁无法释放的问题。这样一来,操作系统内没有发生阻塞或正常释放对象锁的线程的运行过程将不会受到影响,同时,也可以解决因线程阻塞或对象锁无法释放的引起的卡顿问题,从而大大提高用户的使用体验。
其中,上述应用进程可以是终端应用层中某一应用的进程,也可以是后台运行的守护(daemon)进程,本申请实施例对此不做任何限制。
本申请实施例提供的一种系统服务超时的处理方法,可应用于手机、可穿戴设备、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、平板电脑、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等任意终端上,当然,在以下实施例中,对该终端的具体形式不作任何限制。
如图1所示,本申请实施例中的终端可以为手机100。下面以手机100为例对实施例进行具体说明。应该理解的是,图示手机100仅是上述终端的一个范例,并且手机100可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。
如图1所示,手机100具体可以包括:处理器101、射频(radio frequency,RF)电路102、存储器103、触摸屏104、蓝牙装置105、一个或多个传感器106、无线保真(wireless fidelity,Wi-Fi)装置107、定位装置108、音频电路109、外设接口110以及电源系统111等部件。这些部件可通过一根或多根通信总线或信号线(图1中未示出)进行通信。本领域技术人员可以理解,图1中示出的硬件结构并不构成对手机的限定,手机100可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图1对手机100的各个部件进行具体的介绍:
处理器101是手机100的控制中心,利用各种接口和线路连接手机100的各个部分,通过运行或执行存储在存储器103内的应用程序,以及调用存储在存储器103内的数据,执行手机100的各种功能和处理数据。在一些实施例中,处理器101可包括一个或多个处理单元;举例来说,处理器101可以是华为技术有限公司制造的麒麟960芯片。在本申请一些实施例中,上述处理器101还可以包括指纹验证芯片,用于对采集到的指纹进行验证。
射频电路102可用于在收发信息或通话过程中,无线信号的接收和发送。特别地,射频电路102可以将基站的下行数据接收后,给处理器101处理;另外,将涉及上行的数据发送给基站。通常,射频电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等。此外,射频电路102还可以通过无线通信和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统、通用分组无线服务、码分多址、宽带码分多址、长期演进、电子邮件、短消息服务等。
存储器103用于存储应用程序以及数据,处理器101通过运行存储在存储器103的应用程序以及数据,执行手机100的各种功能以及数据处理。存储器103主要包括存储程序区以及存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等);存储数据区可以存储根据使用手机100时所创建的数据(比如音频数据、电话本等)。此外,存储器103可以包括高速随机存取存储器(ramdom access memory,RAM),还 可以包括非易失存储器,例如磁盘存储器件、闪存器件或其他易失性固态存储器件等。存储器103可以存储各种操作系统,例如,苹果公司所开发的
Figure PCTCN2017104795-appb-000001
操作系统,谷歌公司所开发的
Figure PCTCN2017104795-appb-000002
操作系统等。上述存储器103可以是独立的,通过上述通信总线与处理器101相连接;存储器103也可以和处理器101集成在一起。
触摸屏104具体可以包括触控板104-1和显示器104-2。
其中,触控板104-1可采集手机100的用户在其上或附近的触摸事件(比如用户使用手指、触控笔等任何适合的物体在触控板104-1上或在触控板104-1附近的操作),并将采集到的触摸信息发送给其他器件(例如处理器101)。其中,用户在触控板104-1附近的触摸事件可以称之为悬浮触控;悬浮触控可以是指,用户无需为了选择、移动或拖动目标(例如图标等)而直接接触触控板,而只需用户位于终端附近以便执行所想要的功能。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型来实现触控板104-1。
显示器(也称为显示屏)104-2可用于显示由用户输入的信息或提供给用户的信息以及手机100的各种菜单。可以采用液晶显示器、有机发光二极管等形式来配置显示器104-2。触控板104-1可以覆盖在显示器104-2之上,当触控板104-1检测到在其上或附近的触摸事件后,传送给处理器101以确定触摸事件的类型,随后处理器101可以根据触摸事件的类型在显示器104-2上提供相应的视觉输出。虽然在图1中,触控板104-1与显示屏104-2是作为两个独立的部件来实现手机100的输入和输出功能,但是在某些实施例中,可以将触控板104-1与显示屏104-2集成而实现手机100的输入和输出功能。可以理解的是,触摸屏104是由多层的材料堆叠而成,本申请实施例中只展示出了触控板(层)和显示屏(层),其他层在本申请实施例中不予记载。另外,触控板104-1可以以全面板的形式配置在手机100的正面,显示屏104-2也可以以全面板的形式配置在手机100的正面,这样在手机的正面就能够实现无边框的结构。
另外,手机100还可以具有指纹识别功能。例如,可以在手机100的背面(例如后置摄像头的下方)配置指纹识别器112,或者在手机100的正面(例如触摸屏104的下方)配置指纹识别器112。又例如,可以在触摸屏104中配置指纹采集器件112来实现指纹识别功能,即指纹采集器件112可以与触摸屏104集成在一起来实现手机100的指纹识别功能。在这种情况下,该指纹采集器件112配置在触摸屏104中,可以是触摸屏104的一部分,也可以以其他方式配置在触摸屏104中。本申请实施例中的指纹采集器件112的主要部件是指纹传感器,该指纹传感器可以采用任何类型的感测技术,包括但不限于光学式、电容式、压电式或超声波传感技术等。
手机100还可以包括蓝牙装置105,用于实现手机100与其他短距离的终端(例如手机、智能手表等)之间的数据交换。本申请实施例中的蓝牙装置可以是集成电路或者蓝牙芯片等。
手机100还可以包括至少一种传感器106,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境 光传感器可根据环境光线的明暗来调节触摸屏104的显示器的亮度,接近传感器可在手机100移动到耳边时,关闭显示器的电源。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机100还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
Wi-Fi装置107,用于为手机100提供遵循Wi-Fi相关标准协议的网络接入,手机100可以通过Wi-Fi装置107接入到Wi-Fi接入点,进而帮助用户收发电子邮件、浏览网页和访问流媒体等,它为用户提供了无线的宽带互联网访问。在其他一些实施例中,该Wi-Fi装置107也可以作为Wi-Fi无线接入点,可以为其他终端提供Wi-Fi网络接入。
定位装置108,用于为手机100提供地理位置。可以理解的是,该定位装置108具体可以是全球定位系统(global positioning system,GPS)或北斗卫星导航系统、俄罗斯GLONASS等定位系统的接收器。定位装置108在接收到上述定位系统发送的地理位置后,将该信息发送给处理器101进行处理,或者发送给存储器103进行保存。在另外的一些实施例中,该定位装置108还可以是辅助全球卫星定位系统(assisted global positioning system,AGPS)的接收器,AGPS系统通过作为辅助服务器来协助定位装置108完成测距和定位服务,在这种情况下,辅助定位服务器通过无线通信网络与终端例如手机100的定位装置108(即GPS接收器)通信而提供定位协助。在另外的一些实施例中,该定位装置108也可以是基于Wi-Fi接入点的定位技术。由于每一个Wi-Fi接入点都有一个全球唯一的媒体介入控制(media access control,MAC)地址,终端在开启Wi-Fi的情况下即可扫描并收集周围的Wi-Fi接入点的广播信号,因此可以获取到Wi-Fi接入点广播出来的MAC地址;终端将这些能够标示Wi-Fi接入点的数据(例如MAC地址)通过无线通信网络发送给位置服务器,由位置服务器检索出每一个Wi-Fi接入点的地理位置,并结合Wi-Fi广播信号的强弱程度,计算出该终端的地理位置并发送到该终端的定位装置108中。
音频电路109、扬声器113、麦克风114可提供用户与手机100之间的音频接口。音频电路109可将接收到的音频数据转换后的电信号,传输到扬声器113,由扬声器113转换为声音信号输出;另一方面,麦克风114将收集的声音信号转换为电信号,由音频电路109接收后转换为音频数据,再将音频数据输出至RF电路102以发送给比如另一手机,或者将音频数据输出至存储器103以便进一步处理。
外设接口110,用于为外部的输入/输出设备(例如键盘、鼠标、外接显示器、外部存储器、用户识别模块卡等)提供各种接口。例如通过通用串行总线(universal serial bus,USB)接口与鼠标连接,通过用户识别模块卡卡槽上的金属触点与电信运营商提供的用户识别模块卡(subscriber identification module,SIM)卡进行连接。外设接口110可以被用来将上述外部的输入/输出外围设备耦接到处理器101和存储器103。
手机100还可以包括给各个部件供电的电源装置111(比如电池和电源管理芯片),电池可以通过电源管理芯片与处理器101逻辑相连,从而通过电源装置111实现管理充电、放电、以及功耗管理等功能。
尽管图1未示出,手机100还可以包括摄像头(前置摄像头和/或后置摄像头)、闪光灯、微型投影装置、近场通信(near field communication,NFC)装置等,在此不再赘述。
进一步地,上述手机100可以运行Android或IOS等操作系统,本申请实施例对此不作任何限制。
以Android操作系统为例,如图2所示,Android操作系统可以划分为四层,从高层到低层分别是应用程序层201(即APP层)、应用程序框架层202(即framework层)、系统运行库层203(即libraries层)和Linux内核层204。
其中,Linux内核层204可用于控制手机100的安全(security),存储器管理(memory management),程序管理(process management),网络堆栈(network stack),驱动程序模型(driver model)等功能。Linux内核层204同时也作为硬件(例如,CPU、网卡以及内存等)和软件栈之间的抽象层,它可隐藏具体硬件细节从而为上层(系统运行库层203、应用程序框架层202以及应用程序层201)提供统一的服务。
系统运行库层203中包含一些C/C++库,例如,媒体库、系统C库以及显示管理库(surface manager)等,这些库能被Android系统中不同的组件使用,系统运行库层203可通过framework层202为开发人员提供服务。
framework层202为开发人员提供了一个可以完全访问应用程序所使用的应用程序编程接口(application programming interface,API)框架。具体的,framework层202为开发应用程序提供了非常多的API,通过调用相应的API可以构造满足相关业务需求的APP。
应用程序层201主要包括用java语言编写的APP,用户在操作APP上的操作界面时,通过调用framework层202中的相关API,与系统运行库层203或Linux内核层204进行交互,实现与该操作界面相对应的功能。
其中,如图3所示,framework层202中运行有系统服务(system server)进程,该system server进程可以为手机100提供几乎所有的系统服务,例如,电源管理服务(power manager service,PMS)、活动管理服务(activity manager service,AMS)、窗口管理服务(window manager service,WMS)、蓝牙服务(bluetooth service)、网络管理服务(network management service,NMS)以及输入法管理服务(input manager service,IMS)等。
仍如图3所示,这些系统服务可以以线程的形式(后续称为系统服务线程)驻留在system server进程中,这些系统服务线程可以与应用程序层201中第三方应用的进程或守护(daemon)进程实现进程间通信(inter-process communication,IPC)。例如,微信应用的进程在运行过程中可以与input manager service线程通信,从而调用input manager service的API在微信应用中提供输入法服务。
示例性的,上述系统服务线程(例如上述input manager service线程)具体可以通过binder服务或socket(套接字)服务与其他应用的进程实现通信。
以binder服务为例,如图4所示,binder服务架构中提供了服务端、binder驱动以及客户端三个模块。其中,APP层201运行的应用进程可作为客户端,framework层202提供的各个系统服务可以作为服务端。binder驱动可位于Linux内核层204中,该binder驱动中记录有每一对通过binder服务通信的进程(或线程)的标识。
当客户端(例如,微信进程)要想访问服务端(例如,input manager service线程)调用相关系统服务时,可以通过transact()函数调用binder驱动,由binder驱动向服务端的系统服务线程发送调用消息,服务端的系统服务线程接收到binder驱动发送的调用消息后启动一个binder线程,按照onTransact()函数的参数执行服务端的服务代码,实现相应的系统服务。
系统服务线程在与其他进程通信时可能会产生系统服务线程出现阻塞或其占用的对象锁迟迟不能释放的问题。例如,当微信应用的进程在执行过程中发生死循环时,与其通信的系统服务线程A此时会发生阻塞,如果按照现有的watchdog机制,则会触发手机100重启,使手机100当前的运行数据全部丢失。
在本申请的一些实施例中,当某个对象锁被占用时,可触发终端启动第一定时器开始计时,当第一定时器超时时,如果该对象锁仍然处于被占用的状态,则该对象锁发生超时现象,此时,可触发终端获取占用该对象锁的系统服务线程(例如第一系统服务线程)的标识,进而,终端可根据第一系统服务线程的标识,通过上述binder驱动确定与上述第一系统服务线程通信的目标应用进程,并关闭该目标应用进程。目标应用进程被关闭后,与其通信的第一系统服务线程将被释放,所以第一系统服务线程占用的对象锁也被释放,使得其他有需求的系统服务线程可继续使用该对象锁,
又或者,在本申请的另一些实施例中,终端内可运行有多个应用进程,这些应用进程可与一个或多个系统服务线程通信,实现相关的系统服务。当第一应用进程与某一系统服务线程(例如第一系统服务线程)通信时,该第一系统服务线程便无法向其他的应用进程(例如第二应用进程)提供服务,那么,第一应用进程占用第一系统服务线程后,可触发终端启动第二定时器开始计时,当第二定时器超时时,若该第一系统服务线程仍然处于被占用的状态,即第一系统服务线程阻塞,则可触发终端确定此时与该第一系统服务线程通信的具体进程,即上述第一应用进程,并关闭该第一应用进程。第一应用进程被关闭后,与其通信的第一系统服务线程将被释放,后续其他有需求的应用进程可与该被释放的第一系统服务线程通信实现相关的系统服务。
另外,从上述实施例中可以看出,终端关闭与上述第一系统服务线程通信的应用进程后,终端内运行的其他系统服务线程或应用进程也不会受到影响,从而可降低终端发生阻塞或冻屏的几率,提高用户体验。
在另一个实施例中,终端运行有系统服务进程和至少一个应用进程,该系统服务进程包括至少一个系统服务线程,当所述至少一个系统服务线程中的目标系统服务线程超时时,终端确定与所述目标系统服务线程通信的第一应用进程,所述目标系统服务线程超时包括:所述目标系统服务线程占用的对象锁在预设时间内没有被释放,以 及所述目标系统服务线程发生阻塞中的至少一个;终端关闭所述第一应用进程。
本申请的实施例提供一种系统服务超时的处理方法,为方便描述,在本申请实施例中,系统服务线程超时可以是指:system server进程中某一系统服务线程占用的对象锁在预设时间内没有被释放,也可以是指:system server进程中某一系统服务线程发生阻塞的时长达到预设时长,如图5所示,该方法具体包括:
501、终端监测目标系统服务线程是否超时。
其中,该目标系统服务线程可以是system server进程中运行的任意系统服务线程,例如,占用目标对象锁(例如,inputmanagerservice.this、activitymanagerservice.this等任意对象锁)的系统服务线程,也可以是正在与其他线程(或进程)通信的系统服务线程,本申请实施例对此不作任何限制。
具体的,终端可以沿用现有的watchdog监测机制,由终端的处理器对某些系统服务线程以及该系统服务线程占用的对象锁进行监测。
示例性的,处理器可通过watchdog线程监测在预设时间内(例如,60秒)目标对象锁是否被释放,若目标对象锁在60秒中没有被释放,则说明持有该目标对象锁的系统服务线程(即目标系统服务线程)超时,即目标系统服务超时。
在一种可能的实现方式中,处理器可以监测目标系统服务线程是否正在被某一应用进程占用,如果监测到目标系统服务线程正在被某一应用进程占用且占用时长大于等于预设阈值,则可确定该目标系统服务线程超时。
又例如,处理器还可通过watchdog线程监测是否有系统服务线程上报阻塞事件,当接收到某一系统服务线程上报的阻塞事件时,则说明该系统服务线程(此时该系统服务线程即为目标系统服务线程)发生阻塞,即目标系统服务超时。
在本申请的一些实施例中,终端内的watchdog线程可以依次轮询占用对象锁的各个系统服务线程,例如,当前有5个对象锁分别被不同的系统服务线程占用,watchdog线程会依次向这5个系统服务线程发送一个电信号(即喂狗,feed dog),收到该电信号的系统服务线程需要在预设时间内向watchdog线程回复一个响应(即踢狗,kick dog),收到该响应后watchdog线程会依次向下一个系统服务线程喂狗。那么,如果某个系统服务线程(例如系统服务线程A)没有在预设时间内向watchdog线程回复响应,则可确定系统服务线程A占用的对象锁超时。此时,该系统服务线程A即为上述目标系统服务线程,该系统服务线程A占用的对象锁即为目标对象锁。
在本申请的一些实施例中,终端内的watchdog线程可以依次轮询未占用对象锁的各个系统服务线程,以检测该系统服务线程是否发生阻塞。例如,watchdog线程可以依次向当前运行的4个未占用对象锁的系统服务线程发送一个电信号(即喂狗),收到该电信号的系统服务线程需要在预设时间内向watchdog线程回复一个响应(即踢狗)。那么,如果某个系统服务线程(例如系统服务线程B)没有在预设时间内向watchdog线程回复响应,则可确定系统服务线程B发生阻塞。
502、当目标系统服务线程超时时,终端获取该目标系统服务线程的标识。
当目标系统服务线程超时是因为该目标系统服务线程阻塞造成的时,目标系 统服务线程会向watchdog线程上报阻塞事件,该阻塞事件中可携带自身的标识,例如,该目标系统服务线程的ID号,从而使得终端获取到该目标系统服务线程的标识。或者,终端也可以通过调用getThreadId()函数获取上述目标系统服务线程的ID号。
当目标系统服务线程超时是因为目标对象锁超时造成的时,说明持有该目标对象锁的目标系统服务线程一直占用着系统资源(例如内存资源)没有释放,那么后续其他线程也无法得到该目标对象锁实现相关服务,此时,终端容易出现卡顿甚至冻屏现象。
因此,当目标对象锁超时时,终端可以通过调用Java本地接口(Java Native Interface,JNI)接口,查找持有上述目标对象锁的具体目标系统服务线程的标识。例如,终端的处理器可以调用JNI接口中的GetLockOwnerThreadId()函数,该函数的返回值即为持有该目标对象锁的目标系统服务线程的ID号(即目标系统服务线程的标识),例如,GetLockOwnerThreadId()函数的返回值为01,而01为window manager service(窗口管理服务)线程的ID号,即目标系统服务线程为window manager service线程。
当然,可以理解的是,目标系统服务线程的标识还可以是目标系统服务线程的名称等可以唯一标识终端内该线程的参数,本申请实施例对此不作任何限制。
503、终端根据上述目标系统服务线程的标识,查询与目标系统服务线程通信的应用进程。
由于目标系统服务线程超时的原因很可能是由于与该目标系统服务线程通信的应用进程出现阻塞或死循环等原因造成的。因此,在步骤503中,当确定发生超时的目标系统服务线程后,终端的处理器可进一步根据上述目标系统服务线程的标识,在存储器中查询与目标系统服务线程通信的具体应用进程。
以目标系统服务线程通过binder服务与应用进程通信为例。仍如图4所示,system server进程中的各个系统服务线程可预先向binder驱动进行注册,由binder驱动记录各个系统服务线程的ID号等注册信息。
例如,window manager service线程在向binder驱动注册时,可上报window manager service线程的ID号以及window manager service线程的功能,例如,用于创建一个Window(窗口)的创建功能。那么,后续应用程序层201内的APP 1进程需要使用该创建功能时,可向binder驱动发起与window manager service线程通信的进程间通信请求。binder驱动接收到该进程间通信请求后,可根据上述注册信息向window manager service线程请求其创建相应的Window,完成APP 1进程与window manager service线程之间的IPC通信过程。
也就是说,binder驱动可用于维护每一个进行IPC通信的系统服务线程与应用进程之间的对应关系。
示例性的,如表1所示,binder驱动每接收到一个第三方应用进程(或daemon进程)的进程间通信请求后,都可将该第三方应用进程(或daemon进程)以及与其通信的系统服务线程之间的对应关系记录在上述注册信息中。那么,在步骤503中,当确定了上述目标系统服务线程的标识后,终端可以从表1所示的注册信息 中查询到与上述目标系统服务线程(例如,window manager service线程)通信的应用进程为微信应用进程,微信应用进程的标识为11。
表1
系统服务线程的标识 第三方应用进程(或daemon进程)的标识
01(窗口管理服务线程) 11(微信应用进程)
02(电源管理服务线程) 10(浏览器应用进程)
另外,如果上述注册信息中没有记录上述目标系统服务线程,则说明该目标系统服务线程可能没有进行IPC通信,或者,该目标系统服务线程还可以是通过其他方式(例如socket服务)与第三方应用进程(或daemon进程)进行通信的。
例如,上述目标系统服务线程也可能是通过socket服务与应用进程通信的。在本申请实施例中,当一个系统服务线程基于socket服务与应用进程通信时,终端可主动记录该应用进程的标识。这样,当目标系统服务超时,例如,目标系统服务线程与应用进程建立socket连接超时时,终端可查询已记录的与该目标系统服务线程通信的应用进程的标识,从而确定引发目标系统服务超时的具体应用进程。
504、终端关闭上述应用进程,以解决目标系统服务线程超时引起的卡顿。
当终端确定了与目标系统服务线程通信的具体应用进程后,终端的处理器可关闭(kill)该应用进程,应用进程被关闭后,与其通信的目标系统服务线程将被释放,这样,目标系统服务线程占用的目标对象锁可以被释放,原本阻塞的目标系统服务线程也可继续提供相应的系统服务,从而降低系统服务超时引发的阻塞或冻屏的几率。
进一步地,在终端关闭上述应用进程后,处理器还可以重新启动该应用进程,例如,重启微信应用,使得用户可在重新启动的APP上继续操作。
这样,应用进程被关闭或重启后,与其通信的目标系统服务线程占用的目标对象锁可以被释放,目标系统服务线程的阻塞现象也将解决,并且,终端内其他系统服务的运行过程也不会受到影响。
当然,除了直接关闭或重启应用进程外,本领域技术人员也可以设置一定的恢复策略对上述应用进程进行恢复。例如,当多个系统服务线程超时时,终端可以按照其应用进程的优先级,将优先级较低的应用进程直接关闭,将优先级较高的应用进程进行重启。
另外,在关闭应用进程时,终端还可以记录此时应用进程的运行进度,这样,终端重启该应用进程后可以根据记录的运行进度,将应用进程恢复为重启之前的状态。例如,以微信应用进程为应用进程举例,终端在关闭微信应用进程时可将当前与用户A的聊天信息作为运行进度记录下来。这样,当终端重启微信应用进程时,可以根据记录的运行进度将微信应用进程恢复为重启前的状态,使得应用进程在重启前后可以实现无缝对接,提高用户的使用体验。
进一步地,终端对上述应用进程进行恢复时还可以通过UI界面向用户进行提示,请用户耐心等待,避免用户误以为终端此时发生卡死现象。例如,如图6中的(a)所示,终端重启上述应用进程时可告知用户正在重启该应用进程,如图6 中的(b)所示,终端关闭上述应用进程后可告知用户由于该应用进程引起了系统服务超时,因此已经关闭该应用进程,又或者,如图6中的(c)所示,当确定引起目标系统服务超时的应用进程后,终端还可以通过一个提示框向用户提示是否关闭该应用进程,如果用户确认关闭该应用进程,则终端关闭该应用进程。
又或者,在关闭应用进程时,终端还可以保存当前应用进程在UI界面上呈现的应用界面快照,例如,当应用进程为微信进程时,如图7所示,在关闭微信进程前可以将此时微信应用在UI界面上显示的应用界面71快照保存至本地。那么,当终端重启微信进程时,仍如图7所示,可以先显示已保存的在关闭微信进程时的应用界面快照71,同时在后台启动该微信进程,例如,展示其应用界面快照2秒,在显示该应用界面快照的同时重启微信进程,这样,从视觉上可以缩短微信进程重启的时间,提高用户体验。
又或者,在每次系统服务发生超时现象时,终端可以记录每次引发超时的具体系统服务和应用进程,当某一应用进程引发的超时频率较多时,说明运行该应用进程发生卡顿的风险较大,后续终端在执行该应用进程时可通过为该应用进程分配额外的系统资源、清理当前多余的进程等方式预防该应用进程引发超时现象。当然,终端也可以统计每次引发超时的具体运行场景,例如支付场景、通话场景等,以便终端预测出后续发生发生卡顿风险较大的场景,使得终端在该发生卡顿风险较大的场景下提前预防该应用进程引发超时现象。
可以理解的是,终端可以将每次引发超时记录的具体系统服务和应用进程作为历史数据上报给服务器,由服务器基于大数据统计为终端确定需要提前预防容易引发超时现象的应用进程或预测策略,本申请实施例对此不作任何限制。
其中,上述步骤501-504中终端的动作可以由上述图1中的处理器101运行存储器103中存储的指令或软件来指令所述终端完成上述系统服务超时的处理方法。
当任意系统服务线程与应用进程基于binder服务进程进程间通信时,终端会分配一个binder线程实现上述进程间通信的服务,当binder线程的数量过多时,会耗尽binder服务端的binder资源,导致需要进行进程间通信的其他进程无法申请到binder线程。对此,本申请实施例提供了一种系统服务超时的处理方法,如图8所示,包括:
801、当binder线程的总数达到预设值时,终端确定每一个binder线程服务的应用进程。
具体的,终端的处理器可以统计当前终端内提供binder服务的binder线程的总数,一般,操作系统能够支持的binder线程数量是一定的,例如,16个,那么,当统计出的binder线程总数为16个,即binder线程满时,可触发处理器进一步确定这16个binder线程中每一个binder线程服务的应用进程。
示例性的,binder驱动每接收到第三方应用进程(或daemon进程)发送的进程间通信请求后,都会从binder资源池中为该第三方应用进程(或daemon进程)分配一个或多个binder线程实现上述进程间通信服务。如表2所示,binder驱动在注册信息中除了记录每一对进行通信的系统服务线程和第三方应用进程(或 daemon进程)之间的对应关系之外,还可以记录为每一对系统服务线程和第三方应用进程提供IPC服务的binder线程的标识。那么,在步骤801中,终端可以在表2所示的注册信息中查询每一个binder线程服务的应用进程。
表2
Figure PCTCN2017104795-appb-000003
802、终端统计所有应用进程中每一个应用进程占用的binder线程的数量。
由于一个应用进程可以占用多个binder线程进行进程间通信,因此,处理器可根据每一个binder线程服务的应用进程,计算出一个应用进程占用的binder线程的数量。例如,在上述16个binder线程中,微信应用进程占用了8个binder线程,音乐应用进程占用了5个binder线程,浏览器应用进程占用了3个binder线程。
803、终端根据每一个应用进程占用的binder线程的数量,关闭至少一个应用进程。
示例性的,终端可以将占用binder线程数量最多的应用进程,例如上述微信应用进程关闭或重启,从而将微信应用进程占用的8个binder线程释放,被释放的binder线程可为其他等待进行进程间通信的进程(或线程)使用。
或者,终端还可以将占用binder线程数量大于预设值的应用进程关闭或重启,以释放当前被占满的binder线程。又或者,终端还可以根据应用进程的优先级,释放优先级较低的应用进程,从而释放该优先级较低的应用进程占用的binder线程,而优先级较高的应用进程可被保留,避免优先级较高的应用进程被关闭(或重启)后影响终端的运行状态和用户体验。
当然,用户也可以手动设置binder线程被占满时待关闭的应用进程的白名单或黑名单。这样,当binder线程被占满时,位于白名单中的应用进程可以保留,而位于黑名单中的应用进程可以被关闭或重启。
可以理解的是,本领域技术人员可以根据实际经验或实际应用场景设置当binder线程被占满时的应用进程恢复策略,本申请实施例对此不作任何限制。
另外,上述步骤801-803中终端的动作可以由上述图1中的处理器101运行存储器103中存储的指令或软件来指令所述终端完成上述系统服务超时的处理方法。
进一步地,为了预防出现上述binder线程被占满而导致终端卡顿的现象,本申请实施例还提供一种系统服务超时的处理方法,如图9所示,包括:
901、终端统计目标应用进程占用的binder线程数目。
其中,上述目标应用进程可以是终端APP层安装的任意应用的进程,本申请实施例对此不作任何限制。
一个进程中通常包括多个线程,因此,在执行目标应用进程时可能需要与其 他进程(例如系统服务进程)进行通信,此时,目标应用进程中可通过binder驱动创建binder线程的方式实现进程间通信,那么,在步骤701中,终端可通过处理器定期的统计当前目标应用进程所占用的binder线程数目。
例如,终端可以在IPC线程状态(IPC Thread State)中的transact()函数入口处对目标应用进程创建的binder线程进行统计,得到目标应用进程占用的binder线程数目。
902、当目标应用进程占用的binder线程数目大于或等于第一阈值时,终端开始统计这些binder线程调用的具体API。
其中,上述API是指一个或多个预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件得以访问一组例程的能力,这样,应用程序无需访问源代码,开发人员也无需理解终端内部的工作机制的细节便可以实现相应的功能。具体的,上述API可以是Linux或Windows系统中的任意API,例如,用于打开某个文件的API:open{},用于写入的API:write{},以及用于访问消息队列的API:msgget{}等,本申请实施例对此不作任何限制。
示例性的,上述第一阈值可以为8。也就是说,当目标应用进程中占用的binder线程数目达到8时,存在binder线程资源被耗尽的潜在风险,那么,为了避免binder线程资源被耗尽,终端的处理器可以通过统计这些binder线程调用的具体API进一步确定当前目标应用占用的这些binder线程是否存在被恶意占用的情况。
例如,可以对每一个handler对象设置一个计数器,终端通过调用handler对象的方式调用API,那么,当目标应用进程中占用的binder线程数目大于或等于8时,终端可触发每一个handler对象的计数器开始计数,每当binder线程调用一个handler对象时,该handler对象的计数器加一,这样可以统计出每一个API对象被调用的次数。
又或者,终端还可以在存储器中记录每一个binder线程与其调用的API之间的对应关系,那么,如表3所示,终端可根据该对应关系统计出上述目标应用进程占用的每一个binder线程具体调用了哪些API。
表3
binder线程的标识 API的标识
a API 1
b API 1
c API 2
需要说明的是,上述目标应用进程占用的binder线程数目可以是同一时刻占用的binder线程数目,也可以是预设时间段(例如3秒内)占用的binder线程数目,本申请实施例对此不作任何限制。
903、当某一个API(即目标API)被调用的次数大于第二阈值时,终端停止为目标应用进程创建新的binder线程。
例如,上述第二阈值可以为16。也就是说,当调用同一个API(即目标API)的binder线程数目大于16时,说明该目标API的压力较大,可能存在binder线程恶意调用目标API的风险,此时binder线程资源被占用的程度较高,且binder线 程频繁调用单一的API,因此,为了避免出现binder线程被占满导致的阻塞和卡顿,当上述目标应用进程请求binder驱动创建新的binder线程时,binder驱动可停止响应目标应用进程的这一请求,并将待创建的binder线程设置为等待状态,等待binder线程资源更为充足时再为目标应用创建新的binder线程。
可选的,当终端将待创建的binder线程设置为等待状态时,终端还可以插入日志(log),以记录此时新创建的binder线程的执行状态,方便后续开发人员根据记录的log定位目标应用进程出现卡顿的原因。
类似的,上述目标API被调用的次数可以是同一时刻目标API被调用的次数,也可以是预设时间段(例如3秒内)目标API被调用的次数,本申请实施例对此不作任何限制。
904、当目标应用进程占用的binder线程数目小于上述第一阈值时,终端为目标应用创建新的binder线程。
当某个被占用的binder线程释放后,上述目标应用进程占用的binder线程数目将会减少,当减小至上述第一阈值以下时,则说明此时有多余的binder线程可被目标应用使用,那么,终端可将上述设置为等待状态的待创建binder线程的状态设置为创建状态,从而唤醒步骤703中等待创建的binder线程,并开始创建该binder线程。
另外,当目标应用进程占用的binder线程在预设时间内一直没有释放时,待创建的binder线程一直为等待状态无法创建,那么,目标应用进程可基于ANR(Application Not Responding,应用无响应)机制提示用户是否让目标应用进程继续运行,或者,强制关闭该目标应用进程。
在另一种可能的实现方式中,当步骤701中统计的目标应用进程占用的binder线程数目大于或等于第一阈值时,例如,目标应用进程占用的binder线程数目大于8时,由于此时binder线程被占用的较多,即binder线程资源被耗尽的潜在风险,因此,可直接触发终端执行步骤703,即停止运行目标应用进程中新创建的binder线程,将待创建的binder线程设置为等待状态,等待binder线程资源更为充足(例如,目标应用进程占用的binder线程数目小于上述第一阈值)时再创建新的binder线程,本申请实施例对此不作任何限制。
其中,上述步骤901-904中终端的动作可以由上述图1中的处理器101运行存储器103中存储的指令或软件来指令所述终端完成上述系统服务超时的处理方法。
可以理解的是,上述终端等为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
本申请实施例可以根据上述方法示例对上述终端等进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成 在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图10示出了上述实施例中所涉及的终端的一种可能的结构示意图,该终端包括:超时检测单元1001、确定单元1002、超时处理单元1003、以及显示单元1004。
超时检测单元1001用于支持终端执行图5中的过程501;确定单元1002用于支持终端执行图5中的过程502-503,图8中的过程801-802,以及图9中的过程901-902;超时处理单元1003用于支持终端执行图5中的过程504,图8中的过程803,以及图9中的过程903-904;显示单元1004用于显示目标系统服务线程发生超时的原因,或者,显示关闭该目标应用进程的提示。其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
在采用集成的单元的情况下,可将上述超时检测单元1001、确定单元1002、以及超时处理单元1003集成为处理模块,将显示单元1004作为显示模块。
此时,如图11所示,示出了上述实施例中所涉及的终端的一种可能的结构示意图。其中,处理模块1101用于对终端的动作进行控制管理。显示模块1102用于显示由用户输入的信息或提供给用户的信息以及终端的各种菜单。另外,终端还可以包括用于存储指令或数据的存储模块1103以及用于与其他终端设备通信的通信模块1104等。
示例性的,处理模块1101可以是处理器或控制器,例如可以是中央处理器(Central Processing Unit,CPU),GPU,通用处理器,数字信号处理器(Digital Signal Processor,DSP),专用集成电路(Application-Specific Integrated Circuit,ASIC),现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等等。
显示模块1102可以为显示器,具体可以采用液晶显示器、有机发光二极管等形式来配置显示器。另外,显示器上还可以集成触控板,用于采集在其上或附近的触摸事件,并将采集到的触摸信息发送给其他器件(例如处理器等)。
存储模块1103可以是存储器,该存储器可以包括高速随机存取存储器(RAM),还可以包括非易失存储器,例如磁盘存储器件、闪存器件或其他易失性固态存储器件等。
通信模块1104可以是收发器、收发电路、输入输出设备或通信接口等。例如,通信模块1303具体可以是蓝牙装置、Wi-Fi装置、外设接口等等。
当处理模块1101为处理器,通信模块1104为射频电路,存储模块1103为存储器,显示模块1102为显示器时,本申请实施例所提供的终端可以为图1所示的手机100。
在上述实施例中,可以全部或部分的通过软件,硬件,固件或者其任意组合 来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式出现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘,硬盘、磁带)、光介质(例如,DVD)或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (25)

  1. 一种系统服务超时的处理方法,其特征在于,所述方法应用于终端,所述终端运行有系统服务进程和至少一个应用进程,所述系统服务进程包括至少一个系统服务线程,所述方法包括:
    当所述至少一个系统服务线程中的目标系统服务线程超时时,所述终端确定与所述目标系统服务线程通信的第一应用进程,所述目标系统服务线程超时包括:所述目标系统服务线程占用的对象锁在预设时间内没有被释放,以及所述目标系统服务线程发生阻塞中的至少一个;
    所述终端关闭所述第一应用进程。
  2. 根据权利要求1所述的方法,其特征在于,所述终端确定与所述目标系统服务线程通信的第一应用进程,包括:
    所述终端在已存储的注册信息中查询与所述目标系统服务线程通信的第一应用进程,所述注册信息记录有进行进程间通信IPC的系统服务线程与应用进程之间的对应关系。
  3. 根据权利要求1或2所述的方法,其特征在于,在所述终端关闭所述第一应用进程之后,包括:
    所述终端重新启动所述第一应用进程。
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:
    所述终端监测当前运行的绑定binder线程总数N,N为大于或等于0的整数;
    当所述binder线程总数大于第一预设值时,所述终端确定N个binder线程中每一个binder线程服务的应用进程;
    所述终端统计所有应用进程中每一个应用进程占用的binder线程数量;
    当第一目标应用进程占用的binder线程数量大于第二预设值时,所述终端关闭所述第一目标应用进程。
  5. 根据权利要求4所述的方法,其特征在于,当第二目标应用进程占用的binder线程数量大于所述第二预设值时,所述第二目标应用进程的优先级高于所述第一目标应用进程的优先级,所述方法还包括:
    所述终端关闭所述第二目标应用进程;
    所述终端重新启动所述第二目标应用进程。
  6. 根据权利要求5所述的方法,其特征在于,在所述终端关闭所述第二目标应用进程时,还包括:
    所述终端记录所述第二目标应用进程的运行进度;
    其中,所述终端重新启动所述第二目标应用进程,包括:
    所述终端按照所述运行进度,将所述第二目标应用进程恢复至与所述运行进度相同的运行状态。
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,所述方法还包括:
    所述终端统计为目标应用提供IPC服务的binder线程数量M,M为大于或等于0的整数;
    当所述binder线程数量M大于或等于第一阈值时,所述终端停止为所述目标应用 创建新的binder线程。
  8. 根据权利要求7所述的方法,其特征在于,当所述binder线程数量大于第一阈值时,所述终端停止为所述目标应用创建新的binder线程,包括:
    所述终端统计M个binder线程中每一个binder线程调用的应用程序编程接口API;
    当一个API被调用的次数大于第二阈值时,所述终端停止响应所述目标应用创建新的binder线程的请求。
  9. 根据权利要求7或8所述的方法,其特征在于,在所述终端停止为所述目标应用创建新的binder线程之后,还包括:
    当为所述目标应用提供IPC服务的binder线程数量M小于所述第一阈值时,所述终端为所述目标应用创建新的binder线程。
  10. 根据权利要求1-9中任一项所述的方法,其特征在于,所述方法还包括:
    所述终端显示所述目标系统服务线程超时的原因,或者,显示关闭所述第一应用进程的提示。
  11. 根据权利要求1-10中任一项所述的方法,其特征在于,所述目标系统服务线程发生阻塞包括:
    所述目标系统服务线程与所述第一应用进程通信时的持续时间大于第一预设值,以及所述目标系统服务线程在执行过程中暂停的时长大于第二预设值中的至少一个。
  12. 一种终端,所述终端运行有系统服务进程和至少一个应用进程,所述系统服务进程包括至少一个系统服务线程,所述终端包括:
    超时检测单元,用于:检测所述至少一个系统服务线程中的目标系统服务线程是否超时,所述目标系统服务线程超时包括:所述目标系统服务线程占用的对象锁在预设时间内没有被释放,以及所述目标系统服务线程发生阻塞中的至少一个;
    确定单元,用于:当所述目标系统服务线程超时时,确定与所述目标系统服务线程通信的第一应用进程;
    超时处理单元,用于:关闭所述第一应用进程。
  13. 根据权利要求12所述的终端,其特征在于,
    所述确定单元,具体用于:在已存储的注册信息中查询与所述目标系统服务线程通信的第一应用进程,所述注册信息记录有进行进程间通信IPC的系统服务线程与应用进程之间的对应关系。
  14. 根据权利要求12或13所述的终端,其特征在于,
    所述超时处理单元,还用于:重新启动所述第一应用进程。
  15. 根据权利要求12-14中任一项所述的终端,其特征在于,
    所述超时检测单元,还用于:监测当前运行的绑定binder线程总数N,N为大于或等于0的整数;
    所述确定单元,还用于:当所述binder线程总数大于第一预设值时,确定N个binder线程中每一个binder线程服务的应用进程;统计所有应用进程中每一个应用进程占用的binder线程数量;
    所述超时处理单元,还用于:当第一目标应用进程占用的binder线程数量大于第二预设值时,关闭所述第一目标应用进程。
  16. 根据权利要求15所述的终端,其特征在于,当第二目标应用进程占用的binder线程数量大于所述第二预设值时,所述第二目标应用进程的优先级高于所述第一目标应用进程的优先级,
    所述超时处理单元,还用于:关闭所述第二目标应用进程;重新启动所述第二目标应用进程。
  17. 根据权利要求16所述的终端,其特征在于,
    所述超时处理单元,具体用于:记录所述第二目标应用进程的运行进度;按照所述运行进度,将所述第二目标应用进程恢复至与所述运行进度相同的运行状态。
  18. 根据权利要求12-17中任一项所述的终端,其特征在于,
    所述确定单元,还用于:统计为目标应用提供IPC服务的binder线程数量M,M为大于或等于0的整数;
    所述超时处理单元,还用于:当所述binder线程数量M大于或等于第一阈值时,停止为所述目标应用创建新的binder线程。
  19. 根据权利要求18所述的终端,其特征在于,
    所述超时处理单元,具体用于:统计M个binder线程中每一个binder线程调用的应用程序编程接口API;当一个API被调用的次数大于第二阈值时,停止响应所述目标应用创建新的binder线程的请求。
  20. 根据权利要求19所述的终端,其特征在于,
    所述超时处理单元,还用于:当为所述目标应用提供IPC服务的binder线程数量M小于所述第一阈值时,为所述目标应用创建新的binder线程。
  21. 根据权利要求12-20中任一项所述的终端,其特征在于,所述终端还包括:
    显示单元,用于:显示所述目标系统服务线程超时的原因,或者,显示关闭所述第一应用进程的提示。
  22. 根据权利要求12-20中任一项所述的终端,其特征在于,所述目标系统服务线程发生阻塞包括:所述目标系统服务线程与所述第一应用进程通信时的持续时间大于第一预设值,以及所述目标系统服务线程在执行过程中暂停的时长大于第二预设值中的至少一个。
  23. 一种终端,其特征在于,包括:处理器、存储器、总线和通信接口;
    所述存储器用于存储计算机执行指令,所述处理器与所述存储器通过所述总线连接,当所述终端运行时,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述终端执行如权利要求1-11中任一项所述的系统服务超时的处理方法。
  24. 一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,其特征在于,当所述指令在终端上运行时,使得所述终端执行如权利要求1-11中任一项所述的系统服务超时的处理方法。
  25. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在终端上运行时,使得所述终端执行如权利要求1-11中任一项所述的系统服务超时的处理方法。
PCT/CN2017/104795 2017-09-30 2017-09-30 一种系统服务超时的处理方法及装置 WO2019061407A1 (zh)

Priority Applications (8)

Application Number Priority Date Filing Date Title
JP2020517810A JP7006780B2 (ja) 2017-09-30 2017-09-30 システムサービスタイムアウト処理方法および装置
KR1020217032666A KR102460380B1 (ko) 2017-09-30 2017-09-30 시스템 서비스의 타임아웃을 처리하는 방법 및 디바이스
CN201780067385.5A CN109891392B (zh) 2017-09-30 2017-09-30 一种系统服务超时的处理方法及装置
EP17926719.0A EP3678023B1 (en) 2017-09-30 2017-09-30 Method and device for handling timeout of system service
KR1020207011642A KR102313664B1 (ko) 2017-09-30 2017-09-30 시스템 서비스의 타임아웃을 처리하는 방법 및 디바이스
AU2017434691A AU2017434691B2 (en) 2017-09-30 2017-09-30 Method and device for handling timeout of system service
PCT/CN2017/104795 WO2019061407A1 (zh) 2017-09-30 2017-09-30 一种系统服务超时的处理方法及装置
US16/651,909 US11693701B2 (en) 2017-09-30 2017-09-30 System service timeout processing method, and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/104795 WO2019061407A1 (zh) 2017-09-30 2017-09-30 一种系统服务超时的处理方法及装置

Publications (1)

Publication Number Publication Date
WO2019061407A1 true WO2019061407A1 (zh) 2019-04-04

Family

ID=65900429

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/104795 WO2019061407A1 (zh) 2017-09-30 2017-09-30 一种系统服务超时的处理方法及装置

Country Status (7)

Country Link
US (1) US11693701B2 (zh)
EP (1) EP3678023B1 (zh)
JP (1) JP7006780B2 (zh)
KR (2) KR102460380B1 (zh)
CN (1) CN109891392B (zh)
AU (1) AU2017434691B2 (zh)
WO (1) WO2019061407A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667388A (zh) * 2021-03-16 2021-04-16 荣耀终端有限公司 一种操作系统的保护方法及电子设备
CN113190342A (zh) * 2021-06-01 2021-07-30 湖南工学院 用于云-边协同网络的多应用细粒度卸载的方法与系统架构
CN113835985A (zh) * 2021-09-27 2021-12-24 北京基调网络股份有限公司 一种监测卡顿、分析卡顿原因的方法、装置及设备
CN115277606A (zh) * 2022-08-01 2022-11-01 成都安恒信息技术有限公司 一种优化drbd数据同步的方法

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486713B (zh) * 2019-09-11 2023-07-18 华为技术有限公司 一种冻屏处理方法及电子设备
CN111045926B (zh) * 2019-11-05 2023-04-14 北京字节跳动网络技术有限公司 一种应用程序卡顿的检测方法、装置、介质和电子设备
CN111158869A (zh) * 2019-11-15 2020-05-15 西安海的电子科技有限公司 一种基于安卓系统的进程碎片清理方法
CN112000385A (zh) * 2020-09-03 2020-11-27 深圳市智微智能软件开发有限公司 一种用于Android设备的快速重启方法及系统
CN115017004B (zh) * 2021-12-27 2023-07-07 荣耀终端有限公司 进程监控方法及电子设备
CN114153621B (zh) * 2022-02-09 2022-06-07 荣耀终端有限公司 系统进程调控方法、装置、电子设备及可读存储介质
CN115202902B (zh) * 2022-07-01 2023-08-22 荣耀终端有限公司 控制进程交互的方法及相关装置
CN116662024B (zh) * 2022-12-30 2023-11-07 荣耀终端有限公司 进程间通信监控方法、装置、电子设备及存储介质
CN117692832A (zh) * 2023-05-29 2024-03-12 荣耀终端有限公司 超声波通路与耳机通路的冲突解决方法及相关装置
CN116431377B (zh) * 2023-06-13 2023-08-22 苏州至盛半导体科技有限公司 一种看门狗电路

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539878A (zh) * 2008-03-18 2009-09-23 环达电脑(上海)有限公司 在操作系统下加快oracle进程监控回收资源的方法
CN102253863A (zh) * 2011-06-15 2011-11-23 奇智软件(北京)有限公司 一种进程关闭方法
CN102984580A (zh) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 内存清理方法及系统
CN103077052A (zh) * 2012-12-28 2013-05-01 华为终端有限公司 一种处理移动终端运行卡顿问题的方法及装置
CN103425225A (zh) * 2012-05-16 2013-12-04 腾讯科技(深圳)有限公司 便携数据设备操作系统中的应用程序装置及其运行方法
US20140137183A1 (en) * 2012-11-13 2014-05-15 Auckland Uniservices Ltd. Security system and method for the android operating system
CN106681822A (zh) * 2017-01-19 2017-05-17 努比亚技术有限公司 一种基于信号的进程冻结和解冻装置及方法
CN106951318A (zh) * 2017-03-24 2017-07-14 联想(北京)有限公司 一种电子设备后台进程的管理方法及电子设备

Family Cites Families (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001050263A1 (en) * 1999-12-30 2001-07-12 Computer Associates Think, Inc. System and method for device failure recognition
JP3916070B2 (ja) * 2003-01-08 2007-05-16 ソニー株式会社 情報処理装置および方法、並びにプログラム
KR100495367B1 (ko) * 2003-04-02 2005-06-14 엘지전자 주식회사 소프트웨어 워치도그를 이용한 시스템 관리방법
US7694312B2 (en) 2004-09-10 2010-04-06 Pleora Technologies Inc. Methods and apparatus for enabling bus connectivity over a data network
GB0519981D0 (en) * 2005-09-30 2005-11-09 Ignios Ltd Scheduling in a multicore architecture
KR100691120B1 (ko) * 2006-01-16 2007-03-12 엘지전자 주식회사 메모리 에러 관리를 위한 미들웨어 및 메모리 에러 관리방법
JP4462238B2 (ja) * 2006-06-21 2010-05-12 株式会社デンソーウェーブ 携帯端末
JP2010152838A (ja) * 2008-12-26 2010-07-08 Ricoh Co Ltd 画像形成装置、制御方法、およびプログラム
CN101561764B (zh) 2009-05-18 2012-05-23 华为技术有限公司 一种多核环境下的补丁方法与补丁装置
JP5379719B2 (ja) * 2010-02-25 2013-12-25 株式会社日立製作所 コンピュータ、コンピュータの障害検知方法、及びプログラム
WO2012066622A1 (ja) * 2010-11-15 2012-05-24 富士通株式会社 アクセス方法、およびマルチコアプロセッサシステム
CN101996106B (zh) 2010-12-17 2012-12-05 南京中兴力维软件有限公司 一种对软件运行状态进行监控的方法
JP5648187B2 (ja) * 2011-11-25 2015-01-07 株式会社日立製作所 計算機システム、および、監視方法
US10051019B1 (en) * 2012-11-09 2018-08-14 Wells Fargo Bank, N.A. System and method for session management
CN103942113B (zh) 2013-11-21 2017-03-01 小米科技有限责任公司 系统重启原因的检测方法、装置及终端设备
US9274894B1 (en) * 2013-12-09 2016-03-01 Twitter, Inc. System and method for providing a watchdog timer to enable collection of crash data
GB2532424B (en) * 2014-11-18 2016-10-26 Ibm An almost fair busy lock
CN105677501B (zh) 2016-01-07 2019-01-29 烽火通信科技股份有限公司 Linux系统中基于看门狗的精细化进程监控方法及系统
US10037238B2 (en) * 2016-02-10 2018-07-31 Dell Products, L.P. System and method for encoding exception conditions included at a remediation database
CN105824622B (zh) * 2016-03-11 2020-04-24 联想(北京)有限公司 数据处理方法及电子设备
CN106445712A (zh) * 2016-08-31 2017-02-22 上海澳润信息科技有限公司 一种基于消息监控的软件看门狗实现方法
CN106406947B (zh) * 2016-09-13 2019-09-17 Oppo广东移动通信有限公司 防止系统服务进程重启的方法及装置、移动终端
CN106445721B (zh) * 2016-10-11 2019-07-12 Oppo广东移动通信有限公司 看门狗容错处理的方法及移动终端

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539878A (zh) * 2008-03-18 2009-09-23 环达电脑(上海)有限公司 在操作系统下加快oracle进程监控回收资源的方法
CN102253863A (zh) * 2011-06-15 2011-11-23 奇智软件(北京)有限公司 一种进程关闭方法
CN103425225A (zh) * 2012-05-16 2013-12-04 腾讯科技(深圳)有限公司 便携数据设备操作系统中的应用程序装置及其运行方法
CN102984580A (zh) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 内存清理方法及系统
US20140137183A1 (en) * 2012-11-13 2014-05-15 Auckland Uniservices Ltd. Security system and method for the android operating system
CN103077052A (zh) * 2012-12-28 2013-05-01 华为终端有限公司 一种处理移动终端运行卡顿问题的方法及装置
CN106681822A (zh) * 2017-01-19 2017-05-17 努比亚技术有限公司 一种基于信号的进程冻结和解冻装置及方法
CN106951318A (zh) * 2017-03-24 2017-07-14 联想(北京)有限公司 一种电子设备后台进程的管理方法及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3678023A4 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667388A (zh) * 2021-03-16 2021-04-16 荣耀终端有限公司 一种操作系统的保护方法及电子设备
CN112667388B (zh) * 2021-03-16 2021-06-01 荣耀终端有限公司 一种操作系统的保护方法及电子设备
CN113190342A (zh) * 2021-06-01 2021-07-30 湖南工学院 用于云-边协同网络的多应用细粒度卸载的方法与系统架构
CN113835985A (zh) * 2021-09-27 2021-12-24 北京基调网络股份有限公司 一种监测卡顿、分析卡顿原因的方法、装置及设备
CN113835985B (zh) * 2021-09-27 2023-09-29 北京基调网络股份有限公司 一种监测卡顿、分析卡顿原因的方法、装置及设备
CN115277606A (zh) * 2022-08-01 2022-11-01 成都安恒信息技术有限公司 一种优化drbd数据同步的方法
CN115277606B (zh) * 2022-08-01 2023-11-24 成都安恒信息技术有限公司 一种优化drbd数据同步的方法

Also Published As

Publication number Publication date
CN109891392A (zh) 2019-06-14
JP7006780B2 (ja) 2022-01-24
KR20200058479A (ko) 2020-05-27
KR102460380B1 (ko) 2022-10-27
EP3678023A1 (en) 2020-07-08
AU2017434691B2 (en) 2021-05-06
EP3678023B1 (en) 2022-07-13
AU2017434691A1 (en) 2020-04-23
KR102313664B1 (ko) 2021-10-15
CN109891392B (zh) 2022-01-11
KR20210126159A (ko) 2021-10-19
US11693701B2 (en) 2023-07-04
US20200264933A1 (en) 2020-08-20
JP2020536306A (ja) 2020-12-10
EP3678023A4 (en) 2020-08-26

Similar Documents

Publication Publication Date Title
CN109891392B (zh) 一种系统服务超时的处理方法及装置
US11099900B2 (en) Memory reclamation method and apparatus
EP3617889B1 (en) Stutter detection method and device
CN108702421B (zh) 用于控制应用和组件的电子设备和方法
EP4145286A1 (en) Memory management method and electronic device
CN107861817B (zh) 基于线程阻塞的内存优化方法、移动终端及可读存储介质
KR102137097B1 (ko) 소모 전류 저감 방법 및 이를 지원하는 전자 장치
US11287944B2 (en) Application window display method and terminal
CN107590057B (zh) 冻屏监测与解决方法、移动终端及计算机可读存储介质
WO2019028912A1 (zh) 一种应用切换方法及装置
WO2019071615A1 (zh) 一种降低终端功耗的方法及终端
EP4187419A1 (en) Security architecture system, security management method, and computing device
CN107967177B (zh) 基于核心进程的内存优化方法、移动终端及可读存储介质
WO2019071619A9 (zh) 应用管理方法及终端
WO2019128573A1 (zh) 信息处理方法、装置、计算机设备和计算机可读存储介质
WO2019024646A1 (zh) 应用管控方法、装置及电子设备
CN107818036B (zh) 黑屏检测方法、移动终端及计算机可读存储介质
WO2019128553A1 (zh) 应用程序处理方法、电子设备、计算机可读存储介质
CN107908493B (zh) 冻屏监测与解决方法、移动终端及计算机可读存储介质
US20200257558A1 (en) Processing Method and Apparatus
CN107766210B (zh) 黑屏检测方法、移动终端及计算机可读存储介质
WO2019128538A1 (zh) 信息处理方法、移动终端及计算机可读存储介质
CN113760540B (zh) 一种任务处理方法和相关装置
CN114201354A (zh) 一种应用程序的超时检测方法及终端设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17926719

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020517810

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017926719

Country of ref document: EP

Effective date: 20200331

ENP Entry into the national phase

Ref document number: 20207011642

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2017434691

Country of ref document: AU

Date of ref document: 20170930

Kind code of ref document: A