WO2019228344A1 - Resource configuration method and apparatus, and terminal and storage medium - Google Patents

Resource configuration method and apparatus, and terminal and storage medium Download PDF

Info

Publication number
WO2019228344A1
WO2019228344A1 PCT/CN2019/088791 CN2019088791W WO2019228344A1 WO 2019228344 A1 WO2019228344 A1 WO 2019228344A1 CN 2019088791 W CN2019088791 W CN 2019088791W WO 2019228344 A1 WO2019228344 A1 WO 2019228344A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
resource
operating system
target
indicator
Prior art date
Application number
PCT/CN2019/088791
Other languages
French (fr)
Chinese (zh)
Inventor
程杰
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019228344A1 publication Critical patent/WO2019228344A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiments of the present application relate to the technical field of application optimization, and in particular, to a method, a device, a terminal, and a storage medium for resource allocation.
  • a mobile terminal is installed with a game application, a social application, a video playback application, an instant communication application, and a shopping application at the same time.
  • a mobile terminal is configured with a high-performance central processing unit (CPU, Central Processing Unit) and a graphics processor (Graphics Processing Unit, GPU) to improve the running speed and picture quality of game applications.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • the embodiments of the present application provide a method, a device, a terminal, and a storage medium for resource allocation, which can solve the problems of improving the running quality of an application program only by improving the performance of the hardware configuration of the terminal, the cost is high, and the improvement effect is poor.
  • the technical solution is as follows:
  • a resource configuration method is provided.
  • the method is applied to a terminal, and the terminal runs an operating system and at least one application program.
  • the method includes:
  • the target application program sends application running information to the operating system through a binder connection with the operating system, and the application running information is used to characterize the running state of the target application program;
  • the operating system receives the application running information
  • the operating system allocates system resources to the target application according to the resource configuration policy.
  • a resource configuration device is provided.
  • the device is applied to a terminal.
  • the terminal runs an operating system and at least one application program.
  • the device includes:
  • a target application program module configured to send application running information to the operating system through a binder connection with the operating system, where the application running information is used to characterize a running state where the target application is located;
  • An operating system module configured to receive the application running information
  • the operating system module is configured to determine a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
  • the operating system module is configured to allocate system resources to the target application according to the resource configuration policy.
  • a terminal in another aspect, includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used for execution by the processor to implement the resources according to the foregoing aspect Configuration method.
  • a computer-readable storage medium stores at least one instruction, and the at least one instruction is used for execution by a processor to implement the resource allocation method according to the foregoing aspect.
  • FIG. 1 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application.
  • FIG. 2 is an implementation schematic diagram of a communication process between an application program and an operating system in a terminal
  • FIG. 3 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application.
  • FIG. 4 and 5 are schematic diagrams of an implementation process of an application program communicating with an operating system in the terminal shown in FIG. 3;
  • FIG. 6 is a schematic structural diagram of a terminal according to another exemplary embodiment of the present application.
  • FIG. 7 is a flowchart of a resource configuration method according to an exemplary embodiment of the present application.
  • FIG. 8 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application.
  • FIG. 9 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application.
  • FIG. 10 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application.
  • FIG. 11 shows a structural block diagram of a resource configuration apparatus according to an embodiment of the present application.
  • plural refers to two or more.
  • “And / or” describes the association relationship between related objects and indicates that there can be three types of relationships. For example, A and / or B can indicate that there are three cases in which A exists alone, A and B exist, and B exists alone.
  • the character “/” generally indicates that the related objects are an "or" relationship.
  • FIG. 1 is a structural block diagram of a terminal 100 according to an exemplary embodiment of the present application.
  • the terminal 100 may be an electronic device capable of running an application program, such as a smart phone, a tablet computer, or an e-book.
  • the terminal 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and an input-output device 130.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire terminal 100, and executes the terminal by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. 100 various functions and processing data.
  • the processor 110 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • modem modem
  • the CPU mainly handles the operating system, user interface, and application programs; the GPU is responsible for rendering and rendering of the displayed content; the modem is used for wireless communication. It can be understood that the modem may not be integrated into the processor 110, and may be implemented by a communication chip alone.
  • the memory 120 may include a random access memory (Random Access Memory, RAM), and may also include a read-only memory (Read-Only Memory).
  • RAM Random Access Memory
  • Read-Only Memory a read-only memory
  • the memory 120 includes a non-transitory computer-readable storage medium.
  • the memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets.
  • the memory 120 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) Instructions for implementing the following method embodiments, the operating system may be an Android (Android) system (including a system developed based on the Android system), an IOS system (including a system developed based on the IOS system) ) Or other systems.
  • the storage data area may also store data (such as phonebook, audio and video data, and chat history data) created by the terminal 100 during use.
  • the memory 120 can be divided into operating system space and user space.
  • the operating system runs in the operating system space, and native and third-party applications run in the user space.
  • the operating system allocates corresponding system resources for different third-party applications.
  • the requirements for system resources in different application scenarios in the same third-party application are also different.
  • the third-party application has higher requirements for disk read speed; in the animation rendering scenario, the third Three-party applications have higher requirements for GPU performance.
  • the operating system and third-party applications are independent of each other. The operating system often cannot sense the current application scenarios of the third-party applications in time. As a result, the operating system cannot adapt the system resources according to the specific application scenarios of the third-party applications.
  • the memory 120 may store a Linux kernel layer 220, a system runtime layer 240, an application framework layer 260, and an application layer 280.
  • the Linux kernel layer 220, the system runtime layer 240, and the application framework layer 260 belong to the operating system space, and the application layer 280 belongs to the user space.
  • the Linux kernel layer 220 provides low-level drivers for various hardware of the terminal 100, such as a display driver, an audio driver, a camera driver, a Bluetooth driver, a Wi-Fi driver, and power management.
  • the system runtime layer 240 provides main feature support for the Android system through some C / C ++ libraries.
  • the SQLite library provides database support
  • the OpenGL / ES library provides 3D drawing support
  • the Webkit library provides browser kernel support.
  • An Android runtime library (Android Runtime) is also provided in the system runtime layer 240, which mainly provides some core libraries, which can allow developers to use the Java language to write Android applications.
  • the application framework layer 260 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content providers, Package management, call management, resource management, location management.
  • At least one application program is running in the application layer 280.
  • These applications can be native applications that come with the operating system, such as contact programs, SMS programs, clock programs, camera applications, etc .; or they can be developed by third-party developers. Third-party applications, such as game applications, instant messaging programs, photo beautification programs, shopping programs, and so on.
  • FIG. 4 A feasible communication method between the operating system and third-party applications is shown in Figure 4.
  • the binder communication module used to communicate with the operating system is embedded in the third-party application.
  • the binder communication module includes several binder interface functions, and different binder interface functions are used to implement different functions.
  • the binder communication module contains binder interface functions for updating application information (including current frame rate, current delay, and other information), and binders for updating application scenario information (such as game loading scenarios, game team battle scenarios, and so on). Interface functions.
  • the embodiments of the present application do not limit the specific functions implemented by the binder interface function.
  • the operating system developer presets a binder interface corresponding to different functions, and provides a binder interface function that calls the binder interface to a third-party application developer, and the third-party application developer will provide the corresponding
  • the binder interface function is encapsulated into a binder communication module and embedded in a third-party application.
  • a third-party application program with a built-in binder communication module it can call the corresponding binder interface function to establish a connection with the binder interface of the operating system, and then communicate through this connection to achieve data transmission.
  • the system operation layer 240 may additionally include an interface communication system 242.
  • the interface communication system 242 can be regarded as a subsystem in the operating system, or as an application program embedded in the operating system.
  • the interface communication system 242 is used to manage a binder channel between a third-party application and a binder interface provided by the operating system.
  • the interface communication system 242 is configured to establish a binder channel for a third-party application that newly establishes a binder connection, and / or, clear a binder channel for a third-party application that disconnects the binder connection, and / or, Filtering of binder connections of third-party applications, etc.
  • a binder connection After a binder connection is established between a third-party application and the operating system, data related to the application scenario can be transmitted to the operating system through the binder connection.
  • the operating system With the binder connection, the operating system can also actively transfer data to third-party applications, or two-way data transfer can be performed between the operating system and third-party applications.
  • a third-party application may also establish a long-term connection with the Socket interface of the interface communication system 242 by using a socket method.
  • the application scenario of the third-party application is related
  • the data can be transmitted to the operating system through the long connection.
  • the interface communication system 242 may be provided with different policy modules. After receiving data sent by a third-party application, the interface communication system 242 uses the corresponding policy module of the third-party application to analyze the data. To get the corresponding resource adaptation optimization strategy. Based on the analyzed resource adaptation and optimization strategy, the interface communication system 242 notifies the Linux kernel layer 220 to perform system resource adaptation and optimization through the control interface.
  • the control interface can communicate with the Linux kernel layer 220 in a Sysfs manner.
  • different policy modules in the interface communication system 242 may correspond to different third-party applications (that is, setting policy modules for different applications), or different policy modules correspond to different types of third-party applications (that is, targeting Different types of applications set policy modules), or different policy modules correspond to different system resources (that is, set policy modules for different system resources), or different policy modules correspond to different application scenarios (that is, different application applications Scenario setting strategy module), the embodiment of the present application does not limit the specific setting manner of the strategy module. .
  • the interface communication system 242 can also communicate with the application framework layer 260 in a Binder manner, and is used to receive the foreground application information sent by the application framework layer 260, so that based on the foreground application information, only the third-party application running in the foreground is performed. System resource optimization.
  • the IOS system includes: a core operating system layer 320 (Core OS layer), a core service layer 340 (Core services layer), and a media layer. 360 (Media layer), 380 (Cocoa Touch Layer).
  • the core operating system layer 320 includes an operating system kernel, drivers, and a low-level program framework. These low-level program frameworks provide functions closer to the hardware for use by the program framework located in the core service layer 340.
  • the core service layer 340 provides system services and / or program frameworks required by applications, such as a Foundation framework, an account framework, an advertising framework, a data storage framework, a network connection framework, a geographic location framework, a motion framework, and the like.
  • the media layer 360 provides audio-visual-related interfaces for applications, such as graphics and image-related interfaces, audio technology-related interfaces, video technology-related interfaces, and audio and video transmission technology (AirPlay) interfaces.
  • the touchable layer 380 provides various commonly-used interface-related frameworks for application development. The touchable layer 380 is responsible for user touch interaction operations on the terminal 100. For example, a local notification service, a remote push service, an advertising framework, a game tool framework, a message user interface interface (UI) framework, a user interface UIKit framework, a map framework, and so on.
  • UI message user interface interface
  • frameworks related to most applications include, but are not limited to, a basic framework in a core service layer 340 and a UIKit framework in a touchable layer 380.
  • the basic framework provides many basic object classes and data types, and provides the most basic system services for all applications, regardless of the UI.
  • the classes provided by the UIKit framework are basic UI class libraries for creating touch-based user interfaces.
  • IOS applications can provide UIs based on the UIKit framework, so it provides the application's infrastructure for building user interfaces and drawing. , Handling and user interaction events, responding to gestures, and more.
  • the input-output device 130 may include a touch display screen for receiving a user's touch operation on or near any suitable object using a finger, a touch pen, or the like, and a user interface displaying various application programs.
  • the touch display is usually provided on the front panel of the terminal 100.
  • the touch display can be designed as a full screen, curved screen, special screen, folding screen or double-sided screen.
  • the touch display screen can also be designed as a combination of a full screen and a curved screen, and a combination of a special-shaped screen and a curved screen, which is not limited in the embodiment of the present application.
  • the structure of the terminal 100 shown in the above drawings does not constitute a limitation on the terminal 100.
  • the terminal may include more or fewer components than shown in the figure, or combine some Components, or different component arrangements.
  • the terminal 100 further includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, and a Bluetooth module, and details are not described herein again.
  • WiFi wireless fidelity
  • FIG. 7 is a flowchart of a resource configuration method according to an exemplary embodiment of the present application. This embodiment is exemplified by applying the method to a terminal 100 running an operating system and at least one application program.
  • the method includes:
  • Step 701 The target application program sends application running information to the operating system through a binder connection with the operating system, and the application running information is used to characterize the running status of the target application program.
  • a binder connection is established with the operating system.
  • the target application may be a game application, a video playback application, an instant messaging application, or the like, and the embodiment of the present application does not specifically limit the target application.
  • the application operation information is collected, and the collected application operation information is sent to the operating system through a pre-established binder connection.
  • the running state of the target application includes the application scenario in which it is located and the application running quality.
  • the application running information may include an application scenario identifier indicating the current application scenario and an application indicating the current running quality of the application.
  • the application scenario refers to a scenario corresponding to different running phases in a target application. For example, for a game application, the application scenario includes a game data loading scenario, a game data update scenario, and a game battle scenario.
  • the target application sends the collected application running information to the operating system through a binder connection at a predetermined time interval, for example, the predetermined time interval is 5s or 10s;
  • the target application program runs to a specified application scenario, it sends the collected application running information to the operating system through a binder connection.
  • Step 702 The operating system receives application running information.
  • the operating system receives application running information sent by the target application program through a binder interface of the interface communication system 242.
  • the operating system In order to prevent illegal applications from communicating with the operating system through the establishment of a binder connection, causing potential system security risks, optionally, after the operating system receives the application running information, it obtains the application identification of the target application.
  • the operating system obtains an application identifier included in the application running information.
  • a preset application identifier list in the operating system where the preset application identifier list includes an application identifier of an application that supports resource configuration.
  • the list is set by the operating system developer and stored encrypted in the terminal.
  • the operating system executes step 703. If the application identifier of the target application does not belong to the preset application identifier list, the operating system does not respond to the application running information.
  • the operating system disconnects and cleans up the connection with the target application.
  • Step 703 The operating system determines a resource allocation policy according to the application running information.
  • the resource allocation policy refers to a policy for allocating system resources to a target application in a running state.
  • the system resources that the operating system can allocate include CPU resources, GPU resources, memory resources, disk resources, network resources, and so on.
  • the target application requires different levels of system resources. Therefore, in order to achieve different The application scenario dynamically configures system resources for the application, and the operating system formulates a corresponding resource configuration strategy based on the current application running information of the target application.
  • the operating system determines the running quality of the target application under the current application scenario according to the application running parameters in the application running information, and formulates resources for dynamically configuring relevant system resources when the running quality does not meet expectations.
  • the related system resource refers to a system resource related to a current application scenario.
  • the resource configuration strategy includes at least: a type of the system resource to be configured and a quantity of the resource.
  • Step 704 The operating system allocates system resources for the target application according to the resource configuration policy.
  • the operating system communicates with the kernel layer, thereby instructing the kernel layer to configure the corresponding system resources.
  • the interface communication system 242 in the operating system communicates with the Linux kernel layer 220 through the control interface, and finally optimizes the system resource configuration.
  • the operating system directly calls the abstract interface corresponding to such system resources to complete resource configuration; while for operating systems that cannot directly access control
  • the operating system uses a proxy method to indirectly communicate with the subsystems corresponding to such system resources (such as the subsystems corresponding to network resources can be the WiFi subsystem) through the proxy to complete the system resource configuration.
  • the operating system disconnects the connection with the target application and clears the data channel For subsequent connections with other applications.
  • the target application program establishes a binder connection with the operating system in advance, so that the target application program can send its own application running information to the operating system through the binder connection, so that the operating system Based on the application running information, a corresponding resource allocation policy is formulated to allocate corresponding system resources to the target application program according to the resource allocation policy.
  • the operating system in this embodiment can be targeted at the application program location. The operating state of the system is targeted to allocate corresponding system resources, so that the application can achieve good operating results in different operating states, and reduce dependence on terminal hardware.
  • the operating system implements application legality detection based on a preset application identification list, thereby avoiding communication with illegal applications, and improving the security of the operating system.
  • the target application sends application running information to the operating system through a binder connection with the operating system, including:
  • the target application calls the binder interface function to establish a binder connection with the operating system's binder interface.
  • the binder interface function is provided by the developer of the operating system;
  • the target application obtains an application scenario identifier corresponding to the preset application scenario, and collects application running parameters in the current application scenario;
  • the target application program connects to the operating system and sends application operation information including the application scenario identifier and application operation parameters to the operating system.
  • the operating system determines the resource allocation strategy based on the application running information, including:
  • the operating system determines a first operating indicator corresponding to the application scenario identifier, and the first operating indicator is an indicator related to application running quality in the application scenario corresponding to the application scenario identifier;
  • the operating system determines a first target system resource corresponding to the first operating index
  • the operating system determines a first resource allocation policy according to the first target system resource.
  • the first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
  • the first target system resource includes at least one of a CPU resource and a GPU resource;
  • the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
  • the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
  • the first target system resource includes at least network resources.
  • the operating system determines the resource allocation strategy based on the application running information, including:
  • the operating system determines a second operating indicator corresponding to the application scenario identifier, and the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier;
  • the operating system determines a second target system resource corresponding to the second running indicator
  • the operating system determines a second resource allocation policy according to the second target system resource.
  • the second resource allocation policy refers to a policy for lowering the performance of the second target system resource.
  • the second target system resource includes at least one of a CPU resource and a GPU resource;
  • the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
  • the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
  • the second target system resource includes at least network resources.
  • the method further includes:
  • the operating system obtains the foreground application identifier of the foreground application
  • the operating system executes the step of determining a resource allocation policy according to the application running information
  • the operating system does not respond to the application running information.
  • the operating system after the operating system receives the application running information, it further includes:
  • the operating system obtains the application identification of the target application
  • the operating system executes the step of determining a resource allocation policy according to the application running information, and the preset application identifier list includes an application identifier of an application that supports resource configuration;
  • the operating system does not respond to the application running information.
  • the target application after the target application sends the application running information to the operating system through a binder connection with the operating system, it further includes:
  • the target application When switching from foreground running to background running, the target application stops sending application running information to the operating system through the binder connection.
  • the operating system allocates system resources for the target application according to the resource configuration policy, it further includes:
  • the operating system When receiving the process end signal of the target application, the operating system cleans up the binder connection with the target application.
  • the application operating parameters in the application scenario are collected and sent to the operating system.
  • the operating system configures system resources for the target application in the application scenario according to the received application operating parameters.
  • FIG. 8 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application.
  • the method is applied to the terminal 100 for illustration.
  • the terminal 100 runs an operating system and at least one application program.
  • the method includes:
  • step 801 the target application calls a binder interface function to establish a binder connection with a binder interface of the operating system, and the binder interface function is provided by a developer of the operating system.
  • the developer of the operating system provides a binder interface function that calls its own binder interface to a third-party application developer, and the third-party application developer encapsulates some or all of the binder interface function into After the binder communication module, it is embedded into the third-party application.
  • the target application program may be a third-party application program in which the binder communication module is embedded.
  • the binder interface function is called to request the establishment of a binder connection with the binder interface of the operating system.
  • a binder connection is established between the target application and the operating system.
  • the operating system can verify the target application and establish a connection with the target application when the target application has connection permissions (that is, the target application is an authorized application that supports resource optimization configuration). Binder connection, otherwise, the operating system will not establish a binder connection with the target application.
  • Step 802 If the current application scenario is a preset application scenario, the target application obtains an application scenario identifier corresponding to the preset application scenario, and collects application running parameters in the current application scenario.
  • a developer when developing a target application, sets a scenario list including at least one preset application scenario for scenarios that may require optimized configuration of system resources.
  • the scene list may include: a game startup scene, a game resource update scene, a game account login scene, a game main interface scene, a game mall interface scene, a game internal loading scene, and a game battle scene.
  • the target application during the running process of the target application (a binder connection has been established with the operating system), it is detected whether the current application scenario belongs to the scenario list, and if it belongs, the target application obtains the current running scenario (that is, the matched preset application) Scenario) Corresponding scenario identifier, and further collect application operating parameters in the current operating scenario; if it does not belong, the target application continues to monitor the current application scenario without collecting application operating parameters (or collecting application operating parameters, but does not send them To the operating system).
  • the application running parameters include a series of index parameters that cannot be obtained by the operating system.
  • application running parameters collected by different types of application programs may be the same (for example, uniformly formulated by an operating system developer), or application running parameters collected by different types of application programs may be different.
  • the collected application operating parameters include at least one of frame rate, loading speed, frame loss rate, download rate, and network delay; when the target application is a game application
  • the collected application running parameters may also include game picture quality, game picture resolution, game model quality, and the number of models in the game picture.
  • Step 803 The target application program connects to the operating system and sends application operation information including an application scenario identifier and application operation parameters to the operating system.
  • the target application program After the application operation parameter collection is completed, the target application program sends the application scenario identifier and the application operation parameter to the operating system as application operation information.
  • the target application program continuously collects application operation parameters, and continuously sends application operating information including the application scenario identifier and the application operation parameter to the operating system.
  • the target application needs to organize data, such as merging duplicate information and deleting redundant information.
  • the target application can also set the sending priority of the application running information according to the importance of the application scenario or the application operating parameters, so that the application operating information in the important application scenarios is preferentially sent or contains important application operating parameters such as the frame rate and Frame loss rate) application running information, filtering or delaying application running information in non-critical application scenarios.
  • the application scenario identifier "001" in the instant communication application corresponds to the "video chat scenario”
  • the application scenario identifier "001" in the game application It corresponds to the "game main interface scenario”
  • the application running information also includes an application type identifier.
  • the operating system distinguishes application scenarios under different types of applications according to the application type identifier and the application scenario identifier.
  • the application running information also includes a timestamp when the application running parameters are collected. Based on the timestamp, the operating system can determine whether the application running information is sent in a timely manner and determine the sending timing of the application running information, thereby avoiding the application running.
  • the application running information may also carry other information according to requirements, such as an application program identifier.
  • the embodiments of the present application do not limit the specific information contained in the application running information.
  • the target application sends application running information in the form of a data packet, and the format of the data packet is agreed with the operating system in advance.
  • the format of the data packet may be a Java script object tag (JavaScript, Object Notation, JSON), a protocol buffer (ProtocolBuffer, Protocol), or a custom format.
  • Step 804 The operating system receives application running information.
  • the data packet is parsed by using a pre-approved data packet format to obtain the application running information contained therein.
  • Step 805 The operating system determines a first operating index corresponding to the application scenario identifier, where the first operating indicator is an indicator related to application running quality in the application scenario corresponding to the application scenario identifier.
  • the operating system determines the first operation in the current application scenario based on the application scenario identifier. index.
  • the correspondence between the application scenario identifier and the first running indicator can be downloaded and stored from the background server in advance by the terminal (for example, when the target application is downloaded, the correspondence is downloaded from the background server according to the application identifier of the target application) , And the corresponding relationship is obtained after debugging by the developer.
  • the first running indicator is an indicator that the target application needs to achieve in order to achieve the expected running quality in the current application scenario.
  • the first running index includes the (lowest) frame rate index, (lowest) loading speed index, (highest) frame loss index, (lowest) memory index, (lowest) download rate index, and (highest) network latency index. At least one.
  • the first running indicator includes at least one of a loading speed indicator and a memory indicator.
  • the data loading scenario is a scenario where the target application loads local data, and the local data corresponding to different types of applications may be different.
  • the local data may include multimedia data, game model data, and game scene data. And so on; for navigation applications, the local data may include navigation voice data, map data, and so on. All scenarios involving loading local data can be classified as data loading scenarios, which are not limited in the embodiments of the present application.
  • the first operating indicator includes at least one of a download rate indicator and a network delay indicator.
  • the data transmission scenario is a scenario in which the target application performs data transmission through the network.
  • This data transfer scenario may be different for different types of applications.
  • the data transmission scenario may be a file transmission scenario, a voice scenario, a video scenario, or a network multimedia browsing scenario, etc .
  • the data transmission scenario may be a game data packet update scenario, Online game scenes and more. All scenarios involving network data transmission can be classified as data transmission scenarios, which are not limited in the embodiments of the present application.
  • the operating system determines that the first operating indicator is at least one of a download rate indicator and a network delay indicator.
  • the first operating indicator includes at least one of a frame rate indicator, a frame loss rate indicator, and a network delay indicator.
  • the dynamic picture display scene is a scene involving dynamic image rendering and display.
  • the dynamic image may be different.
  • the dynamic image may be a short video, a dynamic expression, a video session, and the like;
  • the dynamic image may be a cut scene animation, a dynamic game scene, and the like.
  • Any scene involving dynamic image display can be classified as a dynamic picture display scene, which is not limited in the embodiments of the present application.
  • the operating system determines that the first operating indicator is the frame rate indicator, frame loss index, and At least one of network latency indicators.
  • a correspondence relationship between different application scenario identifiers and the first operation indicator is preset in the operating system, and the operating system determines the first operation indicator in the current application scenario based on the correspondence relationship.
  • the corresponding relationship is shown in Table 1.
  • Step 806 If the application operating parameters do not reach the first operating index, the operating system determines a first target system resource corresponding to the first operating index.
  • the operating system determines whether the running quality of the target application in the current application scenario meets the expectations by analyzing the current application operating parameters of the target application and the first operating index queried.
  • the operating system determines that the running quality of the target application is not good and the system resource allocation needs to be optimized; when the operating parameters of the application reach the first operating index, the operating system determines the target application The program runs in good quality and does not need to optimize system resource allocation.
  • the operating system determines the first target system resource corresponding to the first operating index, so as to subsequently formulate a configuration optimization strategy for the first target system resource, where the first target system resource That is, the system resource related to the first operation index.
  • a corresponding relationship between different operating indicators and system resources is preset in the operating system, and the operating system determines a first target system resource corresponding to the first operating indicator based on the corresponding relationship.
  • this correspondence is shown in Table 2.
  • Operating indicators system Frame rate CPU resources, GPU resources Loading speed CPU resources, disk resources, memory resources Frame loss rate CPU resources, GPU resources, network resources Download rate Internet resources Network latency Internet resources
  • the collection when the target application is a game application, and the target application runs to a game battle scene, the collection includes the current frame rate (55fps), the current frame loss rate (2%), and the current network delay ( 100ms) and send them to the operating system.
  • the operating system determines, according to the application scenario in which the target application program is located, that the first running indicator corresponding to the game battle scenario includes a frame rate indicator (60fps), a network delay indicator (50ms), and a frame loss rate indicator (5%).
  • the operating system determines that it is necessary to optimize the frame rate and network delay, and further determines that the first A target system resource includes CPU resources, GPU resources, and network resources.
  • Step 807 The operating system determines a first resource allocation policy according to the first target system resource.
  • the first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
  • the operating system After determining the system resources that need to be optimized, the operating system further formulates a first resource allocation strategy for increasing the performance of the first target system resource.
  • the first resource allocation policy determined by the operating system further includes an increase amount of system resources.
  • the system resource to be adjusted is a CPU resource
  • the amount of the system resource adjustment includes at least one of the number of CPU cores, the highest CPU frequency, and the lowest CPU frequency
  • the system resource to be adjusted is a GPU resource
  • the system resource is increased.
  • the amount includes at least one of the number of GPU cores, the highest GPU frequency, and the lowest GPU frequency.
  • the system resource to be adjusted is a memory resource
  • the amount of the system resource adjustment includes at least one of the maximum memory bandwidth and the minimum memory bandwidth.
  • the system resource increase includes at least one of the minimum read / write speed of the disk and the maximum read / write speed of the disk; when the system resource to be adjusted is a network resource, the system The resource increase includes at least one of network throughput, network delay rate, and network power consumption.
  • the system resource to be adjusted is a wireless connection resource (such as Bluetooth, infrared, etc.)
  • the system resource increase includes the wireless connection strength. (Adjust the transmit and receive power).
  • the system resource upward adjustment amount is a fixed value, and each time the operating system performs the upward adjustment, it detects whether the current application operating parameter of the target application program reaches the first operation. If the index is reached, the upward adjustment is stopped. If it is not reached, the upward adjustment is performed according to the system resource upward adjustment.
  • the operating system stores a first system resource performance parameter corresponding to the first operating index.
  • the operating system is based on the current system resource.
  • the performance parameter and the first system resource performance parameter determine the system resource upward adjustment amount.
  • the first resource allocation policy determined by the operating system is: adding and enabling 1 CPU core, adding and enabling 1 CPU core, and reducing network latency by 50 ms.
  • Step 808 The operating system allocates system resources for the target application according to the first resource configuration policy.
  • the operating system allocates system resources to the target application according to the determined first resource allocation strategy, so that the application operating parameters of the target application in the current application scenario reach the first operating index by optimizing the system resource allocation.
  • the expected operating quality is achieved.
  • the target application program when running to a preset application scenario, sends application operation information including the application scenario identifier and the application operation parameter to the operating system, so that the operating system determines the current application of the target application program according to the application operation parameter.
  • Operating quality in scenarios At the same time, in the case of poor operating quality, the operating system can formulate resource allocation policies based on system resources related to the application scenario, thereby optimizing system resources according to the resource allocation policies, and then optimizing the application The effect of the target application running quality in the scene.
  • the application running parameters collected by the target application include parameters related to the running quality, as well as some parameters not related to the running quality. Therefore, in order to reduce the power consumption of the terminal while ensuring the running quality of the target application, In a possible implementation manner, the operating system adjusts the performance of system resources corresponding to unrelated operating parameters.
  • FIG. 8 As shown in FIG. 9, after the above step 804, the following steps may be further included. It should be noted that there is no strict sequence between the following steps 809 to 812 and steps 805 to 808. This embodiment only takes steps 809 to 812 and steps 805 to 808 to execute in parallel as an example, but does not describe This constitution is limited.
  • Step 809 The operating system determines a second operating indicator corresponding to the application scenario identifier.
  • the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier.
  • the operating system determines the first operating indicator related to the application running quality according to the application scenario identifier, and determines the Application-independent second operating indicator.
  • the second running indicator is different.
  • the second operating index includes the (lowest) frame rate index, (lowest) loading speed index, (highest) frame loss index, (lowest) memory index, (lowest) download rate index, and (highest) network latency index. At least one.
  • the second operating indicator includes at least one of a frame rate indicator, a frame loss index, a download rate indicator, and a network delay indicator.
  • the operating system determines that the second operating indicator includes a frame rate indicator, a frame loss indicator, and a download rate indicator. And at least one of network latency indicators.
  • the second operating indicator includes at least one of a frame rate indicator, a frame loss index, and a memory indicator.
  • the operating system determines that the second operating indicator includes a frame rate indicator, a frame loss indicator, and a memory indicator. At least one of.
  • a correspondence relationship between different application scenario identifiers and a second operation indicator is preset in the operating system, and the operating system determines the second operation indicator in the current application scenario based on the correspondence relationship.
  • the corresponding relationship is shown in Table 3.
  • Application scenario Application scenario identification Second operating indicator Game loading scene 001 Frame rate index: 30fps; Frame loss index: 10% Game battle scene 002 - Game update scene 003 Loading speed index: 10M / s; memory index: 1G
  • the corresponding relationship between the application scenario identifier and the second running indicator may be downloaded and stored by the terminal in advance from the background server (for example, when downloading the target application, the corresponding relationship is downloaded from the background server according to the application identifier of the target application) , And the corresponding relationship is obtained after debugging by the developer.
  • Step 810 If the application running parameter is better than the second running index, the operating system determines a second target system resource corresponding to the second running index.
  • the operating system analyzes the current application operating parameters of the target application program and the second operating index that is queried to determine that the target application program can operate normally while reducing the performance of some system resources.
  • the operating system determines that the performance of the corresponding system resource can be reduced; when the second operating index is lower than the current application operating parameter of the target application When the operating system determines that the performance of the corresponding system resource needs to be adjusted.
  • the operating system determines the second target system resource corresponding to the second operating index, so as to subsequently specify a configuration optimization strategy for the second target system resource.
  • the operating system determines the second target system resource corresponding to the second running indicator based on the corresponding relationship shown in Table 2.
  • the target application is a game application
  • the collection includes the current frame rate (60fps), the current frame loss rate (0%), and the current network delay ( 100ms) and send them to the operating system.
  • the operating system determines, according to the application scenario in which the target application is located, the second running indicator corresponding to the game battle scenario, including a frame rate indicator (30fps), a network delay indicator (100ms), and a frame loss rate indicator (10%). Because the current frame rate is greater than the frame rate indicator, and the current frame loss rate is lower than the frame loss rate indicator, the operating system determines that the second target system resource that can be adjusted down is the GPU resource based on the correspondence shown in Table 2.
  • Step 811 The operating system determines a second resource allocation policy according to the second target system resource.
  • the second resource allocation policy refers to a policy for lowering the performance of the second target system resource.
  • the operating system After determining the system resources that can be downgraded, the operating system further formulates a second resource allocation strategy for downgrading the resource performance of the second target system.
  • the second resource allocation policy determined by the operating system further includes a system resource reduction amount.
  • the operating system stores a second system resource performance indicator corresponding to the second operating indicator.
  • the operating system determines the system resource reduction amount according to the current system resource performance and the second system resource performance indicator, so that the system resource performance after the reduction is equal to the second system resource performance indicator
  • the second resource allocation policy determined by the operating system is: shut down one GPU core.
  • Step 812 The operating system allocates system resources for the target application according to the second resource configuration policy.
  • the operating system allocates system resources to the target application according to the determined second resource allocation strategy, thereby reducing the performance of some system resources that do not affect the running quality by optimizing the system resource allocation, thereby achieving a reduction in terminal power consumption. effect.
  • the operating system determines an operation index that has nothing to do with the running quality of the application, and formulates a corresponding system resource performance reduction strategy for the running index, while ensuring the running quality of the application, and further reducing the power consumption of the terminal.
  • step 803 is further included after step 803.
  • Step 813 The operating system obtains a foreground application identifier of the foreground application.
  • a Binder connection is established between the application framework layer 250 and the interface communication system 242, and the operating system obtains foreground application information from the application framework layer 250. Contains the foreground application ID.
  • Step 814 The operating system detects whether the application identifier of the target application is consistent with the foreground application identifier.
  • the operating system detects whether the application identification of the target application is consistent with the foreground application identification. If they are the same, it is determined that the target application sending the application running information is running in the foreground, and then step 804 is performed; If they are not consistent, it is determined that the target application that sends the application running information is running in the background, and step 815 is performed.
  • Step 815 If the application identifier of the target application is not consistent with the foreground application identifier, the operating system does not respond to the application running information.
  • the operating system does not respond to the application running information sent by the target application (continues to maintain the connection with the target application) and prioritizes the application running information sent by the foreground application.
  • step 816 when the target application running in the foreground is switched to the background, the operating system executes step 816.
  • step 816 when switching from the foreground running to the background running, the target application stops sending application running information to the operating system through the binder connection.
  • the application program automatically stops sending application operation information to the operating system, and the connection with the operating system is maintained.
  • a foreground application detection mechanism is added to the operating system, so that only a target application program running in the foreground is provided with a system resource configuration optimization service.
  • FIG. 11 is a structural block diagram of a resource configuration apparatus according to an embodiment of the present application.
  • the resource configuration device can be implemented as all or part of a terminal through software, hardware, or a combination of both.
  • the device includes a target application program module 1110 and an operating system module 1120.
  • a target application program module 1110 is configured to send application running information to the operating system through an adhesive binder connection with the operating system, where the application running information is used to characterize a running state where the target application is located.
  • An operating system module 1120 configured to receive the application running information
  • the operating system module 1120 is configured to determine a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
  • the operating system module 1120 is configured to allocate system resources to the target application according to the resource configuration policy.
  • the current application scenario is a preset application scenario, obtaining an application scenario identifier corresponding to the preset application scenario, and collecting application running parameters in the current application scenario;
  • the operating system module 1120 is used to:
  • a first resource allocation policy is determined according to the first target system resource, and the first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
  • the first target system resource includes at least one of a CPU resource of a central processing unit and a GPU resource of a graphics processor;
  • the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
  • the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
  • the first target system resource includes at least network resources.
  • the operating system module 1120 is used to:
  • a second resource configuration policy is determined according to the second target system resource, and the second resource configuration policy refers to a policy for lowering the performance of the second target system resource.
  • the second target system resource includes at least one of a central processing unit CPU resource and a graphics processor GPU resource;
  • the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
  • the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
  • the second target system resource includes at least network resources.
  • the operating system module 1120 is used to:
  • the application operation information is not responded.
  • the operating system module 1120 is used to:
  • the application identifier of the target application belongs to a preset application identifier list, executing the step of determining a resource allocation policy according to the application running information, where the preset application identifier list includes an application that supports resource configuration Application identification
  • the application identifier of the target application does not belong to the preset application identifier list, it does not respond to the application running information.
  • the target application program module 1110 is used for:
  • the operating system module 1120 is configured to clear a binder connection with the target application program when a process end signal of the target application program is received.
  • the target application program establishes a binder connection with the operating system in advance, so that the target application program can send its own application running information to the operating system through the Sbinder connection for operation.
  • the system formulates the corresponding resource allocation strategy based on the application running information, so as to allocate the corresponding system resources to the target application according to the resource allocation strategy.
  • the operating system in this embodiment can At the operating state of the system, corresponding system resources are allocated to it, so that the application can achieve good operating results in different operating states, and reduce dependence on terminal hardware.
  • the operating system implements application legitimacy detection based on a preset application identification list, thereby avoiding communication with illegal applications embedded with the SDK, and improving the security of the operating system.
  • the target application program when running to a preset application scenario, sends application operation information including the application scenario identifier and the application operation parameter to the operating system, so that the operating system determines the current application of the target application program according to the application operation parameter.
  • Operating quality in scenarios At the same time, in the case of poor operating quality, the operating system can formulate resource allocation policies based on system resources related to the application scenario, thereby optimizing system resources according to the resource allocation policies, and then optimizing the application The effect of the target application running quality in the scene.
  • the operating system determines an operation index that has nothing to do with the running quality of the application, and formulates a corresponding system resource performance reduction strategy for the running index, while ensuring the running quality of the application, and further reducing the power consumption of the terminal.
  • a foreground application detection mechanism is added to the operating system, so that only a target application program running in the foreground is provided with a system resource configuration optimization service.
  • An embodiment of the present application further provides a computer-readable medium.
  • the computer-readable medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the resource configuration method according to the foregoing embodiments. .
  • An embodiment of the present application further provides a computer program product.
  • the computer program product stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the resource allocation method according to the foregoing embodiments.
  • Computer-readable media includes computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another.
  • a storage media may be any available media that can be accessed by a general purpose or special purpose computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed are a resource configuration method and apparatus, and a terminal and a storage medium, which belong to the field of application optimization. The method comprises: a target application program sending application running information to an operating system by means of a binder connection between the target application program and the operating system, wherein the application running information is used for characterizing a running state of the target application program; the operating system receiving the application running information; the operating system determining a resource configuration policy according to the application running information, wherein the resource configuration policy is a policy for allocating a system resource to the target application program in the running state; and the operating system allocating the system resource to the target application program according to the resource configuration policy. The operating system in the present embodiment can allocate, with regard to a running state of an application program, a corresponding system resource thereto in a targeted manner, so that the application program can achieve a good running effect in different running states, and the dependence on terminal hardware is reduced.

