WO2021121161A1 - 进程管理方法和装置、电子设备 - Google Patents

进程管理方法和装置、电子设备 Download PDF

Info

Publication number
WO2021121161A1
WO2021121161A1 PCT/CN2020/135760 CN2020135760W WO2021121161A1 WO 2021121161 A1 WO2021121161 A1 WO 2021121161A1 CN 2020135760 W CN2020135760 W CN 2020135760W WO 2021121161 A1 WO2021121161 A1 WO 2021121161A1
Authority
WO
WIPO (PCT)
Prior art keywords
called
call
application
binder
state
Prior art date
Application number
PCT/CN2020/135760
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 EP20901585.8A priority Critical patent/EP4057140A4/en
Publication of WO2021121161A1 publication Critical patent/WO2021121161A1/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/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/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of computer technology, in particular to a process management method and device, and electronic equipment.
  • IPC Inter-Process Communication
  • IPC Inter-Process Communication
  • the purpose of this application is to solve the problem that a process in a suspended state in the prior art is directly awakened when it is called, and there is a problem that the process is frequently awakened, which causes the consumption of memory and power consumption resources.
  • the present application provides a process management method, which can effectively reduce the process of being awakened in a suspended state, so as to reduce the problem of the consumption of memory and power consumption resources.
  • the embodiments of the present application disclose a process management method, including: when a Binder inter-process call is made, determining whether the called process in the Binder inter-process call is in a suspended state If the called process is in a suspended state, according to the preset wake-up strategy based on the communication type of the Binder inter-process call to determine whether to wake up the called process for the process call; if the called process is in For processes that are not in a suspended state, the process call is executed.
  • the preset wake-up strategy based on the communication type of the Binder inter-process call can be used to determine whether the called process needs to be awakened.
  • the calling process that is, for the communication types called between different Binder processes, the called process is awakened for the process call when it needs to be awakened.
  • the called process When it is not necessary to wake up, the called process does not need to be awakened, which can be effective Reduce the process to be awakened effectively, that is, it can effectively reduce the call process based on the Binder inter-process call to wake up the called process to avoid the process being frequently awakened, causing the problem of memory and power consumption resources, that is, it can effectively reduce the memory usage and power consumption. Consumption of resources.
  • determining whether to wake up the called process for the process call according to a preset wake-up strategy based on the communication type of the Binder process call including: determining the communication type of the Binder process call ; The communication type includes Binder synchronous call and Binder asynchronous call; if the communication type of Binder inter-process call is Binder synchronous call, then according to the preset Binder inter-process call priority type to determine whether to wake up the called process for process call; if Binder The communication type of the inter-process call is Binder asynchronous call, then the Binder inter-process call is cached, and based on whether the accumulation degree of the called process reaches the preset accumulation degree standard or whether the state of the called process has changed to determine whether Wake up the called process for process call.
  • Binder inter-process call for the two communication types of Binder synchronous call and Binder asynchronous call, different management methods about process wake-up are carried out, so that the communication type of different Binder process calls can be processed in a targeted manner. Wake-up management, and can meet the calling requirements of the called process under different communication types.
  • the priority type includes usability priority, and if the priority type of the Binder inter-process call is usability priority, the called process is awakened for process invocation.
  • Ease of use prioritizes the convenience of the process. If the priority type of Binder inter-process call is ease of use, the called process will be awakened for process invocation, thereby ensuring the use of the called process. demand.
  • the priority type of Binder inter-process calling that meets any of the following conditions is ease-of-use priority: the called process or the application corresponding to the calling process that calls the called process is through the user interface Is selected as an application that allows background activities; the application corresponding to the called process or the calling process that calls the called process is an application that is selected to ignore the impact of power consumption through the user interface; the called process or the calling process that calls the called process corresponds to The application is an application that is selected to ignore memory effects through the user interface.
  • the priority type includes power consumption priority, and if the priority type of the Binder inter-process call is power consumption priority, it is determined whether the calling process that calls the called process is a core process. If the process is a core process, the called process is awakened; if the calling process is a non-core process, the called process is not awakened.
  • Power consumption priority is to give priority to the process taking as little power consumption as possible, and when judging that the priority type of the Binder process call is power consumption priority, out of consideration of the normal use of related functions based on the Binder process call, you can pass Determine whether the calling process is a core process, and thereby determine whether to wake up the called process. If the calling process is a core process, in order to ensure the normal use of related functions of the Binder process, wake up the called process for process call. If the calling process is a non-core process, even if the called process is not awakened, the user's use will not be affected. Therefore, the called process may not be awakened.
  • the calling process that meets any of the following conditions is the core process: the application corresponding to the calling process is an application configured through the application whitelist; the calling process is the foreground process, and the user is in the foreground Use; the ADJ value of the calling process in the operating system is less than the ADJ value of the foreground process; the calling process in the operating system is a process that is not in the background process scheduling group; the UID of the application corresponding to the calling process is less than the preset UID; the calling process is the operating system The process of the middle and foreground services; the calling process is the process that is currently performing background-perceptible services.
  • the called process is not awakened, and further includes: marking the state of the calling process as a suspended state, and/or setting the calling process The status of the corresponding application is identified as the suspended status.
  • the calling process is a non-core process, even if the Binder inter-process call is not executed, the user's current use will not be affected.
  • the calling process can also be marked as hanging. Start state, and/or mark the state of the application corresponding to the calling process as the suspended state, so as to further reduce the consumption of memory and power consumption resources.
  • caching the inter-process Binder call includes: caching the call relationship for the called process to an asynchronous call buffer.
  • the accumulation degree of the cached cache for the called process reaches the preset accumulation degree standard, or the state of the called process changes from the suspended state to the active state, wake up The called process.
  • the accumulation degree of the cache for the called process reaches a preset accumulation degree standard, including: the total storage amount of the asynchronous call buffer for the called process exceeds the preset Or the available storage space of the asynchronous call buffer for the called process is less than the preset storage space threshold; or the number of cache calls for the called process reaches the preset threshold for the number of cache calls; or the number of cache calls for the called process
  • the cache call time reaches the preset cache call time threshold.
  • the call to the called process can be temporarily cached, and when a certain wake-up condition is reached, the called process is awakened. Further, when the called process is awakened, the cached Binder inter-process call can be executed.
  • the called process after the called process is awakened, it further includes: converting the state of the called process from the suspended state to the active state, and changing the state of the application corresponding to the called process from the suspended state to the active state.
  • the starting state changes to the active state.
  • the state of the called process is changed from the suspended state to the active state, and the state of the application corresponding to the called process is changed from the suspended state to the active state, that is, the process and the application corresponding to the process In an active state to facilitate the normal use of processes and applications.
  • determining whether the called process is a suspended process includes: determining whether the process identification information of the called process is in a preset management process list; the management process list includes The process identification information of the process corresponding to the application in the suspended state; if the process identification information of the called process is in the management process list, the called process is the process in the suspended state; if the process identification information of the called process is not In the management process list, the called process is a non-suspended process.
  • the process identification information includes a process ID and/or a UID of an application corresponding to the process.
  • applications in a suspended state include: applications that have no perceivable services within a preset time after entering the background.
  • the state of the application can be converted to the suspended state, and the state of the corresponding process of the application Switch to the suspended state, which can avoid the consumption of memory and power consumption resources.
  • it further includes: removing the process identification information of the process from the management process list after the state of the process in the suspended state is converted to the active state; or the process in the suspended state After the state of the application is converted to the active state, the process identification information of the process corresponding to the application is removed from the management process list.
  • the process identification information of the process is removed from the management process list so that it can be directly executed when the process is called Process call.
  • the embodiments of the present application provide a process management device, including: a Binder inter-process call management module, the Binder inter-process call management module determines the called process in the Binder inter-process call when the Binder inter-process call is made Whether it is a process that enters the background and is in a suspended state; and when it is determined that the called process is a suspended process, according to the preset wake-up strategy based on the communication type of the Binder process call, determine whether to wake up the called process for use Process call; when it is determined that the called process is in a non-suspended state, the process call is executed.
  • a Binder inter-process call management module determines the called process in the Binder inter-process call when the Binder inter-process call is made Whether it is a process that enters the background and is in a suspended state; and when it is determined that the called process is a suspended process, according to the preset wake-up strategy based on the communication type of the Binder process call, determine whether to wake up the called
  • it further includes: an application module and an application management module; the application management module is used to determine whether an application entering the background in the application module has no perceptible service within a preset time, if not, The status of the application is identified as the suspended state; if so, the status of the application is identified as the active state; for the application identified as the suspended state, the application management module is also used to identify the state of the corresponding process of the application as suspended State, and notify the Binder inter-process call management module to add the process identification information of the process in the suspended state to the preset management process list in the Binder inter-process call management module.
  • the application management module is further used to notify the Binder inter-process call management module to delete the process identification information of the called process from the management process list when the called process is awakened.
  • the application management module is also used to: when the called process is awakened, change the state of the called process from the suspended state to the active state, and/or change the called process The state of the corresponding application changes from the suspended state to the active state.
  • the application management module is further used to: when the state of the calling process that calls the called process is marked as the suspended state, mark the state of the application corresponding to the calling process as suspended status.
  • the process management device provided by the present application includes a module for executing the process management method provided by the first aspect and/or any one of the possible implementations of the first aspect, so that the process management provided by the first aspect can also be implemented
  • the beneficial effects (or advantages) of the method are provided by the present application.
  • the embodiments of the present application provide an electronic device, including: a memory for storing a computer program, the computer program including program instructions; a processor, for executing the program instructions, so that the electronic device executes the above-mentioned first Aspect and/or the process management method provided by any one of the possible implementation manners of the first aspect.
  • the embodiments of the present application provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program.
  • the computer program includes program instructions.
  • the program instructions are executed by the computer to make the computer execute as in the first aspect. And/or the process management method provided by any one of the possible implementations of the first aspect.
  • Fig. 1 is a schematic diagram of an IPC mechanism according to some embodiments of the present application.
  • FIG. 2 is a diagram showing a scenario diagram of a Binder inter-process call according to some embodiments of the present application
  • FIG. 3 is a flowchart of a process management method in a Binder inter-process call according to some embodiments of the present application
  • FIG. 4 is a flowchart of a method for determining whether to wake up a called process based on a wake-up strategy of a communication type called between Binder processes according to some embodiments of the present application;
  • FIG. 5 is a schematic diagram showing a cache state of a Binder inter-process call in an asynchronous call buffer according to some embodiments of the present application
  • FIG. 6 is a flowchart of a method for managing applications and processes according to some embodiments of the present application.
  • FIG. 7 is a schematic diagram of modules of a process management apparatus according to some embodiments of the present application.
  • FIG. 8 is a flowchart of a process management method in a Binder inter-process call according to some embodiments of the present application.
  • FIG. 9 is a schematic diagram showing the structure of an electronic device according to some embodiments of the present application.
  • FIG. 10 is a schematic diagram showing the structure of a system on chip (SoC) according to some embodiments of the present application.
  • SoC system on chip
  • Electronic equipment is usually set with multiple applications (Application), each application usually corresponds to one or more processes, each process usually has its own part of independent system resources, and are isolated from each other, in order to enable different processes Inter-process communication can only be achieved by accessing resources and coordinating work with each other.
  • Application Application
  • each application usually corresponds to one or more processes
  • each process usually has its own part of independent system resources, and are isolated from each other, in order to enable different processes
  • Inter-process communication can only be achieved by accessing resources and coordinating work with each other.
  • the electronic device may specifically be a terminal device such as a mobile phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), or a desktop computer.
  • a terminal device such as a mobile phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), or a desktop computer.
  • PDA Personal Digital Assistant
  • Figure 1 shows a schematic diagram of a mechanism for inter-process communication.
  • Process A and Process B have independent user spaces.
  • the user spaces of the processes are independent of each other, and the information between user spaces cannot be direct.
  • Kernel space is the shared space of all processes.
  • Processes can spread or exchange information between each other's user space through the kernel space. For example, through system calls, the information in the user space of process A can be copied to process B through the kernel space. In user space.
  • two applications that use inter-process communication can generally be classified into a client and a server.
  • the client process requests data
  • the server process responds to the data request of the client process.
  • Figure 2 shows a scenario of inter-process communication between applications.
  • This scenario includes an application module and an Android Framework module, where the application module includes a first application 10, a second application 20, and a third application 30, and the first application 10, the second application 20, and the third application 30 All are integrated through SDK (Software Development Kit, software development kit), specifically integrated in SDK1 and SDK2, and each SDK communicates through inter-process communication.
  • the Android framework includes modules such as Bluetooth service 40, GPS service 50, Sensor service 60, etc., and the Bluetooth service 40, GPS service 50, Sensor service 60 and other modules may also be connected to the aforementioned first application 10, second application 20, and The third applications 30 communicate through inter-process communication.
  • the third application 30 process can be selected as the server, and the first application 10 and the second application 20 can be used as clients; for SDK2: the second application 20 process can be selected as the server, and the first application 10 and the third application 30 can be selected as the server.
  • the first application 10, the second application 20, and the third application 30 keep alive with each other.
  • One of the applications is dead (or in a suspended state), and the other application will pull up (or wake up) the dead application. Specifically, the pull-up between applications will cause the suspended process in the application to be awakened, and the process will be awakened too much, which will cause the consumption of memory and power consumption resources.
  • the aforementioned SDKs communicate through inter-process communication, and modules such as Bluetooth service, GPS service, and Sensor service can also communicate with the aforementioned first application 10, second application 20, and third application 30 through inter-process communication.
  • the communication may specifically be a communication mechanism between Binder processes.
  • each application program is composed of four components, Activity, Service, Broadcast, and Provider. The underlying inter-process communication involved in these four components all rely on the Binder inter-process communication mechanism.
  • Binder synchronous calls the calling process calls the called process and needs to wait for the called process to return the result to end the call; the asynchronous binder call is The calling process calls the called process without waiting for the called process to return the result, similar to the notification mechanism.
  • the Binder inter-process call based on the Binder inter-process communication mechanism between the corresponding processes of the application will cause process wake-up, and the process is awakened too much, which will lead to the consumption of memory and power consumption resources.
  • FIG. 3 shows a process management method, which specifically includes:
  • S200 Determine whether to wake up the called process according to a preset wake-up strategy based on the communication type called between the Binder processes for the process call.
  • the Binder process call it usually includes the calling process and the called process, where the calling process is the initiator (caller) of the Binder process call, and the called process is the called process called in the Binder process call.
  • the process (the callee).
  • the Binder inter-process call for the called process in the suspended state, when the called process is called, it can wake up according to the preset communication type based on the Binder inter-process call
  • the strategy determines whether the process needs to be awakened, that is, for the communication types called between different Binder processes, the called process is awakened for process invocation when it needs to be awakened, and the called process does not need to be awakened when there is no need to wake up.
  • the wake-up strategy based on the communication type called between Binder processes determines whether to wake up the called process, which specifically includes:
  • the communication types called between Binder processes include Binder synchronous calls and Binder asynchronous calls; if the communication type called between Binder processes is Binder synchronous call, then execute S220: If the communication type called between Binder processes is Binder asynchronous call, then Perform S230.
  • S220 Determine whether to wake up the called process for process invocation according to the preset Binder inter-process call priority type.
  • S230 Cache the Binder inter-process call, and determine whether to wake up the called process for the process call based on whether the accumulated degree of the cached for the called process reaches a preset accumulation degree standard or whether the state of the called process has changed.
  • the communication types of calls between Binder processes include Binder synchronous calls and Binder asynchronous calls.
  • Binder synchronous calls the calling process calls the called process and needs to wait for the called process to return the result to end the call; asynchronous binder calls are the calling process Calling the called process does not need to wait for the called process to return the result, similar to the notification mechanism.
  • This application sets different wake-up strategies based on the communication types called between different Binder processes.
  • Binder synchronous calls you can determine whether to wake up the called process for process calls based on the preset Binder inter-process call priority type; for Binder asynchronous Call, can cache the Binder process calls, and based on whether the accumulation degree of the called process reaches the preset accumulation degree standard or whether the state of the called process has changed, to determine whether to wake up the called process for process invocation .
  • different process wake-up strategies can be formulated for the communication types called between different Binder processes, and on the basis of meeting the requirements of the communication types called between different Binder processes, process wake-ups can be effectively reduced.
  • the priority type includes ease of use priority
  • the priority type of the Binder inter-process call is ease of use priority
  • the called process is awakened for process invocation.
  • the priority of ease of use is to give priority to the ease of use of the process. If the priority type of the Binder inter-process call is the priority of ease of use, the called process is awakened for the process call, thereby ensuring that the called process The usage requirements of the process.
  • the priority type of Binder inter-process calling that meets any of the following conditions is ease of use priority: the called process or the application corresponding to the calling process that calls the called process is passed
  • the user interface is selected as an application that allows background activities; the application corresponding to the called process or the calling process that calls the called process is an application that is selected to ignore the impact of power consumption through the user interface; the called process or the calling process that calls the called process
  • the corresponding application is an application that is selected to ignore memory effects through the user interface.
  • Binder inter-process call if the application corresponding to at least one of the calling process and the called process is an application that allows background activities, the priority type of this Binder inter-process call is considered to be ease of use first. Need to wake up the called process for process call.
  • Binder inter-process call if the application corresponding to at least one of the calling process and the called process is an application that is selected to ignore the impact of power consumption through the user interface, or is selected to ignore memory through the user interface The affected application considers that the priority type of this Binder inter-process call is ease of use first, and the called process needs to be awakened for the process call.
  • the aforementioned application that ignores the influence of power consumption may specifically refer to an application that ignores battery optimization in the android system.
  • the user can set the application through the user interface. For example, for some high-frequency applications, or for applications that are important to the user, the user can choose to allow background activities/ignore power consumption For applications that affect/ignore memory effects, when judging the application corresponding to at least one of the calling process and the called process, for applications that allow background activities/ignore power consumption effects/ignore memory effects, for the convenience of users, you can Determine the type of Binder inter-process call as ease of use first, and wake up the called process for process call.
  • the priority type includes power consumption priority
  • the priority type of the Binder inter-process call is power consumption priority
  • the priority of power consumption is to give priority to the process that takes up as little power as possible, and when judging the priority type of the Binder process call is power consumption priority, it is based on the consideration of the normal use of the Binder process to call related functions. , You can determine whether to wake up the called process by judging whether the calling process is the core process. If the calling process is the core process, in order to ensure the normal use of the related functions of the Binder process, wake up the called process for Process call, if the calling process is a non-core process, even if the called process is not awakened, it will not affect the user's use. Therefore, the called process may not be awakened.
  • the priority type of Binder inter-process calls can only include the aforementioned ease of use priority and power consumption priority.
  • it is also possible to separately determine whether the priority type called between the Binder processes is the ease of use priority type and the power consumption priority type, which can be specifically selected and set according to needs.
  • the calling process that meets any of the following conditions is the core process:
  • the application corresponding to the calling process is the application configured through the application whitelist. Specifically, by judging whether the application corresponding to the calling process is an application configured through the application whitelisting in the operating system, it can be determined whether the calling process is a core process. If the application corresponding to the calling process is an application whitelisting through the system For applications configured by the list, the calling process is considered to be the core process.
  • the calling process is the foreground process and is used by the user in the foreground. Specifically, by judging whether the calling process is the foreground process used by the user in the foreground, it can be determined whether the calling process is the core process. If the calling process is the foreground process and the process is being used by the user in the foreground, the calling process is considered to be the core process. .
  • the ADJ value of the calling process in the operating system is less than the ADJ value of the foreground process. Specifically, the ADJ value of the calling process in the operating system can be compared with the ADJ value of the foreground process. If the ADJ value of the calling process is less than the ADJ value of the foreground process, the calling process is considered to be the core process.
  • the calling process in the operating system is a process that is not in the background process scheduling group (SCHED_GROUP_BACKGROUND). Specifically, if the process in the background process scheduling group is not a core process, by judging whether the calling process is in the background process scheduling group, it can be determined whether the calling process is a core process. If the calling process is in the background process scheduling group, then The calling process is considered to be a non-core process, and if the calling process is not in the background process scheduling group, then the calling process is a core process.
  • the UID of the application corresponding to the calling process is less than the preset UID.
  • the preset UID may specifically be the first application assigned UID (FIRST_APPLICATION_UID) in the operating system. Specifically, if the operating system is the android system, the FIRST_APPLICATION_UID is 10000.
  • the specific value of the preset UID can be selected and set according to specific options.
  • the calling process is the process of the foreground service in the operating system. Specifically, it is possible to determine whether the calling process is a core process by judging whether the calling process is a foreground service process in the operating system. If the calling process is a foreground service process in the operating system, the calling process is considered to be a core process.
  • the calling process is a process that is currently performing background-perceivable services. Specifically, it can be judged whether the calling process is a core process by judging whether the calling process is a process that is currently performing background-perceivable services. If the calling process is a process that is currently performing background-perceivable services, then the calling process is considered to be the core process. .
  • the current process of performing background-perceivable services usually includes processes corresponding to applications such as music playing, recording, downloading, and navigation.
  • the calling process is a core process, it can be specifically determined whether the calling process meets any of the foregoing, and as long as any one of them is satisfied, the calling process is considered to be the core process. If the calling process does not satisfy any of the foregoing, the calling process is considered to be a non-core process.
  • the aforementioned operating system may specifically be android OS, iOS, or other types of operating systems.
  • the called process if the calling process is a core process, the called process is awakened for process invocation; if the calling process is a non-core process, the called process is not awakened, and further This includes: marking the state of the calling process as the suspended state, and/or marking the state of the application corresponding to the calling process as the suspended state.
  • the calling process is a non-core process
  • the binding process even if the Binder inter-process call is not executed, the user’s current use will not be affected. For the sake of saving memory and/or reducing power consumption, the user is not awakened.
  • the state of the calling process that calls the called process can be identified as the suspended state
  • the state of the application corresponding to the calling process can be identified as the suspended state, or only the state of the calling process can be identified as Suspended state, or only the state of the application corresponding to the calling process is marked as suspended state, which can be specifically selected and set as required.
  • Binder inter-process calls whose communication type is the Binder asynchronous call mode
  • the call to the called process can be temporarily cached, and the called process is awakened when a certain wake-up condition is reached. Further, when the called process is awakened, the cached Binder inter-process call can be executed.
  • the Binder inter-process call is cached, and the Binder inter-process call is cached, including: caching the call to the called process It is related to the asynchronous call buffer.
  • an asynchronous call buffer is usually provided in the electronic device, and the Binder inter-process call for the Binder asynchronous call mode is cached.
  • the Binder inter-process call may be cached in the asynchronous call buffer.
  • the cache state of the Binder inter-process call in the asynchronous call buffer may be specifically as shown in FIG. 5.
  • B is the called process
  • a and C are the calling processes that call the called process B
  • the call relationship for the called process B is cached in the asynchronous call buffer, specifically the cache "A call B", " Ccall B” and other calls are related to the asynchronous buffer.
  • asynchronous call buffer is specifically a FIFO (First Input First Output) buffer.
  • Binder inter-process calls are sequentially cached to the asynchronous call buffer.
  • the accumulation degree of the cached cache for the called process reaches the preset accumulation degree standard, or the state of the called process changes from the suspended state to the active state, then wake up The called process.
  • the accumulation degree of the cached cache for the called process reaches the preset accumulation degree standard may be that the total storage amount of the asynchronous call buffer for the called process exceeds the preset Storage threshold. Specifically, if the total storage amount of the asynchronous call buffer for the called process exceeds the preset storage threshold, it is considered that the accumulation degree of the cache for the called process reaches the preset accumulation degree standard.
  • the predetermined threshold may specifically be three-quarters of the storage capacity of the asynchronous call buffer for the called process, and of course it may be specifically set as required.
  • the storage capacity of the asynchronous call buffer is 512k
  • the preset storage threshold can be 384k.
  • the Binder for the called process can continue to be cached.
  • Inter-process call if the current total storage of the asynchronous call buffer is 384k, the Binder inter-process call for the called process cannot be cached, and the called process is awakened at this time.
  • the accumulation degree of the cache for the called process reaches the preset accumulation degree standard, or the available storage space of the asynchronous call buffer for the called process is less than the preset storage space Threshold.
  • the available storage space of the asynchronous call buffer for the called process is less than the preset storage space threshold, it is considered that the accumulation degree of the buffer for the called process reaches the preset accumulation degree standard.
  • the preset storage space threshold may specifically be a quarter of the total storage amount of the asynchronous call buffer for the called process, and of course it may be specifically set as required.
  • the storage capacity of the asynchronous call buffer is 512k
  • the preset storage space threshold can be 128k.
  • Binder inter-process call if the current available storage space of the asynchronous call buffer is 200k, the buffer for the called process can continue to be cached. Binder inter-process call, if the current available storage space of the asynchronous call buffer is 128k, the Binder inter-process call for the called process cannot be cached, and the called process is awakened at this time.
  • the accumulation degree of the cached cache for the called process reaches a preset accumulation degree standard, or the number of cache calls to the called process reaches a preset threshold for the number of cache calls.
  • the preset threshold for the number of cache calls may specifically be 100 times. When the number of calls to the called process in the cache reaches 100 times, it is considered that the accumulation level of the cache for the called process reaches the preset accumulation level standard. , The called process is awakened at this time, and further, the awakened called process can be used for process call.
  • the preset threshold for the number of cache calls may be 100, and it may also be other values set as needed.
  • the accumulation degree of the cache for the called process reaches the preset accumulation degree standard, or the cache call time for the called process reaches the preset cache call time threshold.
  • the preset cache call time threshold may specifically be 30 minutes. When the cache call time of the cache for the called process reaches 30 minutes, it is considered that the accumulation degree of the cache for the called process reaches the preset accumulation level standard. At this time, the called process is awakened, and further, the awakened called process can be used for process call. It should be noted that the preset cache call time threshold may be 30 minutes, of course, it may also be other values set as needed.
  • the called process after the called process is awakened, it further includes: converting the state of the called process from the suspended state to the active state, and changing the state of the application corresponding to the called process from the suspended state to the active state.
  • the starting state changes to the active state.
  • the state of the called process is converted from the suspended state to the active state, and the state of the application corresponding to the called process is converted from the suspended state to the active state, so that the called process Can be used for process calls.
  • Binder inter-process calls cached in the asynchronous call buffer when the above-mentioned called process wake-up condition is satisfied, the list of the buffered Binder inter-process calls in the asynchronous call buffer is required to be targeted at the called process. The cache of the calling process is deleted.
  • determining whether the called process is a suspended process includes: determining whether the process identification information of the called process is in a preset management process list; the management process list includes The process identification information of the process corresponding to the application in the suspended state; if the process identification information of the called process is in the management process list, the called process is the process in the suspended state; if the process identification information of the called process is not In the management process list, the called process is a non-suspended process.
  • a management process list may be preset, and the process identification information of the process in the suspended state can be added to the management process list, that is, the management process list includes the process identification information of the process in the suspended state.
  • the process identification information may only include the process ID, such as “process A_ID”, “process B_ID”, “process C_ID” and so on.
  • the process identification information may also only include the UID of the suspended application corresponding to the suspended process, such as "application 1-UID”, “application 2-UID”, “application 3-UID” and so on.
  • the process identification information may include both the process ID and the UID of the application corresponding to the process, such as "application 1—UID+process A—ID”, “application 2—UID+process B—ID”, “application 3—UID+process C— ID & Process D-ID” and "Application 4-UID + Process C-ID & Process A-ID & Process E-ID” and so on. It can be set according to specific needs.
  • applications in a suspended state include: applications that have no perceptible services within a preset time after entering the background.
  • applications that have no perceptible business within a preset time after entering the background in order to prevent the application from continuing to occupy memory and generate power consumption, the state of the application can be converted to the suspended state, and the state of the corresponding process of the application Switch to the suspended state, which can avoid the consumption of memory and power consumption resources.
  • the application in the suspended state may specifically also be other applications in the suspended state such as an application that is not activated by the system.
  • S610 The application exits the background and is in an active state.
  • step S620 Whether there is no perception service within the preset time, if not, execute step S630; if yes, continue to execute step S620.
  • Step S630 Mark the state of the application as a suspended state. Step S640 is executed.
  • S640 Mark the state of the process corresponding to the application as the suspended state, and add the process ID of the process corresponding to the application to the management process list.
  • the application After the application exits the background, it first enters the active state, and detects whether the application has no perceptible services within the preset time T. If it is detected that the application has no perceptible services within the preset time T, the status of the application is marked as suspended Status: After the application process is in the suspended state, the process ID of the process corresponding to the application is added to the preset management process list.
  • the preset time can be specifically set according to needs, for example, it can be specifically 5 minutes, 10 minutes, etc.
  • the management of the status of applications and processes in this application also includes: judging whether the process in the suspended state or the status of the application is converted to the active state, if the state of the process in the suspended state is converted to the active state, the The process identification information of the process is removed from the management process list; and/or after the state of the application in the suspended state is converted to the active state, the process identification information of the process corresponding to the application is removed from the management process list.
  • the process identification information of the process may be removed from the management process list.
  • the process identification information of the process corresponding to the application may be removed from the management process list.
  • the state of the application is marked as the active state, and the state of the process corresponding to the application is marked as the active state. Or when the process is called by binder, it will switch to the active state.
  • FIG. 7 shows a schematic diagram of modules of a process management apparatus provided by the present application.
  • the process management device includes: a Binder inter-process call management module 710.
  • the Binder inter-process call management module 710 is used to determine whether the called process in the Binder inter-process call is made when the Binder inter-process call is made To enter the process in the suspended state in the background; and when determining that the called process is in the suspended state, determine whether to wake up the called process for the process according to the preset wake-up strategy based on the communication type of the Binder process call Call; when it is determined that the called process is in a non-suspended state, the process call is executed. That is, the Binder inter-process call management module 710 can be used to execute the process management method corresponding to the aforementioned steps S100 to S300.
  • the process management apparatus further includes: an application module 720 and an application management module 730; the application management module 730 is used to manage the state of the application in the application module 720 and the state of the process corresponding to the application, Specifically, the application management module 730 is used to determine whether the application entering the background in the application module 720 has no perceptible service within a preset time, if not, the application status is marked as the suspended status; if so, the application status The status is identified as the active state; for the application identified as the suspended state, the application management module 730 is also used to identify the state of the process corresponding to the application as the suspended state, and notify the Binder inter-process call management module 710 to change the process identification information of the process It is added to the management process list preset in the Binder inter-process call management module 710.
  • the application management module 730 is further configured to notify the Binder inter-process call management module 710 to delete the process identification information of the called process from the management process list when the called process is awakened.
  • the application management module 730 is also used to: when the called process is awakened, change the state of the called process from the suspended state to the active state, and/or change the application corresponding to the called process The state is changed from the suspended state to the active state.
  • the application management module 730 is further configured to: when the state of the calling process that calls the called process is identified as the suspended state, mark the state of the application corresponding to the calling process as the suspended state.
  • the process management device may also include a Binder driving module, which is a core module that implements Binder inter-process calls, and is used to perform Binder inter-process calls and other related Binder inter-process call processing.
  • a Binder driving module which is a core module that implements Binder inter-process calls, and is used to perform Binder inter-process calls and other related Binder inter-process call processing.
  • the process management device includes a Binder inter-process call management module 710, an application module 720, and an application management module 730, which are used to execute each step in the foregoing process management method.
  • the Binder inter-process call management module 710, the application module 720, and the application management module 730 are respectively used to execute corresponding steps. Therefore, the same parts will not be repeated here.
  • FIG. 8 shows a process management method, which specifically includes:
  • S820 Determine whether the process B is a process in a suspended state. If yes, execute S830; if not, execute S890.
  • the B process is a suspended process, which may be specifically determined by the aforementioned Binder inter-process call management module 710 by the aforementioned method for determining whether the called process is a suspended process, where No longer.
  • the Binder inter-process call management module 710 determines the communication type of the A process and the Binder process to call the B process. If the communication type is Binder synchronous call, S840 is executed; if the communication type is Binder asynchronous call, S850 is executed.
  • the Binder inter-process call management module 710 determines the priority type of the A process Binder process to call the B process, and if the priority type is ease of use priority, the Binder inter-process call management module 710 executes S870: If the priority type is power consumption priority, the Binder inter-process calls the management module 710 to execute S860.
  • the Binder inter-process call management module 710 caches the Binder inter-process call of the A process to the B process.
  • the cache may specifically be cached in the asynchronous cache as shown in FIG. 5.
  • the Binder inter-process call management module 710 executes S870 to wake up the process B.
  • the preset condition may specifically be the aforementioned whether the accumulation degree of the called process B reaches the preset accumulation degree standard or whether the state of the called process B has changed, so as to determine whether to wake up the called process B for process invocation. The conditions are not repeated here.
  • the Binder process call for the called process B process, first determine whether the B process is a suspended process, if the B process is a suspended process, according to the preset
  • the wake-up strategy determines whether to wake up the B process, and if the B process is a process in a non-suspended state (active state), a process call is executed.
  • the wake-up strategy includes first determining whether the communication type of this Binder process call is a Binder synchronous call or a Binder asynchronous call.
  • this Binder process call is Binder synchronous call
  • the priority type of this Binder process call is further judged, and the B process is determined whether to wake up the B process according to the determined priority type. Specifically, if the priority type is ease of use priority, the B process is immediately awakened, and the Binder inter-process call is processed. If the priority type is power consumption priority, further determine whether the A process is a core process. If the A process is not a core process, the B process will not be awakened, and the A process will be suspended (sleep) at the same time, and this inter-Binder process call will be suspended; If the A process is the core process, the B process is awakened and the Binder inter-process call is processed.
  • Binder process call will be cached to the asynchronous buffer for process B.
  • process B will be awakened for process call .
  • the application management module 730 changes the state of the B process from the suspended state to the active state. Further, the application management module 730 may also convert the state of the application corresponding to the B process from the suspended state to the active state.
  • the application management module 730 changes the state of the A process from the active state to the suspended state. Further, the application management module 730 may also convert the state of the application corresponding to the A process from the active state to the suspended state.
  • Binder inter-process calls for the B process are cached, after the B process is awakened, the B process sequentially processes all the cached Binder inter-process calls for the B process.
  • the set wake-up strategy based on the communication type of the Binder process call determines whether to wake up the called process.
  • the method of directly waking up the called process for process invocation during inter-calling can effectively reduce the number of times that the process is awakened to reduce memory occupation and power consumption, and it can also meet the normal use requirements of users.
  • FIG. 9 is a schematic structural diagram of an electronic device 900 provided according to an embodiment of the present application.
  • the electronic device 900 may include one or more processors 901 coupled to the controller hub 904.
  • the controller hub 904 communicates with the processor 901 via a multi-drop bus such as a front side bus (FSB), a point-to-point interface such as a fast path interconnect (QPI), or similar connection.
  • the processor 901 executes instructions that control general types of data processing operations.
  • the controller hub 904 includes, but is not limited to, a graphics memory controller hub (GMCH) (not shown in the figure) and an input/output hub (IOH) (which may be on a separate chip) ( (Not shown in the figure), where the GMCH includes a memory and a graphics controller and is coupled with the IOH.
  • GMCH graphics memory controller hub
  • IOH input/output hub
  • the electronic device 900 may also include a coprocessor 906 and a memory 902 coupled to the controller hub 904.
  • a coprocessor 906 and a memory 902 coupled to the controller hub 904.
  • one or both of the memory 902 and the GMCH may be integrated in the processor 901 (as described in this application), and the memory 902 and the coprocessor 906 are directly coupled to the processor 901 and the controller hub 904, and control
  • the device hub 904 and the IOH are in a single chip.
  • the memory 902 may be, for example, dynamic random access memory (DRAM), phase change memory (PCM), or a combination of the two.
  • DRAM dynamic random access memory
  • PCM phase change memory
  • the coprocessor 906 is a dedicated processor, such as, for example, a high-throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, or an embedded processor, or the like.
  • a dedicated processor such as, for example, a high-throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, or an embedded processor, or the like.
  • the optional nature of the coprocessor 906 is shown in dashed lines in FIG. 9.
  • the electronic device 900 may further include a network interface (NIC) 903.
  • the network interface 903 may include a transceiver for providing a radio interface for the electronic device 900 to communicate with any other suitable devices (such as a front-end module, an antenna, etc.).
  • the network interface 903 may be integrated with other components of the electronic device 900.
  • the network interface 903 can implement the function of the communication unit in the above-mentioned embodiment.
  • the electronic device 900 may further include an input/output (I/O) device 905.
  • the input/output (I/O) device 905 may include: a user interface, which is designed to enable a user to interact with the electronic device 900; the design of the peripheral component interface enables peripheral components to also interact with the electronic device 900; and/or a sensor design To determine environmental conditions and/or location information related to the electronic device 900.
  • Figure 9 is only exemplary. That is, although FIG. 9 shows that the electronic device 900 includes multiple devices such as the processor 901, the controller hub 904, and the memory 902, in actual applications, the devices using the methods of the present application may only include the electronic device 900. Some of the devices, for example, may only include the processor 901 and the NIC 903. The properties of optional devices in Fig. 9 are shown by dashed lines.
  • the memory of the electronic device 900 may include one or more tangible, non-transitory computer-readable media for storing data and/or instructions.
  • the computer-readable storage medium stores instructions, specifically, temporary and permanent copies of the instructions.
  • the electronic device 900 may specifically be a terminal device such as the aforementioned mobile phone, tablet computer, personal digital assistant (PDA), or desktop computer.
  • the instructions stored in the memory of the electronic device may include instructions that, when executed by at least one unit in the processor, cause the electronic device to implement the aforementioned process management method.
  • FIG. 10 is a schematic structural diagram of an SoC (System on Chip) 1000 provided according to an embodiment of the present application.
  • SoC System on Chip
  • similar parts have the same reference numerals.
  • dashed box is an optional feature of the more advanced SoC1000.
  • the SoC 1000 can be used in any electronic device according to the present application, and corresponding functions can be implemented according to the different devices where it is located and the instructions stored in it.
  • the SoC1000 includes: an interconnection unit 1002, which is coupled to a processor 1001; a system agent unit 1006; a bus controller unit 1005; an integrated memory controller unit 1003; a group or one or more coprocessors 1007 , which may include integrated graphics logic, image processor, audio processor and video processor; SRAM (Static Random Access Memory) unit 1008; DMA (Direct Memory Access) unit 1004.
  • the coprocessor 1007 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, a GPGPU, a high-throughput MIC processor, or an embedded processor, etc.
  • the SRAM unit 1008 may include one or more computer-readable media for storing data and/or instructions.
  • the computer-readable storage medium may store instructions, specifically, temporary and permanent copies of the instructions.
  • the instruction may include an instruction that, when executed by at least one unit in the processor, causes the electronic device to implement the aforementioned process management method.
  • Each embodiment of the mechanism disclosed in this application can be implemented in software, hardware, firmware, or a combination of these implementation methods.
  • the embodiments of the present application can be implemented as a computer program or program code executed on a programmable system.
  • the programmable program includes at least one processor, memory (or storage system, including volatile and non-volatile memory and/or Storage unit).
  • Program codes can be applied to input instructions to perform the functions described in the text and generate output information.
  • the output information can be applied to one or more output devices in a known manner.
  • the processing system may be a microprocessor, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), etc., and/or any combination thereof.
  • the processor may be a single-core processor, a multi-core processor, etc., and/or any combination thereof.
  • the program code can be implemented in a high-level programming language or an object-oriented programming language to communicate with the processor.
  • assembly language or machine language can also be used to implement the program code.
  • the mechanism described in the text is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.
  • the disclosed embodiments may be implemented in hardware, firmware, software, or any other combination.
  • the disclosed embodiments may be implemented as one or more temporary or non-transitory and its readable (for example, computer-readable) storage medium carried or stored on instructions, which can be read by one or more processors And execution.
  • the instructions are distributed through a network or a barometric computer readable medium.
  • a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (for example, a computer), including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magnetic Optical disc, read only memory (ROM), random access memory (RAM), erasable programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), magnetic or optical card, flash card, Or a tangible machine-readable memory that uses the Internet to transmit information (for example, carrier waves, infrared signal numbers, etc.) with electric, optical, acoustic, or other forms of propagating signals. Therefore, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable form.
  • One or more aspects of at least one embodiment may be implemented by expressive instructions stored on a computer-readable storage medium.
  • the instructions represent various logics in the processor, and the instructions when read by a machine make the machine produce Perform the logic of the technique described in the text.
  • These representations called "IP cores" can be stored on a tangible computer readable storage medium and provided to multiple customers or production equipment for implementation to be loaded into the manufacturing machine that actually manufactures the logic or processor.
  • the instruction converter can be used to transfer instructions from the source instruction set to the target instruction set.
  • the instruction converter may transform (for example, use static binary transformation, dynamic binary transformation including dynamic compilation), deform, emulate, or otherwise convert the instruction into one or more other instructions that are processed by the core.
  • the instruction converter can be implemented by software, hardware, firmware, or other combinations.
  • the instruction converter may be on the processor, off the processor, or part on the processor and part off the processor.
  • each module in each device embodiment of the present application is a logical module.
  • a logical module may be a physical unit, a part of a physical unit, or a combination of multiple physical units.
  • the foregoing device embodiments of the present application are not introduced to modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other modules in the foregoing device embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)
  • Telephone Function (AREA)

