WO2018036505A1 - 一种终端后台应用程序的管理方法及装置 - Google Patents
一种终端后台应用程序的管理方法及装置 Download PDFInfo
- Publication number
- WO2018036505A1 WO2018036505A1 PCT/CN2017/098598 CN2017098598W WO2018036505A1 WO 2018036505 A1 WO2018036505 A1 WO 2018036505A1 CN 2017098598 W CN2017098598 W CN 2017098598W WO 2018036505 A1 WO2018036505 A1 WO 2018036505A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- application
- terminal
- processing resource
- abnormal
- target application
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 238000012545 processing Methods 0.000 claims abstract description 143
- 230000002159 abnormal effect Effects 0.000 claims description 108
- 238000007726 management method Methods 0.000 claims description 58
- 238000001514 detection method Methods 0.000 claims description 8
- 230000005540 biological transmission Effects 0.000 claims description 6
- 238000012546 transfer Methods 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 15
- 230000008569 process Effects 0.000 description 13
- 101150053844 APP1 gene Proteins 0.000 description 10
- 101100189105 Homo sapiens PABPC4 gene Proteins 0.000 description 10
- 102100039424 Polyadenylate-binding protein 4 Human genes 0.000 description 10
- 238000004590 computer program Methods 0.000 description 8
- 238000013468 resource allocation Methods 0.000 description 7
- 101100055496 Arabidopsis thaliana APP2 gene Proteins 0.000 description 6
- 101100016250 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) GYL1 gene Proteins 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 230000008859 change Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000009960 carding Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008014 freezing Effects 0.000 description 1
- 238000007710 freezing Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5066—Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5077—Logical partitioning of resources; Management or configuration of virtualized resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
- G06F9/5088—Techniques for rebalancing the load in a distributed system involving task migration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5021—Priority
Definitions
- the present invention relates to the field of terminal technologies, and in particular, to a terminal back-end application management method and apparatus.
- the existing terminal operating systems include more and more operating systems with multi-tasking capabilities.
- the multitasking function of the operating system can support multiple applications being started at the same time, and the application in the startup state can be switched between the foreground and background of the operating system.
- each application is called a task, and the tasks running in the background occupy the terminal's processor resources. If there are many background tasks that compete with the foreground task for the processor resources, the operating system will not respond to the foreground task in time, causing problems such as frame loss and frame loss in the foreground application, which affects the user experience of the application.
- the foreground task and the background task are divided into a foreground group and a background group, and different processor resources are allocated for different groups. In this way, the problem that the foreground task and the background task compete for the processor resource are alleviated.
- the prior art puts all background tasks into the background grouping, and the background group only allocates a small portion of the processor resources, which largely limits the occupation of the processor resources by the background tasks.
- the background task contains tasks that the user can obviously perceive, such as music playing, etc.
- the lesser processor resources available for the background task will cause the background task of the music playing to be unsmooth, such as sound carding. The user can obviously perceive that the background task does not run smoothly, reduces the user experience of the terminal, and has low applicability.
- the present invention provides a method and a device for managing a terminal background application, which can enhance the controllability of the occupied resources of the terminal background application, improve the applicability of the management of the terminal background application, and enhance the user experience of the terminal.
- the first aspect provides a method for managing a terminal background application, which may include:
- the first processing resource is greater than a second processing resource that is pre-allocated to an application in the background of the terminal operating system.
- the application can determine the application running in the preset running state among the various applications running in the background of the terminal operating system as the target application, thereby allocating more processing resources to the target application.
- the target application can consume more resources than the processing resources originally allocated to all applications in the background, which can ensure the smooth running and enhanced operation of the target application.
- the controllability of the running state of the application improves the user experience of the terminal.
- the first processing resource that allocates a terminal to the first target application includes:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the application can add the first target application in the preset running state to the newly created target application group, wherein the application included in the target application group is a background application in a preset running state.
- the application group included in the terminal may include a foreground application group, a target application group, and a background application group, wherein the background application group contains an application that runs smoothly with the lowest priority.
- the target application group contains applications that run smoothly with higher priority than the background application group, and the target application group contains applications that run smoothly with priority and the front-end application group contains applications that run smoothly. There is no restriction on the relationship between the priority and the priority.
- the terminal may allocate the first processing resource to the target application group, and the first processing resource that the target application group can occupy includes a processor core that is larger than a processor included in the second processing resource that the background application group can occupy.
- the number of the processor cores that can be occupied by the first processing resource that can be occupied by the target application group can be less than or equal to the number of processor cores included in the processing resources that can be occupied by the foreground control group, and is not limited herein. If the first processing resource that can be occupied by the target application group is the same as the processing resource that the foreground control group can occupy, the smooth protection priority of the application included in the target application group and the application included in the foreground application group can be guaranteed.
- the smooth running guarantees have the same priority. If the smoothness of the running of the application included in the target application group is lower than the smooth priority of the running of the application included in the foreground application group, the first processing resource is less than the processing resource that the foreground control group can occupy.
- the target application group's resource allocation method is flexible and can improve the controllability of the running state of the application contained in the target application group.
- the first processing resource that allocates a terminal for the first target application includes:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the application can add the first target application in the preset running state to the foreground application group, wherein the application included in the target application group is a background application in a preset running state.
- the application group included in the terminal may include a foreground application group and a background application group, wherein the application included in the background application group has the lowest priority of running smoothness, so the processing resources of the background control group can be occupied. Less than the processing resources of the foreground control group.
- the terminal may allocate the first processing resource that the foreground application group can occupy to the target application group, and the first processing resource that the target application group can occupy includes a number of processor cores larger than the second application group group can occupy. The number of processor cores included in the processing resource ensures that the smoothness of the application running in the target application group is the same as that of the application in the foreground application group.
- the application group contains applications that run smoothly and improve the user experience of the terminal.
- the preset running state includes at least one of a voice playing state, a file transmission state, a use sensor state, a video call state, and a voice call state.
- the application can determine the running state of the background application that the user can obviously perceive as the preset running state, thereby determining the background application in the running state as the first target application, and can be the first target application.
- the first processing resource that allocates more processing resources shared by the background application ensures that the first target application runs smoothly and improves the user experience of the terminal.
- the preset operating state is the first target application and the terminal The state of the second target application associated with the operating system foreground.
- the application can determine the running state of the background application associated with the second target application running in the foreground of the terminal operating system as a preset running state, thereby determining the background application in the running state as the first target application. program. Further, the processing resources that can be occupied by the foreground application group can be allocated to the first target application, and the running of the first target application is ensured to ensure smooth running of the second target application and improve the user experience of the terminal.
- the application in the application running in the background of the detecting terminal is in the application After the running state, the method further includes:
- the third processing resource includes a first duration in which the exception application occupies the exception processor core, and other operations running on the exception processor core
- the duration of the application occupying the abnormal processor core is a second duration, and the first duration is less than the second duration.
- the application can perform the limit control of the processing resource on the abnormal application included in the background control group or freeze or terminate the operation of the abnormal application, so as to prevent the abnormal application from occupying too much processing resources and affecting the normal operation of other applications. , improve the applicability of the management of the terminal application, and enhance the user experience of the terminal.
- the network input/output IO rate of the abnormal application is less than a preset rate threshold.
- the application can also check the abnormal application by the IO rate of the application, which can improve the judgment accuracy of the abnormal application and improve the control accuracy of the running of the application.
- the first duration is zero;
- the setting the exception application to occupy the third processing resource includes:
- the application can freeze or terminate the operation of the abnormal application included in the background control group, and forcibly end the operation of the abnormal application to better avoid the abnormal application consuming too much processing resources and affecting other applications.
- the applicability of the management of the terminal application is improved, and the user experience of the terminal is enhanced.
- the terminal described in the application includes one or more multi-core processors
- the first processing resource includes one or more processor cores of each of the one or more multi-core processors;
- the second processing resource includes one or more processor cores of each of the one or more multi-core processors;
- the third processing resource includes an available duration of each of the one or more processor cores.
- the processor provided by the application includes a central processing unit (CPU) or an application processor ( English: Application Processor, AP), etc.
- the above application processor can be produced by ARM as a Reduced Instruction Set Computer (RISC) microprocessor (English: Advanced RISC Machines, ARM), and can also be applied to other terminal devices such as mobile phones.
- RISC Reduced Instruction Set Computer
- the ARM processor can be a single core processor or a multi-core processor.
- the method provided by the present application is applicable to multiple types of processors, and improves the applicability of the management method of the terminal background application.
- the second aspect provides a management device for a terminal background application, which may include:
- a detecting module configured to detect an operating state of each application in an application running in a background of the terminal operating system
- a selection module configured to select a first target application from the respective applications detected by the detection module, where an operating state of the first target application is a preset running state
- a setting module configured to allocate, by the first target application selected by the selection module, a first processing resource of the terminal, and set the first target application to run on the first processing resource
- the first processing resource is greater than a second processing resource that is pre-allocated to an application in the background of the terminal operating system.
- the setting module is specifically configured to:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the setting module is specifically configured to:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the preset operating state includes: a voice playing state, a file transmission state, and a use At least one of a sensor status, a video call status, and a voice call status.
- the preset operating state is the first target application and the terminal The state of the second target application associated with the operating system foreground.
- the detecting module is further configured to:
- the selection module is further configured to:
- the abnormal processor core in the each processor core acquires, by the detecting module, the abnormal processor core in the each processor core, acquiring an abnormal application included in each application running on the abnormal processor core, where a load of the abnormal processor core is greater than a first preset load threshold, wherein a ratio of a load of the abnormal application to a load of the abnormal processor core is greater than a preset ratio threshold;
- the setting module is further configured to:
- the third processing resource includes a first duration that the abnormal application occupies the abnormal processor core, and the exception processing The other application running on the core occupies the abnormal processor core for a second duration, and the first duration is less than the second duration.
- the network input/output IO rate of the abnormal application is less than a preset rate threshold.
- the first duration is zero
- the setting module is specifically configured to:
- the terminal described in the application includes one or more multi-core processors
- the first processing resource includes one or more processor cores of each of the one or more multi-core processors;
- the second processing resource includes one or more processor cores of each of the one or more multi-core processors;
- the third processing resource includes an available duration of each of the one or more processor cores.
- the processor provided by the application includes a central processing unit (CPU) or an application processor ( English: Application Processor, AP), etc.
- the above application processor can be produced by ARM as a Reduced Instruction Set Computer (RISC) microprocessor (English: Advanced RISC Machines, ARM), and can also be applied to other terminal devices such as mobile phones.
- RISC Reduced Instruction Set Computer
- the ARM processor can be a single core processor or a multi-core processor.
- a third aspect provides a terminal, which can include: a memory and a processor;
- the memory is for storing a set of program codes
- the processor is configured to invoke program code stored in the memory to perform the following operations:
- the first processing resource is greater than a second processing resource that is pre-allocated to an application in the background of the terminal operating system.
- the processor is specifically configured to: the first processing resource that allocates a terminal to the first target application includes:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the processor is specifically configured to: the first processing resource that allocates a terminal for the first target application includes:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the preset operating state includes: a voice playing state, a file transmission state, and a use. At least one of a sensor status, a video call status, and a voice call status.
- the preset operating state is the first target application and the terminal The state of the second target application associated with the operating system foreground.
- the processor is further configured to:
- the third processing resource includes a first duration in which the exception application occupies the exception processor core, and other operations running on the exception processor core
- the duration of the application occupying the abnormal processor core is a second duration, and the first duration is less than the second duration.
- the network input/output IO rate of the abnormal application is less than a preset rate threshold.
- the first duration is zero
- the setting the exception application to occupy the third processing resource includes:
- the application can be an application running in a preset running state in each application running in the background of the terminal operating system. Determined to be the target application, which in turn can allocate more processing resources to the target application. By allocating more processing resources to the target application in the background application, the target application can consume more resources than the processing resources originally allocated to all applications in the background, which can ensure the smooth running and enhanced operation of the target application.
- the application can perform the limit control of the processing resource on the abnormal application included in the background control group or freeze or terminate the operation of the abnormal application, so as to prevent the abnormal application from occupying too much processing resources and affecting other applications.
- the normal operation improves the applicability of the management of the terminal application and enhances the user experience of the terminal.
- FIG. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
- FIG. 2 is a schematic diagram of an application management operation provided by an embodiment of the present invention.
- FIG. 3 is a schematic flowchart of a method for managing a terminal background application according to an embodiment of the present invention
- FIG. 4 is a schematic diagram of an allocation of CPU resources according to an embodiment of the present invention.
- FIG. 5 is another schematic diagram of allocation of CPU resources according to an embodiment of the present invention.
- FIG. 6 is a schematic diagram of another application management operation provided by an embodiment of the present invention.
- FIG. 7 is a schematic structural diagram of a computer system according to an embodiment of the present invention.
- FIG. 8 is a schematic structural diagram of a device for managing a terminal background application according to an embodiment of the present invention.
- the terminal background application management method provided by the embodiment of the present invention is mainly applied to a terminal device, and the terminal device may also be referred to as a user equipment: User Equipment (UE), mobile station (English: Mobile Station, MS), mobile Terminal (English: Mobile Terminal).
- the terminal device (hereinafter referred to as the terminal) may have the capability of communicating with one or more core networks via a Radio Access Network (RAN).
- RAN Radio Access Network
- the terminal can be a mobile phone (or "cellular" phone), or a computer with mobile nature, and the like.
- the terminal can also be a portable, pocket, handheld, computer built-in or in-vehicle mobile device.
- the management method of the terminal background application provided by the embodiment of the present invention can also be applied to other types of computer systems.
- FIG. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
- the terminal device 100 includes a memory 180, a processor 150, and a display device 140.
- the memory 180 stores a computer program (or program code) including an operating system program 182, an application program 181, and the like.
- the processor 150 is configured to read and save The computer program in the memory 180 then executes the computer program defined method, for example, the processor 150 reads the operating system program 182 to run the operating system on the terminal device 100 and implement various functions of the operating system, or read a type Or a plurality of applications 181 to run the application on the terminal device.
- Processor 150 may include one or more processors, for example, processor 150 may include one or more central processors or one or more central processors and one or more application processors. When the processor 150 includes a plurality of processors, the plurality of processors may be integrated on the same chip, or may each be a separate chip.
- a processor may include one or more processor cores (or processing cores). The following embodiments are all described by taking multiple cores as an example. However, the management method of the terminal background application provided by the embodiment of the present invention can also be applied to a single core. The processor performs parallel operation of multiple applications by utilizing the time-sharing principle of a single-core processor.
- the memory 180 also stores other data 183 in addition to the computer program.
- the other data 183 may include data generated by the operating system 182 or the application 181 after being run, the data including system data (such as operating system configuration parameters) and
- the user data such as a network song downloaded by the user, is typical user data, and the application for downloading the network song is also one of the objects of management of the method provided by the embodiment of the present invention.
- Memory 180 generally includes memory and external memory.
- the memory can be random access memory (RAM), read only memory (ROM), and cache (CACHE).
- the external storage can be a hard disk, a CD, a USB disk, a floppy disk, or a tape drive.
- Computer programs are typically stored on external storage, and the processor loads the computer program from external memory into memory before processing.
- the operating system program 182 includes a computer program that can implement the management method of the terminal background application provided by the embodiment of the present invention, so that after the processor 150 reads the operating system program 182 and runs the operating system, the operating system can The management function of the background application provided by the embodiment of the present invention is provided.
- the terminal device 100 may further include an input device 130 for receiving input digital information, character information or contact touch/contactless gestures, and generating signal inputs related to user settings and function control of the terminal device 100, and the like.
- the input device 130 may include a touch panel 131.
- the touch panel 131 also referred to as a touch screen, can collect touch operations on or near the user (such as the user's operation on the touch panel 131 or on the touch panel 131 using any suitable object or accessory such as a finger, a stylus, or the like. ), and drive the corresponding connection device according to a preset program.
- the touch panel 131 may include two parts: a touch detection device and a touch controller.
- the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
- the processor 150 is provided and can receive commands from the processor 150 and execute them. For example, the user double-clicks an icon of an application on the touch panel 131, and the touch detection device detects the signal brought by the double click, and then transmits the signal to the touch controller, and the touch controller converts the signal.
- the coordinates are sent to the processor 150.
- the processor 150 performs an operation such as starting the application according to the coordinates and the type of the signal (such as double-clicking), and finally displays the operation interface of the application on the display panel 141, thereby implementing "opening". "application.
- the touch panel 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
- the input device 130 may further include other input devices 132.
- the other input devices 132 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like. One or more of them.
- the terminal device 100 may further include a display device 140, including a display panel 141, for displaying information input by the user or information provided to the user, and various menu interfaces of the terminal device 100, etc., in the present invention
- the example is mainly used to display information such as the user interface of the application.
- the display device 140 can include a display panel 141.
- the display panel 141 can be configured in the form of a liquid crystal display (LED) or an organic light-emitting diode (OLED).
- the touch panel 131 can cover the display panel 141 to form a touch display screen.
- the terminal device 100 may further include a power source 190 for supplying power to other modules and a camera 160 for taking a photo or video.
- the terminal device 100 may also include one or more sensors 120, such as gravity sensors, acceleration sensors, light sensors, and the like.
- the terminal device 100 may further include a radio frequency (RF) circuit 110 for performing network communication with the wireless network device, and may further include a WiFi module 170 for performing WiFi communication with other devices and the like.
- RF radio frequency
- the following embodiments describe a method and an apparatus for managing a terminal background application provided by an embodiment of the present invention.
- the management method provided by the embodiment of the present invention can be implemented in the operating system program 182 shown in FIG. 1.
- APP1 After the terminal starts the application (English: application, APP) 1 and executes a certain task in the foreground of the operating system of the terminal, if the terminal starts APP2, APP1 will switch to the background of the operating system of the terminal (hereinafter referred to as Backstage). APP1 is still in the startup state after switching to the background, and can continue to run related tasks in the background. At this time, the APP1 running task also occupies processor resources. During the operation of APP1 and APP2, there is a phenomenon of competing for processor resources. If APP1 occupies more processor resources, APP2 will be stuck in the foreground.
- the processor resource may be a central processing unit (CPU) resource or an application processor (English: Application Processor, AP) resource.
- the above application processor resources can be produced by Arm Corporation as a Reduced Instruction Set Computer (RISC) microprocessor (English: Advanced RISC Machines, ARM), or other terminal devices used in mobile phones. On the processor. It can be determined according to the requirements of the actual application scenario, and no limitation is imposed here. The method and device for managing the terminal background application provided by the embodiment of the present invention will be described below by taking the CPU resource as the processor resource as an example.
- RISC Reduced Instruction Set Computer
- FIG. 2 is a schematic diagram of an application management operation according to an embodiment of the present invention.
- the front-end background control mechanism puts all background applications into the background control group by placing the foreground APP in the foreground control group (English: Foreground CGroup, FG CGroup) (or foreground group grouping) (English: Background CGroup, BG CGroup) (or background grouping), and allocate CPU resources for the foreground control group and the background control group respectively.
- the CPU resources allocated to the foreground control group include most of the CPU cores in the processor core (such as the CPU core or the ARM core, and the CPU core is taken as an example), as shown in the number 0-7 in FIG. 2 . 8 CPU cores.
- the eight CPU cores of the above numbers 0-7 are CPU cores included in the terminal.
- the terminal allocates most of the proportional resources of each CPU core to the foreground control group. For example, all CPU cores (8 CPU cores numbered 0-7) included in the terminal are assigned to the foreground control group, that is, the foreground control group can use resources on all CPU cores.
- the background control group may also be further divided into a background control group and a system background control group, wherein the APP included in the system background control group is an indispensable system APP for the terminal system operation or an APP configured by the terminal,
- the background control packet is a background application other than the APP included in the system background control group in the background application.
- the above implementation allocates less CPU resources for the background control packet, such as a CPU core (number 3).
- the above implementation does not take into account the fact that there may be interdependence between the front and back tasks, and the impact of the output of the background tasks on the user experience.
- the output result is perceived by the user in real time, including voice playback. If the output of the task in the background (assumed to be task A) is perceived by the user in real time, the system needs to ensure that task A runs smoothly. In this scenario, the background tasks in the above implementation manner have less CPU resources, and it is difficult to ensure that the task A runs smoothly.
- the execution of the foreground task depends on the running result of the background task or the background task holds the resources required by the foreground task, that is, there is an association between the foreground task and the background task, the running of the background task is not smooth, and the execution of the foreground task is also affected. Obstruction, the front-end task may appear to be lost frame.
- the CPU resource allocation form is single, the operation is inflexible, and the APP management method of the terminal is poorly applicable.
- the embodiment of the present invention provides a terminal back-end application management method and device, which can be enhanced.
- the controllability of the running state of the terminal background application improves the applicability of the management of the terminal background application and enhances the user experience of the terminal.
- FIG. 3 is a schematic flowchart of a method for managing a terminal background application according to an embodiment of the present invention.
- the management method provided by the embodiment of the present invention includes the following steps:
- the embodiment of the present invention can perform differential management on the key APP in the background APP according to the running state of the background APP, so as to ensure smooth operation of the key APP, thereby improving the user experience of the terminal.
- the terminal can detect an application running in the background to determine the running status of each application.
- the running state of the application includes whether the output result of the application affects the running of the foreground application, that is, whether the application associated with the foreground application exists in the background application.
- the running state of the above application may also include whether the output result of the application can be clearly perceived by the user, that is, whether the application is an application that needs to ensure smooth running, and the like.
- the terminal may detect the running status of the APP1 and the foreground APP (for example, the APP2) when an APP (for example, the APP1) switches to the background, and determine whether the APP1 and the APP2 have an association relationship.
- the terminal may compare the APP1 with the preset APP category, and determine whether the APP1 is an APP that needs to ensure smooth operation.
- the terminal may also detect the running state of each application in all applications running in the background of the system at a specified time by using periodic (for example, one cycle of 10 seconds, etc.) detection to determine the background application. Whether there is a target application associated with the foreground application or a target application that needs to ensure smooth operation.
- the target application associated with the foreground application or the target application that needs to ensure smooth operation is the key application described in the embodiment of the present invention.
- the terminal may acquire the target application (ie, the first target application) in the background application by detecting the background application.
- the first target application is an application whose running state is a preset running state.
- the first target application may include the target application associated with the foreground application described above or a target application that needs to ensure smooth operation.
- the preset operating state may include voice broadcasting.
- the application state in the above-mentioned preset operation state can be set as the target application that needs to ensure smooth operation, such as the release status, the file transfer status, the use of the sensor status, the video call status, and the voice call status.
- the preset running state may also be a state associated with the foreground application, and the application in the state associated with the foreground application may be set as the target application associated with the foreground.
- the application in the preset running state is subjected to differential management such as CPU resource allocation.
- an application running in the foreground of the operating system of the terminal may be set as the second target application, that is, the application included in the foregoing foreground control group may be set as the second target application. program. All the applications running in the background may be the applications included in the background control group, that is, the first target application may be one or more applications in the background control group in the prior art.
- the foreground control group provided by the embodiment of the present invention can occupy a part of resources of the terminal, such as all CPU cores of the foregoing terminal, and 95% of the occupied time of each CPU core.
- the background control group provided by the embodiment of the present invention may also occupy a part of the resources of the terminal (set as the second processing resource), such as one of all the CPU cores of the terminal and the 5% occupation time of the CPU core.
- the other 95% of the CPU cores occupied by the background control group are also the resources owned by the foregoing foreground control group, and may also be resources owned by the critical application provided by the embodiments of the present invention, which may be specifically The actual application scenario is determined, and no limitation is imposed here.
- the terminal may determine, in the background APP, an APP in a running state, such as a voice playing state, a file transmission state, a use sensor state, a video call state, or a voice call state, as the first target APP, so as to be in the The first target APP in the above running state performs CPU resource allocation to ensure smooth running of the first target APP.
- the terminal can create a key background control group (English: key background CGroup, Kbg CGroup), and put the first target APP into a key background control group (ie, a target application group), and is a key background control group. Allocate CPU resources.
- the first target APP may be one or more APPs in an operating state, such as the voice playing state, the file transmission state, the use of the sensor state, the video call state, or the voice call state, and may be specifically according to the specific work of each APP.
- the status is determined and there is no restriction here.
- the above-mentioned key background control group may include one or more APPs, and the APP included in the key background control group may be the first target APP.
- the CPU resource may be allocated to the first target APP.
- the terminal may allocate the first processing resource (specifically, the first CPU resource) of the terminal to the key background control group according to the situation of the CPU resources that have been allocated to the foreground control group and the CPU resources that have been allocated to the background control group. ).
- the terminal may have multiple CPU cores.
- the CPU resources allocated to the foreground control group may be all the CPU cores owned by the terminal, and the preset ratio of each CPU core (for example, 95%) may be occupied.
- the CPU resources allocated to the background control group may be One (or more) of the CPU cores owned by the terminal and a preset ratio of 2 (for example, 5%) of each CPU core, and the like.
- the first CPU resource allocated by the terminal for the key background control group is less than the CPU resources owned by the foreground control group, and more CPU resources owned by the background control group.
- the first CPU resource allocation mode of the key background control group can ensure that the APP of the key background control group runs smoothly, and the key can be avoided.
- the APP of the background control group and the APP of the foreground control group seize resources, affecting the foreground control group. The operation of the APP.
- the terminal may also allocate the same CPU resources as the foreground control group to the key background control group, which may be determined according to actual application scenario requirements, and is not limited herein.
- FIG. 4 is a schematic diagram of an allocation of CPU resources according to an embodiment of the present invention.
- the terminal divides the APP included in the system into a foreground control group, a system background control group (including a system APP of the terminal, such as an APP that is essential for system operation or an APP configured by the terminal), a key background control group, and The background control group and other APP packets.
- the terminal can assign 8 CPU cores to the foreground control group, and assign 3 CPU cores numbered 0 to 2 to the system background control group, which will be numbered as The three CPU cores of 1, 2, and 7 are assigned to the key background control group, and one CPU core numbered 3 is assigned to the background control packet.
- the allocation of CPU cores such as the number and number of CPU cores described above is merely an example and is not exhaustive.
- the foreground control group has the largest number of CPU cores, and the system background control group has fewer CPU cores than the foreground control group.
- the critical background control group has fewer CPU cores than the foreground control group, and the background control group has The number of CPU cores is the least.
- the relationship between the number of CPU cores in the background control group and the key background control group is not limited here, and can be determined according to the actual application scenario.
- the terminal may further be used for each APP.
- the APP included in the control group allocates resources of the CPU core.
- the terminal may record the APP included in the system background control group into the foreground control group, and allocate the preset duration of the CPU core (for example, 95%) to the foreground control group and the system background control group.
- the terminal may also record the key background control combined background control group as the background control group, and allocate the preset time 2 (for example, 5%) of the CPU core to the key background control group and the background control group.
- the APP included in the background control packet is an APP after removing the APP included in the system background control group and the key background control group from all the APPs in the background of the terminal. For example, suppose there are 5 APPs in the background of the terminal system, in which 2 APPs are placed in the system background control group, and 1 APP is placed in the key background control group, and the remaining 2 APPs are background control groups. The app included in it.
- the first target APP may be added to the foreground control group.
- the first target APP may share the CPU resources owned by the foreground control group with other APPs included in the foreground control group.
- the CPU resources used by the foreground control group shared by the first target APP and other APPs included in the foreground control group include resources of the CPU core owned by the foreground control group and the occupation time of each CPU core, and are not described herein. .
- the terminal sets the first target APP to share the CPU resources owned by the foreground control group with other APPs included in the foreground control group, thereby ensuring smooth running of the first target APP and ensuring smooth operation of the foreground APP and improving the users of the terminal.
- the terminal sets the first target APP to share the CPU resources owned by the foreground control group with other APPs included in the foreground control group, thereby ensuring smooth running of the first target APP and ensuring smooth operation of the foreground APP and improving the users of the terminal.
- the terminal may also separately establish a group (such as a key background control group) for the first target APP, and according to the above key background control group.
- the resource allocation mode allocates resources for the first target APP, which can be determined according to actual application scenario requirements, and is not limited herein.
- the association relationship between the foreground APP and the background APP of the foregoing terminal may be determined by an association relationship between processes.
- the terminal may collect the association relationship between the processes running in the system in the activity management service (AMS), and perform the association relationship between the processes through the real-time processing subsystem of the system service. Analysis and determination.
- the association relationship between the foregoing processes may be determined by using an association relationship function such as getContentProvider, startActivity, bindService, unbindService, startService, stopService, etc., which may be determined according to the actual application scenario, and is not limited herein.
- the first target APP may be placed in the background control group to avoid occupying CPU resources.
- the APP4 when it is in the voice call state, it can be placed in the key background control group. At this time, the CPU resources occupied by the APP4 are the CPU resources owned by the key background control group. If the APP4 voice call ends, it can be placed in the background control packet. At this time, the CPU resource occupied by the APP4 is the CPU resource owned by the background control packet.
- the terminal may also detect and manage the abnormal APP in the system during the running of each APP of the system.
- the terminal may detect the load status of each CPU core in all the CPU cores included in the terminal in a certain period (for example, one cycle of 10 seconds) to determine whether there is a CPU core with abnormal load in the terminal (set to an abnormal CPU). nuclear). If it is detected that the load of a certain CPU core exceeds a first preset load threshold (for example, 80%, etc.), the CPU core may be determined as an abnormal CPU core.
- a first preset load threshold for example, 80%, etc.
- the terminal may acquire the load status of the APP running on the abnormal CPU core, and obtain the abnormal APP on the abnormal CPU core, wherein the load of the abnormal APP accounts for a proportion of the total load of the abnormal CPU core is greater than a preset proportional threshold.
- the abnormal APP may also be an APP whose input/output (IO) rate is lower than a preset rate threshold.
- the terminal can determine that the load of three consecutive cycles accounts for more than 50% of the total load of the abnormal CPU, and the APP whose network IO rate is less than 10 Kbits/s is determined to be an abnormal APP.
- the abnormal APP may be an APP that is in danger of being attacked, and may be determined according to the actual application scenario of the terminal or the configuration of the software and hardware, and is not limited herein.
- the terminal can control the CPU resources that can be occupied by the abnormal APP.
- the terminal may set the CPU resource that the abnormal APP can occupy as the third CPU resource.
- the third CPU resource may be empty or may be an occupation time of a preset ratio of 3 on the abnormal CPU core.
- the terminal may set the duration of the abnormal APP to occupy the abnormal CPU core as the first duration, and set the duration of the abnormal CPU core of the other APP on the abnormal CPU core to the second duration, and then set the first duration to occupy the CPU.
- the core can take up 5% of the duration, and the second duration accounts for 95% of the CPU core's usable duration.
- FIG. 5 is a schematic diagram of another allocation of CPU resources according to an embodiment of the present invention.
- the occupant CPU resource of the abnormal APP may be set as 5% of the CPU core's occupiable time. If the abnormal APP runs on the abnormal CPU core for more than 5% of the CPU core's available time in one operating cycle, it needs to exit and give the CPU core to other APPs, waiting for the next operating cycle.
- FIG. 6 is a schematic diagram of another application management operation according to an embodiment of the present invention.
- the terminal may be externally built in the background control group and the system background control group included in the original background control group.
- Set the key background control group put the key APP in the background APP into the key background control group, and allocate resources for the key background control group.
- the key background control group has more resources than the background control group, which can guarantee the key background control.
- the running of the APP included in the group is smooth, and the controllability of the running state of the terminal APP is enhanced.
- the terminal may perform CPU resource quota control on the abnormal APP included in the background control group (5% of the resources of a single CPU core, etc.) or freeze or end the operation of the abnormal APP (occupied CPU resources are empty) Management, to avoid abnormal APPs occupy too much CPU resources, affect the normal operation of other APPs, improve the applicability of terminal APP management, and enhance the user experience of the terminal.
- CPU resource quota control on the abnormal APP included in the background control group (5% of the resources of a single CPU core, etc.) or freeze or end the operation of the abnormal APP (occupied CPU resources are empty) Management, to avoid abnormal APPs occupy too much CPU resources, affect the normal operation of other APPs, improve the applicability of terminal APP management, and enhance the user experience of the terminal.
- FIG. 7 is a schematic structural diagram of a computer system according to an embodiment of the present invention.
- the computer system may be the terminal device provided by the foregoing embodiment of the present invention, or may be other types of computer devices.
- the computer system includes an application layer 710, an operating system layer 700, and a hardware layer 750.
- the operating system may be an Android operating system, and may be an operating system that is applicable to the method provided by the embodiment of the present invention, and is not limited herein.
- the operating system layer 450 is further divided into a system service layer 720, a core library layer 730, and a kernel layer 740.
- the operating system layer 700 in FIG. 7 can be considered as a specific implementation of the operating system 182 in FIG.
- the system service layer 720 includes service state information collection, CPU scheduling decisions, and CPU scheduling executors. It should be noted that FIG. 7 is a schematic diagram of a processor such as a CPU. In a specific implementation, the CPU may be replaced by an ARM, which may be determined according to an actual application, and is not limited herein.
- the core library layer 730 includes a CPU information collection library, a CPU group management, and a CPU grouping task management library.
- the kernel layer 740 may include CPU resource scheduling, CPU control combined CPUSET control groups, and the like.
- the service state information collection in the system server layer 720 is used to collect service state information of each application in the application layer 710.
- the service state information of each application includes a change of the front and back background attributes of the application running in the foreground and the background, or a running state change such as the running or ending of the application.
- the embodiment of the present invention can acquire the first target application in the preset running state of the system background application by using the service state information in the system service layer 720, and can be determined as the first by the CPU scheduling decision in the system service layer 720.
- the CPU scheduling decision in the system service layer 720 is used to determine the CPU resources allocated to the first target application according to the application state information collected by the application state information collection module.
- the CPU scheduling executor in the system service layer 720 is configured to set the CPU resources allocated to the application process corresponding to the first target application according to the CPU resources allocated to the first target application determined by the CPU scheduling decision module, including the CPU that can be occupied. Core and individual occupancy time, etc. Further, after the CPU scheduling executor sets the CPU resources of the application process corresponding to the first target application, the CPU resource allocation and scheduling may be performed by each module in the core library layer 730 and the kernel layer 740.
- the CPU information collection library included in the core library layer 730 is used for CPU information such as the load status of the CPU provided by the system service layer 720.
- the CPU scheduling decision module determines the CPU resources allocated to the first target application
- the CPU core allocated to the first target application may be determined according to the load status of each CPU core provided by the CPU information collection library (specifically, one or more The CPU core), in turn, can execute CPU decisions through the CPU scheduling executor.
- the CPU group management in the core library layer 730 can be divided according to the CPU resources set by the CPU scheduling executor.
- the allocation mode manages the CPU cores included in the system, and the CPU cores in the CPU grouping task management library can perform task management on the CPU cores in each CPU group (specifically, the CPU core grouping).
- the CPU group management is used to allocate a CPU core (that is, all CPU cores included in the system) to the foreground control group, or to allocate a CPU core included in the system to the background control group, or to allocate a CPU included in the system to the key background control group.
- a CPU core that is, all CPU cores included in the system
- One or more of the cores, etc. can implement grouping of CPU cores.
- the task management of the above CPU core includes application process management such as addition and reduction of application processes running on respective CPU cores.
- the CPU control group in the kernel layer 740 can control and manage the occupation time of each CPU core according to the task management situation of the CPU grouping task management library for each CPU core.
- the application included in the foreground control group can occupy 95% of the occupied time of each CPU core
- the application included in the background control group can occupy 5% of the occupied CPU core and the occupation time.
- the CPU grouping task management library has a CPU core with abnormal task allocation in the task management process of each CPU core (such as the abnormal CPU core mentioned above)
- the CPU control group can control the occupation time of the abnormal CPU core occupied by the abnormal application to 5 %Wait.
- the CPUSET control group is used to control the CPU cores included in the respective CPU packets allocated by the CPU packet management.
- the scheduling execution of the CPU resources determined by the CPU scheduling executor can be controlled by the CPUSET control group, and finally the scheduling of the CPU on the hardware layer 750 is performed by the CPU resource scheduling.
- the CPU resource scheduling is used to execute control instructions according to the CPU control group and the CPUSET control group, thereby implementing scheduling of the central processing unit in the hardware layer 750.
- the application layer 710 of the terminal may include a phone, a contact (ie, an address book), an instant messaging, a gallery, a music, a media player, a map navigation, a browser, and the like.
- the application layer 710 in FIG. 7 can be considered as a specific implementation of the application 181 in FIG. 1, and is not limited herein.
- the hardware layer 750 of the terminal includes a central processing unit (ie, a CPU), a graphics processor, a memory, an input device, a display device, and the like.
- the central processing unit and the graphics processing unit may be equivalent to a specific implementation of the processor 150 in FIG. 1.
- the memory may be equivalent to the memory 180 in FIG. 1, including memory and external memory.
- the hardware layer 750 may also include one or more sensors (equivalent to the sensor 120 in FIG. 1).
- the hardware layer 750 may also include the power source, the camera, the RF circuit, and the WiFi module shown in FIG. 1, and may also include other hardware modules not shown in FIG. 1, such as a memory controller and a display controller, etc., Make restrictions.
- FIG. 8 is a schematic structural diagram of a device for managing a terminal background application according to an embodiment of the present invention.
- the management device provided by the embodiment of the present invention includes:
- the detecting module 810 is configured to detect an running state of each application in an application running in a background of the terminal operating system.
- the selecting module 820 is configured to select a first target application from the respective applications detected by the detecting module 810, and the running state of the first target application is a preset running state.
- the setting module 830 is configured to allocate a first processing resource of the terminal to the first target application selected by the selecting module 820, and set the first target application to run on the first processing resource.
- the first processing resource is greater than a second processing resource that is pre-allocated to an application in the background of the terminal operating system.
- the foregoing setting module 830 is specifically configured to:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the foregoing setting module 830 is specifically configured to:
- the number of processor cores included in the first processing resource is greater than the number of processor cores included in the second processing resource.
- the preset operating state includes at least one of a voice play state, a file transfer state, a use sensor state, a video call state, and a voice call state.
- the preset operating state is a state in which the first target application is associated with a second target application running in a foreground of the terminal operating system.
- the foregoing detection module 810 is further configured to:
- the above selection module 820 is further configured to:
- the abnormal processor core in the each processor core acquires, by the detecting module, the abnormal processor core in the each processor core, acquiring an abnormal application included in each application running on the abnormal processor core, where a load of the abnormal processor core is greater than a first preset load threshold, wherein a ratio of a load of the abnormal application to a load of the abnormal processor core is greater than a preset ratio threshold;
- the above setting module 830 is also used to:
- the third processing resource includes a first duration that the abnormal application occupies the abnormal processor core, and the exception processing The other application running on the core occupies the abnormal processor core for a second duration, and the first duration is less than the second duration.
- the network input/output IO rate of the abnormal application is less than a preset rate threshold.
- the first duration is zero;
- the above setting module 830 is specifically configured to:
- the foregoing management device may perform the implementation manners described in the steps of the method for managing the terminal background application provided by the embodiment of the present invention by using the built-in modules.
- the foregoing management device may perform the implementation manners described in the steps of the method for managing the terminal background application provided by the embodiment of the present invention by using the built-in modules.
- the terminal may allocate resources to a target application group (such as a key background control group) where the background application in a preset running state is located, and the key background control group has more resources than the background control group, and further
- the target APP included in the key background control group can be smoothly operated, and the controllability of the running state of the terminal APP is enhanced.
- the terminal may perform CPU resource limit control on the abnormal APP included in the background control group (single The CPU core can occupy 5% of the resources, etc.) or the operation of freezing or ending the operation of the abnormal APP (occupied CPU resources are empty), etc., to avoid abnormal APPs occupying too much CPU resources, affecting the normal operation of other APPs, and improving The applicability of the management of the terminal APP enhances the user experience of the terminal.
- the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
- Stored Programmes (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明实施例公开了一种终端后台应用程序的管理方法,包括:检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;从所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;为所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行;其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。本发明实施例还公开了一种终端后台应用程序的管理装置。采用本发明实施例,具有可增强终端后台应用程序的占用资源的可控性,提高终端后台应用程序的管理的适用性,增强终端的用户体验的优点。
Description
本发明涉及终端技术领域,尤其涉及一种终端后台应用程序的管理方法及装置。
当前随着手机或者平板电脑等终端的软硬件技术的发展,现有的终端操作系统中包含越来越多具备多任务运行能力的操作系统。操作系统的多任务运行功能可支持多个应用程序在同一时间处于启动状态,处于启动状态的应用程序可在操作系统的前台和后台之间切换运行。操作系统同时支撑多个应用程序的运行的操作过程中,每个应用程序被称为一个任务,在后台运行的任务会占用终端的处理器资源。若与前台任务争抢处理器资源的后台任务较多,则将导致操作系统对前台任务的响应不及时,使得前台应用程序出现卡顿丢帧等问题,影响了应用程序的用户体验。
现有技术将前台任务和后台任务分为前台分组和后台分组,并为不同的分组分配不同的处理器资源,通过这种方式来缓解前台任务和后台任务争抢处理器资源的问题。然而,现有技术将后台任务全部放入后台分组,后台分组只分配少部分处理器资源,很大程度上限制了后台任务对处理器资源的占用。此时,若后台任务中包含用户可明显感知的任务,例如音乐播放等,后台任务可用的处理器资源较少则将导致音乐播放的后台任务运行不顺畅,比如声音卡顿等。用户可明显感知到后台任务运行不顺畅,降低了终端的用户体验,适用性低。
发明内容
本申请提供一种终端后台应用程序的管理方法及装置,可增强终端后台应用程序的占用资源的可控性,提高终端后台应用程序的管理的适用性,增强终端的用户体验。
第一方面提供了一种终端后台应用程序的管理方法,其可包括:
检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;
从所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;
为所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行;
其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
本申请可将终端操作系统后台中运行的各个应用程序中处于预设运行状态的应用程序确定为目标应用程序,进而可为目标应用程序分配更多的处理资源。通过为后台应用程序中的目标应用程序分配更多的处理资源,使得目标应用程序的可占用资源多于原来分配给后台所有应用程序共享的处理资源,可保障目标应用程序的运行更顺畅,增强应用程序的运行状态的可控性,提高终端的用户体验。
结合第一方面,在第一种可能的实现方式中,所述为所述第一目标应用程序分配终端的第一处理资源包括:
将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
本申请可将处于预设运行状态的第一目标应用程序添加至新建的目标应用程序组,其中,目标应用程序组中包含的应用程序均为处于预设运行状态的后台应用程序。此时,终端中包含的应用程序组可包括前台应用程序组、目标应用程序组和后台应用程序组,其中,后台应用程序组包含的应用程序的运行顺畅的保障优先级最低。目标应用程序组包含的应用程序的运行顺畅的保障优先级高于后台应用程序组,目标应用程序组包含的应用程序的运行顺畅的保障优先级与前台应用程序组包含的应用程序的运行顺畅的保障优先级高低关系不做限制。终端可将第一处理资源分配给目标应用程序组,目标应用程序组可占用的第一处理资源包括的处理器核的个数大于后台应用程序组可占用的第二处理资源中包含的处理器核的个数。目标应用程序组可占用的第一处理资源包含的处理器核的个数可小于或者等于前台控制组可占用的处理资源包含的处理器核的个数,在此不做限制。若目标应用程序组可占用的第一处理资源与前台控制组可占用的处理资源相同,则可保障目标应用程序组包含的应用程序的运行顺畅的保障优先级与前台应用程序组包含的应用程序的运行顺畅的保障优先级相同。若目标应用程序组包含的应用程序的运行顺畅的保障优先级低于前台应用程序组包含的应用程序的运行顺畅的保障优先级,则第一处理资源少于前台控制组可占用的处理资源。目标应用程序组的资源分配方式操作灵活,可提高目标应用程序组包含的应用程序的运行状态的可控性。
结合第一方面,在第二种可能的实现方式中,所述为所述第一目标应用程序分配终端的第一处理资源包括:
将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
本申请可将处于预设运行状态的第一目标应用程序添加至前台应用程序组,其中,目标应用程序组中包含的应用程序均为处于预设运行状态的后台应用程序。此时,终端中包含的应用程序组可包括前台应用程序组和后台应用程序组,其中,后台应用程序组包含的应用程序的运行顺畅的保障优先级最低,因此后台控制组的可占用处理资源少于前台控制组的可占用处理资源。终端可将前台应用程序组可占用的第一处理资源分配给目标应用程序组,目标应用程序组可占用的第一处理资源包括的处理器核的个数大于后台应用程序组可占用的第二处理资源中包含的处理器核的个数,可保障目标应用程序组包含的应用程序的运行顺畅的保障优先级与前台应用程序组包含的应用程序的运行顺畅的保障优先级相同,可保障目标应用程序组包含的应用程序的运行顺畅,提高终端的用户体验。
结合第一方面第一种可能的实现方式或者第一方面第二种可能的实现方式,在第三种
可能的实现方式中,所述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
本申请可将用户可明显感知的后台应用程序的运行状态确定为预设运行状态,进而可将处于此类运行状态的后台应用程序确定为第一目标应用程序,并可为第一目标应用程序分配多于后台应用程序共享的处理资源的第一处理资源,可保证第一目标应用程序的运行顺畅,提高终端的用户体验。
结合第一方面第一种可能的实现方式或者第一方面第二种可能的实现方式,在第四种可能的实现方式中,所述预设运行状态为所述第一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
本申请可将与在终端操作系统前台运行的第二目标应用程序关联的后台应用程序的运行状态确定为预设运行状态,进而可将处于此类运行状态的后台应用程序确定为第一目标应用程序。进一步的,可将前台应用程序组可占用的处理资源分配给第一目标应用程序,通过保障第一目标应用程序的运行顺畅来保障第二目标应用程序的运行顺畅,提高终端的用户体验。
结合第一方面第三种可能的实现方式或者第一方面第四种可能的实现方式,在第五种可能的实现方式中,所述检测终端的操作系统后台中运行的应用程序中各个应用程序的运行状态之后,所述方法还包括:
检测所述终端包含的处理器核中各个处理器核的负载状态;
当确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;
将所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
本申请可对后台控制组中包含的异常应用程序进行处理资源的限额管制或者对异常应用程序的运行进行冻结或者结束等管理,避免异常应用程序占用太多处理资源,影响其他应用程序的正常运行,提高了终端应用程序的管理的适用性,增强了终端的用户体验。
结合第一方面第五种可能的实现方式,在第六种可能的实现方式中,所述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
本申请还可通过应用程序的IO速率来排查异常应用程序,可提高异常应用程序的判断准确性,提高应用程序的运行的控制准确率。
结合第一方面第六种可能的实现方式,在第七种可能的实现方式中,所述第一时长为零;
所述将所述异常应用程序设置为占用第三处理资源包括:
将所述异常应用程序进行冻结;或者
结束所述异常应用程序。
本申请可对后台控制组中包含的异常应用程序的运行进行冻结或者结束等管理,通过强制结束异常应用程序的运行来更好地避免异常应用程序占用太多处理资源,影响其他应
用程序的正常运行,提高了终端应用程序的管理的适用性,增强了终端的用户体验。
结合第一方面至第一方面第七种可能的实现方式中任一种,在第八种可能的实现方式中,本申请所描述的终端中包含一个或者多个多核处理器;
第一处理资源包括一个或者多个多核处理器中每个处理器的一个或者多个处理器核;
第二处理资源包括一个或者多个多核处理器中每个处理器的一个或者多个处理器核;
第三处理资源包括一个或者多个处理器核中每个处理器核的可占用时长。
结合第一方面第八种可能的实现方式中任一种,在第九种可能的实现方式中,本申请提供的处理器包括中央处理器(英文:Central Process Unit,CPU)或者应用处理器(英文:Application Processor,AP)等。上述应用处理器具体可为arm公司生产是一款精简指令集(英文:Reduced Instruction Set Computer,RISC)微处理器(英文:Advanced RISC Machines,ARM),也可为其他应用于手机等终端设备上的处理器;
其中,ARM处理器可为单核处理器或者多核处理器。
本申请提供的方法适用于多种类型的处理器,提高了终端后台应用程序的管理方法的适用性。
第二方面提供了一种终端后台应用程序的管理装置,其可包括:
检测模块,用于检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;
选取模块,用于从所述检测模块检测到的所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;
设置模块,用于为所述选取模块选取的所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行;
其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
结合第二方面,在第一种可能的实现方式中,所述设置模块具体用于:
将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
结合第二方面,在第二种可能的实现方式中,所述设置模块具体用于:
将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
结合第二方面第一种可能的实现方式或者第二方面第二种可能的实现方式,在第三种可能的实现方式中,所述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
结合第二方面第一种可能的实现方式或者第二方面第二种可能的实现方式,在第四种可能的实现方式中,所述预设运行状态为所述第一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
结合第二方面第三种可能的实现方式或者第二方面第四种可能的实现方式,在第五种可能的实现方式中,所述检测模块还用于:
检测所述终端包含的处理器核中各个处理器核的负载状态;
所述选取模块还用于:
在所述检测模块确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;
所述设置模块还用于:
将所述选取模块选取的所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
结合第二方面第五种可能的实现方式,在第六种可能的实现方式中,所述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
结合第二方面第六种可能的实现方式,在第七种可能的实现方式中,所述第一时长为零;
所述设置模块具体用于:
将所述异常应用程序进行冻结;或者
结束所述异常应用程序。
结合第二方面至第二方面第七种可能的实现方式中任一种,在第八种可能的实现方式中,本申请所描述的终端中包含一个或者多个多核处理器;
第一处理资源包括一个或者多个多核处理器中每个处理器的一个或者多个处理器核;
第二处理资源包括一个或者多个多核处理器中每个处理器的一个或者多个处理器核;
第三处理资源包括一个或者多个处理器核中每个处理器核的可占用时长。
结合第二方面第八种可能的实现方式中任一种,在第九种可能的实现方式中,本申请提供的处理器包括中央处理器(英文:Central Process Unit,CPU)或者应用处理器(英文:Application Processor,AP)等。上述应用处理器具体可为arm公司生产是一款精简指令集(英文:Reduced Instruction Set Computer,RISC)微处理器(英文:Advanced RISC Machines,ARM),也可为其他应用于手机等终端设备上的处理器;
其中,ARM处理器可为单核处理器或者多核处理器。
第三方面提供了一种终端,其可包括:存储器和处理器;
所述存储器用于存储一组程序代码;
所述处理器用于调用所述存储器中存储的程序代码执行如下操作:
检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;
从所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;
为所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置
在所述第一处理资源上运行;
其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
结合第三方面,在第一种可能的实现方式中,所述处理器具体用于:所述为所述第一目标应用程序分配终端的第一处理资源包括:
将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
结合第三方面,在第二种可能的实现方式中,所述处理器具体用于:所述为所述第一目标应用程序分配终端的第一处理资源包括:
将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
结合第三方面第一种可能的实现方式或者第三方面第二种可能的实现方式,在第三种可能的实现方式中,所述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
结合第三方面第一种可能的实现方式或者第三方面第二种可能的实现方式,在第四种可能的实现方式中,所述预设运行状态为所述第一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
结合第三方面第三种可能的实现方式或者第三方面第四种可能的实现方式,在第五种可能的实现方式中,所述处理器还用于:
检测所述终端包含的处理器核中各个处理器核的负载状态;
当确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;
将所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
结合第三方面第五种可能的实现方式,在第六种可能的实现方式中,所述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
结合第三方面第六种可能的实现方式,在第七种可能的实现方式中,所述第一时长为零;
所述将所述异常应用程序设置为占用第三处理资源包括:
将所述异常应用程序进行冻结;或者
结束所述异常应用程序。
本申请可将终端操作系统后台中运行的各个应用程序中处于预设运行状态的应用程序
确定为目标应用程序,进而可为目标应用程序分配更多的处理资源。通过为后台应用程序中的目标应用程序分配更多的处理资源,使得目标应用程序的可占用资源多于原来分配给后台所有应用程序共享的处理资源,可保障目标应用程序的运行更顺畅,增强应用程序的运行状态的可控性。进一步的,本申请可对后台控制组中包含的异常应用程序进行处理资源的限额管制或者对异常应用程序的运行进行冻结或者结束等管理,避免异常应用程序占用太多处理资源,影响其他应用程序的正常运行,提高了终端应用程序的管理的适用性,增强了终端的用户体验。
为了更清楚地说明本发明实施中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例应用的终端设备的结构示意图;
图2是本发明实施例提供的一应用程序管理操作示意图;
图3是本发明实施例提供的终端后台应用程序的管理方法的流程示意图;
图4是本发明实施例提供的CPU资源的一分配示意图;
图5是本发明实施例提供的CPU资源的另一分配示意图;
图6是本发明实施例提供的另一应用程序管理操作示意图;
图7是本发明实施例提供的计算机系统的结构示意图;
图8是本发明实施例提供的终端后台应用程序的管理装置的结构示意图。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例提供的终端后台应用程序的管理方法主要应用于终端设备,该终端设备也可称之为用户设备英文:(User Equipment,UE)、移动台(英文:Mobile Station,MS)、移动终端(英文:Mobile Terminal)等。可选的,该终端设备(以下简称终端)可以具备经无线接入网(英文:Radio Access Network,RAN)与一个或多个核心网进行通信的能力。例如,终端可以是移动电话(或称为“蜂窝”电话)、或具有移动性质的计算机等。例如,终端还可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置。应理解的是,除了终端设备以外,本发明实施例提供的终端后台应用程序的管理方法也可以应用于其他类型的计算机系统。
请参考图1,为本发明实施例提供的终端设备的结构示意图。如图1所示,终端设备100包括存储器180、处理器150以及显示设备140。存储器180存储计算机程序(或称程序代码),该计算机程序包括操作系统程序182和应用程序181等。处理器150用于读取存
储器180中的计算机程序,然后执行计算机程序定义的方法,例如处理器150读取操作系统程序182从而在该终端设备100上运行操作系统以及实现操作系统的各种功能,或读取一种或多种应用程序181,从而在该终端设备上运行应用。
处理器150可以包括一个或多个处理器,例如,处理器150可以包括一个或多个中央处理器,或者包括一个或者多个中央处理器和一个或者多个应用处理器。当处理器150包括多个处理器时,这多个处理器可以集成在同一块芯片上,也可以各自为独立的芯片。一个处理器可以包括一个或多个处理器核(或称处理核),以下实施例均以多核为例来介绍,但是本发明实施例提供的终端后台应用程序的管理方法也可以应用于单核处理器,利用单核处理器的分时工作原理执行多个应用程序的并行运行。
另外,存储器180还存储有除计算机程序之外的其他数据183,其他数据183可包括操作系统182或应用程序181被运行后产生的数据,该数据包括系统数据(例如操作系统的配置参数)和用户数据,例如用户下载的一首网络歌曲就是典型的用户数据,下载网络歌曲的应用程序也是本发明实施例提供的方法的管理的对象之一。
存储器180一般包括内存和外存。内存可以为随机存储器(RAM),只读存储器(ROM),以及高速缓存(CACHE)等。外存可以为硬盘、光盘、USB盘、软盘或磁带机等。计算机程序通常被存储在外存上,处理器在执行处理前会将计算机程序从外存加载到内存。
操作系统程序182中包含了可实现本发明实施例提供的终端后台应用程序的管理方法的计算机程序,从而使得处理器150读取到该操作系统程序182并运行该操作系统后,该操作系统可具备本发明实施例提供的后台应用程序的管理功能。
终端设备100还可以包括输入设备130,用于接收输入的数字信息、字符信息或接触式触摸操作/非接触式手势,以及产生与终端设备100的用户设置以及功能控制有关的信号输入等。具体地,本发明实施例中,该输入设备130可以包括触控面板131。触控面板131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板131上或在触控面板131的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给该处理器150,并能接收处理器150发来的命令并加以执行。例如,用户在触控面板131上用手指双击一个应用程序的图标,触摸检测装置检测到此次双击带来的这个信号,然后将该信号传送给触摸控制器,触摸控制器再将这个信号转换成坐标发送给处理器150,处理器150根据该坐标和该信号的类型(如双击)执行启动该应用程序等操作,最后将该应用程序的操作界面显示在显示面板141上,从而实现“打开”应用程序。
触控面板131可以采用电阻式、电容式、红外线以及表面声波等多种类型实现。除了触控面板131,输入设备130还可以包括其他输入设备132,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
终端设备100还可以包括显示设备140,显示设备140,包括显示面板141,用于显示由用户输入的信息或提供给用户的信息以及终端设备100的各种菜单界面等,在本发明实
施例中主要用于显示应用程序的用户操作界面等信息。该显示设备140可包括显示面板141,可选的,可以采用液晶显示器(英文:Liquid Crystal Display,LED)或有机发光二极管(英文:Organic Light-Emitting Diode,OLED)等形式来配置显示面板141。在其他一些实施例中,触控面板131可覆盖显示面板141上,形成触摸显示屏。
除以上之外,终端设备100还可以包括用于给其他模块供电的电源190以及用于拍摄照片或视频的摄像头160。终端设备100还可以包括一个或多个传感器120,例如重力传感器、加速度传感器、光传感器等。终端设备100还可以包括无线射频(英文:Radio Frequency,RF)电路110,用于与无线网络设备进行网络通信,还可以包括WiFi模块170,用于与其他设备进行WiFi通信等。
下面的实施例将以终端为执行主体对本发明实施例提供的终端后台应用程序的管理方法及装置进行描述。本发明实施例提供的管理方法可以实现在图1所示的操作系统程序182中。
具体实现中,终端启动应用程序(英文:application,APP)1并在终端的操作系统的前台执行完某个任务之后,若终端启动APP2,则APP1将切换至终端的操作系统的后台(下面简称后台)。APP1切换至后台之后还处于启动状态,还可继续在后台运行相关任务,此时APP1运行任务还会占用处理器资源。APP1和APP2的运行过程中会存在争抢处理器资源的现象,若APP1占用的处理器资源较多则将导致APP2在前台运行出现卡顿等现象。其中,上述处理器资源具体可为中央处理器(英文:Central Process Unit,CPU)资源或者应用处理器(英文:Application Processor,AP)资源等。上述应用处理器资源具体可为arm公司生产是一款精简指令集(英文:Reduced Instruction Set Computer,RISC)微处理器(英文:Advanced RISC Machines,ARM),也可为其他应用于手机等终端设备上的处理器。具体可根据实际应用场景需求确定,在此不做限制。下面将以CPU资源为处理器资源为例对本发明实施例提供的终端后台应用程序的管理方法及装置进行说明。
具体实现中,解决前后台任务争抢CPU资源的问题可采用基于控制组(英文:Control Group,CGroup)的前后台控制机制。参见图2,图2是本发明实施例提供的一应用程序管理操作示意图。如图2所示,前后台控制机制通过把前台APP放到前台控制组(英文:Foreground CGroup,FG CGroup)(或称前台分组),将所有后台APP放到后台控制组(英文:Background CGroup,BG CGroup)(或称后台分组),并分别为前台控制组和后台控制组分配CPU资源。其中,为前台控制组分配的CPU资源包括终端中包含的所有处理器核(如CPU核或者ARM核,下面以CPU核为例)中的大部分CPU核,如图2中的编号0-7的8个CPU核。其中,上述编号0-7的8个CPU核为终端包含的CPU核。此外,终端将每个CPU核的大部分比例资源分配给前台控制组。例如,将终端中包含的所有CPU核(编号0-7的8个CPU核)分配给前台控制组,即前台控制组可使用所有CPU核上的资源。此外,还可将每个CPU核的可占用资源(例如CPU核的可占用时间)中的95%分配给前台控制组等。具体的,还可为后台控制组还可分为后台控制分组和系统后台控制组,其中,系统后台控制组中包含的APP为终端系统运行必不可少的系统APP或者终端出厂配置的APP等,后台控制分组为后台应用程序中除去系统后台控制组中包含的APP之外的后台APP。上述实现方式为后台控制分组分配较少的CPU资源,比如一个CPU核(编号为3
的CPU核),为系统后台控制分组分配3个CPU核,如图2中编号0-2的3个CPU核,并且后台控制组中包含的所有APP只能共享该CPU核中的5%的可占用时间等。通过为前台控制组中包含的APP分配更多的资源来保障前台控制组的APP运行顺畅,提高终端的前台APP运行的用户体验。
然而,上述实现方式没有考虑到前后台任务之间可能存在相互依赖的情况,以及后台任务的输出结果对用户体验的影响等现象。具体实现中,某些任务即使处于后台,其输出结果也是用户可实时感知的,包括语音播放等。若处于后台的任务(假设为任务A)的输出结果是用户可实时感知的,系统则需要保障任务A的运行顺畅。在该场景中,上述实现方式中后台任务所拥有的CPU资源较少,难以保障任务A的运行顺畅。若前台任务的执行需要依赖后台任务的运行结果或者后台任务持有前台任务所需的资源,即前台任务和后台任务之间存在关联,则后台任务的运行不顺畅也将导致前台任务的执行受到阻碍,前台任务可能出现卡顿丢帧的现象。
为了上述现有实现方式中存在的CPU资源分配形式单一,操作不灵活以及终端的APP管理方法的适用性差等问题,本发明实施例提供了一种终端后台应用程序的管理方法及装置,可增强终端后台应用程序的运行状态的可控性,提高终端后台应用程序的管理的适用性,增强终端的用户体验。
参见图3,是本发明实施例提供的终端后台应用程序的管理方法的流程示意图。本发明实施例提供的管理方法,包括步骤:
S201,检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态。
在一些可行的实施方式中,本发明实施例可根据后台APP的运行状态对后台APP中的关键APP进行区别化管理,以保证关键APP的运行顺畅,进而可提高终端的用户体验。具体实现中,终端可对后台中运行的应用程序进行检测,确定各个应用程序的运行状态。其中,上述应用程序的运行状态包括应用程序的输出结果对前台应用程序的运行是否造成影响,即后台应用程序中是否存在与前台应用程序关联的应用程序。此外,上述应用程序的运行状态还可包括应用程序的输出结果用户是否可以明显感知,即应用程序是否为需要保障运行顺畅的应用程序等。具体的,终端可在某个APP(例如上述APP1)切换到后台时检测APP1与前台APP(例如上述APP2)的运行状态,判断上述APP1与APP2是否存在关联关系。或者,终端可将APP1与预设的APP类别进行比对,判断上述APP1是否为需要保障运行顺畅的APP。进一步的,终端也可使用周期性(例如10秒一个周期等)检测的方式,在指定时间对系统后台中运行的所有应用程序中每个应用程序的运行状态进行检测,以确定后台应用程序中是否存在与前台应用程序关联的目标应用程序或者需要保障运行顺畅的目标应用程序等。其中,上述与前台应用程序关联的目标应用程序或者需要保障运行顺畅的目标应用程序则为本发明实施例中描述的关键应用程序。
S202,从所述各个应用程序中选取第一目标应用程序。
在一些可行的实施方式中,终端可通过对后台应用程序的检测获取后台应用程序中的目标应用程序(即第一目标应用程序)。其中,上述第一目标应用程序为运行状态为预设运行状态的应用程序。具体的,第一目标应用程序可包括上述与前台应用程序关联的目标应用程序或者需要保障运行顺畅的目标应用程序等。其中,上述预设运行状态可包括语音播
放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态等,处于上述预设运行状态的应用程序可设定为需要保障运行顺畅的目标应用程序。上述预设运行状态也可为与前台应用程序关联的状态,处于上述与前台应用程序关联的状态的应用程序可设定为与前台关联的目标应用程序。下面将结合步骤S203对处于预设运行状态的应用程序进行CPU资源分配等区别性管理。
S203,为所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行。
在一些可行的实施方式中,终端的操作系统前台运行的应用程序(例如上述APP2)可设定为第二目标应用程序,即上述前台控制组中包含的应用程序可设定为第二目标应用程序。上述后台中运行的所有应用程序可为上述后台控制组中包含的应用程序,即,上述第一目标应用程序可为现有技术中分在后台控制组中的一个或者多个应用程序。本发明实施例提供的前台控制组可占用终端的一部分资源,比如上述终端的所有CPU核,以及每个CPU核的95%的可占用时长等。本发明实施例提供的后台控制组也可占用终端的一部分资源(设为第二处理资源),比如上述终端的所有CPU核中的一个以及该CPU核的5%的可占用时长。其中,上述后台控制组所占用的CPU核的另外95%的可占用时长也为上述前台控制组所拥有的资源,也可为本发明实施例提供的关键应用程序所拥有的资源,具体可根据实际应用场景确定,在此不做限制。
在一些可行的实施方式中,终端可将后台APP中处于语音播放状态、文件传输状态、使用传感器状态、视频通话状态或者语音通话状态等运行状态中的APP确定为第一目标APP,以对处于上述运行状态中的第一目标APP进行CPU资源分配,保证上述第一目标APP的运行顺畅。具体实现中,终端可创建一个关键后台控制组(英文:key background CGroup,Kbg CGroup),将上述第一目标APP放入关键后台控制组(即目标应用程序组)中,并为关键后台控制组分配CPU资源。具体实现中,上述第一目标APP可为处于上述语音播放状态、文件传输状态、使用传感器状态、视频通话状态或者语音通话状态等运行状态的一个或者多个APP,具体可根据各个APP的具体工作状态确定,在此不做限制。相应的,上述关键后台控制组中可包含一个或者多个APP,并且上述关键后台控制组中包含的APP可为上述第一目标APP。
具体实现中,终端确定了后台APP中包含的第一目标APP之后,则可为第一目标APP分配CPU资源。具体的,终端可根据已分配给前台控制组的CPU资源的情况,以及已分配给后台控制组的CPU资源的情况为关键后台控制组分配终端的第一处理资源(具体可为第一CPU资源)。在本发明实施例中,终端拥有的CPU核可为多个。其中,分配给前台控制组的CPU资源可为终端所拥有的所有CPU核并且每个CPU核的预设比例1(例如95%)的可占用时长等,分配给后台控制组的CPU资源可为终端所拥有的CPU核中的一个(或者多个)并且为每个CPU核的预设比例2(例如5%)的可占用时长等。终端为关键后台控制组分配的第一CPU资源少于前台控制组所拥有的CPU资源,多于后台控制组所拥有的CPU资源。具体实现中,由于前台控制组的APP运行顺畅的保障优先级最高,因此,关键后台控制组所占用的第一CPU资源的分配方式既可保证关键后台控制组的APP运行顺畅,也可避免关键后台控制组的APP与前台控制组的APP抢占资源,影响前台控制组的
APP的运行。需要说明的是,具体实现中,终端也可为关键后台控制组分配与前台控制组相同的CPU资源,具体可根据实际应用场景需求确定,在此不做限制。
例如,若终端为后台控制组分配1个CPU核,终端则可为关键后台控制组分配2个或者3个等多于1个的CPU核。具体实现中,终端还可为系统APP分配CPU资源。如图4,图4是本发明实施例提供的CPU资源的一分配示意图。例如,终端将其系统中包含的APP分为前台控制组、系统后台控制组(其中包含终端的系统APP,例如系统运行必不可少的APP或者终端出厂配置的APP等)、关键后台控制组和后台控制分组等APP分组。若终端中包含编号为0到7的8个CPU核,终端则可将8个CPU核分配给前台控制组,将编号为0到2的3个CPU核分配给系统后台控制组,将编号为1、2和7的3个CPU核分配给关键后台控制组,并将编号为3的1个CPU核分配给后台控制分组。其中,上述CPU核的数量与编号等CPU核的分配方式仅是举例,而非穷举。其中,前台控制组所拥有的CPU核数量最多,系统后台控制组所拥有的CPU核数量少于前台控制组,关键后台控制组所拥有的CPU核数量少于前台控制组,后台控制组所拥有的CPU核数量最少。系统后台控制组与关键后台控制组之间的CPU核的数量大小关系在此不做限制,具体可根据实际应用场景确定。
进一步的,如图4,在一些可行的实施方式中,终端为各个APP控制组分配CPU核资源之后,若各个APP控制组中包含的APP在同一个CPU核上运行,则可进一步为各个APP控制组中包含的APP分配该CPU核的资源。例如,终端可将系统后台控制组中包含的APP记入前台控制组,并为前台控制组和系统后台控制组分配CPU核的预设比例1(例如95%)的可占用时长。终端还可将关键后台控制组合后台控制分组记为后台控制组,并将CPU核的预设比例2(例如5%)的可占用时长分配给关键后台控制组和后台控制分组。其中,后台控制分组中包含的APP为终端后台的所有APP中除去系统后台控制组和关键后台控制组中包含的APP之后的APP。例如,假设终端系统后台的所有APP有5个,其中放入系统后台控制组的APP为2个,放入关键后台控制组的APP为1个,则剩下的2个APP则为后台控制组中包含的APP。
进一步的,在一些可行的实施方式中,若上述选取的第一目标APP为与前台APP(即第二目标APP)关联的APP,则可将上述第一目标APP添加至前台控制组。终端将上述第一目标APP添加至前台控制组之后,上述第一目标APP则可与前台控制组中包含的其他APP共享前台控制组所拥有的CPU资源。其中,第一目标APP与前台控制组中包含的其他APP共享的前台控制组所用的CPU资源包括前台控制组所拥有的CPU核以及每个CPU核的可占用时长等资源,在此不再赘述。由于第一目标APP与前台APP关联,第一目标APP的运行顺畅与否将较大程度地影响着前台APP的运行,因此,第一目标APP运行顺畅的保障优先级应该等于前台APP或者略低于前台APP。终端设置第一目标APP则可与前台控制组中包含的其他APP共享前台控制组所拥有的CPU资源,保障第一目标APP的运行顺畅的同时保障着前台APP的运行顺畅,提高了终端的用户体验。需要说明的是,在一些可行的实施方式中,第一目标APP与前台APP关联时终端也可为第一目标APP单独建立一个分组(如关键后台控制组),并按照上述关键后台控制组的资源分配方式为第一目标APP分配资源,具体可根据实际应用场景需求确定,在此不做限制。
在一些可行的实施方式中,上述终端的前台APP与后台APP之间的关联关系可通过进程之间的关联关系确定。具体的,终端可在活动管理服务(英文:activity manager service,AMS)中采集系统中运行的各个进程之间的关联关系,并通过系统服务的实时处理子系统对各个进程之间的关联关系进行分析、确定。其中,上述各个进程之间的关联关系可使用getContentProvider,startActivity,bindService、unbindService,startService、stopService等关联关系采集函数来确定,具体可根据实际应用场景确定,在此不做限制。
具体实现中,若上述第一目标APP运行完处于上述预设运行状态的任务,则可将上述第一目标APP放入后台控制组中,以避免占用CPU资源。例如,APP4处于语音通话状态时,可将其放入关键后台控制组,此时,APP4的可占用CPU资源为关键后台控制组所拥有的CPU资源。若APP4语音通话结束,则可将其放入后台控制分组中,此时APP4的可占用CPU资源则为后台控制分组所拥有的CPU资源。
在一些可行的实施方式中,终端还可在系统的各个APP运行过程中,对系统中的异常APP进行检测和管理。具体实现中,终端可以以一定的周期(例如10秒一个周期)检测终端中包含的所有CPU核中每个CPU核的负载状态,以判别终端中是否存在负载异常的CPU核(设为异常CPU核)。若检测得到某个CPU核的负载超过第一预设负载阈值(例如80%等),则可将该CPU核确定为异常CPU核。进一步的,终端可获取异常CPU核上运行的APP的负载状态,获取上述异常CPU核上的异常APP,其中,上述异常APP的负载占异常CPU核的总负载的比例大于预设比例阈值的APP。进一步的,上述异常APP还可为网络输入输出(英文:input/output,IO)速率小于预设速率阈值的APP。比如,终端可将连续3个周期的负载占异常CPU的总负载比例超过50%,并且网络IO速率小于10Kbits/s的APP确定为异常APP。具体实现中,上述异常APP也可为存在被攻击等风险的APP,具体可根据终端的实际应用场景或者软硬件配置等情况确定,在此不做限制。
在一些可行的实施方式中,终端检测得到终端中的异常APP之后,则可对上述异常APP运行可占用的CPU资源进行管制。具体的,终端可将上述异常APP所能占用的CPU资源设定为第三CPU资源。其中,上述第三CPU资源可为空,也可为异常CPU核上的预设比例3的可占用时长。例如,终端可将上述异常APP占用异常CPU核的时长设定为第一时长,异常CPU核上的其他APP占用异常CPU核的时长设定为第二时长,进而可设定第一时长占CPU核的可占用时长的5%,第二时长占CPU核的可占用时长的95%等。
具体实现中,终端检测得到异常APP之后,可直接对异常APP进行冻结或者直接结束异常APP,此时,异常APP所占用的第三CPU资源为空。此外,若上述异常APP需要收发消息,并且也为用户常用的APP,则可将异常APP设置在上述第一时长上运行,通过可占用时长的限制来控制异常APP的运行对其他APP的运行造成影响。如图5,图5为本发明实施例提供的CPU资源的另一分配示意图。若上述异常APP为用户常用的APP,或者上述异常APP需要收发信息,则可将上述异常APP的可占用CPU资源设定为CPU核的5%的可占用时间。若异常APP在异常CPU核上运行的时间超过CPU核在一个运行周期内的可占用时间的5%,则需要退出将CPU核让给其他APP,等待下一个运行周期。
参见图6,图6是本发明实施例提供的另一应用程序管理操作示意图。如图6,在本发明实施例中,终端可在原有的后台控制组中包含的后台控制分组和系统后台控制组之外建
立关键后台控制组,将后台APP中的关键APP放入关键后台控制组中,并为关键后台控制组分配资源,关键后台控制组所拥有的资源比后台控制分组多,进而可保障关键后台控制组中包含的APP的运行顺畅,增强了终端APP的运行状态的可控性。进一步的,终端可对后台控制组中包含的异常APP进行CPU资源的限额管制(单个CPU核的可占资源5%等)或者对异常APP的运行进行冻结或者结束(占用的CPU资源为空)等管理,避免异常APP占用太多CPU资源,影响其他APP的正常运行,提高了终端APP的管理的适用性,增强了终端的用户体验。
以上主要介绍了本发明实施例提供的方法的具体流程,下面结合图7并以Android操作系统为例,介绍本发明实施例提供的方法的实现位置和运行时状态,更具体的方法流程可参考前述实施例。
请参阅图7,为本发明实施例提供的计算机系统的结构示意图。该计算机系统可以是上述本发明实施例提供的终端设备,也可以是其他类型的计算机设备。该计算机系统包括应用层710、操作系统层700和硬件层750。
其中,上述操作系统可以为Android操作系统,也可为其他适用于本发明实施例提供的方法的操作系统,在此不做限制。操作系统层450又分为系统服务层720、核心库层730和内核层740。其中,图7中的操作系统层700可以认为是图1中操作系统182的一种具体实现。系统服务层720包括业务状态信息采集、CPU调度决策和CPU调度执行器等。需要说明的是,图7是以CPU这种处理器为例的示意图,具体实现中,CPU也可替换为ARM,具体可根据实际应用程序确定,在此不做限制。核心库层730包括CPU信息采集库、CPU分组管理和CPU分组任务管理库等。内核层740可包括CPU资源调度、CPU控制组合CPUSET控制组等。
在一些可行的实施方式中,系统服务器层720中的业务状态信息采集用于采集应用层710中各个应用的业务状态信息。其中,各个应用的业务状态信息包括应用在前台运行和后台运行的前后台属性变化,或者应用的运行或者结束等运行状态变化等。本发明实施例可通过系统服务层720中的业务状态信息采集获取系统后台应用程序中处于预设运行状态的第一目标应用程序,进而可通过系统服务层720中的CPU调度决策确定为第一目标应用程序分配的第一处理资源。系统服务层720中的CPU调度决策用于根据应用状态信息采集模块采集到的应用状态信息确定分配给第一目标应用程序的CPU资源。系统服务层720中的CPU调度执行器用于根据CPU调度决策模块确定的分配给第一目标应用程序的CPU资源,设置第一目标应用程序对应的应用进程的可占用CPU资源,包括可占用的CPU核以及单个的可占用时长等。进一步的,CPU调度执行器设置好第一目标应用程序对应的应用进程的可占用CPU资源之后,则可通过核心库层730和内核层740中各个模块执行CPU资源的分配和调度。
具体实现中,核心库层730中包含的CPU信息采集库用于为系统服务层720提供的CPU的负载状态等CPU信息。CPU调度决策模块确定分配给第一目标应用程序的CPU资源时可根据CPU信息采集库提供的各个CPU核的负载状态确定分配给第一目标应用程序的CPU核(具体可为某一个或者多个CPU核),进而可通过CPU调度执行器进行CPU决策的执行。核心库层730中的CPU分组管理可根据CPU调度执行器设置的CPU资源的分
配方式对系统中包含的CPU核进行分组管理,进而可通过CPU分组任务管理库对各个CPU分组(具体可为CPU核的分组)中的CPU核进行任务管理。其中,CPU分组管理用于为前台控制组分配CPU核(即系统包含的所有CPU核),或者为后台控制组分配系统中包含的某一个CPU核,或者为关键后台控制组分配系统包含的CPU核中的一个或者多个等,进而可实现CPU核的分组。上述CPU核的任务管理包括各个CPU核上运行的应用进程的添加与减少等应用进程管理。
进一步的,内核层740中的CPU控制组可根据CPU分组任务管理库对各个CPU核的任务管理情况对各个CPU核的可占用时间进行控制管理。例如,前台控制组中包含的应用程序可占用每个CPU核的95%的可占用时长,后台控制组中包含的应用程序可占用其可占用的CPU核的5%的可占用时长等。若CPU分组任务管理库对各个CPU核的任务管理过程中出现了任务分配异常的CPU核(如上述异常CPU核),CPU控制组可将异常应用程序占用异常CPU核的可占用时长控制在5%等。CPUSET控制组用于对CPU分组管理分配的各个CPU分组包含的CPU核进行控制。CPU调度执行器确定的CPU资源的调度执行可通过CPUSET控制组进行控制,最后通过CPU资源调度进行硬件层750上的CPU的调度。CPU资源调度用于执行根据CPU控制组和CPUSET控制组的控制指令,进而实现对硬件层750中的中央处理器的调度。
进一步的,如图7,终端的应用层710可包括电话、联系人(即通讯录)、即时通讯、图库、音乐、媒体播放器、地图导航、以及浏览器等。其中,图7中的应用层710可以认为是图1中应用程序181的一种具体实现,在此不做限制。终端的硬件层750包括中央处理器(即CPU)、图形处理器、存储器、输入设备和显示设备等。其中,中央处理器和图形处理器可相当于图1中的处理器150的一种具体实现)存储器可相当于图1中的存储器180,包括内存和外存。图7中的输入设备可相当于图1中的输入设备132,图7中的显示设备455可相当于图1中的显示设备140,例如液晶显示器(英文:Liquid Crystal Display,LCD)、全息成像(英文:Holographic)、投影(英文:Projector)等。当然除此之外,硬件层750还可以包括一个或多个传感器(相当于图1中的传感器120)。硬件层750还可以包括图1中示出的电源、摄像头、RF电路和WiFi模块,还可以包括图1中也没有示出的其他硬件模块,例如内存控制器和显示控制器等,在此不做限制。
参见图8,是本发明实施例提供的终端后台应用程序的管理装置的结构示意图。本发明实施例提供的管理装置包括:
检测模块810,用于检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态。
选取模块820,用于从所述检测模块810检测到的所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态。
设置模块830,用于为所述选取模块820选取的所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行。
其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
在一些可行的实施方式中,上述设置模块830具体用于:
将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
在一些可行的实施方式中,上述设置模块830具体用于:
将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;
其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
在一些可行的实施方式中,上述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
在一些可行的实施方式中,上述预设运行状态为所述第一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
在一些可行的实施方式中,上述检测模块810还用于:
检测所述终端包含的处理器核中各个处理器核的负载状态;
上述选取模块820还用于:
在所述检测模块确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;
上述设置模块830还用于:
将所述选取模块选取的所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
在一些可行的实施方式中,上述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
在一些可行的实施方式中,上述第一时长为零;
上述设置模块830具体用于:
将所述异常应用程序进行冻结;或者
结束所述异常应用程序。
具体实现中,上述管理装置可通过其内置的各个模块执行本发明实施例提供的终端后台应用程序的管理方法中各个步骤所描述的实现方式,具体可参见上述实施例,在此不再赘述。
在本发明实施例中,终端可为处于预设运行状态的后台应用程序所在的目标应用程序组(如关键后台控制组)分配资源,关键后台控制组所拥有的资源比后台控制分组多,进而可保障关键后台控制组中包含的目标APP的运行顺畅,增强了终端APP的运行状态的可控性。进一步的,终端可对后台控制组中包含的异常APP进行CPU资源的限额管制(单
个CPU核的可占资源5%等)或者对异常APP的运行进行冻结或者结束(占用的CPU资源为空)等管理,避免异常APP占用太多CPU资源,影响其他APP的正常运行,提高了终端APP的管理的适用性,增强了终端的用户体验。
本发明的说明书、权利要求书以及附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或者单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或者单元,或可选地还包括对于这些过程、方法、系统、产品或设备固有的其他步骤或单元。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。
Claims (16)
- 一种终端后台应用程序的管理方法,其特征在于,包括:检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;从所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;为所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行;其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
- 如权利要求1所述的管理方法,其特征在于,所述为所述第一目标应用程序分配终端的第一处理资源包括:将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
- 如权利要求1所述的管理方法,其特征在于,所述为所述第一目标应用程序分配终端的第一处理资源包括:将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
- 如权利要求2或3所述的管理方法,其特征在于,所述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
- 如权利要求2或3所述的管理方法,其特征在于,所述预设运行状态为所述第一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
- 如权利要求4或5所述的管理方法,其特征在于,所述检测终端的操作系统后台中运行的应用程序中各个应用程序的运行状态之后,所述方法还包括:检测所述终端包含的处理器核中各个处理器核的负载状态;当确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;将所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
- 如权利要求6所述的管理方法,其特征在于,所述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
- 如权利要求7所述的管理方法,其特征在于,所述第一时长为零;所述将所述异常应用程序设置为占用第三处理资源包括:将所述异常应用程序进行冻结;或者结束所述异常应用程序。
- 一种终端后台应用程序的管理装置,其特征在于,包括:检测模块,用于检测终端操作系统后台中运行的应用程序中各个应用程序的运行状态;选取模块,用于从所述检测模块检测到的所述各个应用程序中选取第一目标应用程序,所述第一目标应用程序的运行状态为预设运行状态;设置模块,用于为所述选取模块选取的所述第一目标应用程序分配终端的第一处理资源,并将所述第一目标应用程序设置在所述第一处理资源上运行;其中,所述第一处理资源大于预先分配给所述终端操作系统后台中的应用程序的第二处理资源。
- 如权利要求9所述的管理装置,其特征在于,所述设置模块具体用于:将所述第一目标应用程序添加至所述终端的目标应用程序组,并将所述终端的第一处理资源分配给所述目标应用程序组;其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
- 如权利要求9所述的管理装置,其特征在于,所述设置模块具体用于:将所述第一目标应用程序添加至在终端操作系统前台运行的第二目标应用程序所在的前台应用程序组,所述第一处理资源为所述前台应用程序组拥有的处理资源;其中,所述第一处理资源中包含的处理器核的个数大于所述第二处理资源中包含的处理器核的个数。
- 如权利要求10或11所述的管理装置,其特征在于,所述预设运行状态包括:语音播放状态、文件传输状态、使用传感器状态、视频通话状态以及语音通话状态中的至少一种。
- 如权利要求10或11所述的管理装置,其特征在于,所述预设运行状态为所述第 一目标应用程序与在终端操作系统前台运行的第二目标应用程序关联的状态。
- 如权利要求12或13所述的管理装置,其特征在于,所述检测模块还用于:检测所述终端包含的处理器核中各个处理器核的负载状态;所述选取模块还用于:在所述检测模块确定所述各个处理器核中包含异常处理器核时,获取所述异常处理器核上运行的各个应用程序中包含的异常应用程序,其中所述异常处理器核的负载大于第一预设负载阈值,所述异常应用程序的负载占所述异常处理器核的负载的比例大于预设比例阈值;所述设置模块还用于:将所述选取模块选取的所述异常应用程序设置为占用第三处理资源,其中,所述第三处理资源包括所述异常应用程序占用所述异常处理器核的第一时长,所述异常处理器核上运行的其他应用程序占用所述异常处理器核的时长为第二时长,所述第一时长小于所述第二时长。
- 如权利要求14所述的管理装置,其特征在于,所述异常应用程序的网络输入/输出IO速率小于预设速率阈值。
- 如权利要求15所述的管理装置,其特征在于,所述第一时长为零;所述设置模块具体用于:将所述异常应用程序进行冻结;或者结束所述异常应用程序。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP17842927.0A EP3495950A4 (en) | 2016-08-25 | 2017-08-23 | METHOD AND DEVICE FOR ADMINISTERING BACKGROUND APPLICATIONS OF A TERMINAL DEVICE |
US16/282,282 US20190188030A1 (en) | 2016-08-25 | 2019-02-21 | Terminal background application management method and apparatus |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610725591.8A CN107783833B (zh) | 2016-08-25 | 2016-08-25 | 一种终端后台应用程序的管理方法及装置 |
CN201610725591.8 | 2016-08-25 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/282,282 Continuation US20190188030A1 (en) | 2016-08-25 | 2019-02-21 | Terminal background application management method and apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018036505A1 true WO2018036505A1 (zh) | 2018-03-01 |
Family
ID=61245504
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/098598 WO2018036505A1 (zh) | 2016-08-25 | 2017-08-23 | 一种终端后台应用程序的管理方法及装置 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20190188030A1 (zh) |
EP (1) | EP3495950A4 (zh) |
CN (1) | CN107783833B (zh) |
WO (1) | WO2018036505A1 (zh) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102372644B1 (ko) * | 2017-08-23 | 2022-03-17 | 삼성전자주식회사 | 운영 체제의 운용 방법 및 이를 지원하는 전자 장치 |
WO2020133205A1 (zh) * | 2018-12-28 | 2020-07-02 | 驭势科技(北京)有限公司 | 一种分配数据处理资源的方法及装置 |
US11080014B2 (en) * | 2019-02-28 | 2021-08-03 | Xevo Inc. | System and method for managing multiple applications in a display-limited environment |
CN111913750B (zh) * | 2019-05-10 | 2022-04-22 | 华为技术有限公司 | 一种应用程序管理方法、装置及设备 |
CN111078186A (zh) * | 2019-12-31 | 2020-04-28 | 维沃移动通信有限公司 | 一种播放方法及电子设备 |
CN112306681A (zh) * | 2020-10-27 | 2021-02-02 | 中思博安科技(北京)有限公司 | 一种资源控制方法、装置及电子设备 |
CN113791828A (zh) * | 2021-03-03 | 2021-12-14 | 北京沃东天骏信息技术有限公司 | 提示信息的生成方法及装置 |
US11974253B2 (en) * | 2021-04-26 | 2024-04-30 | Qualcomm Incorporated | Smart resource management for low latency use case |
CN115904645A (zh) * | 2021-09-30 | 2023-04-04 | 华为技术有限公司 | 用于任务调度的方法、设备、装置和介质 |
US20240004453A1 (en) * | 2022-06-30 | 2024-01-04 | Advanced Micro Devices, Inc. | Techniques for reducing processor power consumption |
CN117130773B (zh) * | 2023-04-28 | 2024-06-21 | 荣耀终端有限公司 | 资源分配方法、装置和设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103164269A (zh) * | 2011-12-08 | 2013-06-19 | 中兴通讯股份有限公司 | 一种多窗口显示应用程序的方法及终端 |
CN104731643A (zh) * | 2015-02-27 | 2015-06-24 | 浙江大学 | 一种后台应用程序的管理方法和管理系统 |
US20160034308A1 (en) * | 2012-01-20 | 2016-02-04 | Microsoft Technology Licensing, Llc | Background task resource control |
CN105320561A (zh) * | 2015-11-09 | 2016-02-10 | 深圳市万普拉斯科技有限公司 | 任务管理方法和系统 |
CN105786520A (zh) * | 2016-03-17 | 2016-07-20 | 北京百纳威尔科技有限公司 | 电子设备应用程序的管理方法和装置 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080313639A1 (en) * | 2007-06-13 | 2008-12-18 | Krishna Kumar | Policy based scheduling of software applications |
CN103106117A (zh) * | 2012-12-25 | 2013-05-15 | 青岛海信电器股份有限公司 | 一种资源分配方法及电子设备 |
KR20150136345A (ko) * | 2014-05-27 | 2015-12-07 | 삼성전자주식회사 | 태스크 그룹 전달 방법 및 이를 제공하는 전자 장치 |
US9348645B2 (en) * | 2014-05-30 | 2016-05-24 | Apple Inc. | Method and apparatus for inter process priority donation |
CN105224439A (zh) * | 2014-07-02 | 2016-01-06 | 北京金山安全软件有限公司 | 终端app的cpu占用率的检测方法、装置及终端 |
CN104239094B (zh) * | 2014-08-29 | 2017-12-08 | 小米科技有限责任公司 | 后台应用程序的控制方法、装置及终端设备 |
-
2016
- 2016-08-25 CN CN201610725591.8A patent/CN107783833B/zh active Active
-
2017
- 2017-08-23 EP EP17842927.0A patent/EP3495950A4/en not_active Withdrawn
- 2017-08-23 WO PCT/CN2017/098598 patent/WO2018036505A1/zh unknown
-
2019
- 2019-02-21 US US16/282,282 patent/US20190188030A1/en not_active Abandoned
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103164269A (zh) * | 2011-12-08 | 2013-06-19 | 中兴通讯股份有限公司 | 一种多窗口显示应用程序的方法及终端 |
US20160034308A1 (en) * | 2012-01-20 | 2016-02-04 | Microsoft Technology Licensing, Llc | Background task resource control |
CN104731643A (zh) * | 2015-02-27 | 2015-06-24 | 浙江大学 | 一种后台应用程序的管理方法和管理系统 |
CN105320561A (zh) * | 2015-11-09 | 2016-02-10 | 深圳市万普拉斯科技有限公司 | 任务管理方法和系统 |
CN105786520A (zh) * | 2016-03-17 | 2016-07-20 | 北京百纳威尔科技有限公司 | 电子设备应用程序的管理方法和装置 |
Also Published As
Publication number | Publication date |
---|---|
CN107783833A (zh) | 2018-03-09 |
US20190188030A1 (en) | 2019-06-20 |
CN107783833B (zh) | 2020-04-28 |
EP3495950A4 (en) | 2019-06-19 |
EP3495950A1 (en) | 2019-06-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018036505A1 (zh) | 一种终端后台应用程序的管理方法及装置 | |
CN106406966B (zh) | 一种应用程序的预加载方法及移动终端 | |
US11442747B2 (en) | Method for establishing applications-to-be preloaded prediction model based on preorder usage sequence of foreground application, storage medium, and terminal | |
CN113110941B (zh) | 使用应用容器管理代码和依赖性数据的传递 | |
US10437631B2 (en) | Operating system hot-switching method and apparatus and mobile terminal | |
CN109960507B (zh) | 编译优化方法、装置、存储介质、智能终端及服务器 | |
CN108363593B (zh) | 应用程序预加载方法、装置、存储介质及终端 | |
WO2018082570A1 (zh) | I/o请求的调度方法及装置 | |
CN108762831B (zh) | 应用程序预加载方法、装置、存储介质及终端 | |
US9432314B2 (en) | Quick navigation of message conversation history | |
KR102064952B1 (ko) | 수신 데이터를 이용하여 어플리케이션을 운영하는 전자 장치 | |
CN106371900B (zh) | 一种实现异步调用的数据处理方法及装置 | |
CN110300328B (zh) | 一种视频播放控制方法、装置及可读存储介质 | |
US20210208935A1 (en) | Method for Scheduling Multi-Core Processor, Terminal, and Storage Medium | |
WO2018045934A1 (zh) | 应用进程的管理方法和终端设备 | |
KR102193404B1 (ko) | 상호작용 개발 환경으로부터의 소프트웨어 아티팩트의 점진적 컴파일링 기법 | |
JP2013175180A (ja) | アプリケーション切替装置及び方法 | |
WO2022143446A1 (zh) | 内存释放方法及相关设备 | |
CN110865884A (zh) | 一种内存管理方法及装置 | |
CN111736980A (zh) | 一种内存管理方法及装置 | |
WO2017206901A1 (zh) | 进程控制方法及相关设备 | |
EP3757739A1 (en) | Method for display when exiting an application, and terminal | |
CN115576645B (zh) | 一种虚拟处理器调度方法、装置、存储介质及电子设备 | |
CN108762838B (zh) | 应用程序预加载方法、装置、存储介质及终端 | |
CN110023907B (zh) | 一种处理方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17842927 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
ENP | Entry into the national phase |
Ref document number: 2017842927 Country of ref document: EP Effective date: 20190305 |