Description

资源配置方法、装置、终端及存储介质Resource allocation method, device, terminal and storage medium
本申请要求于2018年05月30日提交的申请号为201810538187.9、发明名称为“资源配置方法、装置、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on May 30, 2018 with an application number of 201810538187.9 and an invention name of "resource allocation method, device, terminal and storage medium", the entire contents of which are incorporated herein by reference. .
技术领域Technical field
本申请实施例涉及应用优化技术领域,特别涉及一种资源配置方法、装置、终端及存储介质。The embodiments of the present application relate to the technical field of application optimization, and in particular, to a method, a device, a terminal, and a storage medium for resource allocation.
背景技术Background technique
随着移动终端技术的不断发展,移动终端中应用程序的种类也越来越多。比如,移动终端中同时安装有游戏类应用程序、社交类应用程序、视频播放类应用程序、即时通信类应用程序和购物类应用程序。With the continuous development of mobile terminal technology, there are more and more types of applications in mobile terminals. For example, a mobile terminal is installed with a game application, a social application, a video playback application, an instant communication application, and a shopping application at the same time.
为了提高应用程序的使用体验,移动终端厂商都在不断提升自身的硬件配置,以提高应用程序的运行速度及质量。比如,移动终端通过配置高性能的中央处理器(CPU,Central Processing Unit)和图形处理器(Graphics Processing Unit,GPU),来提高游戏类应用程序的运行速度和画面质量。In order to improve the application experience, mobile terminal manufacturers are constantly improving their hardware configurations to improve the speed and quality of application programs. For example, a mobile terminal is configured with a high-performance central processing unit (CPU, Central Processing Unit) and a graphics processor (Graphics Processing Unit, GPU) to improve the running speed and picture quality of game applications.
发明内容Summary of the Invention
本申请实施例提供了一种资源配置方法、装置、终端及存储介质,可以解决仅通过提升终端硬件配置的性能来提高应用程序的运行质量,成本较高且提升效果不佳的问题。所述技术方案如下:The embodiments of the present application provide a method, a device, a terminal, and a storage medium for resource allocation, which can solve the problems of improving the running quality of an application program only by improving the performance of the hardware configuration of the terminal, the cost is high, and the improvement effect is poor. The technical solution is as follows:
一方面,提供了一种资源配置方法,所述方法应用于终端,所述终端运行有操作***和至少一个应用程序,所述方法包括:In one aspect, a resource configuration method is provided. The method is applied to a terminal, and the terminal runs an operating system and at least one application program. The method includes:
目标应用程序通过与所述操作***之间的粘合(binder)连接,向所述操作***发送应用运行信息,所述应用运行信息用于表征所述目标应用程序所处的运行状态;The target application program sends application running information to the operating system through a binder connection with the operating system, and the application running information is used to characterize the running state of the target application program;
所述操作***接收所述应用运行信息;The operating system receives the application running information;
所述操作***根据所述应用运行信息确定资源配置策略,所述资源配置策略指为所述运行状态下所述目标应用程序分配***资源的策略;Determining, by the operating system, a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
所述操作***根据所述资源配置策略为所述目标应用程序分配***资源。The operating system allocates system resources to the target application according to the resource configuration policy.
另一方面,提供了一种资源配置装置,所述装置应用于终端,所述终端运行有操作***和至少一个应用程序,所述装置包括:In another aspect, a resource configuration device is provided. The device is applied to a terminal. The terminal runs an operating system and at least one application program. The device includes:
目标应用程序模块,用于通过与所述操作***之间的binder连接,向所述操作***发送应用运行信息,所述应用运行信息用于表征所述目标应用程序所处的运行状态;A target application program module, configured to send application running information to the operating system through a binder connection with the operating system, where the application running information is used to characterize a running state where the target application is located;
操作***模块,用于接收所述应用运行信息;An operating system module, configured to receive the application running information;
所述操作***模块,用于根据所述应用运行信息确定资源配置策略,所述资源配置策略指为所述运行状态下所述目标应用程序分配***资源的策略;The operating system module is configured to determine a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
所述操作***模块,用于根据所述资源配置策略为所述目标应用程序分配***资源。The operating system module is configured to allocate system resources to the target application according to the resource configuration policy.
另一方面,提供了一种终端,所述终端包括处理器和存储器;所述存储器存储有至少一条指令,所述至少一条指令用于被所述处理器执行以实现如上述方面所述的资源配置方法。In another aspect, a terminal is provided, the terminal includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used for execution by the processor to implement the resources according to the foregoing aspect Configuration method.
另一方面,提供了一种计算机可读存储介质,所述存储介质存储有至少一条指令,所述至少一条指令用于被处理器执行以实现如上述方面所述的资源配置方法。In another aspect, a computer-readable storage medium is provided, where the storage medium stores at least one instruction, and the at least one instruction is used for execution by a processor to implement the resource allocation method according to the foregoing aspect.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请一个示例性实施例提供的终端的结构示意图;FIG. 1 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application; FIG.
图2是终端中应用程序与操作***通信过程的实施示意图;FIG. 2 is an implementation schematic diagram of a communication process between an application program and an operating system in a terminal; FIG.
图3是本申请一个示例性实施例提供的终端的结构示意图;3 is a schematic structural diagram of a terminal provided by an exemplary embodiment of the present application;
图4和图5是图3所示终端中应用程序与操作***通信过程的实施示意图;4 and 5 are schematic diagrams of an implementation process of an application program communicating with an operating system in the terminal shown in FIG. 3;
图6是本申请另一个示例性实施例提供的终端的结构示意图;6 is a schematic structural diagram of a terminal according to another exemplary embodiment of the present application;
图7示出了本申请一个示例性实施例示出的资源配置方法的流程图;FIG. 7 is a flowchart of a resource configuration method according to an exemplary embodiment of the present application; FIG.
图8示出了本申请另一个示例性实施例示出的资源配置方法的流程图;FIG. 8 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application; FIG.
图9示出了本申请另一个示例性实施例示出的资源配置方法的流程图;FIG. 9 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application; FIG.
图10示出了本申请另一个示例性实施例示出的资源配置方法的流程图;FIG. 10 is a flowchart of a resource configuration method according to another exemplary embodiment of the present application; FIG.
图11示出了本申请一个实施例提供的资源配置装置的结构框图。FIG. 11 shows a structural block diagram of a resource configuration apparatus according to an embodiment of the present application.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。As used herein, "plurality" refers to two or more. "And / or" describes the association relationship between related objects and indicates that there can be three types of relationships. For example, A and / or B can indicate that there are three cases in which A exists alone, A and B exist, and B exists alone. The character "/" generally indicates that the related objects are an "or" relationship.
请参考图1,其示出了本申请一个示例性实施例提供的终端100的结构方框图。该终端100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的终端100可以包括一个或多个如下部件:处理器110、存储器120和输入输出装置130。Please refer to FIG. 1, which is a structural block diagram of a terminal 100 according to an exemplary embodiment of the present application. The terminal 100 may be an electronic device capable of running an application program, such as a smart phone, a tablet computer, or an e-book. The terminal 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and an input-output device 130.
处理器110可以包括一个或者多个处理核心。处理器110利用各种接口和线路连接整个终端100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行终端100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作***、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire terminal 100, and executes the terminal by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. 100 various functions and processing data. Optionally, the processor 110 may use at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). To implement a hardware form. The processor 110 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem. Among them, the CPU mainly handles the operating system, user interface, and application programs; the GPU is responsible for rendering and rendering of the displayed content; the modem is used for wireless communication. It can be understood that the modem may not be integrated into the processor 110, and may be implemented by a communication chip alone.
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。可选地,该存储器120包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作***的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等,该操作***可以是安卓(Android)***(包括基于Android***深度开发的***)、苹果公司开发的IOS***(包括基于IOS***深度开发的***)或其它***。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 120 may include a random access memory (Random Access Memory, RAM), and may also include a read-only memory (Read-Only Memory). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system and instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) Instructions for implementing the following method embodiments, the operating system may be an Android (Android) system (including a system developed based on the Android system), an IOS system (including a system developed based on the IOS system) ) Or other systems. The storage data area may also store data (such as phonebook, audio and video data, and chat history data) created by the terminal 100 during use.
存储器120可分为操作***空间和用户空间,操作***即运行于操作***空间,原生及第三方应用程序即运行于用户空间。为了保证不同第三方应用程序均能够达到较好的运行效果,操作***针对不同第三方应用程序为其分配相应的***资源。然而,同一第三方应用程序中不同应用场景对***资源的需求也存在差异,比如,在本地资源加载场景下,第三方应用程序对磁盘读取速度的要求较高;在动画渲染场景下,第三方应用程序则对GPU性能的要求较高。而操作***与第三方应用程序之间相互独立,操作***往往不能及时感知第三方应用程序当前的应用场景,导致操作***无法根据第三方应用程序的具体应用场景进行针对性 的***资源适配。The memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve better operating results, the operating system allocates corresponding system resources for different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk read speed; in the animation rendering scenario, the third Three-party applications have higher requirements for GPU performance. However, the operating system and third-party applications are independent of each other. The operating system often cannot sense the current application scenarios of the third-party applications in time. As a result, the operating system cannot adapt the system resources according to the specific application scenarios of the third-party applications.
如图2所示,为了使操作***能够区分第三方应用程序的具体应用场景,需要打通第三方应用程序与操作***之间的数据通信,使得操作***能够随时获取第三方应用程序当前的场景信息,进而基于当前场景进行针对性的***资源适配。As shown in Figure 2, in order for the operating system to distinguish the specific application scenarios of third-party applications, data communication between the third-party applications and the operating system needs to be opened, so that the operating system can obtain the current scene information of the third-party applications at any time. , And then perform targeted system resource adaptation based on the current scenario.
以操作***为Android***为例,存储器120中存储的程序和数据如图3所示,存储器120中可存储有Linux内核层220、***运行库层240、应用框架层260和应用层280,其中,Linux内核层220、***运行库层240和应用框架层260属于操作***空间,应用层280属于用户空间。Linux内核层220为终端100的各种硬件提供了底层的驱动,如显示驱动、音频驱动、摄像头驱动、蓝牙驱动、Wi-Fi驱动、电源管理等。***运行库层240通过一些C/C++库来为Android***提供了主要的特性支持。如SQLite库提供了数据库的支持,OpenGL/ES库提供了3D绘图的支持,Webkit库提供了浏览器内核的支持等。在***运行库层240中还提供有安卓运行时库(Android Runtime),它主要提供了一些核心库,能够允许开发者使用Java语言来编写Android应用。应用框架层260提供了构建应用程序时可能用到的各种API,开发者也可以通过使用这些API来构建自己的应用程序,比如活动管理、窗口管理、视图管理、通知管理、内容提供者、包管理、通话管理、资源管理、定位管理。应用层280中运行有至少一个应用程序,这些应用程序可以是操作***自带的原生应用程序,比如联系人程序、短信程序、时钟程序、相机应用等;也可以是第三方开发者所开发的第三方应用程序,比如游戏类应用程序、即时通信程序、相片美化程序、购物程序等。Taking the operating system as an Android system as an example, the programs and data stored in the memory 120 are shown in FIG. 3. The memory 120 may store a Linux kernel layer 220, a system runtime layer 240, an application framework layer 260, and an application layer 280. The Linux kernel layer 220, the system runtime layer 240, and the application framework layer 260 belong to the operating system space, and the application layer 280 belongs to the user space. The Linux kernel layer 220 provides low-level drivers for various hardware of the terminal 100, such as a display driver, an audio driver, a camera driver, a Bluetooth driver, a Wi-Fi driver, and power management. The system runtime layer 240 provides main feature support for the Android system through some C / C ++ libraries. For example, the SQLite library provides database support, the OpenGL / ES library provides 3D drawing support, and the Webkit library provides browser kernel support. An Android runtime library (Android Runtime) is also provided in the system runtime layer 240, which mainly provides some core libraries, which can allow developers to use the Java language to write Android applications. The application framework layer 260 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content providers, Package management, call management, resource management, location management. At least one application program is running in the application layer 280. These applications can be native applications that come with the operating system, such as contact programs, SMS programs, clock programs, camera applications, etc .; or they can be developed by third-party developers. Third-party applications, such as game applications, instant messaging programs, photo beautification programs, shopping programs, and so on.
操作***与第三方应用程序之间一种可行的通信方式如图4所示,第三方应用程序中内嵌有用于与操作***进行通信的binder通讯模块。A feasible communication method between the operating system and third-party applications is shown in Figure 4. The binder communication module used to communicate with the operating system is embedded in the third-party application.
其中,该binder通讯模块中包含若干个binder接口函数,不同的binder接口函数用于实现不同的功能。比如,binder通讯模块中包含用于更新应用信息(包括当前帧率、当前延迟等信息)的binder接口函数,以及用于更新应用场景信息(比如游戏加载场景、游戏团战场景等等)的binder接口函数。本申请实施例并不对binder接口函数所实现的具体功能进行限定。Among them, the binder communication module includes several binder interface functions, and different binder interface functions are used to implement different functions. For example, the binder communication module contains binder interface functions for updating application information (including current frame rate, current delay, and other information), and binders for updating application scenario information (such as game loading scenarios, game team battle scenarios, and so on). Interface functions. The embodiments of the present application do not limit the specific functions implemented by the binder interface function.
可选的,操作***开发者预设设置对应不同功能的binder接口,并将调用binder接口的binder接口函数提供给第三方应用程序开发者,由第三方应用程序开发者根据实际需求,将相应的binder接口函数封装成binder通讯模块后内嵌到第三方应用程序中。内嵌有binder通讯模块的第三方应用程序运行时,即可调用相应的binder接口函数与操作***的binder接口建立连接,进而通过该连接进行通信,实现数据传输。Optionally, the operating system developer presets a binder interface corresponding to different functions, and provides a binder interface function that calls the binder interface to a third-party application developer, and the third-party application developer will provide the corresponding The binder interface function is encapsulated into a binder communication module and embedded in a third-party application. When a third-party application program with a built-in binder communication module is running, it can call the corresponding binder interface function to establish a connection with the binder interface of the operating system, and then communicate through this connection to achieve data transmission.
相应的,如图4所示,***运行层240可以额外包括接口通信***242。接口通信***242可以视为操作***中的一个子***,或视为操作***内嵌的一个应用程序。接口通信***242用于管理与第三方应用程序与操作***提供binder接口之间的binder通道。可选的,接口通信***242用于为新建立binder连接的第三方应用程序建立binder通道,和/或,为断开binder连接的第三方应用程序清理binder通道,和/或,对没有权限的第三方应用程序的binder连接进行过滤等等。Accordingly, as shown in FIG. 4, the system operation layer 240 may additionally include an interface communication system 242. The interface communication system 242 can be regarded as a subsystem in the operating system, or as an application program embedded in the operating system. The interface communication system 242 is used to manage a binder channel between a third-party application and a binder interface provided by the operating system. Optionally, the interface communication system 242 is configured to establish a binder channel for a third-party application that newly establishes a binder connection, and / or, clear a binder channel for a third-party application that disconnects the binder connection, and / or, Filtering of binder connections of third-party applications, etc.
第三方应用程序与操作***之间建立binder连接后,与应用场景相关的数据就可以通过binder连接传输给操作***。借助binder连接,操作***还可以主动向第三方应用程序传输数据,或者,操作***与第三方应用程序之间可以进行双向数据传输。After a binder connection is established between a third-party application and the operating system, data related to the application scenario can be transmitted to the operating system through the binder connection. With the binder connection, the operating system can also actively transfer data to third-party applications, or two-way data transfer can be performed between the operating system and third-party applications.
在另一种可行的通信方式中,如图5所示,第三方应用程序还可以采用套接字(Socket)方式与接口通信***242的Socket接口建立长连接,第三方应用程序的应用场景相关的数据即可以通过该长连接传输给操作***。In another feasible communication method, as shown in FIG. 5, a third-party application may also establish a long-term connection with the Socket interface of the interface communication system 242 by using a socket method. The application scenario of the third-party application is related The data can be transmitted to the operating system through the long connection.
如图4和5所示,接口通信***242中可设置有不同的策略模块,接收到第三方应用程序发送的数据后,接口通信***242即采用第三方应用程序对应的策略模块对数据进行分析,得到相应的资源适配优化策略。基于分析得到的资源适配优化策略,接口通信***242通过控制接口通知Linux内核层220进行***资源适配优化。其中,该控制接口可以采用Sysfs 的方式与Linux内核层220进行通信。As shown in Figures 4 and 5, the interface communication system 242 may be provided with different policy modules. After receiving data sent by a third-party application, the interface communication system 242 uses the corresponding policy module of the third-party application to analyze the data. To get the corresponding resource adaptation optimization strategy. Based on the analyzed resource adaptation and optimization strategy, the interface communication system 242 notifies the Linux kernel layer 220 to perform system resource adaptation and optimization through the control interface. The control interface can communicate with the Linux kernel layer 220 in a Sysfs manner.
可选的,接口通信***242中不同的策略模块可以对应不同的第三方应用程序(即针对不同的应用程序设置策略模块),或者,不同的策略模块对应不同类型的第三方应用程序(即针对不同类型的应用程序设置策略模块),或者,不同的策略模块对应不同的***资源(即针对不同***资源设置策略模块),或者,不同的策略模块对应不同的应用场景(即针对不同的以应用场景设置策略模块),本申请实施例并不对策略模块的具体设置方式进行限定。。Optionally, different policy modules in the interface communication system 242 may correspond to different third-party applications (that is, setting policy modules for different applications), or different policy modules correspond to different types of third-party applications (that is, targeting Different types of applications set policy modules), or different policy modules correspond to different system resources (that is, set policy modules for different system resources), or different policy modules correspond to different application scenarios (that is, different application applications Scenario setting strategy module), the embodiment of the present application does not limit the specific setting manner of the strategy module. .
其中,接口通信***242还可以通过Binder的方式与应用框架层260进行通信,用于接收应用框架层260发送的前景应用信息,从而基于前景应用信息,仅针对当前前台运行的第三方应用程序进行***资源优化。Among them, the interface communication system 242 can also communicate with the application framework layer 260 in a Binder manner, and is used to receive the foreground application information sent by the application framework layer 260, so that based on the foreground application information, only the third-party application running in the foreground is performed. System resource optimization.
以操作***为IOS***为例,存储器120中存储的程序和数据如图6所示,IOS***包括:核心操作***层320(Core OS layer)、核心服务层340(Core Services layer)、媒体层360(Media layer)、可触摸层380(Cocoa Touch Layer)。核心操作***层320包括了操作***内核、驱动程序以及底层程序框架,这些底层程序框架提供更接近硬件的功能,以供位于核心服务层340的程序框架所使用。核心服务层340提供给应用程序所需要的***服务和/或程序框架,比如基础(Foundation)框架、账户框架、广告框架、数据存储框架、网络连接框架、地理位置框架、运动框架等等。媒体层360为应用程序提供有关视听方面的接口,如图形图像相关的接口、音频技术相关的接口、视频技术相关的接口、音视频传输技术的无线播放(AirPlay)接口等。可触摸层380为应用程序开发提供了各种常用的界面相关的框架,可触摸层380负责用户在终端100上的触摸交互操作。比如本地通知服务、远程推送服务、广告框架、游戏工具框架、消息用户界面接口(User Interface,UI)框架、用户界面UIKit框架、地图框架等等。Taking the operating system as an IOS system as an example, the programs and data stored in the memory 120 are shown in FIG. 6. The IOS system includes: a core operating system layer 320 (Core OS layer), a core service layer 340 (Core services layer), and a media layer. 360 (Media layer), 380 (Cocoa Touch Layer). The core operating system layer 320 includes an operating system kernel, drivers, and a low-level program framework. These low-level program frameworks provide functions closer to the hardware for use by the program framework located in the core service layer 340. The core service layer 340 provides system services and / or program frameworks required by applications, such as a Foundation framework, an account framework, an advertising framework, a data storage framework, a network connection framework, a geographic location framework, a motion framework, and the like. The media layer 360 provides audio-visual-related interfaces for applications, such as graphics and image-related interfaces, audio technology-related interfaces, video technology-related interfaces, and audio and video transmission technology (AirPlay) interfaces. The touchable layer 380 provides various commonly-used interface-related frameworks for application development. The touchable layer 380 is responsible for user touch interaction operations on the terminal 100. For example, a local notification service, a remote push service, an advertising framework, a game tool framework, a message user interface interface (UI) framework, a user interface UIKit framework, a map framework, and so on.
在图6所示出的框架中,与大部分应用程序有关的框架包括但不限于:核心服务层340中的基础框架和可触摸层380中的UIKit框架。基础框架提供许多基本的对象类和数据类型,为所有应用程序提供最基本的***服务,和UI无关。而UIKit框架提供的类是基础的UI类库,用于创建基于触摸的用户界面,iOS应用程序可以基于UIKit框架来提供UI,所以它提供了应用程序的基础架构,用于构建用户界面,绘图、处理和用户交互事件,响应手势等等。Among the frameworks shown in FIG. 6, frameworks related to most applications include, but are not limited to, a basic framework in a core service layer 340 and a UIKit framework in a touchable layer 380. The basic framework provides many basic object classes and data types, and provides the most basic system services for all applications, regardless of the UI. The classes provided by the UIKit framework are basic UI class libraries for creating touch-based user interfaces. IOS applications can provide UIs based on the UIKit framework, so it provides the application's infrastructure for building user interfaces and drawing. , Handling and user interaction events, responding to gestures, and more.
其中,在IOS***中实现第三方应用程序与操作***数据通信的方式以及原理可参考Android***,本申请在此不再赘述。For the manner and principle of implementing third-party application programs and operating system data communication in the IOS system, please refer to the Android system, which is not described in this application.
输入输出装置130可以包括触摸显示屏,该触摸显示屏用于接收用户使用手指、触摸笔等任何适合的物体在其上或附近的触摸操作,以及显示各个应用程序的用户界面。触摸显示屏通常设置在终端100的前面板。触摸显示屏可被设计成为全面屏、曲面屏、异型屏、折叠屏或双面屏。触摸显示屏还可被设计成为全面屏与曲面屏的结合,异型屏与曲面屏的结合,本申请实施例对此不加以限定。The input-output device 130 may include a touch display screen for receiving a user's touch operation on or near any suitable object using a finger, a touch pen, or the like, and a user interface displaying various application programs. The touch display is usually provided on the front panel of the terminal 100. The touch display can be designed as a full screen, curved screen, special screen, folding screen or double-sided screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, and a combination of a special-shaped screen and a curved screen, which is not limited in the embodiment of the present application.
除此之外,本领域技术人员可以理解,上述附图所示出的终端100的结构并不构成对终端100的限定,终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,终端100中还包括射频电路、输入单元、传感器、音频电路、无线保真(Wireless Fidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art can understand that the structure of the terminal 100 shown in the above drawings does not constitute a limitation on the terminal 100. The terminal may include more or fewer components than shown in the figure, or combine some Components, or different component arrangements. For example, the terminal 100 further includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, and a Bluetooth module, and details are not described herein again.
请参考图7,其示出了本申请一个示例性实施例示出的资源配置方法的流程图。本实施例以该方法应用于运行有操作***和至少一个应用程序的终端100来举例说明。该方法包括:Please refer to FIG. 7, which is a flowchart of a resource configuration method according to an exemplary embodiment of the present application. This embodiment is exemplified by applying the method to a terminal 100 running an operating system and at least one application program. The method includes:
步骤701,目标应用程序通过与操作***之间的binder连接,向操作***发送应用运行信息,应用运行信息用于表征目标应用程序所处的运行状态。Step 701: The target application program sends application running information to the operating system through a binder connection with the operating system, and the application running information is used to characterize the running status of the target application program.
在一种可能的实施方式中,目标应用程序启动过程中,即与操作***之间建立binder连接。该目标应用程序可以为游戏类应用程序、视频播放类应用程序、即时通信应用程序等等,本申请实施例并不对目标应用程序进行具体限定。In a possible implementation manner, during the startup process of the target application, a binder connection is established with the operating system. The target application may be a game application, a video playback application, an instant messaging application, or the like, and the embodiment of the present application does not specifically limit the target application.
目标应用程序运行过程中,即对应用运行信息进行采集,并通过预先建立的binder连接, 将采集到的应用运行信息发送至操作***。During the running of the target application, the application operation information is collected, and the collected application operation information is sent to the operating system through a pre-established binder connection.
可选的,目标应用程序所处的运行状态包括所处的应用场景以及应用运行质量,相应的,该应用运行信息中可以包括指示当前应用场景的应用场景标识,以及指示应用当前运行质量的应用运行参数。其中,应用场景指目标应用程序中不同运行阶段对应的场景,比如,对于游戏类应用程序,该应用场景包括游戏数据加载场景、游戏数据更新场景和游戏对战场景等等。Optionally, the running state of the target application includes the application scenario in which it is located and the application running quality. Correspondingly, the application running information may include an application scenario identifier indicating the current application scenario and an application indicating the current running quality of the application. Operating parameters. The application scenario refers to a scenario corresponding to different running phases in a target application. For example, for a game application, the application scenario includes a game data loading scenario, a game data update scenario, and a game battle scenario.
针对发送应用运行信息的时机,在一种可能的实施方式中,目标应用程序每隔预定时间间隔通过binder连接向操作***发送采集到的应用运行信息,比如,该预定时间间隔为5s或10s;在另一种可能的实施方式中,目标应用程序在运行至指定应用场景时,通过binder连接向操作***发送采集到的应用运行信息。Regarding the timing of sending application running information, in a possible implementation manner, the target application sends the collected application running information to the operating system through a binder connection at a predetermined time interval, for example, the predetermined time interval is 5s or 10s; In another possible implementation manner, when the target application program runs to a specified application scenario, it sends the collected application running information to the operating system through a binder connection.
步骤702,操作***接收应用运行信息。Step 702: The operating system receives application running information.
如图4所示,操作***通过接口通信***242的binder接口,接收目标应用程序发送的应用运行信息。As shown in FIG. 4, the operating system receives application running information sent by the target application program through a binder interface of the interface communication system 242.
为了避免非法应用程序通过建立binder连接与操作***进行通信,造成***安全隐患,可选的,操作***接收到应用运行信息后,获取目标应用程序的应用标识。In order to prevent illegal applications from communicating with the operating system through the establishment of a binder connection, causing potential system security risks, optionally, after the operating system receives the application running information, it obtains the application identification of the target application.
可选的,操作***获取应用运行信息中包含的应用标识。Optionally, the operating system obtains an application identifier included in the application running information.
操作***中预设应用标识列表,该预设应用标识列表中包含支持进行资源配置的应用程序的应用标识。可选的,该列表由操作***开发商设置,且加密存储在终端内。A preset application identifier list in the operating system, where the preset application identifier list includes an application identifier of an application that supports resource configuration. Optionally, the list is set by the operating system developer and stored encrypted in the terminal.
若目标应用程序的应用标识属于预设应用标识列表,操作***则执行步骤703,若目标应用程序的应用标识不属于预设应用标识列表,操作***则不响应应用运行信息。If the application identifier of the target application belongs to the preset application identifier list, the operating system executes step 703. If the application identifier of the target application does not belong to the preset application identifier list, the operating system does not respond to the application running information.
可选的,当目标应用程序的应用标识不属于预设应用标识列表时,操作***断开并清理与目标应用程序之间的连接。Optionally, when the application identifier of the target application does not belong to the preset application identifier list, the operating system disconnects and cleans up the connection with the target application.
步骤703,操作***根据应用运行信息确定资源配置策略,资源配置策略指为运行状态下目标应用程序分配***资源的策略。Step 703: The operating system determines a resource allocation policy according to the application running information. The resource allocation policy refers to a policy for allocating system resources to a target application in a running state.
操作***能够分配的***资源包括CPU资源、GPU资源、内存资源、磁盘资源和网络资源等等,而不同应用场景下,目标应用程序对不同***资源的需求程度不同,因此,为了实现针对不同的应用场景,为应用程序动态配置***资源,操作***根据目标应用程序当前的应用运行信息,制定相应的资源配置策略。The system resources that the operating system can allocate include CPU resources, GPU resources, memory resources, disk resources, network resources, and so on. In different application scenarios, the target application requires different levels of system resources. Therefore, in order to achieve different The application scenario dynamically configures system resources for the application, and the operating system formulates a corresponding resource configuration strategy based on the current application running information of the target application.
在一种可能的实施方式中,操作***根据应用运行信息中的应用运行参数,确定当前应用场景下目标应用程序的运行质量,并在运行质量不符合预期时,制定动态配置相关***资源的资源配置策略。其中,该相关***资源指与当前应用场景相关的***资源。In a possible implementation manner, the operating system determines the running quality of the target application under the current application scenario according to the application running parameters in the application running information, and formulates resources for dynamically configuring relevant system resources when the running quality does not meet expectations. Configure policies. The related system resource refers to a system resource related to a current application scenario.
可选的,该资源配置策略中至少包括:待配置***资源的类型以及资源数量。Optionally, the resource configuration strategy includes at least: a type of the system resource to be configured and a quantity of the resource.
步骤704,操作***根据资源配置策略为目标应用程序分配***资源。Step 704: The operating system allocates system resources for the target application according to the resource configuration policy.
进一步的,根据制定出的资源配置策略,操作***与内核层进行通信,从而指示内核层对相应的***资源进行配置。Further, according to the formulated resource allocation strategy, the operating system communicates with the kernel layer, thereby instructing the kernel layer to configure the corresponding system resources.
示意性的,如图4所示,操作***中接口通信***242即通过控制接口与Linux内核层220进行通信,最终完成***资源优化配置。Illustratively, as shown in FIG. 4, the interface communication system 242 in the operating system communicates with the Linux kernel layer 220 through the control interface, and finally optimizes the system resource configuration.
可选的,对于能够通过直接通讯的方式进行控制的***资源(比如CPU资源和GPU资源),操作***直接调用此类***资源对应的抽象接口完成资源配置;而对于操作***无法直接访问控制的***资源(比如网络资源),操作***采用代理的方式,通过代理与此类***资源对应的子***(比如网络资源对应的子***可以为WiFi子***)进行间接通讯,从而完成***资源配置。Optionally, for system resources (such as CPU resources and GPU resources) that can be controlled through direct communication, the operating system directly calls the abstract interface corresponding to such system resources to complete resource configuration; while for operating systems that cannot directly access control For system resources (such as network resources), the operating system uses a proxy method to indirectly communicate with the subsystems corresponding to such system resources (such as the subsystems corresponding to network resources can be the WiFi subsystem) through the proxy to complete the system resource configuration.
可选的,当目标应用程序结束生命周期时(应用程序的进程结束),即当接收到目标应用程序的进程结束信号时,操作***断开与目标应用程序之间的连接,并清理数据通道,以便后续与其他应用程序建立连接。Optionally, when the target application ends its life cycle (the process of the application ends), that is, when the process end signal of the target application is received, the operating system disconnects the connection with the target application and clears the data channel For subsequent connections with other applications.
综上所述,本申请实施例提供的资源配置方法中,目标应用程序通过预先与操作***建 立binder连接,使得目标应用程序能够通过该binder连接向操作***发送自身的应用运行信息,以便操作***基于应用运行信息制定相应的资源配置策略,从而根据该资源配置策略为目标应用程序分配相应的***资源;相较于单纯提升终端的硬件性能,本实施例中的操作***可以针对应用程序所处的运行状态,针对性地为其分配相应***资源,使得应用程序在不同运行状态下均能够达到良好的运行效果,并降低对终端硬件的依赖。In summary, in the resource configuration method provided by the embodiment of the present application, the target application program establishes a binder connection with the operating system in advance, so that the target application program can send its own application running information to the operating system through the binder connection, so that the operating system Based on the application running information, a corresponding resource allocation policy is formulated to allocate corresponding system resources to the target application program according to the resource allocation policy. Compared to simply improving the hardware performance of the terminal, the operating system in this embodiment can be targeted at the application program location. The operating state of the system is targeted to allocate corresponding system resources, so that the application can achieve good operating results in different operating states, and reduce dependence on terminal hardware.
另外,操作***基于预设应用标识列表实现应用程序合法性检测,从而避免与非法应用程序进行通信,提高了操作***的安全性。In addition, the operating system implements application legality detection based on a preset application identification list, thereby avoiding communication with illegal applications, and improving the security of the operating system.
可选的,目标应用程序通过与操作***之间的binder连接,向操作***发送应用运行信息,包括:Optionally, the target application sends application running information to the operating system through a binder connection with the operating system, including:
目标应用程序调用binder接口函数与操作***的binder接口建立binder连接,binder接口函数由操作***的开发者提供;The target application calls the binder interface function to establish a binder connection with the operating system's binder interface. The binder interface function is provided by the developer of the operating system;
若当前应用场景为预设应用场景,目标应用程序则获取预设应用场景对应的应用场景标识,并采集当前应用场景下的应用运行参数;If the current application scenario is a preset application scenario, the target application obtains an application scenario identifier corresponding to the preset application scenario, and collects application running parameters in the current application scenario;
目标应用程序通过binder连接,向操作***发送包含应用场景标识和应用运行参数的应用运行信息。The target application program connects to the operating system and sends application operation information including the application scenario identifier and application operation parameters to the operating system.
可选的,操作***根据应用运行信息确定资源配置策略,包括:Optionally, the operating system determines the resource allocation strategy based on the application running information, including:
操作***确定应用场景标识对应的第一运行指标,第一运行指标是在应用场景标识对应的应用场景下,与应用运行质量相关的指标;The operating system determines a first operating indicator corresponding to the application scenario identifier, and the first operating indicator is an indicator related to application running quality in the application scenario corresponding to the application scenario identifier;
若应用运行参数未达到第一运行指标,操作***确定第一运行指标对应的第一目标***资源;If the application operating parameters do not reach the first operating index, the operating system determines a first target system resource corresponding to the first operating index;
操作***根据第一目标***资源确定第一资源配置策略,第一资源配置策略指上调第一目标***资源性能的策略。The operating system determines a first resource allocation policy according to the first target system resource. The first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
可选的,当第一运行指标为帧率指标时,第一目标***资源包括CPU资源和GPU资源中的至少一种;Optionally, when the first running indicator is a frame rate indicator, the first target system resource includes at least one of a CPU resource and a GPU resource;
当第一运行指标为加载速度指标时,第一目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the first running indicator is a loading speed indicator, the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
当第一运行指标为丢帧率指标时,第一目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the first running indicator is a frame loss rate indicator, the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
当第一运行指标为下载速率指标或网络延迟指标时,第一目标***资源至少包括网络资源。When the first operation indicator is a download rate indicator or a network delay indicator, the first target system resource includes at least network resources.
可选的,操作***根据应用运行信息确定资源配置策略,包括:Optionally, the operating system determines the resource allocation strategy based on the application running information, including:
操作***确定应用场景标识对应的第二运行指标,第二运行指标是在应用场景标识对应的应用场景下,与应用运行质量无关的指标;The operating system determines a second operating indicator corresponding to the application scenario identifier, and the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier;
若应用运行参数优于第二运行指标,操作***确定第二运行指标对应的第二目标***资源;If the application running parameter is better than the second running indicator, the operating system determines a second target system resource corresponding to the second running indicator;
操作***根据第二目标***资源确定第二资源配置策略,第二资源配置策略指下调第二目标***资源性能的策略。The operating system determines a second resource allocation policy according to the second target system resource. The second resource allocation policy refers to a policy for lowering the performance of the second target system resource.
可选的,当第二运行指标为帧率指标时,第二目标***资源包括CPU资源和GPU资源中的至少一种;Optionally, when the second operation indicator is a frame rate indicator, the second target system resource includes at least one of a CPU resource and a GPU resource;
当第二运行指标为加载速度指标时,第二目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the second running indicator is a loading speed indicator, the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
当第二运行指标为丢帧率指标时,第二目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the second running indicator is a frame loss rate indicator, the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
当第二运行指标为下载速率指标或网络延迟指标时,第二目标***资源至少包括网络资源。When the second operation indicator is a download rate indicator or a network delay indicator, the second target system resource includes at least network resources.
可选的,操作***接收应用运行信息之后,所述方法还包括:Optionally, after the operating system receives application running information, the method further includes:
操作***获取前台应用的前台应用标识;The operating system obtains the foreground application identifier of the foreground application;
若目标应用程序的应用标识与前台应用标识一致,操作***则执行根据应用运行信息确定资源配置策略的步骤;If the application identifier of the target application is consistent with the foreground application identifier, the operating system executes the step of determining a resource allocation policy according to the application running information;
若目标应用程序的应用标识与前台应用标识不一致,操作***则不响应应用运行信息。If the application identifier of the target application is inconsistent with the foreground application identifier, the operating system does not respond to the application running information.
可选的,操作***接收应用运行信息之后,还包括:Optionally, after the operating system receives the application running information, it further includes:
操作***获取目标应用程序的应用标识;The operating system obtains the application identification of the target application;
若目标应用程序的应用标识属于预设应用标识列表,操作***则执行根据应用运行信息确定资源配置策略的步骤,预设应用标识列表中包含支持进行资源配置的应用程序的应用标识;If the application identifier of the target application belongs to a preset application identifier list, the operating system executes the step of determining a resource allocation policy according to the application running information, and the preset application identifier list includes an application identifier of an application that supports resource configuration;
若目标应用程序的应用标识不属于预设应用标识列表,操作***则不响应应用运行信息。If the application identifier of the target application does not belong to the preset application identifier list, the operating system does not respond to the application running information.
可选的,目标应用程序通过与操作***之间的binder连接,向操作***发送应用运行信息之后,还包括:Optionally, after the target application sends the application running information to the operating system through a binder connection with the operating system, it further includes:
当由前台运行切换至后台运行时,目标应用程序停止通过binder连接向操作***发送应用运行信息。When switching from foreground running to background running, the target application stops sending application running information to the operating system through the binder connection.
可选的,操作***根据资源配置策略为目标应用程序分配***资源之后,还包括:Optionally, after the operating system allocates system resources for the target application according to the resource configuration policy, it further includes:
当接收到目标应用程序的进程结束信号时,操作***清理与目标应用程序之间的binder连接。When receiving the process end signal of the target application, the operating system cleans up the binder connection with the target application.
综合考虑功耗、数据传输量等诸多因素,在一种可能的实施方式中,目标应用程序仅在运行至特定应用场景时,才会采集该应用场景下的应用运行参数,并发送至操作***,相应的,操作***根据接收到的应用运行参数,为该应用场景下的目标应用程序配置***资源。下面采用示意性的实施例进行说明。Considering factors such as power consumption and data transmission volume, in one possible implementation, only when the target application runs to a specific application scenario, the application operating parameters in the application scenario are collected and sent to the operating system. Correspondingly, the operating system configures system resources for the target application in the application scenario according to the received application operating parameters. The following uses a schematic embodiment for description.
请参考图8,其示出了本申请另一个示例性实施例示出的资源配置方法的流程图。本实施例以该方法应用于终端100中来举例说明,终端100中运行有操作***和至少一个应用程序。该方法包括:Please refer to FIG. 8, which is a flowchart of a resource configuration method according to another exemplary embodiment of the present application. In this embodiment, the method is applied to the terminal 100 for illustration. The terminal 100 runs an operating system and at least one application program. The method includes:
步骤801,目标应用程序调用binder接口函数与操作***的binder接口建立binder连接,binder接口函数由操作***的开发者提供。In step 801, the target application calls a binder interface function to establish a binder connection with a binder interface of the operating system, and the binder interface function is provided by a developer of the operating system.
在一种可能的实施方式中,操作***的开发者将调用自身binder接口的binder接口函数提供给第三方应用程序开发者,由第三方应用程序开发者根据需要将部分或全部binder接口函数封装成binder通讯模块后,内嵌到第三方应用程序中。本申请实施例中,目标应用程序可以为内嵌有该binder通讯模块的第三方应用程序。In a possible implementation manner, the developer of the operating system provides a binder interface function that calls its own binder interface to a third-party application developer, and the third-party application developer encapsulates some or all of the binder interface function into After the binder communication module, it is embedded into the third-party application. In the embodiment of the present application, the target application program may be a third-party application program in which the binder communication module is embedded.
可选的,在目标应用程序启动过程中,或,在账号登陆过程中,即调用binder接口函数请求与操作***的binder接口建立binder连接。操作***接受请求后,目标应用程序与操作***之间即建立起binder连接。Optionally, during the target application startup process or during the account login process, the binder interface function is called to request the establishment of a binder connection with the binder interface of the operating system. After the operating system accepts the request, a binder connection is established between the target application and the operating system.
可选的,操作***接收到请求后,可以对目标应用程序进行验证,并在目标应用程序具备连接权限(即目标应用程序为支持资源优化配置的授权应用)时,与目标应用程序之间建立binder连接,否则,操作***将不会与目标应用程序建立binder连接。Optionally, after the operating system receives the request, it can verify the target application and establish a connection with the target application when the target application has connection permissions (that is, the target application is an authorized application that supports resource optimization configuration). Binder connection, otherwise, the operating system will not establish a binder connection with the target application.
步骤802,若当前应用场景为预设应用场景,目标应用程序则获取预设应用场景对应的应用场景标识,并采集当前应用场景下的应用运行参数。Step 802: If the current application scenario is a preset application scenario, the target application obtains an application scenario identifier corresponding to the preset application scenario, and collects application running parameters in the current application scenario.
在一种可能的实施方式中,开发人员在开发目标应用程序时,针对可能需要进行***资源优化配置的场景,设置包含至少一个预设应用场景的场景列表。示意性的,针对游戏类应用程序,该场景列表中可以包括:游戏启动场景、游戏资源更新场景、游戏账号登陆场景、游戏主界面场景、游戏商城界面场景、游戏内部加载场景、游戏对战场景。In a possible implementation manner, when developing a target application, a developer sets a scenario list including at least one preset application scenario for scenarios that may require optimized configuration of system resources. Illustratively, for game applications, the scene list may include: a game startup scene, a game resource update scene, a game account login scene, a game main interface scene, a game mall interface scene, a game internal loading scene, and a game battle scene.
可选的,目标应用程序在运行过程中(已与操作***建立binder连接),即检测当前应用场景是否属于该场景列表,若属于,目标应用程序则获取当前运行场景(即匹配的预设应用场景)对应的场景标识,并进一步采集当前运行场景下的应用运行参数;若不属于,目标应 用程序则继续监测当前应用场景,而不采集应用运行参数(或者采集应用运行参数,但并不发送给操作***)。其中,该应用运行参数包括操作***无法获取到的一系列指标参数。Optionally, during the running process of the target application (a binder connection has been established with the operating system), it is detected whether the current application scenario belongs to the scenario list, and if it belongs, the target application obtains the current running scenario (that is, the matched preset application) Scenario) Corresponding scenario identifier, and further collect application operating parameters in the current operating scenario; if it does not belong, the target application continues to monitor the current application scenario without collecting application operating parameters (or collecting application operating parameters, but does not send them To the operating system). Among them, the application running parameters include a series of index parameters that cannot be obtained by the operating system.
其中,不同类型应用程序采集的应用运行参数可以相同(比如,由操作***开发商统一制定),或者,不同类型应用程序采集的应用运行参数也可以不同。Among them, application running parameters collected by different types of application programs may be the same (for example, uniformly formulated by an operating system developer), or application running parameters collected by different types of application programs may be different.
比如,当目标应用程序为即时通信类应用程序时,采集的应用运行参数包括帧率、加载速度、丢帧率、下载速率、网络延迟中的至少一种;当目标应用程序为游戏类应用程序时,采集的应用运行参数中还可以包括游戏画面质量、游戏画面分辨率、游戏模型质量以及游戏画面内模型数量等等。For example, when the target application is an instant communication application, the collected application operating parameters include at least one of frame rate, loading speed, frame loss rate, download rate, and network delay; when the target application is a game application At this time, the collected application running parameters may also include game picture quality, game picture resolution, game model quality, and the number of models in the game picture.
步骤803,目标应用程序通过binder连接,向操作***发送包含应用场景标识和应用运行参数的应用运行信息。Step 803: The target application program connects to the operating system and sends application operation information including an application scenario identifier and application operation parameters to the operating system.
完成应用运行参数采集后,目标应用程序即将应用场景标识和应用运行参数作为应用运行信息,发送至操作***。After the application operation parameter collection is completed, the target application program sends the application scenario identifier and the application operation parameter to the operating system as application operation information.
可选的,目标应用程序在检测到处于预设应用场景后,持续采集应用运行参数,并持续向操作***发送包含应用场景标识和应用运行参数的应用运行信息。Optionally, after detecting that the target application is in a preset application scenario, the target application program continuously collects application operation parameters, and continuously sends application operating information including the application scenario identifier and the application operation parameter to the operating system.
可选的,对于采集到的应用运行信息,目标应用程序还需要对其进行数据整理,比如合并重复信息、删除冗余信息。同时,目标应用程序还可以根据应用场景或应用运行参数的重要程度,设置应用运行信息的发送优先级,从而优先发送重要应用场景下的应用运行信息,或包含重要应用运行参数(比如帧率以及丢帧率)的应用运行信息,过滤或延迟发送非重要应用场景下的应用运行信息。Optionally, for the collected application running information, the target application needs to organize data, such as merging duplicate information and deleting redundant information. At the same time, the target application can also set the sending priority of the application running information according to the importance of the application scenario or the application operating parameters, so that the application operating information in the important application scenarios is preferentially sent or contains important application operating parameters such as the frame rate and Frame loss rate) application running information, filtering or delaying application running information in non-critical application scenarios.
可选的,当不同类型应用程序对应的应用场景标识相同时,比如,即时通信类应用程序中应用场景标识“001”对应“视频聊天场景”,而游戏类应用程序中应用场景标识“001”则对应“游戏主界面场景”,该应用运行信息中还包括应用类型标识,操作***即根据应用类型标识和应用场景标识区分不同类型应用程序下的应用场景。Optionally, when the application scenario identifiers corresponding to different types of applications are the same, for example, the application scenario identifier "001" in the instant communication application corresponds to the "video chat scenario", and the application scenario identifier "001" in the game application It corresponds to the "game main interface scenario", and the application running information also includes an application type identifier. The operating system distinguishes application scenarios under different types of applications according to the application type identifier and the application scenario identifier.
可选的,该应用运行信息中还包括采集应用运行参数时的时间戳,根据该时间戳,操作***即可确定应用运行信息是否及时发送,并确定应用运行信息的发送时序,从而避免应用运行信息发送超时以及发送时序颠倒的问题。Optionally, the application running information also includes a timestamp when the application running parameters are collected. Based on the timestamp, the operating system can determine whether the application running information is sent in a timely manner and determine the sending timing of the application running information, thereby avoiding the application running. The problem of message sending timeout and sending timing reversal.
需要说明的是,在实际应用过程中,该应用运行信息中还可以根据需求携带其他信息,比如应用程序标识,本申请实施例并不对应用运行信息中包含的具体信息进行限定。It should be noted that in the actual application process, the application running information may also carry other information according to requirements, such as an application program identifier. The embodiments of the present application do not limit the specific information contained in the application running information.
可选的,目标应用程序采用数据包的形式发送应用运行信息,且数据包的格式预先与操作***进行约定。其中,数据包的格式可以为Java脚本对象标记(JavaScript Object Notation,JSON)、协议缓冲区(ProtocolBuffer,Protobuf)或自定义格式等。Optionally, the target application sends application running information in the form of a data packet, and the format of the data packet is agreed with the operating system in advance. The format of the data packet may be a Java script object tag (JavaScript, Object Notation, JSON), a protocol buffer (ProtocolBuffer, Protocol), or a custom format.
步骤804,操作***接收应用运行信息。Step 804: The operating system receives application running information.
在一种可能的实施方式中,操作***接收到目标应用程序发送的数据包后,采用预先约定的数据包格式对该数据包进行解析,从而得到其中包含的应用运行信息。In a possible implementation manner, after the operating system receives the data packet sent by the target application, the data packet is parsed by using a pre-approved data packet format to obtain the application running information contained therein.
步骤805,操作***确定应用场景标识对应的第一运行指标,第一运行指标是在应用场景标识对应的应用场景下,与应用运行质量相关的指标。Step 805: The operating system determines a first operating index corresponding to the application scenario identifier, where the first operating indicator is an indicator related to application running quality in the application scenario corresponding to the application scenario identifier.
由于评价同一应用程序在不同应用场景下运行质量的指标不同,因此为了确定目标应用程序在当前应用场景下的运行质量是否符合预期,操作***根据应用场景标识,确定当前应用场景下的第一运行指标。Because the indicators for evaluating the running quality of the same application in different application scenarios are different, in order to determine whether the running quality of the target application in the current application scenario is as expected, the operating system determines the first operation in the current application scenario based on the application scenario identifier. index.
其中,应用场景标识与第一运行指标之间的对应关系可以由终端预先从后台服务器处下载并存储(比如当下载目标应用程序,根据目标应用程序的应用标识从后台服务器处下载该对应关系),且该对应关系由开发人员通过调试后得到。The correspondence between the application scenario identifier and the first running indicator can be downloaded and stored from the background server in advance by the terminal (for example, when the target application is downloaded, the correspondence is downloaded from the background server according to the application identifier of the target application) , And the corresponding relationship is obtained after debugging by the developer.
可选的,第一运行指标是当前应用场景下,为达到预期运行质量,目标应用程序所需达到的指标。其中,第一运行指标包括(最低)帧率指标、(最低)加载速度指标、(最高)丢帧率指标、(最低)内存指标、(最低)下载速率指标和(最高)网络延迟指标中的至少一种。Optionally, the first running indicator is an indicator that the target application needs to achieve in order to achieve the expected running quality in the current application scenario. Among them, the first running index includes the (lowest) frame rate index, (lowest) loading speed index, (highest) frame loss index, (lowest) memory index, (lowest) download rate index, and (highest) network latency index. At least one.
可选的,当应用场景标识对应的应用场景为数据加载场景时,第一运行指标包括加载速 度指标和内存指标中的至少一种。Optionally, when the application scenario corresponding to the application scenario identifier is a data loading scenario, the first running indicator includes at least one of a loading speed indicator and a memory indicator.
其中,数据加载场景为目标应用程序加载本地数据的场景,且不同类型应用程序对应的本地数据可能不同,比如,对于游戏类应用程序,该本地数据可以包括多媒体数据、游戏模型数据、游戏场景数据等等;对于导航类应用程序,该本地数据可以包括导航语音数据、地图数据等等。凡是涉及加载本地数据的场景均可以被归为数据加载场景,本申请实施例并不对此进行限定。The data loading scenario is a scenario where the target application loads local data, and the local data corresponding to different types of applications may be different. For example, for game applications, the local data may include multimedia data, game model data, and game scene data. And so on; for navigation applications, the local data may include navigation voice data, map data, and so on. All scenarios involving loading local data can be classified as data loading scenarios, which are not limited in the embodiments of the present application.
可选的,当应用场景标识对应的应用场景为数据传输场景时,第一运行指标包括下载速率指标和网络延迟指标的至少一种。Optionally, when the application scenario corresponding to the application scenario identifier is a data transmission scenario, the first operating indicator includes at least one of a download rate indicator and a network delay indicator.
其中,数据传输场景为目标应用程序通过网络进行数据传输的场景。对于不同类型的应用程序,该数据传输场景可能不同。比如,对于即时通信类应用程序,该数据传输场景可以为文件传输场景、语音场景、视频场景或网络多媒体浏览场景等等;对于游戏类应用程序,该数据传输场景可以为游戏数据包更新场景、在线游戏场景等等。凡是涉及网络数据传输的场景均可以被归为数据传输场景,本申请实施例并不对此进行限定。The data transmission scenario is a scenario in which the target application performs data transmission through the network. This data transfer scenario may be different for different types of applications. For example, for an instant messaging application, the data transmission scenario may be a file transmission scenario, a voice scenario, a video scenario, or a network multimedia browsing scenario, etc .; for a game application, the data transmission scenario may be a game data packet update scenario, Online game scenes and more. All scenarios involving network data transmission can be classified as data transmission scenarios, which are not limited in the embodiments of the present application.
由于可以采用传输速度和传输延迟衡量数据传输场景下的运行质量,因此,当应用场景为动态画面显示场景时,操作***确定第一运行指标为下载速率指标和网络延迟指标中的至少一种。Because transmission speed and transmission delay can be used to measure running quality in data transmission scenarios, when the application scenario is a dynamic picture display scenario, the operating system determines that the first operating indicator is at least one of a download rate indicator and a network delay indicator.
可选的,当应用场景标识对应的应用场景为动态画面显示场景时,第一运行指标包括帧率指标、丢帧率指标和网络延迟指标中的至少一种。Optionally, when the application scenario corresponding to the application scenario identifier is a dynamic screen display scenario, the first operating indicator includes at least one of a frame rate indicator, a frame loss rate indicator, and a network delay indicator.
其中,动态画面显示场景为涉及动态图像渲染显示的场景,对于不同类型的应用程序,该动态图像可能不同。比如,对于即时通信类应用程序,该动态图像可以为短视频、动态表情、视频会话等等;对于游戏类应用程序,该动态图像可以为过场动画、动态游戏场景等等。凡是涉及动态图像显示的场景均可以被归为动态画面显示场景,本申请实施例并不对此进行限定。The dynamic picture display scene is a scene involving dynamic image rendering and display. For different types of applications, the dynamic image may be different. For example, for an instant communication application, the dynamic image may be a short video, a dynamic expression, a video session, and the like; for a game application, the dynamic image may be a cut scene animation, a dynamic game scene, and the like. Any scene involving dynamic image display can be classified as a dynamic picture display scene, which is not limited in the embodiments of the present application.
由于画面流畅度、画面质量和画面延迟可以衡量动态画面显示场景下的运行质量,因此,当应用场景为动态画面显示场景时,操作***确定第一运行指标为帧率指标、丢帧率指标和网络延迟指标中的至少一种。Because picture fluency, picture quality, and picture delay can measure the running quality in dynamic picture display scenarios, when the application scenario is a dynamic picture display scenario, the operating system determines that the first operating indicator is the frame rate indicator, frame loss index, and At least one of network latency indicators.
在一种可能的实施方式中,操作***中预先设置有不同应用场景标识与第一运行指标之间的对应关系,操作***即基于该对应关系确定当前应用场景下的第一运行指标。示意性,以游戏类应用程序为例,该对应关系如表一所示。In a possible implementation manner, a correspondence relationship between different application scenario identifiers and the first operation indicator is preset in the operating system, and the operating system determines the first operation indicator in the current application scenario based on the correspondence relationship. Illustratively, taking a game application as an example, the corresponding relationship is shown in Table 1.
表一Table I
应用场景Application scenario 应用场景标识Application scenario identification 第一运行指标First operating indicator
游戏加载场景Game loading scene 001001 加载速度指标:20M/s,内存指标:1GLoading speed index: 20M / s, memory index: 1G
游戏对战场景Game battle scene 002002 帧率指标:60fps;网络延迟指标:50ms;丢帧率指标:5%Frame rate index: 60fps; Network delay index: 50ms; Frame loss index: 5%
游戏更新场景Game update scene 003003 下载速度指标:250k/sDownload speed indicator: 250k / s
步骤806,若应用运行参数未达到第一运行指标,操作***确定第一运行指标对应的第一目标***资源。Step 806: If the application operating parameters do not reach the first operating index, the operating system determines a first target system resource corresponding to the first operating index.
进一步的,操作***通过分析目标应用程序当前的应用运行参数与查询到的第一运行指标,确定当前应用场景下目标应用程序的运行质量是否达到预期。Further, the operating system determines whether the running quality of the target application in the current application scenario meets the expectations by analyzing the current application operating parameters of the target application and the first operating index queried.
可选的,当应用运行参数未达到第一运行指标时,操作***确定目标应用程序的运行质量不佳,需要优化***资源配置;当应用运行参数达到第一运行指标时,操作***确定目标应用程序的运行质量良好,无需优化***资源配置。Optionally, when the operating parameters of the application do not reach the first operating index, the operating system determines that the running quality of the target application is not good and the system resource allocation needs to be optimized; when the operating parameters of the application reach the first operating index, the operating system determines the target application The program runs in good quality and does not need to optimize system resource allocation.
当分析发现目标应用程序需要优化***资源配置时,操作***确定第一运行指标对应的第一目标***资源,以便后续制定针对第一目标***资源的配置优化策略,其中,该第一目标***资源即为与第一运行指标相关的***资源。When the analysis finds that the target application needs to optimize the system resource configuration, the operating system determines the first target system resource corresponding to the first operating index, so as to subsequently formulate a configuration optimization strategy for the first target system resource, where the first target system resource That is, the system resource related to the first operation index.
在一种可能的实施方式中,操作***中预先设置有不同运行指标与***资源之间的对应关系,操作***即基于该对应关系确定第一运行指标对应的第一目标***资源。示意性,该 对应关系如表二所示。In a possible implementation manner, a corresponding relationship between different operating indicators and system resources is preset in the operating system, and the operating system determines a first target system resource corresponding to the first operating indicator based on the corresponding relationship. Schematically, this correspondence is shown in Table 2.
表二Table II
运行指标Operating indicators ***资源system resource
帧率Frame rate CPU资源、GPU资源CPU resources, GPU resources
加载速度Loading speed CPU资源、磁盘资源、内存资源CPU resources, disk resources, memory resources
丢帧率Frame loss rate CPU资源、GPU资源、网络资源CPU resources, GPU resources, network resources
下载速率Download rate 网络资源Internet resources
网络延迟Network latency 网络资源Internet resources
在一个示意性的例子中,目标应用程序为游戏类应用程序,且目标应用程序运行至游戏对战场景时,采集包含当前帧率(55fps)、当前丢帧率(2%)和当前网络延迟(100ms)的应用运行参数,并发送至操作***。操作***根据目标应用程序所处的应用场景,确定该游戏对战场景对应的第一运行指标包括帧率指标(60fps)、网络延迟指标(50ms)和丢帧率指标(5%)。由于当前帧率小于帧率指标,且当前网络延迟大于网络延迟指标,因此,操作***确定需要对帧率和网络延迟进行优化,并进一步确定基于表二所示的对应关系,确定需要优化的第一目标***资源包括CPU资源、GPU资源和网络资源。In a schematic example, when the target application is a game application, and the target application runs to a game battle scene, the collection includes the current frame rate (55fps), the current frame loss rate (2%), and the current network delay ( 100ms) and send them to the operating system. The operating system determines, according to the application scenario in which the target application program is located, that the first running indicator corresponding to the game battle scenario includes a frame rate indicator (60fps), a network delay indicator (50ms), and a frame loss rate indicator (5%). Because the current frame rate is less than the frame rate indicator, and the current network delay is greater than the network delay indicator, the operating system determines that it is necessary to optimize the frame rate and network delay, and further determines that the first A target system resource includes CPU resources, GPU resources, and network resources.
步骤807,操作***根据第一目标***资源确定第一资源配置策略,第一资源配置策略指上调第一目标***资源性能的策略。Step 807: The operating system determines a first resource allocation policy according to the first target system resource. The first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
确定出需要优化的***资源后,操作***进一步制定出用于上调第一目标***资源性能的第一资源配置策略。After determining the system resources that need to be optimized, the operating system further formulates a first resource allocation strategy for increasing the performance of the first target system resource.
可选的,操作***确定出的第一资源配置策略中还包括***资源上调量。其中,当待上调的***资源为CPU资源时,该***资源上调量包括CPU核心数量、CPU最高频率、CPU最低频率的至少一种;当待上调的***资源为GPU资源时,该***资源上调量包括GPU核心数量、GPU最高频率、GPU最低频率、的至少一种;当待上调的***资源为内存资源时,该***资源上调量包括内存带宽最大值和内存带宽最小值中的至少一种;当待上调的***资源为磁盘资源时,该***资源上调量包括磁盘读写最低读写速度和磁盘最高读写速度中的至少一种;当待上调的***资源为网络资源时,该***资源上调量包括网络吞吐量、网络延迟率和网络功耗中的至少一种;当待上调的***资源为无线连接资源(比如蓝牙、红外等等)时,该***资源上调量包括无线连接强度(调整收发功率)。Optionally, the first resource allocation policy determined by the operating system further includes an increase amount of system resources. Wherein, when the system resource to be adjusted is a CPU resource, the amount of the system resource adjustment includes at least one of the number of CPU cores, the highest CPU frequency, and the lowest CPU frequency; when the system resource to be adjusted is a GPU resource, the system resource is increased. The amount includes at least one of the number of GPU cores, the highest GPU frequency, and the lowest GPU frequency. When the system resource to be adjusted is a memory resource, the amount of the system resource adjustment includes at least one of the maximum memory bandwidth and the minimum memory bandwidth. When the system resource to be adjusted is a disk resource, the system resource increase includes at least one of the minimum read / write speed of the disk and the maximum read / write speed of the disk; when the system resource to be adjusted is a network resource, the system The resource increase includes at least one of network throughput, network delay rate, and network power consumption. When the system resource to be adjusted is a wireless connection resource (such as Bluetooth, infrared, etc.), the system resource increase includes the wireless connection strength. (Adjust the transmit and receive power).
针对***资源上调量的确定方式,在一种可能的实施方式中,该***资源上调量为固定值,操作***每进行一次上调后,即检测目标应用程序当前的应用运行参数是否达到第一运行指标,若达到,则停止上调,若未达到,则根据***资源上调量进行上调。Regarding the determination method of the system resource upward adjustment amount, in a possible implementation manner, the system resource upward adjustment amount is a fixed value, and each time the operating system performs the upward adjustment, it detects whether the current application operating parameter of the target application program reaches the first operation. If the index is reached, the upward adjustment is stopped. If it is not reached, the upward adjustment is performed according to the system resource upward adjustment.
在其他可能的实施方式中,操作***中存储有第一运行指标对应的第一***资源性能参数,当目标应用程序当前的应用运行参数未达到第一运行指标时,操作***即根据当前***资源性能参数和第一***资源性能参数确定***资源上调量。In other possible implementation manners, the operating system stores a first system resource performance parameter corresponding to the first operating index. When the current application operating parameter of the target application does not reach the first operating index, the operating system is based on the current system resource. The performance parameter and the first system resource performance parameter determine the system resource upward adjustment amount.
示意性的,结合步骤806中的示例,操作***确定出的第一资源配置策略为:增加启用1个CPU核心、增加启用1个CPU核心以及降低网络延迟50ms。Illustratively, in combination with the example in step 806, the first resource allocation policy determined by the operating system is: adding and enabling 1 CPU core, adding and enabling 1 CPU core, and reducing network latency by 50 ms.
步骤808,操作***根据第一资源配置策略为目标应用程序分配***资源。Step 808: The operating system allocates system resources for the target application according to the first resource configuration policy.
进一步的,操作***根据确定出的第一资源配置策略为目标应用程序分配***资源,从而通过优化***资源配置的方式,使得目标应用程序在当前应用场景下的应用运行参数达到第一运行指标,即达到预期运行质量。Further, the operating system allocates system resources to the target application according to the determined first resource allocation strategy, so that the application operating parameters of the target application in the current application scenario reach the first operating index by optimizing the system resource allocation. The expected operating quality is achieved.
本实施例中,当运行至预设应用场景时,目标应用程序向操作***发送包含应用场景标识和应用运行参数的应用运行信息,以便操作***根据该应用运行参数,确定目标应用程序的当前应用场景下的运行质量;同时,在运行质量不佳的情况下,操作***能够基于与该应用场景相关的***资源制定资源配置策略,从而根据资源配置策略对***资源进行优化,进而达到优化该应用场景下目标应用程序运行质量的效果。In this embodiment, when running to a preset application scenario, the target application program sends application operation information including the application scenario identifier and the application operation parameter to the operating system, so that the operating system determines the current application of the target application program according to the application operation parameter. Operating quality in scenarios; At the same time, in the case of poor operating quality, the operating system can formulate resource allocation policies based on system resources related to the application scenario, thereby optimizing system resources according to the resource allocation policies, and then optimizing the application The effect of the target application running quality in the scene.
目标应用程序采集的应用运行参数中,除了包含与运行质量相关的参数外,还包含部分与运行质量无关的参数,因此,为了在保证目标应用程序运行质量的前提下,降低终端的功耗,在一种可能的实施方式中,操作***下调无关运行参数对应***资源的性能。在图8的基础上,如图9所示,上述步骤804之后还可以包括如下步骤。需要说明的是,下述步骤809至812与步骤805至808之间并不存在严格的先后时序,本实施例仅以步骤809至812与步骤805至808并行执行为例进行说明,但并不对此构成限定。The application running parameters collected by the target application include parameters related to the running quality, as well as some parameters not related to the running quality. Therefore, in order to reduce the power consumption of the terminal while ensuring the running quality of the target application, In a possible implementation manner, the operating system adjusts the performance of system resources corresponding to unrelated operating parameters. On the basis of FIG. 8, as shown in FIG. 9, after the above step 804, the following steps may be further included. It should be noted that there is no strict sequence between the following steps 809 to 812 and steps 805 to 808. This embodiment only takes steps 809 to 812 and steps 805 to 808 to execute in parallel as an example, but does not describe This constitution is limited.
步骤809,操作***确定应用场景标识对应的第二运行指标,第二运行指标是在应用场景标识对应的应用场景下,与应用运行质量无关的指标。Step 809: The operating system determines a second operating indicator corresponding to the application scenario identifier. The second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier.
由于并非所有运行指标都与目标应用程序在当前应用场景下的应用运行质量相关,因此,操作***根据应用场景标识确定与应用运行质量相关的第一运行指标的同时,根据该应用场景标识确定与应用运行质量无关的第二运行指标。Because not all operating indicators are related to the application running quality of the target application in the current application scenario, the operating system determines the first operating indicator related to the application running quality according to the application scenario identifier, and determines the Application-independent second operating indicator.
可选的,对于同一应用程序的不同应用场景,该第二运行指标不同。其中,第二运行指标包括(最低)帧率指标、(最低)加载速度指标、(最高)丢帧率指标、(最低)内存指标、(最低)下载速率指标和(最高)网络延迟指标中的至少一种。Optionally, for different application scenarios of the same application, the second running indicator is different. Among them, the second operating index includes the (lowest) frame rate index, (lowest) loading speed index, (highest) frame loss index, (lowest) memory index, (lowest) download rate index, and (highest) network latency index. At least one.
可选的,当应用场景标识对应的应用场景为数据加载场景时,第二运行指标包括帧率指标、丢帧率指标、下载速率指标和网络延迟指标中的至少一种。Optionally, when the application scenario corresponding to the application scenario identifier is a data loading scenario, the second operating indicator includes at least one of a frame rate indicator, a frame loss index, a download rate indicator, and a network delay indicator.
由于数据加载场景下的运行质量与画面质量、画面流畅度以及网络状态无关,因此,应用场景为数据加载场景时,操作***确定第二运行指标包括帧率指标、丢帧率指标、下载速率指标和网络延迟指标中的至少一种。Since the running quality in the data loading scenario has nothing to do with picture quality, picture fluency, and network status, when the application scenario is a data loading scenario, the operating system determines that the second operating indicator includes a frame rate indicator, a frame loss indicator, and a download rate indicator. And at least one of network latency indicators.
可选的,当应用场景标识对应的应用场景为数据传输场景时,第二运行指标包括帧率指标、丢帧率指标和内存指标中的至少一种。Optionally, when the application scenario corresponding to the application scenario identifier is a data transmission scenario, the second operating indicator includes at least one of a frame rate indicator, a frame loss index, and a memory indicator.
由于数据传输场景下的运行质量与画面质量、画面流畅度以及内存大小无关,因此,当应用场景为数据传输场景时,操作***确定第二运行指标包括帧率指标、丢帧率指标和内存指标中的至少一种。在一种可能的实施方式中,操作***中预先设置有不同应用场景标识与第二运行指标之间的对应关系,操作***即基于该对应关系确定当前应用场景下的第二运行指标。示意性,以游戏类应用程序为例,该对应关系如表三所示。Since the running quality in the data transmission scenario has nothing to do with picture quality, picture fluency, and memory size, when the application scenario is a data transmission scenario, the operating system determines that the second operating indicator includes a frame rate indicator, a frame loss indicator, and a memory indicator. At least one of. In a possible implementation manner, a correspondence relationship between different application scenario identifiers and a second operation indicator is preset in the operating system, and the operating system determines the second operation indicator in the current application scenario based on the correspondence relationship. Illustratively, taking a game application as an example, the corresponding relationship is shown in Table 3.
表三Table three
应用场景Application scenario 应用场景标识Application scenario identification 第二运行指标Second operating indicator
游戏加载场景Game loading scene 001001 帧率指标:30fps;丢帧率指标:10%Frame rate index: 30fps; Frame loss index: 10%
游戏对战场景Game battle scene 002002 --
游戏更新场景Game update scene 003003 加载速度指标:10M/s;内存指标:1GLoading speed index: 10M / s; memory index: 1G
其中,应用场景标识与第二运行指标之间的对应关系可以由终端预先从后台服务器处下载并存储(比如当下载目标应用程序,根据目标应用程序的应用标识从后台服务器处下载该对应关系),且该对应关系由开发人员通过调试后得到。The corresponding relationship between the application scenario identifier and the second running indicator may be downloaded and stored by the terminal in advance from the background server (for example, when downloading the target application, the corresponding relationship is downloaded from the background server according to the application identifier of the target application) , And the corresponding relationship is obtained after debugging by the developer.
步骤810,若应用运行参数优于第二运行指标,操作***确定第二运行指标对应的第二目标***资源。Step 810: If the application running parameter is better than the second running index, the operating system determines a second target system resource corresponding to the second running index.
进一步的,操作***通过分析目标应用程序当前的应用运行参数与查询到的第二运行指标,确定能够在下调部分***资源性能的情况下,保证目标应用程序正常运行。Further, the operating system analyzes the current application operating parameters of the target application program and the second operating index that is queried to determine that the target application program can operate normally while reducing the performance of some system resources.
可选的,当目标应用程序当前的应用运行参数优于(超过)第二运行指标时,操作***确定能够下调相应***资源的性能;当第二运行指标低于目标应用程序当前的应用运行参数时,操作***确定需要上调相应***资源的性能。Optionally, when the current application operating parameter of the target application is better than (exceeding) the second operating index, the operating system determines that the performance of the corresponding system resource can be reduced; when the second operating index is lower than the current application operating parameter of the target application When the operating system determines that the performance of the corresponding system resource needs to be adjusted.
当分析发现能够下调目标应用程序的部分***资源时,操作***确定第二运行指标对应的第二目标***资源,以便后续指定针对第二目标***资源的配置优化策略。When the analysis finds that part of the system resources of the target application can be reduced, the operating system determines the second target system resource corresponding to the second operating index, so as to subsequently specify a configuration optimization strategy for the second target system resource.
在一种可能的实施方式中,操作***基于表二所示的对应关系,确定出第二运行指标对应的第二目标***资源。In a possible implementation manner, the operating system determines the second target system resource corresponding to the second running indicator based on the corresponding relationship shown in Table 2.
在一个示意性的例子中,目标应用程序为游戏类应用程序,且目标应用程序运行至游戏 加载场景时,采集包含当前帧率(60fps)、当前丢帧率(0%)和当前网络延迟(100ms)的应用运行参数,并发送至操作***。操作***根据目标应用程序所处的应用场景,确定该游戏对战场景对应的第二运行指标包括帧率指标(30fps)、网络延迟指标(100ms)和丢帧率指标(10%)。由于当前帧率大于帧率指标,且当前丢帧率低于丢帧率指标,因此,操作***基于表二所示的对应关系,确定能够下调的第二目标***资源为GPU资源。In a schematic example, the target application is a game application, and when the target application runs to the game loading scene, the collection includes the current frame rate (60fps), the current frame loss rate (0%), and the current network delay ( 100ms) and send them to the operating system. The operating system determines, according to the application scenario in which the target application is located, the second running indicator corresponding to the game battle scenario, including a frame rate indicator (30fps), a network delay indicator (100ms), and a frame loss rate indicator (10%). Because the current frame rate is greater than the frame rate indicator, and the current frame loss rate is lower than the frame loss rate indicator, the operating system determines that the second target system resource that can be adjusted down is the GPU resource based on the correspondence shown in Table 2.
步骤811,操作***根据第二目标***资源确定第二资源配置策略,第二资源配置策略指下调第二目标***资源性能的策略。Step 811: The operating system determines a second resource allocation policy according to the second target system resource. The second resource allocation policy refers to a policy for lowering the performance of the second target system resource.
确定出可以下调的***资源后,操作***进一步制定出用于下调第二目标***资源性能的第二资源配置策略。After determining the system resources that can be downgraded, the operating system further formulates a second resource allocation strategy for downgrading the resource performance of the second target system.
可选的,操作***确定出的第二资源配置策略中还包括***资源下调量。Optionally, the second resource allocation policy determined by the operating system further includes a system resource reduction amount.
针对***资源下调量的确定方式,在一种可能的实施方式中,操作***中存储有第二运行指标对应的第二***资源性能指标,当目标应用程序当前的应用运行参数优于到第二运行指标时,操作***即根据当前***资源性能和第二***资源性能指标确定***资源下调量,使得下调后***资源性能等于第二***资源性能指标For the determination method of the system resource reduction amount, in a possible implementation manner, the operating system stores a second system resource performance indicator corresponding to the second operating indicator. When the current application operating parameter of the target application is better than the second operating indicator, When the indicator is run, the operating system determines the system resource reduction amount according to the current system resource performance and the second system resource performance indicator, so that the system resource performance after the reduction is equal to the second system resource performance indicator
示意性的,结合步骤810中的示例,操作***确定出的第二资源配置策略为:关闭1个GPU核心。Illustratively, in combination with the example in step 810, the second resource allocation policy determined by the operating system is: shut down one GPU core.
步骤812,操作***根据第二资源配置策略为目标应用程序分配***资源。Step 812: The operating system allocates system resources for the target application according to the second resource configuration policy.
进一步的,操作***根据确定出的第二资源配置策略为目标应用程序分配***资源,从而通过优化***资源配置的方式,降低部分不影响运行质量的***资源的性能,达到了降低终端功耗的效果。Further, the operating system allocates system resources to the target application according to the determined second resource allocation strategy, thereby reducing the performance of some system resources that do not affect the running quality by optimizing the system resource allocation, thereby achieving a reduction in terminal power consumption. effect.
本实施例中,操作***通过确定与应用运行质量无关的运行指标,并针对该运行指标制定相应的***资源性能下调策略,在保证应用程序运行质量的同时,进一步降低终端的功耗。In this embodiment, the operating system determines an operation index that has nothing to do with the running quality of the application, and formulates a corresponding system resource performance reduction strategy for the running index, while ensuring the running quality of the application, and further reducing the power consumption of the terminal.
由于终端中可能安装并运行有多个内嵌binder通讯模块的应用程序,且操作***可能同时与多个应用程序建立连接。为了保证前台应用程序的运行质量,在一种可能的实施方式中,在图8的基础上,如图10所示,步骤803之后还包括步骤813。Because multiple applications with a built-in binder communication module may be installed and running in the terminal, and the operating system may establish connections with multiple applications at the same time. To ensure the running quality of the foreground application, in a possible implementation manner, based on FIG. 8, as shown in FIG. 10, step 803 is further included after step 803.
步骤813,操作***获取前台应用的前台应用标识。Step 813: The operating system obtains a foreground application identifier of the foreground application.
在一种可能的实现方式中,如图4所示,应用框架层250与接口通信***242之间建立有Binder连接,操作***即从应用框架层250处获取前景应用信息,该前景应用信息中即包含前台应用标识。In a possible implementation manner, as shown in FIG. 4, a Binder connection is established between the application framework layer 250 and the interface communication system 242, and the operating system obtains foreground application information from the application framework layer 250. Contains the foreground application ID.
步骤814,操作***检测目标应用程序的应用标识与前台应用标识是否一致。Step 814: The operating system detects whether the application identifier of the target application is consistent with the foreground application identifier.
获取到前台应用标识后,操作***即检测目标应用程序的应用标识与前台应用标识是否一致,若两者一致,则确定发送应用运行信息的目标应用程序正在前台运行,从而执行步骤804;若两者不一致,则确定发送应用运行信息的目标应用程序在后台运行,并执行步骤815。After the foreground application identification is obtained, the operating system detects whether the application identification of the target application is consistent with the foreground application identification. If they are the same, it is determined that the target application sending the application running information is running in the foreground, and then step 804 is performed; If they are not consistent, it is determined that the target application that sends the application running information is running in the background, and step 815 is performed.
步骤815,若目标应用程序的应用标识与前台应用标识不一致,操作***则不响应应用运行信息。Step 815: If the application identifier of the target application is not consistent with the foreground application identifier, the operating system does not respond to the application running information.
当目标应用程序未在前台运行,操作***则不响应目标应用程序发送的应用运行信息(继续维持与目标应用程序之间的连接),并优先响应前台应用程序发送的应用运行信息。When the target application is not running in the foreground, the operating system does not respond to the application running information sent by the target application (continues to maintain the connection with the target application) and prioritizes the application running information sent by the foreground application.
进一步的,当运行在前台的目标应用程序切换至后台时,操作***执行步骤816。Further, when the target application running in the foreground is switched to the background, the operating system executes step 816.
步骤816,当由前台运行切换至后台运行时,目标应用程序停止通过binder连接向操作***发送应用运行信息。In step 816, when switching from the foreground running to the background running, the target application stops sending application running information to the operating system through the binder connection.
可选的,为了避免长时间占用与操作***之间的数据通道,目标应用程序由前台运行切换至后台运行时,自动停止向操作***发送应用运行信息,并维持与操作***之间的连接。Optionally, in order to avoid occupying a data channel with the operating system for a long time, when the target application program is switched from the foreground operation to the background operation, the application program automatically stops sending application operation information to the operating system, and the connection with the operating system is maintained.
本实施例中,操作***中增加了前台应用检测机制,实现仅为前台运行的目标应用程序提供***资源配置优化服务。In this embodiment, a foreground application detection mechanism is added to the operating system, so that only a target application program running in the foreground is provided with a system resource configuration optimization service.
请参考图11,其示出了本申请一个实施例提供的资源配置装置的结构框图。该资源配置装置可以通过软件、硬件或者两者的结合实现成为终端的全部或一部分。该装置包括:目标应用程序模块1110和操作***模块1120。Please refer to FIG. 11, which is a structural block diagram of a resource configuration apparatus according to an embodiment of the present application. The resource configuration device can be implemented as all or part of a terminal through software, hardware, or a combination of both. The device includes a target application program module 1110 and an operating system module 1120.
目标应用程序模块1110,用于通过与所述操作***之间的粘合binder连接,向所述操作***发送应用运行信息,所述应用运行信息用于表征所述目标应用程序所处的运行状态;A target application program module 1110 is configured to send application running information to the operating system through an adhesive binder connection with the operating system, where the application running information is used to characterize a running state where the target application is located. ;
操作***模块1120,用于接收所述应用运行信息;An operating system module 1120, configured to receive the application running information;
所述操作***模块1120,用于根据所述应用运行信息确定资源配置策略,所述资源配置策略指为所述运行状态下所述目标应用程序分配***资源的策略;The operating system module 1120 is configured to determine a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
所述操作***模块1120,用于根据所述资源配置策略为所述目标应用程序分配***资源。The operating system module 1120 is configured to allocate system resources to the target application according to the resource configuration policy.
可选的,目标应用程序模块1110。用于:Optionally, the target application program module 1110. Used for:
调用binder接口函数与所述操作***的binder接口建立所述binder连接,所述binder接口函数由所述操作***的开发者提供;Calling a binder interface function to establish the binder connection with a binder interface of the operating system, and the binder interface function is provided by a developer of the operating system;
若当前应用场景为预设应用场景,则获取所述预设应用场景对应的应用场景标识,并采集当前应用场景下的应用运行参数;If the current application scenario is a preset application scenario, obtaining an application scenario identifier corresponding to the preset application scenario, and collecting application running parameters in the current application scenario;
通过所述binder连接,向所述操作***发送包含所述应用场景标识和所述应用运行参数的所述应用运行信息。Sending the application running information including the application scenario identifier and the application running parameter to the operating system through the binder connection.
可选的,操作***模块1120,用于:Optionally, the operating system module 1120 is used to:
确定所述应用场景标识对应的第一运行指标,所述第一运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量相关的指标;Determining a first operating indicator corresponding to the application scenario identifier, where the first operating indicator is an indicator related to application running quality in an application scenario corresponding to the application scenario identifier;
若所述应用运行参数未达到所述第一运行指标,确定所述第一运行指标对应的第一目标***资源;If the application operating parameter does not reach the first operating index, determining a first target system resource corresponding to the first operating index;
根据所述第一目标***资源确定第一资源配置策略,所述第一资源配置策略指上调第一目标***资源性能的策略。A first resource allocation policy is determined according to the first target system resource, and the first resource allocation policy refers to a policy for increasing the performance of the first target system resource.
可选的,当所述第一运行指标为帧率指标时,所述第一目标***资源包括中央处理器CPU资源和图形处理器GPU资源中的至少一种;Optionally, when the first operation indicator is a frame rate indicator, the first target system resource includes at least one of a CPU resource of a central processing unit and a GPU resource of a graphics processor;
当所述第一运行指标为加载速度指标时,所述第一目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the first running indicator is a loading speed indicator, the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
当所述第一运行指标为丢帧率指标时,所述第一目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the first operation indicator is a frame loss rate indicator, the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
当所述第一运行指标为下载速率指标或网络延迟指标时,所述第一目标***资源至少包括网络资源。When the first operation indicator is a download rate indicator or a network delay indicator, the first target system resource includes at least network resources.
可选的,操作***模块1120,用于:Optionally, the operating system module 1120 is used to:
确定所述应用场景标识对应的第二运行指标,所述第二运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量无关的指标;Determining a second operating indicator corresponding to the application scenario identifier, where the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier;
若所述应用运行参数优于所述第二运行指标,确定所述第二运行指标对应的第二目标***资源;If the application operating parameter is better than the second operating indicator, determining a second target system resource corresponding to the second operating indicator;
根据所述第二目标***资源确定第二资源配置策略,所述第二资源配置策略指下调第二目标***资源性能的策略。A second resource configuration policy is determined according to the second target system resource, and the second resource configuration policy refers to a policy for lowering the performance of the second target system resource.
可选的,当所述第二运行指标为帧率指标时,所述第二目标***资源包括中央处理器CPU资源和图形处理器GPU资源中的至少一种;Optionally, when the second operation indicator is a frame rate indicator, the second target system resource includes at least one of a central processing unit CPU resource and a graphics processor GPU resource;
当所述第二运行指标为加载速度指标时,所述第二目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the second running indicator is a loading speed indicator, the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
当所述第二运行指标为丢帧率指标时,所述第二目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the second operating indicator is a frame loss rate indicator, the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
当所述第二运行指标为下载速率指标或网络延迟指标时,所述第二目标***资源至少包括网络资源。When the second operation indicator is a download rate indicator or a network delay indicator, the second target system resource includes at least network resources.
可选的,操作***模块1120,用于:Optionally, the operating system module 1120 is used to:
获取前台应用的前台应用标识;Get the foreground application ID of the foreground application;
若所述目标应用程序的应用标识与所述前台应用标识一致,则执行所述根据所述应用运行信息确定资源配置策略的步骤;If the application identifier of the target application is consistent with the foreground application identifier, performing the step of determining a resource allocation policy according to the application running information;
若所述目标应用程序的应用标识与所述前台应用标识不一致,则不响应所述应用运行信息。If the application identifier of the target application is inconsistent with the foreground application identifier, the application operation information is not responded.
可选的,操作***模块1120,用于:Optionally, the operating system module 1120 is used to:
获取所述目标应用程序的应用标识;Obtaining an application identifier of the target application;
若所述目标应用程序的应用标识属于预设应用标识列表,则执行所述根据所述应用运行信息确定资源配置策略的步骤,所述预设应用标识列表中包含支持进行资源配置的应用程序的应用标识;If the application identifier of the target application belongs to a preset application identifier list, executing the step of determining a resource allocation policy according to the application running information, where the preset application identifier list includes an application that supports resource configuration Application identification
若所述目标应用程序的应用标识不属于预设应用标识列表,则不响应所述应用运行信息。If the application identifier of the target application does not belong to the preset application identifier list, it does not respond to the application running information.
可选的,目标应用程序模块1110,用于:Optionally, the target application program module 1110 is used for:
当由前台运行切换至后台运行时,停止通过所述binder连接向所述操作***发送所述应用运行信息。When switching from foreground running to background running, stop sending the application running information to the operating system through the binder connection.
可选的,操作***模块1120,用于当接收到所述目标应用程序的进程结束信号时,清理与所述目标应用程序之间的binder连接。Optionally, the operating system module 1120 is configured to clear a binder connection with the target application program when a process end signal of the target application program is received.
综上所述,本申请实施例提供的资源配置装置中,目标应用程序通过预先与操作***建立binder连接,使得目标应用程序能够通过该Sbinder连接,向操作***发送自身的应用运行信息,以便操作***基于应用运行信息制定相应的资源配置策略,从而根据该资源配置策略为目标应用程序分配相应的***资源;相较于单纯提升终端的硬件性能,本实施例中的操作***可以针对应用程序所处的运行状态,针对性地为其分配相应***资源,使得应用程序在不同运行状态下均能够达到良好的运行效果,并降低对终端硬件的依赖。In summary, in the resource configuration device provided in the embodiment of the present application, the target application program establishes a binder connection with the operating system in advance, so that the target application program can send its own application running information to the operating system through the Sbinder connection for operation. The system formulates the corresponding resource allocation strategy based on the application running information, so as to allocate the corresponding system resources to the target application according to the resource allocation strategy. Compared to simply improving the hardware performance of the terminal, the operating system in this embodiment can At the operating state of the system, corresponding system resources are allocated to it, so that the application can achieve good operating results in different operating states, and reduce dependence on terminal hardware.
另外,操作***基于预设应用标识列表实现应用程序合法性检测,从而避免与内嵌SDK的非法应用程序进行通信,提高了操作***的安全性。In addition, the operating system implements application legitimacy detection based on a preset application identification list, thereby avoiding communication with illegal applications embedded with the SDK, and improving the security of the operating system.
本实施例中,当运行至预设应用场景时,目标应用程序向操作***发送包含应用场景标识和应用运行参数的应用运行信息,以便操作***根据该应用运行参数,确定目标应用程序的当前应用场景下的运行质量;同时,在运行质量不佳的情况下,操作***能够基于与该应用场景相关的***资源制定资源配置策略,从而根据资源配置策略对***资源进行优化,进而达到优化该应用场景下目标应用程序运行质量的效果。In this embodiment, when running to a preset application scenario, the target application program sends application operation information including the application scenario identifier and the application operation parameter to the operating system, so that the operating system determines the current application of the target application program according to the application operation parameter. Operating quality in scenarios; At the same time, in the case of poor operating quality, the operating system can formulate resource allocation policies based on system resources related to the application scenario, thereby optimizing system resources according to the resource allocation policies, and then optimizing the application The effect of the target application running quality in the scene.
本实施例中,操作***通过确定与应用运行质量无关的运行指标,并针对该运行指标制定相应的***资源性能下调策略,在保证应用程序运行质量的同时,进一步降低终端的功耗。In this embodiment, the operating system determines an operation index that has nothing to do with the running quality of the application, and formulates a corresponding system resource performance reduction strategy for the running index, while ensuring the running quality of the application, and further reducing the power consumption of the terminal.
本实施例中,操作***中增加了通前台应用检测机制,实现仅为前台运行的目标应用程序提供***资源配置优化服务。In this embodiment, a foreground application detection mechanism is added to the operating system, so that only a target application program running in the foreground is provided with a system resource configuration optimization service.
本申请实施例还提供了一种计算机可读介质,该计算机可读介质存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现如上各个实施例所述的资源配置方法。An embodiment of the present application further provides a computer-readable medium. The computer-readable medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the resource configuration method according to the foregoing embodiments. .
本申请实施例还提供了一种计算机程序产品,该计算机程序产品存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现如上各个实施例所述的资源配置方法。An embodiment of the present application further provides a computer program product. The computer program product stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the resource allocation method according to the foregoing embodiments.
本领域技术人员应该可以意识到,在上述一个或多个示例中,本申请实施例所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application may be implemented by hardware, software, firmware, or any combination thereof. When implemented in software, these functions may be stored in or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present application shall be included in the protection of the present application. Within range.