Abstract

一种进程管理方法、装置及电子设备。方法包括:在进行Binder进程间调用时,确定被调用进程是否为处于挂起状态的进程(S100);若被调用进程为处于挂起状态的进程,则根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程,以用于进程调用(S200);若被调用进程为处于非挂起状态的进程,则执行进程调用(S300)。即对于不同的Binder进程间调用的通信类型,在需要唤醒时唤醒该被调用进程以用于进程调用,在不需要唤醒时,则可以不用唤醒该被调用进程,由此,可以有效地减少处于挂起状态的被调用进程的唤醒,以避免进程被频繁唤醒,存在内存和功耗资源的消耗的问题。

Description

进程管理方法和装置、电子设备
本申请要求于2019年12月17日提交中国专利局、申请号为201911302697.7、申请名称为“进程管理方法和装置、电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别涉及一种进程管理方法和装置、电子设备。
背景技术
IPC(Inter-Process Communication,进程间通信)是指在不同进程之间传播或交换信息的一种通信方式。基于IPC的不同应用之间通常存在进程间的调用,当前,对于处于挂起(休眠)状态的进程,当有其他进程调用该处于挂起状态的进程时,该处于挂起状态的进程存在直接被唤醒的情况,当进程被频繁唤醒,内存和功耗资源也将相应被频繁地消耗。
发明内容
本申请的目的在于解决现有技术中处于挂起状态的进程在被调用时直接被唤醒,存在进程被频繁唤醒,导致内存和功耗资源的消耗的问题。本申请提供了一种进程管理方法,可以有效地减少处于挂起状态的进程被唤醒,以减少内存和功耗资源的消耗的问题。
为解决上述技术问题,第一方面,本申请的实施方式公开了一种进程管理方法,包括:在进行Binder进程间调用时,确定该Binder进程间调用中的被调用进程是否为处于挂起状态的进程;若被调用进程为处于挂起状态的进程,则根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程,以用于进程调用;若被调用进程为处于非挂起状态的进程,则执行进程调用。
在Binder进程间调用中,对于处于挂起状态的被调用进程,当该被调用进程被调用进程调用时,可以根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否需要唤醒该被调用进程,即对于不同的Binder进程间调用的通信类型,在需要唤醒时唤醒该被调 用进程以用于进程调用,在不需要唤醒时,则可以不用唤醒该被调用进程,由此,可以有效地减少进程被唤醒,即可以有效地减少调用进程基于Binder进程间调用唤醒被调用进程,以避免进程被频繁唤醒,导致内存和功耗资源的消耗的问题,即可以有效地降低内存占用和功耗资源的消耗。
在上述第一方面的一种可能的实现中,根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程以用于进程调用,包括:确定Binder进程间调用的通信类型;通信类型包括Binder同步调用和Binder异步调用;若Binder进程间调用的通信类型为Binder同步调用,则根据预设的Binder进程间调用优先类型确定是否唤醒被调用进程以用于进程调用;若Binder进程间调用的通信类型为Binder异步调用,则缓存Binder进程间调用,并基于缓存的针对被调用进程的累积程度是否达到预设的累积程度标准或被调用进程的状态是否发生变化,以确定是否唤醒被调用进程以用于进程调用。
在Binder进程间调用中,对于Binder同步调用和Binder异步调用两种通信类型,分别进行不同的关于进程唤醒的管理方法,由此对于不同的Binder进程间调用的通信类型,可以进行针对性地进程唤醒管理,且可以满足不同通信类型的情况下对被调用进程的调用需求。
在上述第一方面的一种可能的实现中,优先类型包括易用性优先,且若Binder进程间调用的优先类型为易用性优先,则唤醒被调用进程以用于进程调用。
易用性优先则为优先考虑进程的使用便捷性,若Binder进程间调用的优先类型为易用性优先,则唤醒被调用进程以用于进程调用,由此可以保证对该被调用进程的使用需求。
在上述第一方面的一种可能的实现中,满足以下任一条件的Binder进程间调用的优先类型为易用性优先:被调用进程或调用被调用进程的调用进程对应的应用为通过用户界面被选择为允许后台活动的应用;被调用进程或调用被调用进程的调用进程对应的应用为通过用户界面被选择为忽略功耗影响的应用;被调用进程或调用被调用进程的调用进程对应的应用为通过用户界面被选择为忽略内存影响的应用。
在上述第一方面的一种可能的实现中,优先类型包括功耗优先,且若Binder进程间调用的优先类型为功耗优先,则判断调用被调用进程的调用进程是否为核心进程,若调用进程为核心进程,则唤醒被调用进程;若调用进程为非核心进程,则不唤醒被调用进程。
功耗优先则为优先考虑进程尽量占用少的功耗,并且在判断Binder进程间调用的优先 类型为功耗优先时,出于对基于该Binder进程间调用相关功能的正常使用的考虑,可以通过判断该调用进程是否为核心进程,由此决定是否唤醒被调用进程,若该调用进程为核心进程,为保证该Binder进程间调用相关功能的正常使用,则唤醒该被调用进程用于进程调用,若该调用进程为非核心进程,则即使不唤醒该被调用进程,也不影响用户的使用,因此,可以不唤醒该被调用进程。
在上述第一方面的一种可能的实现中,满足以下任一条件的调用进程为核心进程:调用进程对应的应用为通过应用白名单配置的应用;调用进程为前台进程,且被用户正在前台使用;操作系统中调用进程的ADJ值小于前台进程的ADJ值;操作系统中调用进程为不在后台进程调度分组中的进程;调用进程对应的应用的UID小于预设的UID;调用进程为操作系统中前台服务的进程;调用进程为当前进行后台可感知业务的进程。
在上述第一方面的一种可能的实现中,若调用进程为非核心进程,则不唤醒被调用进程,并进一步还包括:将调用进程的状态标识为挂起状态,和/或将调用进程对应的应用的状态标识为挂起状态。
若调用进程为非核心进程,则即使不执行该Binder进程间调用,也不影响用户的当前使用,在不唤醒该被调用进程的基础上,还可以将调用进程将调用进程的状态标识为挂起状态,和/或将调用进程对应的应用的状态标识为挂起状态,以进一步减少内存和功耗资源的消耗。
在上述第一方面的一种可能的实现中,缓存Binder进程间调用,包括:缓存针对被调用进程的调用关系至异步调用缓存器中。
在上述第一方面的一种可能的实现中,若缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,或被调用进程的状态由挂起状态转换为活跃状态,则唤醒被调用进程。
在上述第一方面的一种可能的实现中,缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,包括:针对被调用进程的异步调用缓存器的存储总量超过预设的存储阈值;或针对被调用进程的异步调用缓存器的可用存储空间小于预设的存储空间阈值;或针对被调用进程的缓存调用次数达到预设的缓存调用次数阈值;或针对被调用进程的缓存调用时间达到预设的缓存调用时间阈值。
对于通信类型为Binder异步调用方式的Binder进程间调用,为避免进程被频繁唤醒, 则可以暂时缓存针对被调用进程的调用,在达到一定的唤醒条件时,再唤醒该被调用进程。进一步地,当该被调用进程被唤醒时,可以执行该缓存的Binder进程间调用。
在上述第一方面的一种可能的实现中,被调用进程被唤醒后,还包括:将被调用进程的状态由挂起状态转换为活跃状态,且将被调用进程对应的应用的状态由挂起状态转换为活跃状态。在被调用进程被唤醒后,将被调用进程的状态由挂起状态转换为活跃状态,且将被调用进程对应的应用的状态由挂起状态转换为活跃状态,即使得进程和进程对应的应用处于活跃状态,以便于进程及应用处于的正常使用。
在上述第一方面的一种可能的实现中,确定被调用进程是否为处于挂起状态的进程,包括:判断被调用进程的进程标识信息是否位于预设的管理进程列表中;管理进程列表包括与处于挂起状态的应用对应的进程的进程标识信息;若被调用进程的进程标识信息位于管理进程列表中,则被调用进程为处于挂起状态的进程;若被调用进程的进程标识信息未位于管理进程列表中,则被调用进程为处于非挂起状态的进程。
预先设置管理进程列表,并将处于挂起状态的进程的进程标识信息添加至该管理进程列表中,在判断被调用进程是否为挂起进程时,只需要判断该被调用进程的进程标识信息是否位于该管理进程列表中,即可以方便地确定该被调用进程是否为挂起进程。
在上述第一方面的一种可能的实现中,进程标识信息包括进程ID和/或与进程对应的应用的UID。
在上述第一方面的一种可能的实现中,处于挂起状态的应用,包括:进入后台后,在预设时间内无可感知业务的应用。
对于进入后台后,在预设时间内无可感知业务的应用,为避免该应用继续占用内存及产生功耗,可以将该应用的状态转换为挂起状态,并将该应用对应的进程的状态转换为挂起状态,由此可以避免内存及功耗资源的消耗。
在上述第一方面的一种可能的实现中,进一步包括,处于挂起状态的进程的状态转换为活跃状态后,将进程的进程标识信息从管理进程列表中移除;或处于挂起状态的应用的状态转换为活跃状态后,将应用对应的进程的进程标识信息从管理进程列表中移除。
为避免进程/应用的正常使用,在进程的状态由挂起状态转换为活跃状态后,将该进程的进程标识信息从管理进程列表中移除,以使在该进程被调用时,可以直接执行进程调用。
第二方面,本申请的实施方式提供了一种进程管理装置,包括:Binder进程间调用管 理模块,Binder进程间调用管理模块在进行Binder进程间调用时,确定Binder进程间调用中的被调用进程是否为进入后台处于挂起状态的进程;并在确定被调用进程为处于挂起状态的进程时,根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程以用于进程调用;在确定被调用进程为处于非挂起状态的进程时,执行进程调用。
在上述第二方面的一种可能的实现中,还包括:应用模块和应用管理模块;应用管理模块用于确定应用模块中进入后台的应用在预设时间内是否无可感知业务,若无,则将应用的状态标识为挂起状态;若有,则将应用的状态标识为活跃状态;针对标识为挂起状态的应用,应用管理模块还用于将应用对应的进程的状态标识为挂起状态,并通知Binder进程间调用管理模块将处于挂起状态的进程的进程标识信息加入Binder进程间调用管理模块中预设的管理进程列表中。
在上述第二方面的一种可能的实现中,应用管理模块还用于:当被调用进程被唤醒后,通知Binder进程间调用管理模块将被调用进程的进程标识信息从管理进程列表中删除。
在上述第二方面的一种可能的实现中,应用管理模块还用于:当被调用进程被唤醒后,将被调用进程的状态由挂起状态转换为活跃状态,和/或将被调用进程对应的应用的状态由挂起状态转换为活跃状态。
在上述第二方面的一种可能的实现中,应用管理模块还用于:当调用被调用进程的调用进程的状态被标识为挂起状态时,将调用进程对应的应用的状态标识为挂起状态。
本申请提供的进程管理装置,包括用于执行上述第一方面和/或第一方面的任意一种可能的实现方式所提供的进程管理方法的模块,因此也能实现第一方面提供的进程管理方法所具备的有益效果(或优点)。
第三方面,本申请的实施方式提供了一种电子设备,包括:存储器,用于存储计算机程序,计算机程序包括程序指令;处理器,用于执行程序指令,以使电子设备执行如上述第一方面和/或第一方面的任意一种可能的实现方式所提供的进程管理方法。
第四方面,本申请的实施方式提供了一种计算机可读取存储介质,计算机可读取存储介质存储有计算机程序,计算机程序包括程序指令,程序指令被计算机运行以使计算机执行如第一方面和/或第一方面的任意一种可能的实现方式所提供的进程管理方法。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对实施例描述中所使用的附图作简单介绍。
图1是根据本申请的一些实施例,示出了一种IPC机制原理图;
图2是根据本申请的一些实施例,示出了一种Binder进程间调用场景图;
图3是根据本申请的一些实施例,示出了一种Binder进程间调用中的进程管理方法流程图;
图4是根据本申请的一些实施例,示出了一种基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程的方法流程图;
图5是根据本申请的一些实施例,示出了一种Binder进程间调用在异步调用缓存器中的缓存状态示意图;
图6是根据本申请的一些实施例,示出了一种应用及进程的管理方法流程图;
图7是根据本申请的一些实施例,示出了一种进程管理装置的模块示意图;
图8是根据本申请的一些实施例,示出了一种Binder进程间调用中的进程管理方法流程图;
图9是根据本申请的一些实施例,示出了一种电子设备的结构示意图;
图10是根据本申请的一些实施例,示出了一种片上系统(SoC)的结构示意图。
具体实施方式
以下由特定的具体实施例说明本申请的实施方式,本领域技术人员可由本说明书所揭示的内容轻易地了解本申请的其他优点及功效。虽然本申请的描述将结合较佳实施例一起介绍,但这并不代表此申请的特征仅限于该实施方式。恰恰相反,结合实施方式作申请介绍的目的是为了覆盖基于本申请的权利要求而有可能延伸出的其它选择或改造。为了提供对本申请的深度了解,以下描述中将包含许多具体的细节。本申请也可以不使用这些细节实施。此外,为了避免混乱或模糊本申请的重点,有些具体细节将在描述中被省略。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
应注意的是,在本说明书中,相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请的实施方式 作进一步地详细描述。
电子设备中通常设置有多个应用(Application),各应用通常会对应一个或多个进程,每个进程通常都有自己的一部分独立的系统资源,且彼此是隔离的,为了能使不同的进程互相访问资源并进行协调工作,才有了进程间通信。
该电子设备具体可以是手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)或台式电脑等终端设备。
请参见图1,图1示出了进程间通信的一种机制原理图,其中进程A和进程B分别具有独立的用户空间,进程的用户空间是互相独立的,且用户空间之间信息不可直接共享。内核空间是所有进程的共享空间,进程间可以通过内核空间实现彼此的用户空间之间的信息传播或交换,比如通过系统调用可以将进程A的用户空间内的信息通过内核空间复制到进程B的用户空间内。
进一步地,使用进程间通信的两个应用通常可以被分类为客户端和服务端,客户端进程请求数据,服务端进程回复客户端进程的数据请求。
具体的,请参见图2,图2示出了一种应用间进行进程间通信的一种场景。该场景下包括应用模块和安卓框架(Android Framework)模块,其中应用模块包括第一应用10,第二应用20和第三应用30,且该第一应用10,第二应用20和第三应用30都通过SDK(Software Development Kit,软件开发工具包)集成,具体的都集成在SDK1和SDK2,且各SDK之间通过进程间通信通信。另外,安卓框架中包括蓝牙服务40、GPS服务50、Sensor服务60等模块,且该蓝牙服务40、GPS服务50、Sensor服务60等模块具体也可以与前述第一应用10,第二应用20和第三应用30之间通过进程间通信通信。
针对SDK1,可以选择第三应用30进程作为服务端,第一应用10和第二应用20作为客户端;针对SDK2:可以选择第二应用20进程作为服务端,第一应用10和第三应用30作为客户端。该第一应用10、第二应用20和第三应用30之间互相保活,其中一个应用死掉(或处于挂起状态),另一个应用会将死掉应用拉起(或唤醒)。具体的,应用之间的拉起会使得应用中处于挂起状态的进程被唤醒,进程被唤醒过多,会导致内存和功耗资源消耗。
进一步地,前述各SDK之间通过进程间通信通信,及蓝牙服务、GPS服务、Sensor服务等模块具体也可以与前述第一应用10,第二应用20和第三应用30之间通过进程间通 信通信具体可以是进行Binder进程间通信机制。具体的,Android系统中,每个应用程序是由Activity,Service,Broadcast,Provider这四大组件组成,这四大组件所涉及的进程间通信底层都是依赖于Binder进程间通信机制。
需要说明的是,Binder进程间调用的通信类型包括Binder同步调用和Binder异步调用,其中Binder同步调用中调用进程调用被调用进程,需要等待被调用进程返回结果才能结束此次调用;异步binder调用为调用进程调用被调用进程,不需要等待被调用进程返回结果,类似通知机制。
进一步地,图2中,带箭头的实线所示的为Binder同步调用,带箭头的虚线所示的为Binder异步调用。
由此,应用对应的进程之间基于Binder进程间通信机制的Binder进程间调用会存在进程唤醒,而进程被唤醒过多,会导致内存和功耗资源消耗。
基于上述技术问题,本申请的实施方式公开了一种进程管理方法,请参见图3,图3示出了一种进程管理方法,其具体包括:
S100:在进行Binder进程间调用时,确定被调用进程是否为处于挂起状态的进程;若被调用进程为处于挂起状态的进程,则执行S200;若被调用进程为处于非挂起状态的进程,则执行S300。
S200:根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程,以用于进程调用。
S300:执行进程调用。
具体的,在Binder进程间调用中,通常包括调用进程和被调用进程,其中,调用进程为Binder进程间调用的发起者(调用者),被调用进程为在Binder进程间调用中被调用进程调用的进程(被调用者)。本申请提供的进程管理方法中,在Binder进程间调用中,对于处于挂起状态的被调用进程,当该被调用进程被调用时,可以根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否需要唤醒该进程,即对于不同的Binder进程间调用的通信类型,在需要唤醒时唤醒该被调用进程以用于进程调用,在不需要唤醒时,则可以不用唤醒该被调用进程,可以有效地减少被调用进程被唤醒,即可以有效地减少调用进程基于Binder进程间调用唤醒被调用进程,以避免进程被频繁唤醒,引起内存和功耗资源的消耗的问题,由此,可以减少内存及功耗资源的消耗。
示例性的,请参见图4,基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程,具体包括:
S210:确定Binder进程间调用的通信类型。
具体的,Binder进程间调用的通信类型包括Binder同步调用和Binder异步调用;若Binder进程间调用的通信类型为Binder同步调用,则执行S220:若Binder进程间调用的通信类型为Binder异步调用,则执行S230。
S220:根据预设的Binder进程间调用优先类型确定是否唤醒被调用进程以用于进程调用。
S230:缓存Binder进程间调用,并基于缓存的针对被调用进程的累积程度是否达到预设的累积程度标准或被调用进程的状态是否发生变化,以确定是否唤醒被调用进程以用于进程调用。
具体的,Binder进程间调用的通信类型包括Binder同步调用和Binder异步调用,其中Binder同步调用中调用进程调用被调用进程,需要等待被调用进程返回结果才能结束此次调用;异步binder调用为调用进程调用被调用进程,不需要等待被调用进程返回结果,类似通知机制。本申请基于不同的Binder进程间调用的通信类型设定不同的唤醒策略,对于Binder同步调用,可以根据预设的Binder进程间调用优先类型确定是否唤醒被调用进程以用于进程调用;对于Binder异步调用,可以缓存Binder进程间调用,并基于缓存的针对被调用进程的累积程度是否达到预设的累积程度标准或被调用进程的状态是否发生变化,以确定是否唤醒被调用进程以用于进程调用。由此,可以针对不同的Binder进程间调用的通信类型,制定不同的进程的唤醒策略,可以在满足不同的Binder进程间调用的通信类型的需求的基础上,可以有效地减少进程的唤醒。
示例性的,本申请的一种实现方式中,优先类型包括易用性优先,且若Binder进程间调用的优先类型为易用性优先,则唤醒被调用进程以用于进程调用。具体的,易用性优先则为优先考虑进程的使用便捷性,若Binder进程间调用的优先类型为易用性优先,则唤醒被调用进程以用于进程调用,由此可以保证对该被调用进程的使用需求。
示例性的,在本申请的一种可能的实现中,满足以下任一条件的Binder进程间调用的优先类型为易用性优先:被调用进程或调用被调用进程的调用进程对应的应用为通过用户界面被选择为允许后台活动的应用;被调用进程或调用被调用进程的调用进程对应的应用 为通过用户界面被选择为忽略功耗影响的应用;被调用进程或调用被调用进程的调用进程对应的应用为通过用户界面被选择为忽略内存影响的应用。
具体的,在一次Binder进程间调用中,若调用进程和被调用进程中的至少一个进程对应的应用为允许后台活动的应用,则认为本次Binder进程间调用的优先类型为易用性优先,需要唤醒被调用进程以用于进程调用。
同样的,在一次Binder进程间调用中,若调用进程和被调用进程中的至少一个进程对应的应用为通过用户界面被选择为忽略功耗影响的应用,或为通过用户界面被选择为忽略内存影响的应用,则认为本次Binder进程间调用的优先类型为易用性优先,需要唤醒被调用进程以用于进程调用。
具体的,前述忽略功耗影响的应用具体可以是指android系统中的忽略电池优化的应用。
需要说明的是,在Binder进程间调用中,用户可以通过用户界面对应用进行设置,例如对于一些高频使用应用,或者对于用户重要的应用,用户可以将其选择为允许后台活动/忽略功耗影响/忽略内存影响的应用,则在判断调用进程和被调用进程中的至少一个进程对应的应用,为允许后台活动/忽略功耗影响/忽略内存影响的应用时,为方便用户的使用,可以确定此次Binder进程间调用的类型为易用性优先,并唤醒被调用进程,以进行进程调用。
示例性的,本申请的一种实现方式中,优先类型包括功耗优先,且若Binder进程间调用的优先类型为功耗优先,则判断调用被调用进程的调用进程是否为核心进程,若调用进程为核心进程,则唤醒被调用进程;若调用进程为非核心进程,则不唤醒被调用进程。
具体的,功耗优先则为优先考虑进程尽量占用少的功耗,并且在判断Binder进程间调用的优先类型为功耗优先时,出于对基于该Binder进程间调用相关功能的正常使用的考虑,可以通过判断该调用进程是否为核心进程,由此决定是否唤醒被调用进程,若该调用进程为核心进程,为保证该Binder进程间调用相关功能的正常使用,则唤醒该被调用进程用于进程调用,若该调用进程为非核心进程,则即使不唤醒该被调用进程,也不影响用户的使用,因此,可以不唤醒该被调用进程。
需要说明的是,本申请中,Binder进程间调用的优先类型可以只包括前述易用性优先和功耗优先两种类型,在判断Binder进程间调用的优先类型时,可以只判断其是否为易用 性优先类型,若否,则认为其是功耗优先类型,或者可以只判断其是否为功耗优先类型,若否,则认为其是易用性优先类型。当然,也可以分别判断Binder进程间调用的优先类型是否为易用性优先类型和功耗优先类型,其可以根据需要具体选择和设置。
示例性的,本申请的一种实现方式中,满足以下任一条件的调用进程为核心进程:
调用进程对应的应用为通过应用白名单配置的应用。具体的,通过判断调用进程对应的应用是否为通过操作系统中的应用白名单(Application Whitelisting)配置的应用,可以确定调用进程是否为核心进程,若调用进程对应的应用为通过系统中的应用白名单配置的应用,则认为该调用进程为核心进程。
调用进程为前台进程,且被用户正在前台使用。具体的,通过判断调用进程是否为被用户正在前台使用的前台进程可以确定调用进程是否为核心进程,若调用进程为前台进程,且被用户正在前台使用的进程,则认为该调用进程为核心进程。
操作系统中调用进程的ADJ值小于前台进程的ADJ值。具体的,可以将操作系统中调用进程的ADJ值于前台进程的ADJ值进行比较,若调用进程的ADJ值小于前台进程的ADJ值,则认为该调用进程为核心进程。
操作系统中调用进程为不在后台进程调度分组(SCHED_GROUP_BACKGROUND)中的进程。具体的,处于后台进程调度分组中的进程未非核心进程,则通过判断调用进程是否处于后台进程调度分组中,可以确定调用进程是否为核心进程,若调用进程位于该后台进程调度分组中,则认为调用进程为非核心进程,若调用进程非处于该后台进程调度分组中,则该调用进程为核心进程。
调用进程对应的应用的UID小于预设的UID。具体的,该预设的UID的具体可以是操作系统中的第一应用分配UID(FIRST_APPLICATION_UID),具体的,若操作系统为android系统,则该FIRST_APPLICATION_UID为10000。当然,该预设的UID的具体值可以根据具体的选择和设置。
调用进程为操作系统中前台服务的进程。具体的,可以通过判断调用进程是否为操作系统中前台服务的进程,以判断该调用进程是否为核心进程,若调用进程为操作系统中的前台服务的进程,则认为该调用进程为核心进程。
调用进程为当前进行后台可感知业务的进程。具体的,可以通过判断调用进程是否为当前进行后台可感知业务的进程,以判断该调用进程是否为核心进程,若调用进程为当前 进行后台可感知业务的进程,则认为该调用进程为核心进程。当前进行后台可感知业务的进程通常包括音乐播放、录音、下载、导航等应用对应的进程。
需要说明的是,判断调用进程是否是核心进程,具体可以判断调用进程是否满足前述任意一项,且只要满足其中任意一项,则认为调用进程为核心进程。若调用进程不满足前述任意一项,则认为调用进程为非核心进程。
前述操作系统具体可以是android OS,也可以是iOS,或者其他类型的操作系统。
进一步地,也可以根据需要设置其他用于判断调用进程是否为核心进程的条件。
示例性的,本申请的一种实现方式中,若调用进程为核心进程,则唤醒被调用进程,以用于进程调用;若调用进程为非核心进程,则不唤醒被调用进程,并进一步还包括:将调用进程的状态标识为挂起状态,和/或将调用进程对应的应用的状态标识为挂起状态。
具体的,本申请中,若调用进程为非核心进程,则即使不执行该Binder进程间调用,也不影响用户的当前使用,出于节省内存和/或降低功耗的考虑,在不唤醒被调用进程的基础上,可以将调用该被调用进程的调用进程的状态标识为挂起状态,并且将调用进程对应的应用的状态标识为挂起状态,或者也可以只将调用进程的状态标识为挂起状态,或者只将调用进程对应的应用的状态标识为挂起状态,其可以根据需要具体选择设置。
进一步地,对于通信类型为Binder异步调用方式的Binder进程间调用,为避免进程被频繁唤醒,则可以暂时缓存针对被调用进程的调用,在达到一定的唤醒条件时,再唤醒该被调用进程。进一步地,当该被调用进程被唤醒时,可以执行该缓存的Binder进程间调用。
示例性的,本申请的一种实现方式中,若Binder进程间调用的通信类型为Binder异步调用,则缓存该Binder进程间调用,并且缓存Binder进程间调用,包括:缓存针对被调用进程的调用关系至异步调用缓存器中。具体的,电子设备中通常设置有异步调用缓存器,缓存针对Binder异步调用方式的Binder进程间调用,具体可以是将该Binder进程间调用缓存至异步调用缓存器中。
示例性的,Binder进程间调用在异步调用缓存器中的缓存状态具体可以如图5所示。其中,B为被调用进程,A、C皆为调用该被调用进程B的调用进程,缓存针对该被调用进程B的调用关系至异步调用缓存器中,具体为缓存“A call B”、“C call B”等调用关系至该异步缓存器中。
进一步地,该异步调用缓存器具体为FIFO(First Input First Output,先进先出)缓存器。
需要说明的是,当存在需要缓存多个不同的调用进程对被调用进程的Binder进程间调用时,依次将各Binder进程间调用缓存至该异步调用缓存器。
示例性的,本申请的一种实现方式中,若缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,或被调用进程的状态由挂起状态转换为活跃状态,则唤醒被调用进程。
示例性的,本申请的一种实现方式中,缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准可以是针对被调用进程的异步调用缓存器的存储总量超过预设的存储阈值。具体的,如果针对被调用进程的异步调用缓存器的存储总量超过预设的存储阈值,则认为缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准。该预定阈值具体可以是针对被调用进程的异步调用缓存器的存储容量的四分之三,当然其可以根据需要具体设置。更为详细的,异步调用缓存器的存储容量为512k,该预设的存储阈值具体可以是384k,若异步调用缓存器的当前的存储总量为300k,则可以继续缓存针对被调用进程的Binder进程间调用,若异步调用缓存器的当前的存储总量为384k,则不能继续缓存针对被调用进程的Binder进程间调用,此时唤醒该被调用进程。
本申请的一种实现方式中,缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,也可以是针对被调用进程的异步调用缓存器的可用存储空间小于预设的存储空间阈值。具体的,如果针对被调用进程的异步调用缓存器的可用存储空间小于预设的存储空间阈值,则认为缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准。该预设的存储空间阈值具体可以是针对被调用进程的异步调用缓存器的存储总量的四分之一,当然其可以根据需要具体设置。更为详细的,异步调用缓存器的存储容量为512k,该预设的存储空间阈值具体可以是128k,若异步调用缓存器的当前的可用存储空间为200k,则可以继续缓存针对被调用进程的Binder进程间调用,若异步调用缓存器的当前的可用存储空间为128k,则不能继续缓存针对被调用进程的Binder进程间调用,此时唤醒该被调用进程。
本申请的一种实现方式中,缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,还可以是针对被调用进程的缓存调用次数达到预设的缓存调用次数阈值。具体的,预设的缓存调用次数阈值具体可以是100次,当缓存的针对被调用进程的调用次数达到100次时,认为缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,此 时唤醒被调用进程,进一步地,该唤醒的被调用进程可以用于进程调用。需要说明的是,预设的缓存调用次数阈值可以是100次,其也可以是根据需要设置的其他数值。
本申请的一种实现方式中,缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,还可以是针对被调用进程的缓存调用时间达到预设的缓存调用时间阈值。具体的,预设的缓存调用时间阈值具体可以是30min,当缓存的针对被调用进程的缓存调用时间达到30min时,认为缓存的针对被调用进程的缓存的累积程度达到预设的累积程度标准,此时唤醒被调用进程,进一步地,该唤醒的被调用进程可以用于进程调用。需要说明的是,预设的缓存调用时间阈值可以是30min,当然其也可以是根据需要设置的其他数值。
示例性的,本申请的一种实现方式中,被调用进程被唤醒后,还包括:将被调用进程的状态由挂起状态转换为活跃状态,且将被调用进程对应的应用的状态由挂起状态转换为活跃状态。具体的,当被调用进程被唤醒后,将被调用进程的状态由挂起状态转换为活跃状态,且将被调用进程对应的应用的状态由挂起状态转换为活跃状态,以使被调用进程可以用于进程调用。
具体的,对于缓存在异步调用缓存器中的Binder进程间调用,在满足上述被调用进程唤醒条件时,还需要从该异步调用缓存器中的缓存的Binder进程间调用的列表中将针对该被调用进程的缓存删除。
示例性的,本申请的一种实现方式中,确定被调用进程是否为处于挂起状态的进程,包括:判断被调用进程的进程标识信息是否位于预设的管理进程列表中;管理进程列表包括与处于挂起状态的应用对应的进程的进程标识信息;若被调用进程的进程标识信息位于管理进程列表中,则被调用进程为处于挂起状态的进程;若被调用进程的进程标识信息未位于管理进程列表中,则被调用进程为处于非挂起状态的进程。
具体的,可以预先设置管理进程列表,将处于挂起状态的进程的进程标识信息加入该管理进程列表中,即管理进程列表中包括处于挂起状态的进程的进程标识信息。在判断被调用进程是否为处于挂起状态的进程时,通过判断该被调用进程的进程标识是否位于该管理进程列表中,则可以方便地确定该调用进程是否为处于挂起状态的进程。
示例性的,本申请的一种实现方式中,进程标识信息可以只包括进程ID,比如“进程A—ID”、“进程B—ID”、“进程C—ID”等。或者进程标识信息也可以只包括与处于挂起状态的进程对应的处于挂起状态的应用的UID,比如“应用1—UID”、“应用2—UID”、“应 用3—UID”等。或者该进程标识信息可以同时包括进程ID和与进程对应的应用的UID,比如“应用1—UID+进程A—ID”、“应用2—UID+进程B—ID”、“应用3—UID+进程C—ID&进程D—ID”以及“应用4—UID+进程C—ID&进程A—ID&进程E—ID”等。其可以根据需要具体选择设置。
示例性的,本申请的一种实现方式中,处于挂起状态的应用,包括:进入后台后,在预设时间内无可感知业务的应用。对于进入后台后,在预设时间内无可感知业务的应用,为避免该应用继续占用内存及产生功耗,可以将该应用的状态转换为挂起状态,并将该应用对应的进程的状态转换为挂起状态,由此可以避免内存及功耗资源的消耗。当然,该处于挂起状态的应用具体也可以是系统未激活的应用等其他处于挂起状态的应用。
具体的,请参见图6,本申请中对应用及进程的状态进行管理具体包括:
S610:应用退后台,且处于活跃状态。
S620:在预设时间内是否无感知业务,若无,则执行步骤S630;如有,则继续执行步骤S620。
S630:将应用的状态标识为挂起状态。执行步骤S640。
S640:将应用对应的进程的状态标识为挂起状态,且将该应用对应的进程的进程ID加入管理进程列表中。
具体的,应用退后台后,先进入活跃状态,检测预设时间T内应用是否无可感知业务,若检测到应用在预设时间T内无可感知业务,则将应用的状态标识为挂起状态,应用进程处于挂起状态后将该应用对应的进程的进程ID加入预先设置的管理进程列表中。
需要说明的是,该预设时间可以根据需要具体设置,比如具体可以是5min,10min等。
进一步地,本申请中对应用及进程的状态进行管理还包括:判断处于挂起状态的进程或应用的状态是否转换为活跃状态,若处于挂起状态的进程的状态转换为活跃状态后,将进程的进程标识信息从管理进程列表中移除;和/或处于挂起状态的应用的状态转换为活跃状态后,将应用对应的进程的进程标识信息从管理进程列表中移除。
具体的,当处于挂起状态的进程的状态转换为活跃状态后,为保证进程的正常调用,可以将进程的进程标识信息从管理进程列表中移除。或者处于挂起状态的应用的状态转换为活跃状态后,为保证与该应用对应的进程的正常调用,可以将应用对应的进程的进程标识信息从管理进程列表中移除。由此,可以实时得对进程和/或应用的状态进行管理,以方 便用户的使用。
进一步地,对于前述进入后台后,处于挂起状态的进程,若该应用被启动到前台,则将该应用的状态标识为活跃状态,且将该应用对应的进程的状态标识为活跃状态。或者进程被进行了binder调用时,将切换到活跃状态。
请参见图7,图7示出了本申请提供的一种进程管理装置的模块示意图。
本申请的一种实现方式中,进程管理装置包括:Binder进程间调用管理模块710,Binder进程间调用管理模块710用于在进行Binder进程间调用时,确定Binder进程间调用中的被调用进程是否为进入后台处于挂起状态的进程;并在确定被调用进程为处于挂起状态的进程时,根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程以用于进程调用;在确定被调用进程为处于非挂起状态的进程时,执行进程调用。即Binder进程间调用管理模块710可以用于执行前述步骤S100~S300对应的进程管理方法。
本申请的另一种实现方式中,进程管理装置还包括:应用模块720和应用管理模块730;应用管理模块730用于对应用模块720中的应用的状态和应用对应的进程的状态进行管理,具体的,应用管理模块730用于确定应用模块720中进入后台的应用在预设时间内是否无可感知业务,若无,则将应用的状态标识为挂起状态;若有,则将应用的状态标识为活跃状态;针对标识为挂起状态的应用,应用管理模块730还用于将应用对应的进程的状态标识为挂起状态,并通知Binder进程间调用管理模块710将进程的进程标识信息加入Binder进程间调用管理模块710中预设的管理进程列表中。
本申请的一种实现方式中,应用管理模块730还用于:当被调用进程被唤醒后,通知Binder进程间调用管理模块710将被调用进程的进程标识信息从管理进程列表中删除。
本申请的一种实现方式中,应用管理模块730还用于:当被调用进程被唤醒后,将被调用进程的状态由挂起状态转换为活跃状态,和/或将被调用进程对应的应用的状态由挂起状态转换为活跃状态。
本申请的一种实现方式中,应用管理模块730还用于:当调用被调用进程的调用进程的状态被标识为挂起状态时,将调用进程对应的应用的状态标识为挂起状态。
进一步地本申请提供的进程管理装置中,还可以包括Binder驱动模块,Binder驱动模块是实现Binder进程间调用的核心模块,用于执行Binder进程间调用等相关Binder进程间调用处理。
需要说明的是,本申请提供的进程管理装置包括用于分别执行前述进程管理方法中的各步骤的Binder进程间调用管理模块710、应用模块720和应用管理模块730,该Binder进程间调用管理模块710、应用模块720和应用管理模块730分别用于执行对应的步骤,因此,对于相同部分,此处不再赘述。
进一步地,请参见图8,图8示出了一种进程管理方法,其具体包括:
S810:A进程Binder进程间调用B进程。
S820:判断B进程是否为处于挂起状态的进程。若是,则执行S830;若否,则执行S890。
具体的,判断B进程是否为处于挂起状态的进程,具体可以是前述的Binder进程间调用管理模块710通过前述的用于确定被调用进程是否为处于挂起状态的进程的方式确定,此处不再赘述。
S830:判断通信类型。
具体的,Binder进程间调用管理模块710判断A进程Binder进程间调用B进程的通信类型,若通信类型为Binder同步调用,则执行S840;若通信类型为Binder异步调用则执行S850。
S840:判断优先类型。
具体的,若通信类型为Binder同步调用,则Binder进程间调用管理模块710判断A进程Binder进程间调用B进程的优先类型,若优先类型为易用性优先,则Binder进程间调用管理模块710执行S870;若优先类型为功耗优先,则Binder进程间调用管理模块710执行S860。
S850:缓存进行调用。
具体的,若通信类型为Binder异步调用,Binder进程间调用管理模块710缓存A进程对B进程的Binder进程间调用。其缓存具体可以是缓存至如图5所示的异步缓存器中。
进一步地,缓存A进程对B进程的Binder进程间调用之后,还包括,在满足预设条件时Binder进程间调用管理模块710执行S870,以唤醒进程B。该预设条件具体可以是前述的针对被调用进程B的累积程度是否达到预设的累积程度标准或被调用进程B的状态是否发生变化,以确定是否唤醒被调用进程B以用于进程调用的条件,此处不再赘述。
S860:判断A进程是否为核心进程。若是,执行S870;若否,执行S880。
S870:唤醒B进程。
S880:不唤醒B进程,且挂起A进程。
S890:执行进程调用。
本实现方式提供的进程管理方法,在Binder进程间调用中,对于被调用进程B进程,先判断B进程是否为挂起状态的进程,若B进程为挂起状态的进程,则根据预设的唤醒策略判断是否唤醒该B进程,若B进程为非挂起状态(活跃状态)的进程,则执行进程调用。具体的,该唤醒策略包括先判断本次Binder进程间调用的通信类型为Binder同步调用还是Binder异步调用。
若本次Binder进程间调用的通信类型为Binder同步调用,则进一步判断本次Binder进程间调用的优先类型,根据确定的优先类型确定是否唤醒B进程。具体的,若优先类型为易用性优先,则立即唤醒B进程,处理Binder进程间调用。若优先类型为功耗优先,则进一步判断A进程是否为核心进程,如果A进程不是核心进程,则不唤醒B进程,且同时将A进程挂起(休眠),暂停本次Binder进程间调用;若A进程是核心进程,则唤醒B进程,处理Binder进程间调用。
若本次Binder进程间调用的通信类型为Binder异步调用,则缓存本次Binder进程间调用至针对B进程的异步缓存器中,待满足预设的唤醒条件时,唤醒B进程以用于进程调用。
进一步地,唤醒B进程后,应用管理模块730将B进程的状态从挂起状态转换为活跃状态。进一步地,该应用管理模块730还可以将B进程对应的应用的状态从挂起状态转换为活跃状态。
进一步地,将A进程挂起后,应用管理模块730将A进程的状态从活跃状态转换为挂起状态。进一步地,应用管理模块730还可以将A进程对应的应用的状态从活跃状态转换为挂起状态。
若缓存了多个针对该B进程的Binder进程间调用,则在唤醒B进程后,由B进程依次处理缓存的所有针对B进程的Binder进程间调用。
本实现方式提供的进程管理方法,在Binder进程间调用中,通过设置的前述基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒被调用进程,相比于现有技术中,在发生Binder进程间调用时直接唤醒被调用进程以用于进程调用的方法,可以有效地减少进程被 唤醒的次数,以减少内存占用和功耗资源的损耗,而且还能满足用户的正常使用需求。
参见图9,图9所示为根据本申请的一实施方式提供的电子设备900的结构示意图。电子设备900可以包括耦合到控制器中枢904的一个或多个处理器901。对于至少一个实施例,控制器中枢904经由诸如前端总线(FSB)之类的多分支总线、诸如快速通道互连(QPI)之类的点对点接口、或者类似的连接与处理器901进行通信。处理器901执行控制一般类型的数据处理操作的指令。在一实施例中,控制器中枢904包括,但不局限于,图形存储器控制器中枢(GMCH)(图中未示出)和输入/输出中枢(IOH)(其可以在分开的芯片上)(图中未示出),其中GMCH包括存储器和图形控制器并与IOH耦合。
电子设备900还可包括耦合到控制器中枢904的协处理器906和存储器902。或者,存储器902和GMCH中的一个或两者可以被集成在处理器901内(如本申请中所描述的),存储器902和协处理器906直接耦合到处理器901以及控制器中枢904,控制器中枢904与IOH处于单个芯片中。
存储器902可以是例如动态随机存取存储器(DRAM)、相变存储器(PCM)或这两者的组合。
在一个实施例中,协处理器906是专用处理器,诸如例如高吞吐量MIC处理器、网络或通信处理器、压缩引擎、图形处理器、GPGPU、或嵌入式处理器等等。协处理器906的任选性质用虚线表示在图9中。
在一个实施例中,电子设备900可以进一步包括网络接口(NIC)903。网络接口903可以包括收发器,用于为电子设备900提供无线电接口,进而与任何其他合适的设备(如前端模块,天线等)进行通信。在各种实施例中,网络接口903可以与电子设备900的其他组件集成。网络接口903可以实现上述实施例中的通信单元的功能。
电子设备900可以进一步包括输入/输出(I/O)设备905。输入/输出(I/O)设备905可以包括:用户界面,该设计使得用户能够与电子设备900进行交互;外围组件接口的设计使得外围组件也能够与电子设备900交互;和/或传感器设计用于确定与电子设备900相关的环境条件和/或位置信息。
值得注意的是,图9仅是示例性的。即虽然图9中示出了电子设备900包括处理器901、控制器中枢904、存储器902等多个器件,但是,在实际的应用中,使用本申请各方法的设备,可以仅包括电子设备900各器件中的一部分器件,例如,可以仅包含处理器901和 NIC903。图9中可选器件的性质用虚线示出。
在该电子设备900的存储器中可以包括用于存储数据和/或指令的一个或多个有形的、非暂时性计算机可读介质。计算机可读存储介质中存储有指令,具体而言,存储有该指令的暂时和永久副本。
本申请中,该电子设备900具体可以是前述的手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)或台式电脑等终端设备。该电子设备的存储器中存储的指令可以包括:由处理器中的至少一个单元执行时导致电子设备实施如前述提到的进程管理方法的指令。
参见图10,图10所示为根据本申请的一实施方式提供的SoC(System on Chip,片上系统)1000的结构示意图。在图10中,相似的部件具有同样的附图标记。另外,虚线框是更先进的SoC1000的可选特征。该SoC 1000可以被用于根据本申请的任一电子设备,根据其所在的设备不同以及其内所存储的指令的不同,可以实现相应的功能。
在图10中,SoC1000包括:互连单元1002,其被耦合至处理器1001;系统代理单元1006;总线控制器单元1005;集成存储器控制器单元1003;一组或一个或多个协处理器1007,其可包括集成图形逻辑、图像处理器、音频处理器和视频处理器;SRAM(静态随机存取存储器)单元1008;DMA(直接存储器存取)单元1004。在一个实施例中,协处理器1007包括专用处理器,诸如例如网络或通信处理器、压缩引擎、GPGPU、高吞吐量MIC处理器、或嵌入式处理器等等。
SRAM单元1008中可以包括用于存储数据和/或指令的一个或多个计算机可读介质。计算机可读存储介质中可以存储有指令,具体而言,存储有该指令的暂时和永久副本。该指令可以包括:由处理器中的至少一个单元执行时导致电子设备实施如前述所提到的进程管理方法的指令。
本申请公开的机制的各实施例均可以以软件、硬件、固件或这些实现方法的组合等方式实现。本申请的实施例可实现为在可编程系统上执行的计算机程序或程序代码,该可编程程序包括至少一个处理器、存储器(或存储系统,包括易失性和非易失性存储器和/或存储单元)。
可将程序代码应用于输入指令,以执行文本描述的各功能并生成输出信息。可以按已知方式将输出信息应用于一个或多个输出设备。可以理解,在本申请的实施例中,处理系 统可以是微处理器、数字信号处理器(DSP)、微控制器、专用集成电路(ASIC)等,和/或其任何组合。根据另一方面,处理器可以是单核处理器、多核处理器等,和/或其任何组合。
程序代码可以用高级程序化语言或面向对象的编程语言来实现,以便与处理器通信。在需要时,也可用汇编语言或机器语言来实现程序代码。事实上,文本中描述的机制不限于任何特定编程语言的范围。在任一情形下,该语言可以是编译语言或解释语言。
在一些情况下,所公开的实施例可以以硬件、固件、软件或其他任何组合来实现。所公开的实施例可以被实现为一个或多个暂时或非暂时性及其可读(例如,计算机可读)存储介质承载或存储在其上的指令,其可以由一个多个处理器读取和执行。例如,指令通过网络或气压计算机可读取介质分发。因此,机器可读取介质可以包括用于机器(例如,计算机)可读的形式存储或传输信息的任何机制,包括但不限于,软盘、光盘、光碟、只读存储器(CD-ROMs)、磁光盘、只读存储器(ROM)、随机存取存储器(RAM)、可擦除可编程只读存储器(EPROM)、电可擦除可编程只读存储器(EEPROM)、磁卡或光卡、闪卡、或用于利用因特网以电、光、声或其他形式的传播信号来传输信息(例如,载波、红外信号数字等)的有形的机器可读取存储器。因此,机器可读取介质包括适合于以机器可读的形式存储或传输电子指令或信息的任何类型的机器可读介质。
至少一个实施例的一个或多个方面可以由存储在计算机可读取存储介质上的表示性指令来实现,指令表示处理器中的各种逻辑,指令在被机器读取时使得该机制作用于执行文本所述的技术的逻辑。被称为“IP核”的这些表示可以被存储在有形的计算机可读取存储介质上,并被提供给多个客户或生产设备实施以加载到实际制造该逻辑或处理器的制造机器中。
在一些情况下,指令转换器可用来将指令从源指令集转移至目标指令集。例如,指令转换器可以变换(例如使用静态二进制变换、包括动态编译的动态二进制变换)、变形、仿真或以其他方式将指令转换成由核来处理的一个或多个其他指令。指令转换器可以用软件、硬件、固件、或其他组合实现。指令转换器可以在处理器上、在处理器外、或者部分在处理器上且部分在处理器外。
需要说明的是,如本文所使用的,术语“模块”可以指代或者专用集成电路(ASIC)、电子电路、执行一个或多个软件或固件程序的处理器(共享、专用或群组)和/或存储器、 组合逻辑电路、和/或提供所描述的功能的其他适当硬件组件,或者可以作为这些硬件组合的一部分。即本申请各设备实施例中的各模块都是逻辑模块,在物理上,一个逻辑模块可以是一个物理单元,也可以是一个物理单元的一部分,还可以是多个物理单元的组合实现。另外,本申请上述各设备实施例并没有将于解决本申请所提出的技术问题关系不太密切的模块引入,这并不表明上述设备实施例并不存在其他的模块。
需要说明的是,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
需要说明的是,在附图中,可以以特定布置和/或顺序示出一些结构或方法特征。然而,应该理解,可能不需要这样的特定布置和/或排序。而是,在一些实施例中,这些特征可以以不同于说明性附图中所示的方式和/或顺序来布置。另外,在特定图中包括结构或方法特征并不意味着暗示在所有实施例中都需要这样的特征,并且在一些实施例中,可以不包括这些特征或者可以与其他特征组合。
虽然通过参照本申请的某些优选实施方式,已经对本申请进行了图示和描述,但本领域的普通技术人员应该明白,以上内容是结合具体的实施方式对本申请所作的进一步详细说明,不能认定本申请的具体实施只局限于这些说明。本领域技术人员可以在形式上和细节上对其作各种改变,包括做出若干简单推演或替换,而不偏离本申请的精神和范围。