Claims (22)

  1. 一种资源配置方法,所述方法应用于终端,所述终端运行有操作***和至少一个应用程序,所述方法包括:A resource configuration method, the method is applied to a terminal, the terminal runs an operating system and at least one application program, and the method includes:
    目标应用程序通过与所述操作***之间的粘合binder连接,向所述操作***发送应用运行信息,所述应用运行信息用于表征所述目标应用程序所处的运行状态;The target application program sends application running information to the operating system through a binder connection with the operating system, where the application running information is used to characterize the running state of the target application program;
    所述操作***接收所述应用运行信息;The operating system receives the application running information;
    所述操作***根据所述应用运行信息确定资源配置策略,所述资源配置策略指为所述运行状态下所述目标应用程序分配***资源的策略;Determining, by the operating system, a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
    所述操作***根据所述资源配置策略为所述目标应用程序分配***资源。The operating system allocates system resources to the target application according to the resource configuration policy.
  2. 根据权利要求1所述的方法,其中,所述目标应用程序通过与所述操作***之间的binder连接,向所述操作***发送应用运行信息,包括:The method according to claim 1, wherein the target application program sends application running information to the operating system through a binder connection with the operating system, comprising:
    所述目标应用程序调用binder接口函数与所述操作***的binder接口建立所述binder连接,所述binder接口函数由所述操作***的开发者提供;The target application program calls a binder interface function to establish the binder connection with a binder interface of the operating system, and the binder interface function is provided by a developer of the operating system;
    若当前应用场景为预设应用场景,所述目标应用程序则获取所述预设应用场景对应的应用场景标识,并采集当前应用场景下的应用运行参数;If the current application scenario is a preset application scenario, the target application obtains an application scenario identifier corresponding to the preset application scenario, and collects application running parameters in the current application scenario;
    所述目标应用程序通过所述binder连接,向所述操作***发送包含所述应用场景标识和所述应用运行参数的所述应用运行信息。The target application program sends the application running information including the application scenario identifier and the application running parameter to the operating system through the binder connection.
  3. 根据权利要求2所述的方法,其中,所述操作***根据所述应用运行信息确定资源配置策略,包括:The method according to claim 2, wherein the operating system determining the resource allocation policy according to the application running information comprises:
    所述操作***确定所述应用场景标识对应的第一运行指标,所述第一运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量相关的指标;Determining, by the operating system, a first operating indicator corresponding to the application scenario identifier, where the first operating indicator is an indicator related to application running quality in an application scenario corresponding to the application scenario identifier;
    若所述应用运行参数未达到所述第一运行指标,所述操作***确定所述第一运行指标对应的第一目标***资源;If the application operating parameter does not reach the first operating index, the operating system determines a first target system resource corresponding to the first operating index;
    所述操作***根据所述第一目标***资源确定第一资源配置策略,所述第一资源配置策略指上调第一目标***资源性能的策略。The operating system determines a first resource configuration policy according to the first target system resource, and the first resource configuration policy refers to a policy for increasing the performance of the first target system resource.
  4. 根据权利要求3所述的方法,其中,The method according to claim 3, wherein:
    当所述第一运行指标为帧率指标时,所述第一目标***资源包括中央处理器CPU资源和图形处理器GPU资源中的至少一种;When the first operation indicator is a frame rate indicator, the first target system resource includes at least one of a central processing unit CPU resource and a graphics processor GPU resource;
    当所述第一运行指标为加载速度指标时,所述第一目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the first running indicator is a loading speed indicator, the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
    当所述第一运行指标为丢帧率指标时,所述第一目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the first operation indicator is a frame loss rate indicator, the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
    当所述第一运行指标为下载速率指标或网络延迟指标时,所述第一目标***资源至少包括网络资源。When the first operation indicator is a download rate indicator or a network delay indicator, the first target system resource includes at least network resources.
  5. 根据权利要求2所述的方法,其中,所述操作***根据所述应用运行信息确定资源配置策略,包括:The method according to claim 2, wherein the operating system determining the resource allocation policy according to the application running information comprises:
    所述操作***确定所述应用场景标识对应的第二运行指标,所述第二运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量无关的指标;Determining, by the operating system, a second operating indicator corresponding to the application scenario identifier, where the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier;
    若所述应用运行参数优于所述第二运行指标,所述操作***确定所述第二运行指标对应的第二目标***资源;If the application operating parameter is better than the second operating indicator, the operating system determines a second target system resource corresponding to the second operating indicator;
    所述操作***根据所述第二目标***资源确定第二资源配置策略,所述第二资源配置策 略指下调第二目标***资源性能的策略。The operating system determines a second resource allocation policy according to the second target system resource, and the second resource allocation policy refers to a policy for lowering the resource performance of the second target system.
  6. 根据权利要求5所述的方法,其中,The method according to claim 5, wherein:
    当所述第二运行指标为帧率指标时,所述第二目标***资源包括CPU资源和GPU资源中的至少一种;When the second operation indicator is a frame rate indicator, the second target system resource includes at least one of a CPU resource and a GPU resource;
    当所述第二运行指标为加载速度指标时,所述第二目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the second running indicator is a loading speed indicator, the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
    当所述第二运行指标为丢帧率指标时,所述第二目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the second operating indicator is a frame loss rate indicator, the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
    当所述第二运行指标为下载速率指标或网络延迟指标时,所述第二目标***资源至少包括网络资源。When the second operation indicator is a download rate indicator or a network delay indicator, the second target system resource includes at least network resources.
  7. 根据权利要求1至6任一所述的方法,其中,所述操作***接收所述应用运行信息之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein after the operating system receives the application running information, the method further comprises:
    所述操作***获取前台应用的前台应用标识;Obtaining, by the operating system, a foreground application identifier of a foreground application;
    若所述目标应用程序的应用标识与所述前台应用标识一致,所述操作***则执行所述根据所述应用运行信息确定资源配置策略的步骤;If the application identifier of the target application is consistent with the foreground application identifier, the operating system executes the step of determining a resource allocation policy according to the application running information;
    若所述目标应用程序的应用标识与所述前台应用标识不一致,所述操作***则不响应所述应用运行信息。If the application identifier of the target application is inconsistent with the foreground application identifier, the operating system does not respond to the application running information.
  8. 根据权利要求1至6任一所述的方法,其中,所述操作***接收所述应用运行信息之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein after the operating system receives the application running information, the method further comprises:
    所述操作***获取所述目标应用程序的应用标识;Obtaining, by the operating system, an application identifier of the target application;
    若所述目标应用程序的应用标识属于预设应用标识列表,所述操作***则执行所述根据所述应用运行信息确定资源配置策略的步骤,所述预设应用标识列表中包含支持进行资源配置的应用程序的应用标识;If the application identifier of the target application belongs to a preset application identifier list, the operating system executes the step of determining a resource allocation policy according to the application running information, and the preset application identifier list includes support for resource configuration Application ID of the application;
    若所述目标应用程序的应用标识不属于预设应用标识列表,所述操作***则不响应所述应用运行信息。If the application identifier of the target application does not belong to the preset application identifier list, the operating system does not respond to the application running information.
  9. 根据权利要求1至6任一所述的方法,其中,所述目标应用程序通过与所述操作***之间的binder连接,向所述操作***发送应用运行信息之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein after the target application program sends application running information to the operating system through a binder connection with the operating system, the method further comprises:
    当由前台运行切换至后台运行时,所述目标应用程序停止通过所述binder连接向所述操作***发送所述应用运行信息。When switching from running in the foreground to running in the background, the target application stops sending the application running information to the operating system through the binder connection.
  10. 根据权利要求1至6任一所述的方法,其中,所述操作***根据所述资源配置策略为所述目标应用程序分配***资源之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein after the operating system allocates system resources to the target application according to the resource configuration policy, the method further comprises:
    当接收到所述目标应用程序的进程结束信号时,所述操作***清理与所述目标应用程序之间的所述binder连接。When the process end signal of the target application is received, the operating system cleans up the binder connection with the target application.
  11. 一种资源配置装置,所述装置应用于终端,所述终端运行有操作***和至少一个应用程序,所述装置包括:A device for resource allocation, the device is applied to a terminal, the terminal runs an operating system and at least one application program, and the device includes:
    目标应用程序模块,用于通过与所述操作***之间的粘合binder连接,向所述操作***发送应用运行信息,所述应用运行信息用于表征所述目标应用程序所处的运行状态;A target application program module, configured to send application running information to the operating system through an adhesive binder connection with the operating system, where the application running information is used to characterize a running state where the target application is located;
    操作***模块,用于接收所述应用运行信息;An operating system module, configured to receive the application running information;
    所述操作***模块,用于根据所述应用运行信息确定资源配置策略,所述资源配置策略指为所述运行状态下所述目标应用程序分配***资源的策略;The operating system module is configured to determine a resource allocation policy according to the application running information, where the resource allocation policy refers to a policy for allocating system resources to the target application in the running state;
    所述操作***模块,用于根据所述资源配置策略为所述目标应用程序分配***资源。The operating system module is configured to allocate system resources to the target application according to the resource configuration policy.
  12. 根据权利要求11所述的装置,其中,The apparatus according to claim 11, wherein:
    所述目标应用程序模块,用于调用binder接口函数与所述操作***的binder接口建立所述binder连接,所述binder接口函数由所述操作***的开发者提供;The target application program module is configured to call a binder interface function to establish the binder connection with a binder interface of the operating system, and the binder interface function is provided by a developer of the operating system;
    所述目标应用程序模块,用于若当前应用场景为预设应用场景,则获取所述预设应用场景对应的应用场景标识,并采集当前应用场景下的应用运行参数;The target application program module is configured to obtain an application scenario identifier corresponding to the preset application scenario if the current application scenario is a preset application scenario, and collect application running parameters in the current application scenario;
    所述目标应用程序模块,用于通过所述binder连接,向所述操作***发送包含所述应用场景标识和所述应用运行参数的所述应用运行信息。The target application program module is configured to send the application running information including the application scenario identifier and the application running parameter to the operating system through the binder connection.
  13. 根据权利要求12所述的装置,其中,The apparatus according to claim 12, wherein:
    所述操作***模块,用于确定所述应用场景标识对应的第一运行指标,所述第一运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量相关的指标;The operating system module is configured to determine a first operating indicator corresponding to the application scenario identifier, where the first operating indicator is an indicator related to application running quality in an application scenario corresponding to the application scenario identifier;
    所述操作***模块,用于若所述应用运行参数未达到所述第一运行指标,确定所述第一运行指标对应的第一目标***资源;The operating system module is configured to determine a first target system resource corresponding to the first operating indicator if the application operating parameter does not reach the first operating indicator;
    所述操作***模块,用于根据所述第一目标***资源确定第一资源配置策略,所述第一资源配置策略指上调第一目标***资源性能的策略。The operating system module is configured to determine a first resource configuration policy according to the first target system resource, where the first resource configuration policy refers to a policy for increasing the performance of the first target system resource.
  14. 根据权利要求13所述的装置,其中,The apparatus according to claim 13, wherein:
    当所述第一运行指标为帧率指标时,所述第一目标***资源包括中央处理器CPU资源和图形处理器GPU资源中的至少一种;When the first operation indicator is a frame rate indicator, the first target system resource includes at least one of a central processing unit CPU resource and a graphics processor GPU resource;
    当所述第一运行指标为加载速度指标时,所述第一目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the first running indicator is a loading speed indicator, the first target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
    当所述第一运行指标为丢帧率指标时,所述第一目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the first operation indicator is a frame loss rate indicator, the first target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
    当所述第一运行指标为下载速率指标或网络延迟指标时,所述第一目标***资源至少包括网络资源。When the first operation indicator is a download rate indicator or a network delay indicator, the first target system resource includes at least network resources.
  15. 根据权利要求12所述的装置,其中,The apparatus according to claim 12, wherein:
    所述操作***模块,用于确定所述应用场景标识对应的第二运行指标,所述第二运行指标是在所述应用场景标识对应的应用场景下,与应用运行质量无关的指标;The operating system module is configured to determine a second operating indicator corresponding to the application scenario identifier, where the second operating indicator is an indicator that has nothing to do with application running quality in the application scenario corresponding to the application scenario identifier;
    所述操作***模块,用于若所述应用运行参数优于所述第二运行指标,确定所述第二运行指标对应的第二目标***资源;The operating system module is configured to determine a second target system resource corresponding to the second operating indicator if the application operating parameter is better than the second operating indicator;
    所述操作***模块,用于根据所述第二目标***资源确定第二资源配置策略,所述第二资源配置策略指下调第二目标***资源性能的策略。The operating system module is configured to determine a second resource configuration policy according to the second target system resource, where the second resource configuration policy refers to a policy for lowering the performance of the second target system resource.
  16. 根据权利要求15所述的装置,其中,The apparatus according to claim 15, wherein:
    当所述第二运行指标为帧率指标时,所述第二目标***资源包括CPU资源和GPU资源中的至少一种;When the second operation indicator is a frame rate indicator, the second target system resource includes at least one of a CPU resource and a GPU resource;
    当所述第二运行指标为加载速度指标时,所述第二目标***资源包括CPU资源、磁盘资源和内存资源中的至少一种;When the second running indicator is a loading speed indicator, the second target system resource includes at least one of a CPU resource, a disk resource, and a memory resource;
    当所述第二运行指标为丢帧率指标时,所述第二目标***资源包括CPU资源、GPU资源和网络资源中的至少一种;When the second operating indicator is a frame loss rate indicator, the second target system resource includes at least one of a CPU resource, a GPU resource, and a network resource;
    当所述第二运行指标为下载速率指标或网络延迟指标时,所述第二目标***资源至少包括网络资源。When the second operation indicator is a download rate indicator or a network delay indicator, the second target system resource includes at least network resources.
  17. 根据权利要求11至16任一所述的装置,其中,The device according to any one of claims 11 to 16, wherein:
    所述操作***模块,用于获取前台应用的前台应用标识;The operating system module is configured to obtain a foreground application identifier of the foreground application;
    所述操作***模块,用于若所述目标应用程序的应用标识与所述前台应用标识一致,则执行所述根据所述应用运行信息确定资源配置策略的步骤;The operating system module is configured to execute the step of determining a resource allocation policy according to the application running information if the application identifier of the target application is consistent with the foreground application identifier;
    所述操作***模块,用于若所述目标应用程序的应用标识与所述前台应用标识不一致,则不响应所述应用运行信息。The operating system module is configured to not respond to the application running information if the application identifier of the target application is inconsistent with the foreground application identifier.
  18. 根据权利要求11至16任一所述的装置,其中,The device according to any one of claims 11 to 16, wherein:
    所述操作***模块,用于获取所述目标应用程序的应用标识;The operating system module is configured to obtain an application identifier of the target application program;
    所述操作***模块,用于若所述目标应用程序的应用标识属于预设应用标识列表,则执行所述根据所述应用运行信息确定资源配置策略的步骤,所述预设应用标识列表中包含支持进行资源配置的应用程序的应用标识;The operating system module is configured to execute the step of determining a resource allocation policy according to the application running information if an application identifier of the target application program belongs to a preset application identifier list, and the preset application identifier list includes Application identification of applications that support resource configuration;
    所述操作***模块,用于若所述目标应用程序的应用标识不属于预设应用标识列表,则不响应所述应用运行信息。The operating system module is configured to not respond to the application running information if the application identifier of the target application does not belong to a preset application identifier list.
  19. 根据权利要求11至16任一所述的装置,其中,The device according to any one of claims 11 to 16, wherein:
    所述目标应用程序模块,还用于当由前台运行切换至后台运行时,停止通过所述binder连接向所述操作***发送所述应用运行信息。The target application program module is further configured to stop sending the application running information to the operating system through the binder connection when switching from the foreground running to the background running.
  20. 根据权利要求11至16任一所述的装置,其中,The device according to any one of claims 11 to 16, wherein:
    所述操作***模块,还用于当接收到所述目标应用程序的进程结束信号时,清理与所述目标应用程序之间的所述binder连接。The operating system module is further configured to clear the binder connection with the target application program when a process end signal of the target application program is received.
  21. 一种终端,所述终端包括处理器和存储器;所述存储器存储有至少一条指令,所述至少一条指令用于被所述处理器执行以实现如权利要求1至10任一所述的资源配置方法。A terminal, wherein the terminal includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used by the processor to implement the resource configuration according to any one of claims 1 to 10. method.
  22. 一种计算机可读存储介质,所述存储介质存储有至少一条指令,所述至少一条指令用于被处理器执行以实现如权利要求1至10任一所述的资源配置方法。A computer-readable storage medium stores at least one instruction, and the at least one instruction is used for execution by a processor to implement the resource allocation method according to any one of claims 1 to 10.