Claims (22)

  1. 一种进程管理方法,其特征在于,包括:
    在进行Binder进程间调用时,确定被调用进程是否为处于挂起状态的进程;
    若所述被调用进程为处于挂起状态的进程,则根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒所述被调用进程,以用于进程调用;
    若所述被调用进程为处于非挂起状态的进程,则执行进程调用。
  2. 根据权利要求1所述的进程管理方法,其特征在于,根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒所述被调用进程,以用于进程调用,包括:
    确定所述Binder进程间调用的通信类型;所述通信类型包括Binder同步调用和Binder异步调用;
    若所述Binder进程间调用的通信类型为Binder同步调用,则根据预设的Binder进程间调用的优先类型确定是否唤醒所述被调用进程以用于进程调用;
    若所述Binder进程间调用的通信类型为Binder异步调用,则缓存所述Binder进程间调用,并基于缓存的针对所述被调用进程的累积程度是否达到预设的累积程度标准或所述被调用进程的状态是否发生变化,以确定是否唤醒所述被调用进程以用于进程调用。
  3. 根据权利要求2所述的进程管理方法,其特征在于,所述优先类型包括易用性优先,且若所述Binder进程间调用的优先类型为易用性优先,则唤醒所述被调用进程以用于进程调用。
  4. 根据权利要求3所述的进程管理方法,其特征在于,满足以下任一条件的所述Binder进程间调用的优先类型为易用性优先:
    所述被调用进程或调用所述被调用进程的调用进程对应的应用为通过用户界面被选择为允许后台活动的应用;
    所述被调用进程或调用所述被调用进程的调用进程对应的应用为通过用户界面被选择为忽略功耗影响的应用;
    所述被调用进程或调用所述被调用进程的调用进程对应的应用为通过用户界面被选 择为忽略内存影响的应用。
  5. 根据权利要求2所述的进程管理方法,其特征在于,所述优先类型包括功耗优先,且若所述Binder进程间调用的优先类型为功耗优先,则判断调用所述被调用进程的调用进程是否为核心进程,若所述调用进程为核心进程,则唤醒所述被调用进程;若所述调用进程为非核心进程,则不唤醒所述被调用进程。
  6. 根据权利要求5所述的进程管理方法,其特征在于,满足以下任一条件的所述调用进程为核心进程:
    所述调用进程对应的应用为通过应用白名单配置的应用;
    所述调用进程为前台进程,且被用户正在前台使用;
    操作系统中所述调用进程的ADJ值小于前台进程的ADJ值;
    操作系统中所述调用进程为不在后台进程调度分组中的进程;
    所述调用进程对应的应用的UID小于预设的UID;
    所述调用进程为操作系统中前台服务的进程;
    所述调用进程为当前进行后台可感知业务的进程。
  7. 根据权利要求5所述的进程管理方法,其特征在于,若所述调用进程为非核心进程,则不唤醒所述被调用进程,并进一步还包括:将所述调用进程的状态标识为挂起状态,和/或将所述调用进程对应的应用的状态标识为挂起状态。
  8. 根据权利要求2所述的进程管理方法,其特征在于,缓存所述Binder进程间调用,包括:缓存针对所述被调用进程的调用关系至异步调用缓存器中。
  9. 根据权利要求8所述的进程管理方法,其特征在于,若缓存的针对所述被调用进程的缓存的累积程度达到预设的累积程度标准,或所述被调用进程的状态由挂起状态转换为活跃状态,则唤醒所述被调用进程。
  10. 根据权利要求9所述的进程管理方法,其特征在于,缓存的针对所述被调用进程的缓存的累积程度达到预设的累积程度标准,包括:
    针对所述被调用进程的所述异步调用缓存器的存储总量超过预设的存储阈值;或
    针对所述被调用进程的所述异步调用缓存器的可用存储空间小于预设的存储空间阈值;或
    针对所述被调用进程的缓存调用次数达到预设的缓存调用次数阈值;或
    针对所述被调用进程的缓存调用时间达到预设的缓存调用时间阈值。
  11. 根据权利要求1所述的进程管理方法,其特征在于,所述被调用进程被唤醒后,还包括:将所述被调用进程的状态由挂起状态转换为活跃状态,且将所述被调用进程对应的应用的状态由挂起状态转换为活跃状态。
  12. 根据权利要求1-11任一项所述的进程管理方法,其特征在于,确定所述被调用进程是否为处于挂起状态的进程,包括:
    判断所述被调用进程的进程标识信息是否位于预设的管理进程列表中;所述管理进程列表包括与处于挂起状态的应用对应的进程的进程标识信息;
    若所述被调用进程的进程标识信息位于所述管理进程列表中,则所述被调用进程为处于挂起状态的进程;若所述被调用进程的进程标识信息未位于所述管理进程列表中,则所述被调用进程为处于非挂起状态的进程。
  13. 根据权利要求12所述的进程管理方法,其特征在于,所述进程标识信息包括进程ID和/或与进程对应的应用的UID。
  14. 根据权利要求12所述的进程管理方法,其特征在于,所述处于挂起状态的应用,包括:进入后台后,在预设时间内无可感知业务的应用。
  15. 根据权利要求12所述的进程管理方法,其特征在于,进一步包括,处于挂起状态的进程的状态转换为活跃状态后,将所述进程的进程标识信息从所述管理进程列表中移除; 和/或
    处于挂起状态的应用的状态转换为活跃状态后,将所述应用对应的进程的进程标识信息从所述管理进程列表中移除。
  16. 一种进程管理装置,其特征在于,包括:Binder进程间调用管理模块,
    所述Binder进程间调用管理模块用于在进行Binder进程间调用时,确定被调用进程是否为处于挂起状态的进程;并在确定所述被调用进程为处于挂起状态的进程时,根据预设的基于Binder进程间调用的通信类型的唤醒策略确定是否唤醒所述被调用进程以用于进程调用;在确定所述被调用进程为处于非挂起状态的进程时,执行进程调用。
  17. 根据权利要求16所述的进程管理装置,其特征在于,还包括:应用模块和应用管理模块;
    所述应用管理模块用于确定所述应用模块中进入后台的应用在预设时间内是否无可感知业务,若无,则将所述应用的状态标识为挂起状态;若有,则将所述应用的状态标识为活跃状态;
    针对标识为挂起状态的应用,所述应用管理模块还用于将所述应用对应的进程的状态标识为挂起状态,并通知所述Binder进程间调用管理模块将处于挂起状态的进程的进程标识信息加入所述Binder进程间调用管理模块中预设的管理进程列表中。
  18. 根据权利要求17所述的进程管理装置,其特征在于,所述应用管理模块还用于:当所述被调用进程被唤醒后,通知所述Binder进程间调用管理模块将所述被调用进程的进程标识信息从所述管理进程列表中删除。
  19. 根据权利要求18所述的进程管理装置,其特征在于,所述应用管理模块还用于:当所述被调用进程被唤醒后,将所述被调用进程的状态由挂起状态转换为活跃状态,和/或将所述被调用进程对应的应用的状态由挂起状态转换为活跃状态。
  20. 根据权利要求16所述的进程管理装置,其特征在于,所述应用管理模块还用于: 当调用所述被调用进程的调用进程的状态被标识为挂起状态时,将所述调用进程对应的应用的状态标识为挂起状态。
  21. 一种电子设备,其特征在于,包括:
    存储器,用于存储计算机程序,所述计算机程序包括程序指令;
    处理器,用于执行所述程序指令,以使所述电子设备执行如权利要求1-15任一项所述的进程管理方法。
  22. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令被计算机运行以使计算机执行如权利要求1-15任一项所述的进程管理方法。
PCT/CN2020/135760 2019-12-17 2020-12-11 进程管理方法和装置、电子设备 WO2021121161A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP20901585.8A EP4057140A4 (en) 2019-12-17 2020-12-11 PROCESS MANAGEMENT METHOD AND APPARATUS, AND ELECTRONIC DEVICE

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911302697.7 2019-12-17
CN201911302697.7A CN112988375B (zh) 2019-12-17 2019-12-17 进程管理方法和装置、电子设备

Publications (1)

Publication Number Publication Date
WO2021121161A1 true WO2021121161A1 (zh) 2021-06-24

Family

ID=76342306

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/135760 WO2021121161A1 (zh) 2019-12-17 2020-12-11 进程管理方法和装置、电子设备

Country Status (3)

Country Link
EP (1) EP4057140A4 (zh)
CN (1) CN112988375B (zh)
WO (1) WO2021121161A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309547B (zh) * 2022-07-31 2023-08-29 荣耀终端有限公司 处理异步binder调用的方法和装置
CN118034789A (zh) * 2022-11-07 2024-05-14 蔚来移动科技有限公司 一种进程管理方法、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902583A (zh) * 2011-09-12 2013-01-30 微软公司 在挂起状态和执行状态下管理进程
CN102999384A (zh) * 2011-09-12 2013-03-27 微软公司 在挂起状态和执行状态下管理进程
US20130347002A1 (en) * 2012-06-21 2013-12-26 Microsoft Corporation Performant runtime pause with no cpu utilization
CN109032814A (zh) * 2018-06-29 2018-12-18 Oppo(重庆)智能科技有限公司 一种移动终端及其进程间通信的监控方法、存储介质
CN109445917A (zh) * 2018-10-16 2019-03-08 Oppo广东移动通信有限公司 应用处理方法和装置、电子设备、计算机可读存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109992309B (zh) * 2017-12-29 2021-03-12 Oppo广东移动通信有限公司 应用程序处理方法和装置、电子设备、计算机可读存储介质
CN109992393A (zh) * 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 应用处理方法和装置、电子设备、计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902583A (zh) * 2011-09-12 2013-01-30 微软公司 在挂起状态和执行状态下管理进程
CN102999384A (zh) * 2011-09-12 2013-03-27 微软公司 在挂起状态和执行状态下管理进程
US20130347002A1 (en) * 2012-06-21 2013-12-26 Microsoft Corporation Performant runtime pause with no cpu utilization
CN109032814A (zh) * 2018-06-29 2018-12-18 Oppo(重庆)智能科技有限公司 一种移动终端及其进程间通信的监控方法、存储介质
CN109445917A (zh) * 2018-10-16 2019-03-08 Oppo广东移动通信有限公司 应用处理方法和装置、电子设备、计算机可读存储介质