PCT/CN2019/088791 2018-05-30 2019-05-28 Resource configuration method and apparatus, and terminal and storage medium WO2019228344A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810538187.9A CN109542614B (en) 2018-05-30 2018-05-30 Resource allocation method, device, terminal and storage medium
CN201810538187.9 2018-05-30

Publications (1)

Publication Number Publication Date
WO2019228344A1 true WO2019228344A1 (en) 2019-12-05

Family

ID=65830908

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/088791 WO2019228344A1 (en) 2018-05-30 2019-05-28 Resource configuration method and apparatus, and terminal and storage medium

Country Status (2)

Country Link
CN (1) CN109542614B (en)
WO (1) WO2019228344A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256295A (en) * 2020-09-21 2021-01-22 北京达佳互联信息技术有限公司 Application program updating method, device, equipment and storage medium
CN112596820A (en) * 2020-12-30 2021-04-02 北京达佳互联信息技术有限公司 Resource loading method, device, equipment and storage medium
CN115842653A (en) * 2022-11-03 2023-03-24 支付宝(杭州)信息技术有限公司 Information exchange method, device, equipment and computer storage medium
CN113032278B (en) * 2021-04-19 2023-09-26 上海哔哩哔哩科技有限公司 Application running mode, and method and device for confirming grade of terminal equipment

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542614B (en) * 2018-05-30 2023-06-23 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium
CN110399213B (en) * 2019-05-21 2024-05-10 腾讯科技(深圳)有限公司 Method, device, electronic equipment and medium for determining resource demand of application program
CN110795323A (en) * 2019-10-29 2020-02-14 Oppo广东移动通信有限公司 Load statistical method, device, storage medium and electronic equipment
CN113051465A (en) * 2019-12-27 2021-06-29 Oppo广东移动通信有限公司 Push method and device for optimization strategy, server and storage medium
CN112380012A (en) * 2020-11-16 2021-02-19 Oppo(重庆)智能科技有限公司 Resource adjusting method and device, terminal equipment and storage medium
CN117112187A (en) * 2022-05-16 2023-11-24 荣耀终端有限公司 Resource scheduling method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110161974A1 (en) * 2009-12-28 2011-06-30 Empire Technology Development Llc Methods and Apparatus for Parallelizing Heterogeneous Network Communication in Smart Devices
CN104239814A (en) * 2014-09-17 2014-12-24 上海斐讯数据通信技术有限公司 Mobile office safety method and mobile office safety system
CN107483725A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107832142A (en) * 2017-10-11 2018-03-23 广东欧珀移动通信有限公司 The resource allocation method and equipment of application program
CN109542614A (en) * 2018-05-30 2019-03-29 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5640595A (en) * 1993-06-29 1997-06-17 International Business Machines Corporation Multimedia resource reservation system with graphical interface for manual input of resource reservation value
CN107426432B (en) * 2017-07-31 2019-09-17 Oppo广东移动通信有限公司 Resource allocation method and Related product
CN107515787A (en) * 2017-08-31 2017-12-26 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107577533B (en) * 2017-08-31 2020-12-15 Oppo广东移动通信有限公司 Resource allocation method and related product
CN107528977B (en) * 2017-08-31 2020-07-07 Oppo广东移动通信有限公司 Resource allocation method and related product

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110161974A1 (en) * 2009-12-28 2011-06-30 Empire Technology Development Llc Methods and Apparatus for Parallelizing Heterogeneous Network Communication in Smart Devices
CN104239814A (en) * 2014-09-17 2014-12-24 上海斐讯数据通信技术有限公司 Mobile office safety method and mobile office safety system
CN107483725A (en) * 2017-07-31 2017-12-15 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107832142A (en) * 2017-10-11 2018-03-23 广东欧珀移动通信有限公司 The resource allocation method and equipment of application program
CN109542614A (en) * 2018-05-30 2019-03-29 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256295A (en) * 2020-09-21 2021-01-22 北京达佳互联信息技术有限公司 Application program updating method, device, equipment and storage medium
CN112596820A (en) * 2020-12-30 2021-04-02 北京达佳互联信息技术有限公司 Resource loading method, device, equipment and storage medium
CN113032278B (en) * 2021-04-19 2023-09-26 上海哔哩哔哩科技有限公司 Application running mode, and method and device for confirming grade of terminal equipment
CN115842653A (en) * 2022-11-03 2023-03-24 支付宝(杭州)信息技术有限公司 Information exchange method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
CN109542614A (en) 2019-03-29
CN109542614B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
WO2019228344A1 (en) Resource configuration method and apparatus, and terminal and storage medium
CN111240837B (en) Resource allocation method, device, terminal and storage medium
WO2019228340A1 (en) Program optimization method and apparatus, terminal, and storage medium
CN107577533B (en) Resource allocation method and related product
CN107547746B (en) Resource allocation method and related product
US10819592B2 (en) Slice instance management method and apparatus
JP7100154B6 (en) Processor core scheduling method, device, terminal and storage medium
WO2020063008A1 (en) Resource configuration method and apparatus, terminal, and storage medium
WO2018103405A1 (en) Method for identifying access point and hotspot, and related product
WO2020063040A1 (en) Processor core configuration method and apparatus, terminal, and storage medium
WO2019047708A1 (en) Resource configuration method and related product
US20200258195A1 (en) Image Processing Method and Device
CN109379548B (en) Multimedia recording method, device, terminal and storage medium
WO2018049941A1 (en) Data migration method and related product
WO2021102748A1 (en) Method and apparatus for downloading application, mobile terminal and storage medium
WO2018145236A1 (en) Flow control method and device

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19811982

Country of ref document: EP

Kind code of ref document: A1