Non-Patent Citations (1)

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

Also Published As

Publication number Publication date
CN112988375B (zh) 2024-04-09
EP4057140A4 (en) 2022-12-07
EP4057140A1 (en) 2022-09-14
CN112988375A (zh) 2021-06-18

Similar Documents

Publication Publication Date Title
CN107003948B (zh) 电子设备及用于控制其可共享的高速缓存存储器的方法
WO2021121161A1 (zh) 进程管理方法和装置、电子设备
US11822958B2 (en) Method and a device for data transmission between an internal memory of a system-on-chip and an external memory
CN108566634B (zh) 降低蓝牙音箱连续唤醒延时的方法、装置及蓝牙音箱
CN109074331B (zh) 具有系统高速缓存和本地资源管理的功率降低存储器子系统
JP2009527828A (ja) マルチプロセッサのアプリケーションサポートのためのシステムおよび方法
EP2893444A1 (en) Quota-based resource management
WO2021036370A1 (zh) 预读取文件页的方法、装置和终端设备
WO2021047120A1 (zh) 一种fpga异构加速卡集群中的资源调度方法、设备及介质
CN112799696B (zh) 固件升级方法和相关设备
JP2014503103A (ja) 階層的キャッシュ設計におけるキャッシュ間の効率的通信のための方法および装置
CN116909943B (zh) 一种缓存访问方法、装置、存储介质及电子设备
US9489305B2 (en) System and method for managing bandwidth and power consumption through data filtering
WO2021164560A1 (zh) 一种多核芯片及其调度方法
WO2011131003A1 (zh) 实现手机缓冲存储器机制的系统及手机操作系统加载方法
US10838763B2 (en) Network interface device and host processing device
CN207424866U (zh) 一种基于异构多核处理器的内核之间的数据通讯系统
CN102929800A (zh) Cache一致性协议派生处理方法
CN113961261B (zh) 休眠管理方法、装置、电子设备及存储介质
US9354812B1 (en) Dynamic memory utilization in a system on a chip
KR20040067063A (ko) 디지털 신호 처리장치의 저전력 소비형 캐시 메모리 장치및 이에 대한 제어방법
US12013780B2 (en) Multi-partition memory sharing with multiple components
US20140215157A1 (en) Monitoring multiple memory locations for targeted stores in a shared-memory multiprocessor
CN108885587B (zh) 具有系统高速缓存和本地资源管理的功率降低存储器子系统
US20230126322A1 (en) Memory transaction management

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: 20901585

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020901585

Country of ref document: EP

Effective date: 20220610

NENP Non-entry into the national phase

Ref country code: DE