技术领域Technical Field
本申请涉及电子设备技术领域,特别涉及一种资源管控方法、装置、芯片、电子设备及介质。The present application relates to the technical field of electronic equipment, and in particular to a resource management method, device, chip, electronic equipment and medium.
背景技术Background technique
电子设备中可以运行一个或者多个任务,运行多个任务时,各个任务均可以竞争电子设备的资源。电子设备的资源有限,有必要提供一种资源管控方法。An electronic device can run one or more tasks. When multiple tasks are run, each task can compete for the resources of the electronic device. The resources of the electronic device are limited, so it is necessary to provide a resource management method.
发明内容Summary of the invention
本申请实施例提供了一种资源管控方法、装置、芯片、电子设备及介质,能够对任务所能占用的设备资源进行管控。The embodiments of the present application provide a resource management method, device, chip, electronic device and medium, which can manage the device resources that can be occupied by a task.
第一方面,本申请实施例提供一种资源管控方法,应用于电子设备,该方法包括:响应于第一操作,运行第一应用,其中,在第一应用的运行过程中运行有第一线程和第二线程,第一线程为用于响应对第一应用的使用操作的线程,第二线程为不用于响应对第一应用的使用操作的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。In a first aspect, an embodiment of the present application provides a resource management method, which is applied to an electronic device, the method comprising: in response to a first operation, running a first application, wherein a first thread and a second thread are running during the running of the first application, the first thread is a thread for responding to operations using the first application, and the second thread is a thread not for responding to operations using the first application; determining the occupation of device resources of the electronic device by the first thread as a first occupation, and determining the occupation of device resources of the electronic device by the second thread as a second occupation, wherein the first occupation is greater than the second occupation; allocating device resources of the electronic device to the first thread based on the first occupation, and allocating device resources of the electronic device to the second thread based on the second occupation.
第一线程可以是响应(或称能够响应)第一应用的使用操作的线程。第二线程可以是不响应第一应用的使用操作的线程。The first thread may be a thread that responds to (or is capable of responding to) a use operation of the first application, and the second thread may be a thread that does not respond to a use operation of the first application.
在应用程序、小程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键线程分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the running scenarios of applications and applets, compared with not performing resource control, the resource control method provided in this embodiment helps electronic devices respond to user operations in a timely manner by allocating more device resources to key threads, thereby helping to improve user experience.
可选地,第一应用为电子设备上安装的任一应用;第一线程包括用户界面线程、渲染线程、动画效果线程中的至少一种。Optionally, the first application is any application installed on the electronic device; the first thread includes at least one of a user interface thread, a rendering thread, and an animation effect thread.
可选地,第一应用为电子设备所加载的任一小程序;第一线程包括网页示图类的线程。Optionally, the first application is any small program loaded by the electronic device; the first thread includes a thread of the web page illustration class.
可选地,第二线程包括后台线程。Optionally, the second thread comprises a background thread.
第二方面,本申请实施例提供一种资源管控方法,应用于电子设备,该方法包括:响应于第一操作,加载第一小程序,其中,在加载第一小程序的过程中运行有第一线程和第二线程,第一线程为用于加载第一小程序的线程,第二线程为不用于加载第一小程序的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。In a second aspect, an embodiment of the present application provides a resource management method, which is applied to an electronic device, the method comprising: in response to a first operation, loading a first applet, wherein a first thread and a second thread are running in the process of loading the first applet, the first thread is a thread used to load the first applet, and the second thread is a thread not used to load the first applet; determining the occupation of device resources of the electronic device by the first thread as a first occupation, and determining the occupation of device resources of the electronic device by the second thread as a second occupation, wherein the first occupation is greater than the second occupation; allocating device resources of the electronic device to the first thread based on the first occupation, and allocating device resources of the electronic device to the second thread based on the second occupation.
第二线程可以是第一小程序中用于加载该第一小程序的线程之外的其他线程。The second thread may be another thread in the first applet other than the thread used to load the first applet.
在小程序的加载场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键线程分配更多的设备资源,有助于电子设备快速加载小程序,从而有助于提升用户体验。In the mini-program loading scenario, compared with not performing resource management, the resource management method provided in this embodiment helps electronic devices to quickly load mini-programs by allocating more device resources to key threads, thereby helping to improve user experience.
第三方面,本申请实施例提供一种资源管控方法,应用于电子设备,该方法包括:响应于第一操作,启动电子设备上安装的第一应用,其中,在启动第一应用的过程中运行有第一线程和第二线程,第一线程为用于启动第一应用的线程,第二线程为不用于启动第一应用的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。In a third aspect, an embodiment of the present application provides a resource management method, which is applied to an electronic device, the method comprising: in response to a first operation, starting a first application installed on the electronic device, wherein a first thread and a second thread are running in the process of starting the first application, the first thread is a thread used to start the first application, and the second thread is a thread not used to start the first application; determining the occupation of device resources of the electronic device by the first thread as a first occupation, and determining the occupation of device resources of the electronic device by the second thread as a second occupation, wherein the first occupation is greater than the second occupation; allocating device resources of the electronic device to the first thread based on the first occupation, and allocating device resources of the electronic device to the second thread based on the second occupation.
第二线程可以是第一应用中用于启动第一应用的线程之外的其他线程。The second thread may be another thread in the first application other than the thread used to start the first application.
在应用程序的启动场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时启动应用程序,从而有助于提升用户体验。In the application startup scenario, compared with not performing resource management, the resource management method provided in this embodiment helps the electronic device to start the application in a timely manner by allocating more device resources to key tasks, thereby helping to improve the user experience.
第四方面,本申请实施例提供一种资源管控方法,该方法包括:获取电子设备中的第一任务的第一信息,以及获取电子设备中的第二任务的第二信息,其中,第一信息用于描述第一任务的关键程度,第二信息用于描述第二任务的关键程度,第一任务的关键程度高于第二任务的关键程度;根据第一信息确定第一任务对电子设备的设备资源的第一占用量,以及根据第二信息确定第二任务对电子设备的设备资源的第二占用量,其中,第一占用量大于第二占用量;根据第一占用量向第一任务分配电子设备的设备资源,以及根据第二占用量向第二任务分配电子设备的设备资源。In a fourth aspect, an embodiment of the present application provides a resource management method, the method comprising: obtaining first information of a first task in an electronic device, and obtaining second information of a second task in the electronic device, wherein the first information is used to describe the criticality of the first task, and the second information is used to describe the criticality of the second task, and the criticality of the first task is higher than the criticality of the second task; determining a first occupancy of device resources of the electronic device by the first task based on the first information, and determining a second occupancy of device resources of the electronic device by the second task based on the second information, wherein the first occupancy is greater than the second occupancy; allocating device resources of the electronic device to the first task based on the first occupancy, and allocating device resources of the electronic device to the second task based on the second occupancy.
基于电子设备的有限资源,通过进行资源管控,以对不同任务所能占用的设备资源进行管控,来控制不同任务运行时对设备资源的使用。可以为关键任务分配更多的设备资源,为不关键任务分配更少的设备资源。如此可以避免出现关键任务存在较多的待运行状态的情况,可以提升关键任务的响应速率,提升用户对电子设备的使用体验。Based on the limited resources of electronic devices, resource management is performed to manage the device resources that can be occupied by different tasks, so as to control the use of device resources when different tasks are running. More device resources can be allocated to critical tasks, and fewer device resources can be allocated to non-critical tasks. This can avoid the situation where there are too many critical tasks in the waiting state, improve the response rate of critical tasks, and enhance the user experience of electronic devices.
可选地,在电子设备上安装的第一应用程序处于运行状态的情况下,第一任务包括用于响应第一操作的任务,第一操作为对第一应用程序的使用操作,第二任务包括不用于响应第一操作的任务。Optionally, when a first application installed on the electronic device is in operation, the first task includes a task for responding to a first operation, the first operation is an operation of using the first application, and the second task includes a task not for responding to the first operation.
在应用程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the application running scenario, compared with not performing resource management, the resource management method provided in this embodiment helps electronic devices respond to user operations in a timely manner by allocating more device resources to key tasks, thereby helping to improve user experience.
可选地,在电子设备加载第二应用程序的过程中,第一任务包括用于加载第二应用程序的任务,第二任务包括不用于加载第二应用程序的任务。Optionally, during the process of the electronic device loading the second application, the first task includes a task for loading the second application, and the second task includes a task not for loading the second application.
在小程序的加载场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备快速加载小程序,从而有助于提升用户体验。In the mini-program loading scenario, compared with not performing resource management, the resource management method provided in this embodiment helps electronic devices to quickly load mini-programs by allocating more device resources to key tasks, thereby helping to improve user experience.
可选地,在电子设备所加载的第三应用程序处于运行状态的情况下,第一任务包括用于响应第二操作的任务,第二操作为对第三应用程序的使用操作,第二任务包括不用于响应第二操作的任务。Optionally, when a third application loaded by the electronic device is in operation, the first task includes a task for responding to a second operation, the second operation is an operation of using the third application, and the second task includes a task not for responding to the second operation.
在小程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the running scenario of the mini program, compared with not performing resource management, the resource management method provided in this embodiment helps electronic devices respond to user operations in a timely manner by allocating more device resources to key tasks, thereby helping to improve user experience.
可选地,在电子设备启动电子设备上安装的第四应用程序的过程中,第一任务包括用于启动第四应用程序的任务,第二任务包括不用于启动第四应用程序的任务。Optionally, in the process of the electronic device launching a fourth application installed on the electronic device, the first task includes a task for launching the fourth application, and the second task includes a task not for launching the fourth application.
在应用程序的启动场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时启动应用程序,从而有助于提升用户体验。In the application startup scenario, compared with not performing resource management, the resource management method provided in this embodiment helps the electronic device to start the application in a timely manner by allocating more device resources to key tasks, thereby helping to improve the user experience.
可选地,第一任务为包括一个或者多个子任务的任务组,第二任务为包括一个或者多个子任务的任务组;资源管控方法还包括:控制第一任务中的子任务运行时对电子设备的设备资源的总使用量,使得第一任务中的子任务运行时对电子设备的设备资源的总使用量不超过向第一任务分配的设备资源的量,以及控制第二任务中的子任务运行时对电子设备的设备资源的总使用量,使得第二任务中的子任务运行时对电子设备的设备资源的总使用量不超过向第二任务分配的设备资源的量。Optionally, the first task is a task group including one or more subtasks, and the second task is a task group including one or more subtasks; the resource management method also includes: controlling the total usage of device resources of the electronic device when the subtasks in the first task are running, so that the total usage of device resources of the electronic device when the subtasks in the first task are running does not exceed the amount of device resources allocated to the first task, and controlling the total usage of device resources of the electronic device when the subtasks in the second task are running, so that the total usage of device resources of the electronic device when the subtasks in the second task are running does not exceed the amount of device resources allocated to the second task.
通过以任务组为单位进行资源管控,可以对任务组内的任务的设备资源量进行统一限制,便于对相同关键程度任务进行统一的资源管控。通过控制非关键任务组对设备资源的消耗,可以将设备资源留给更关键的任务组来使用,提高更关键的任务的响应效率。By performing resource control based on task groups, the amount of equipment resources for tasks within the task group can be uniformly limited, making it easier to uniformly control resources for tasks of the same criticality. By controlling the consumption of equipment resources by non-critical task groups, equipment resources can be left for more critical task groups to use, thereby improving the response efficiency of more critical tasks.
可选地,根据第一占用量向第一任务分配电子设备的设备资源,以及根据第二占用量向第二任务分配电子设备的设备资源这一步骤可以包括:根据第一占用量向第一任务分配在单位调度窗口内的运行时间,以及根据第二占用量向第二任务分配在单位调度窗口内的运行时间,其中,向第一任务分配的在单位调度窗口内的运行时间大于向第二任务分配的在单位调度窗口内的运行时间;Optionally, the step of allocating the device resources of the electronic device to the first task according to the first occupancy, and allocating the device resources of the electronic device to the second task according to the second occupancy may include: allocating the running time within the unit scheduling window to the first task according to the first occupancy, and allocating the running time within the unit scheduling window to the second task according to the second occupancy, wherein the running time within the unit scheduling window allocated to the first task is greater than the running time within the unit scheduling window allocated to the second task;
资源管控方法还包括:在第一任务在当前的单位调度窗口内的运行时间达到向第一任务分配的在单位调度窗口内的运行时间的情况下,释放第一任务在当前的单位调度窗口内运行时使用的电子设备的设备资源,以及在第二任务在当前的单位调度窗口内的运行时间达到向第二任务分配的在单位调度窗口内的运行时间的情况下,释放第二任务在当前的单位调度窗口内运行时使用的电子设备的设备资源。The resource management method also includes: when the running time of the first task in the current unit scheduling window reaches the running time in the unit scheduling window allocated to the first task, releasing the device resources of the electronic device used when the first task is running in the current unit scheduling window; and when the running time of the second task in the current unit scheduling window reaches the running time in the unit scheduling window allocated to the second task, releasing the device resources of the electronic device used when the second task is running in the current unit scheduling window.
通过向任务分配在单位调度窗口内的运行时间,基于各个单位调度窗口的依次进行,可以使得电子设备中各个任务的响应更均衡,避免有些任务长时间处于待运行状态。By allocating the running time within the unit scheduling window to the task, and executing each unit scheduling window in sequence, the response of each task in the electronic device can be made more balanced, and some tasks can be prevented from being in the waiting state for a long time.
可选地,资源管控方法还包括:检测电子设备的负载;在检测到电子设备的负载达到预先设定的负载阈值的情况下,执行获取电子设备中的第一任务的第一信息的步骤。Optionally, the resource management method further includes: detecting a load of the electronic device; and executing a step of acquiring first information of a first task in the electronic device when it is detected that the load of the electronic device reaches a preset load threshold.
通过限定执行资源管控的生效时机,不仅可以保证任务的响应效率,保证电子设备的良好系统性能,还可简化管控流程。By limiting the effective time of resource control, we can not only ensure the response efficiency of the task and the good system performance of the electronic equipment, but also simplify the control process.
可选地,第一任务为包括一个或者多个子任务的任务组,第二任务为包括一个或者多个子任务的任务组;资源管控方法还包括:根据任务管理请求,执行任务管理操作;其中,任务管理操作包括:设置第一信息的操作、设置第二信息的操作、删除第一任务的操作、删除第二任务的操作、删除第一任务中任一子任务的操作、删除第二任务中任一子任务的操作、向第一任务中新增子任务的操作、向第二任务中新增子任务的操作、新增包括一个或者多个子任务的第三任务的操作中的一个或者多个。Optionally, the first task is a task group including one or more subtasks, and the second task is a task group including one or more subtasks; the resource management method also includes: performing task management operations according to a task management request; wherein the task management operations include: one or more of the operations of setting first information, setting second information, deleting the first task, deleting the second task, deleting any subtask in the first task, deleting any subtask in the second task, adding a subtask to the first task, adding a subtask to the second task, and adding a third task including one or more subtasks.
通过执行任务管理操作,可使得对任务的分组符合实际应用需求,支持资源管控的按需进行。By performing task management operations, tasks can be grouped in accordance with actual application requirements, supporting on-demand resource management and control.
第五方面,本申请实施例提供一种电子设备,电子设备包括用于存储计算机程序指令的存储器、用于执行计算机程序指令的处理器和通信装置,其中,当计算机程序指令被该处理器执行时,触发电子设备执行如第一方面中任一项的方法。In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory for storing computer program instructions, a processor for executing the computer program instructions, and a communication device, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute a method as described in any one of the first aspects.
第六方面,本申请实施例提供一种芯片,包括:处理器,其用于执行存储在存储器上的计算机程序指令,其中,当计算机程序指令被处理器执行时,触发芯片执行如第一方面中任一项的方法。In a sixth aspect, an embodiment of the present application provides a chip, comprising: a processor, which is used to execute computer program instructions stored in a memory, wherein when the computer program instructions are executed by the processor, the chip is triggered to execute any method as in the first aspect.
第七方面,本申请实施例提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行如第一方面中任一项的方法。In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes any method in the first aspect.
第八方面,本申请实施例提供一种计算机程序产品,计算机程序产品包括计算机程序,当计算机程序在计算机上运行时,使得计算机执行如第一方面中任一项的方法。In an eighth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is run on a computer, the computer executes any method in the first aspect.
本申请实施例能够对任务所能占用的设备资源进行管控。The embodiment of the present application can manage and control the device resources that can be occupied by the task.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
图1为本申请一个实施例提供的一种电子设备的结构示意图;FIG1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
图2为本申请一个实施例提供的系统负载较高且不进行资源管控时系统中的一个关键任务的运行情况的示意图;FIG2 is a schematic diagram of the operation of a key task in a system when the system load is high and resource control is not performed according to an embodiment of the present application;
图3为本申请一个实施例提供的系统负载较高且不进行资源管控时系统中的另一关键任务的运行情况的示意图;FIG3 is a schematic diagram of the operation of another key task in the system when the system load is high and resource control is not performed according to an embodiment of the present application;
图4为本申请一个实施例提供的一种资源管控方法的流程示意图;FIG4 is a schematic diagram of a process flow of a resource management method provided by an embodiment of the present application;
图5为本申请一个实施例提供的一个被限制运行的非关键任务的运行情况的示意图;FIG5 is a schematic diagram of an operation status of a non-critical task that is restricted from running according to an embodiment of the present application;
图6为本申请一个实施例提供的一种分组负载管控系统的示意图。FIG6 is a schematic diagram of a group load control system provided by an embodiment of the present application.
具体实施方式Detailed ways
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
应当理解,本文中使用的术语“至少一个”是指一个或者多个,“多个”是指两个或两个以上。本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。其中A,B可以是单数或者复数。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。“以下至少一项”及其类似表达,是指的这些项中的任意组合,包括单项或复数项的任意组合。例如,a,b和c中的至少一项可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。It should be understood that the term "at least one" used in this article refers to one or more, and "plurality" refers to two or more. The term "and/or" used in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone. Among them, A and B can be singular or plural. In addition, the character "/" in this article generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b and c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c can be single or multiple.
应当理解,尽管在本申请实施例中可能采用术语第一、第二等来描述设定阈值,但这些设定阈值不应限于这些术语。这些术语仅用来将设定阈值彼此区分开。例如,在不脱离本申请实施例范围的情况下,第一设定阈值也可以被称为第二设定阈值,类似地,第二设定阈值也可以被称为第一设定阈值。It should be understood that, although the terms first, second, etc. may be used to describe the set thresholds in the embodiments of the present application, these set thresholds should not be limited to these terms. These terms are only used to distinguish the set thresholds from each other. For example, without departing from the scope of the embodiments of the present application, the first set threshold may also be referred to as the second set threshold, and similarly, the second set threshold may also be referred to as the first set threshold.
本申请的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。The terms used in the implementation section of this application are only used to explain the specific embodiments of this application and are not intended to limit this application.
本申请任一实施例提供的资源管控方法可以应用于图1所示的电子设备100中。图1示出了电子设备100的结构示意图。The resource management method provided in any embodiment of the present application can be applied to the electronic device 100 shown in Fig. 1. Fig. 1 shows a schematic diagram of the structure of the electronic device 100.
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。电源管理模块141用于连接电池142,充电管理模块140与处理器110。电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidounavigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellitesystem,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and/or satellite based augmentation system (SBAS).
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
ISP用于处理摄像头193反馈的数据。摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture static images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。NPU is a neural-network (NN) computing processor. It can quickly process input information by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, and can also continuously self-learn.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and/or instructions stored in a memory provided in the processor.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。磁传感器180D包括霍尔传感器。加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。环境光传感器180L用于感知环境光亮度。指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。温度传感器180J用于检测温度。The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focus. The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The ambient light sensor 180L is used to sense the brightness of ambient light. The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc. The temperature sensor 180J is used to detect temperature.
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。The SIM card interface 195 is used to connect the SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100. The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture.
电子设备中可以运行一个或者多个任务。一个实施例中,电子设备中运行的一个任务比如可以为一个进程或者一个线程。进程和线程均可作为任务的最小执行单元。One or more tasks may be executed in an electronic device. In one embodiment, a task executed in an electronic device may be, for example, a process or a thread. Both a process and a thread may be used as the minimum execution unit of a task.
一个实施例中,电子设备运行已安装的某一应用程序时,电子设备可以显示该应用程序的界面。在用户对界面的展示内容进行如点击、滑动等操作时,电子设备可以执行用于响应用户所执行操作的任务,该任务为与用户响应相关的任务。电子设备在运行应用程序的同时,还可执行与用户响应无关的任务,比如电子设备的后台任务。In one embodiment, when an electronic device runs an installed application, the electronic device can display the interface of the application. When a user performs operations such as clicking or sliding on the displayed content of the interface, the electronic device can execute a task for responding to the operation performed by the user, which is a task related to the user's response. While running the application, the electronic device can also execute tasks unrelated to the user's response, such as background tasks of the electronic device.
电子设备运行多个任务且不执行资源管控操作(不对任务所能使用的设备资源进行管控)时,各个任务均可竞争电子设备的有限资源,且不同任务竞争到设备资源的概率可以相同。When an electronic device runs multiple tasks and does not perform resource control operations (does not control the device resources that can be used by the tasks), each task can compete for the limited resources of the electronic device, and the probability of different tasks competing for device resources can be the same.
不同任务所竞争的设备资源可以为电子设备的硬件资源。电子设备的硬件资源可以有CPU(central processing unit,中央处理器)、GPU(graphics processing unit,图形处理器)、内存等。The device resources that different tasks compete for may be hardware resources of the electronic device, which may include a CPU (central processing unit), a GPU (graphics processing unit), a memory, and the like.
以任务竞争电子设备的CPU资源为例,一种实现方式中,当电子设备的系统负载较重(或称较高)时,电子设备的各个CPU上的任务较满。Taking the task competition for the CPU resources of the electronic device as an example, in one implementation, when the system load of the electronic device is heavy (or high), the tasks on each CPU of the electronic device are relatively full.
当电子设备的系统负载较高、且不对任务所能使用的设备资源进行管控时,系统中各个任务均竞争电子设备的CPU资源,则系统中相对重要(或称关键)的任务(比如与用户响应相关的任务等)也难免会出现较多的待运行状态(比如记作runnable状态),从而导致相对重要任务的响应时延变长。相对关键的任务可以记作关键任务,其他任务可以记作非关键任务,关键任务的关键程度高于非关键任务的关键程度。When the system load of an electronic device is high and the device resources that can be used by tasks are not controlled, each task in the system competes for the CPU resources of the electronic device, and relatively important (or critical) tasks in the system (such as tasks related to user response, etc.) will inevitably have more waiting to be run (such as recorded as runnable state), resulting in a longer response delay for relatively important tasks. Relatively critical tasks can be recorded as critical tasks, and other tasks can be recorded as non-critical tasks. The criticality of critical tasks is higher than that of non-critical tasks.
请参考图2和图3,图2示出了系统负载较高且不进行资源管控时,系统中的一个关键任务的运行情况,图3示出了系统负载较高且不进行资源管控时,系统中的另一关键任务的运行情况。其中,图2和图3的横轴可以表示时间的变化。Please refer to Figures 2 and 3. Figure 2 shows the operation of a key task in the system when the system load is high and no resource control is performed, and Figure 3 shows the operation of another key task in the system when the system load is high and no resource control is performed. The horizontal axes of Figures 2 and 3 can represent changes in time.
如图2所示,当系统负载较高时,系统中的一个关键任务在运行过程中存在较多的待运行状态,存在较少的运行状态。As shown in FIG. 2 , when the system load is high, a key task in the system has more waiting-to-run states and fewer running states during operation.
如图3所示,当系统负载较高时,系统中的另一关键任务在运行过程中存在较多的待运行状态,存在较少的运行状态。As shown in FIG3 , when the system load is high, another key task in the system has more waiting-to-run states and fewer running states during operation.
除了待运行状态和运行状态,任务在运行过程中还可以存在其他可能的状态,比如图3中所示的始终等待设备资源的休眠状态(比如可以记作sleep状态)等。In addition to the waiting state and the running state, a task may also exist in other possible states during the running process, such as the dormant state (eg, which can be recorded as the sleep state) of always waiting for device resources as shown in FIG. 3 .
由于系统负载较高时,系统中关键任务的待运行状态的时长较长,关键任务的响应时延较长,则用户对电子设备的使用体验不佳。When the system load is high, the critical tasks in the system are in a waiting state for a long time, and the response delay of the critical tasks is long, so the user experience of the electronic device is not good.
一种实现方式中,通过对一种移动端操作系统的电子设备的动态功耗模块的测试数据进行分析,可以发现电子设备的系统负载(或称后台负载)越高,电子设备的功耗越高,电子设备充电一次所能使用的时长越短,即可以认为系统负载对动态功耗模型有较大影响。In one implementation, by analyzing the test data of the dynamic power consumption module of an electronic device of a mobile operating system, it can be found that the higher the system load (or background load) of the electronic device, the higher the power consumption of the electronic device, and the shorter the time that the electronic device can be used on a single charge. That is, it can be considered that the system load has a greater impact on the dynamic power consumption model.
基于电子设备的有限资源,为了提升关键任务的响应速率,提升用户对电子设备的使用体验,有必要提供一种资源管控流程,以对任务所能占用的设备资源进行管控,控制任务运行时对设备资源的使用。Based on the limited resources of electronic devices, in order to improve the response rate of key tasks and enhance the user experience of electronic devices, it is necessary to provide a resource management process to manage the device resources that can be occupied by the task and control the use of device resources when the task is running.
场景1:应用程序的运行场景Scenario 1: Application running scenario
应用程序可以预先安装在电子设备上。一个实施例中,手机可以显示所运行的应用程序的界面。用户通过查看界面显示内容,可以通过手机的触摸屏,对应用程序的界面展示内容按需执行点击、滑动等操作。电子设备可以执行用于响应用户所执行操作的任务。手机在运行应用程序的同时,还可执行后台任务等与用户响应无关的任务。手机中运行的各个任务均可竞争手机的CPU资源。The application can be pre-installed on the electronic device. In one embodiment, the mobile phone can display the interface of the running application. The user can view the content displayed on the interface and perform operations such as clicking and sliding on the content displayed on the interface of the application as needed through the touch screen of the mobile phone. The electronic device can perform tasks for responding to the operations performed by the user. While running the application, the mobile phone can also perform background tasks and other tasks that are not related to the user response. Each task running in the mobile phone can compete for the CPU resources of the mobile phone.
在应用程序的运行场景中,与用户响应相关的任务可以作为关键任务,与用户响应无关的任务比如后台任务可以作为非关键任务。In the application running scenario, tasks related to user response can be regarded as critical tasks, and tasks unrelated to user response, such as background tasks, can be regarded as non-critical tasks.
在应用程序的运行场景中,关键任务可以包括响应应用程序的使用操作的线程,非关键任务可以包括不响应应用程序的使用操作的线程。In the running scenario of the application, the critical task may include a thread that responds to the use operation of the application, and the non-critical task may include a thread that does not respond to the use operation of the application.
一个实施例中,在应用程序的运行场景中,电子设备执行的关键任务可以包括:与用户响应最直接关联的UI(User Interface,用户界面)线程、Render(渲染)线程、动效(动画效果)线程等。In one embodiment, in the running scenario of the application, the key tasks performed by the electronic device may include: UI (User Interface) thread, Render thread, animation effect thread, etc. which are most directly related to user response.
在场景1中,一种可行的资源管控流程可以为:电子设备响应于用户执行的用于请求运行电子设备上安装的应用程序的操作,运行该应用程序。电子设备在该应用程序的运行过程中,可以运行有用于响应对应用程序的使用操作的关键线程、和不用于响应对应用程序的使用操作的非关键线程。电子设备可以确定关键线程对电子设备的CPU资源的占用量和非关键线程对电子设备的CPU资源的占用量,且关键线程对电子设备的CPU资源的占用量大于非关键线程对电子设备的CPU资源的占用量,以为关键线程分配更多的CPU资源。基于确定出的占用量,电子设备可以向关键线程和非关键线程分配CPU资源。In scenario 1, a feasible resource management process may be: the electronic device runs the application in response to an operation performed by a user to request the running of an application installed on the electronic device. During the running of the application, the electronic device may run a critical thread for responding to the use operation of the application, and a non-critical thread that is not used to respond to the use operation of the application. The electronic device may determine the occupancy of the electronic device's CPU resources by the critical thread and the occupancy of the electronic device's CPU resources by the non-critical thread, and the occupancy of the electronic device's CPU resources by the critical thread is greater than the occupancy of the electronic device's CPU resources by the non-critical thread, so as to allocate more CPU resources to the critical thread. Based on the determined occupancy, the electronic device may allocate CPU resources to the critical thread and the non-critical thread.
其中,用户对应用程序的使用操作可以有点击操作、滑动操作等。Among them, the user's operation of using the application program may include click operation, slide operation, etc.
其中,场景1中的关键线程可以有用户界面线程、渲染线程、动画效果线程,场景1中的非关键线程可以有后台线程。后台线程比如可以有垃圾回收线程。Among them, the key threads in scene 1 may include a user interface thread, a rendering thread, and an animation effect thread, and the non-key threads in scene 1 may include background threads. For example, background threads may include a garbage collection thread.
在应用程序的运行场景中,通过为关键线程分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the application running scenario, allocating more device resources to key threads helps electronic devices respond to user operations in a timely manner, thereby helping to improve user experience.
场景2:小程序的加载场景Scenario 2: Mini Program Loading Scenario
电子设备可以加载应用程序,所加载的应用程序可以为未安装在电子设备上的小应用程序(或称小程序)。小程序是一种不需要下载安装即可使用的应用程序。The electronic device can load an application program, and the loaded application program can be a small application program (or mini program) that is not installed on the electronic device. A mini program is an application program that can be used without downloading and installing.
一个实施例中,手机为了加载小程序,可以执行用于加载解析小程序的任务。手机在加载小程序的过程中,还可执行其他无关于加载解析小程序的任务。一个实施例中,无关于加载解析小程序的任务比如可以有后台任务。手机中运行的各个任务均可竞争手机的CPU资源。In one embodiment, in order to load the applet, the mobile phone can execute a task for loading and parsing the applet. In the process of loading the applet, the mobile phone can also execute other tasks unrelated to loading and parsing the applet. In one embodiment, the tasks unrelated to loading and parsing the applet can include background tasks. Each task running in the mobile phone can compete for the CPU resources of the mobile phone.
在小程序的加载场景中,用于加载解析小程序的任务可以作为关键任务,其他无关于加载小程序的任务可以作为非关键任务。In the loading scenario of the mini-program, the task for loading and parsing the mini-program can be regarded as a critical task, and other tasks unrelated to loading the mini-program can be regarded as non-critical tasks.
在小程序的加载场景中,非关键任务可以包括小程序中用于加载该小程序的线程之外的其他线程。In the loading scenario of the applet, the non-critical tasks may include other threads in the applet other than the thread used to load the applet.
一个实施例中,在小程序的加载场景中,电子设备执行的关键任务可以包括:负责程序加载解析的线程。In one embodiment, in the loading scenario of the mini-program, the key tasks performed by the electronic device may include: a thread responsible for program loading and parsing.
在场景2中,一种可行的资源管控流程可以为:电子设备响应于用户执行的用于请求运行小程序的操作,可以先加载该小程序。电子设备在加载该小程序的过程中,可以运行有用于加载第一小程序的关键线程、和不用于加载第一小程序的非关键线程。电子设备可以确定关键线程对电子设备的设备资源的占用量和非关键线程对电子设备的设备资源的占用量,且关键线程对电子设备的设备资源的占用量大于非关键线程对电子设备的设备资源的占用量,以为关键线程分配更多的设备资源。基于确定出的占用量,电子设备可以向关键线程和非关键线程分配设备资源。In scenario 2, a feasible resource management process may be: the electronic device may first load the applet in response to an operation performed by a user to request the running of the applet. In the process of loading the applet, the electronic device may run a critical thread for loading the first applet and a non-critical thread that is not used to load the first applet. The electronic device may determine the amount of device resources occupied by the critical thread and the amount of device resources occupied by the non-critical thread, and the amount of device resources occupied by the critical thread is greater than the amount of device resources occupied by the non-critical thread, so as to allocate more device resources to the critical thread. Based on the determined occupancy, the electronic device may allocate device resources to the critical thread and the non-critical thread.
其中,场景2中的关键线程可以有负责程序加载解析的线程,场景2中的非关键线程可以有后台线程。Among them, the critical thread in scenario 2 may include a thread responsible for program loading and parsing, and the non-critical thread in scenario 2 may include a background thread.
在小程序的加载场景中,通过为关键线程分配更多的设备资源,有助于电子设备快速加载小程序,从而有助于提升用户体验。In the loading scenario of the mini program, allocating more device resources to key threads helps electronic devices load the mini program quickly, thereby helping to improve the user experience.
场景3:小程序的运行场景Scenario 3: Mini Program Operation Scenario
电子设备可以加载小程序,在加载好小程序后,可以运行小程序。一个实施例中,手机可以显示所运行的小程序的界面。用户通过查看界面显示内容,可以通过手机的触摸屏,对小程序的界面展示内容按需执行点击、滑动等操作。电子设备可以执行用于响应用户所执行操作的任务。手机在运行小程序的同时,还可执行与用户响应无关的任务。一个实施例中,与用户响应无关的任务比如可以有后台任务。手机中运行的各个任务均可竞争手机的CPU资源。An electronic device can load a mini-program, and after loading the mini-program, it can run the mini-program. In one embodiment, a mobile phone can display the interface of the mini-program being run. The user can view the content displayed on the interface and can use the touch screen of the mobile phone to perform operations such as clicking and sliding on the content displayed on the mini-program interface as needed. An electronic device can perform tasks to respond to operations performed by the user. While running the mini-program, the mobile phone can also perform tasks unrelated to the user's response. In one embodiment, tasks unrelated to the user's response may include background tasks. Each task running in the mobile phone can compete for the CPU resources of the mobile phone.
在小程序的运行场景中,与用户响应相关的任务可以作为关键任务,与用户响应无关的任务可以作为非关键任务。In the running scenario of the mini program, tasks related to user response can be regarded as key tasks, and tasks unrelated to user response can be regarded as non-key tasks.
在小程序的运行场景中,关键任务可以包括响应小程序的使用操作的线程,非关键任务可以包括不响应小程序的使用操作的线程。In the running scenario of the mini program, the critical tasks may include threads that respond to the use operations of the mini program, and the non-critical tasks may include threads that do not respond to the use operations of the mini program.
一个实施例中,在小程序的运行场景中,电子设备执行的关键任务可以包括:与用户响应最直接关联的webview(网页示图)类的线程等。In one embodiment, in the running scenario of the mini program, the key tasks performed by the electronic device may include: threads of the webview (web page view) class that are most directly related to user responses, etc.
在场景3中,一种可行的资源管控流程可以为:电子设备响应于用户执行的用于请求运行小程序的操作,可以先加载该小程序,之后运行加载好的小程序。电子设备在该小程序的运行过程中,可以运行有用于响应对小程序的使用操作的关键线程、和不用于响应对小程序的使用操作的非关键线程。电子设备可以确定关键线程对电子设备的CPU资源的占用量和非关键线程对电子设备的CPU资源的占用量,且关键线程对电子设备的CPU资源的占用量大于非关键线程对电子设备的CPU资源的占用量,以为关键线程分配更多的CPU资源。基于确定出的占用量,电子设备可以向关键线程和非关键线程分配CPU资源。In scenario 3, a feasible resource management process may be: in response to the operation performed by the user to request the running of the applet, the electronic device may first load the applet and then run the loaded applet. During the running of the applet, the electronic device may run a critical thread for responding to the use operation of the applet, and a non-critical thread that is not used to respond to the use operation of the applet. The electronic device may determine the occupancy of the electronic device's CPU resources by the critical thread and the occupancy of the electronic device's CPU resources by the non-critical thread, and the occupancy of the electronic device's CPU resources by the critical thread is greater than the occupancy of the electronic device's CPU resources by the non-critical thread, so as to allocate more CPU resources to the critical thread. Based on the determined occupancy, the electronic device may allocate CPU resources to the critical thread and the non-critical thread.
其中,用户对小程序的使用操作可以有点击操作、滑动操作等。Among them, users can use the mini program through clicking operations, sliding operations, etc.
其中,场景3中的关键线程可以有webview类的线程,场景3中的非关键线程可以有后台线程。Among them, the critical thread in scene 3 can include threads of the webview class, and the non-critical thread in scene 3 can include background threads.
在小程序的运行场景中,通过为关键线程分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the running scenario of the mini program, allocating more device resources to key threads helps electronic devices respond to user operations in a timely manner, thereby helping to improve the user experience.
场景4:应用程序的启动场景Scenario 4: Application startup scenario
应用程序可以预先安装在电子设备上。用户需要使用电子设备上安装的任一应用程序时,电子设备可以启动该应用程序。The application program may be pre-installed on the electronic device. When the user needs to use any application program installed on the electronic device, the electronic device may start the application program.
一个实施例中,手机在启动所安装的应用程序的过程中,可以执行用于启动应用程序的任务。比如在存在应用程序启动动效的情况下,手机可以执行用于显示启动动效的任务。手机在启动应用程序的同时,还可执行与应用程序启动无关的任务。一个实施例中,与应用程序启动无关的任务比如可以有后台任务。手机中运行的各个任务均可竞争手机的CPU资源。In one embodiment, the mobile phone can execute a task for launching the application while launching the installed application. For example, in the case of an application launch animation, the mobile phone can execute a task for displaying the launch animation. While launching the application, the mobile phone can also execute tasks unrelated to the launch of the application. In one embodiment, the tasks unrelated to the launch of the application can include background tasks. Each task running in the mobile phone can compete for the CPU resources of the mobile phone.
在应用程序的启动场景中,用于启动应用程序的任务可以作为关键任务,与启动应用程序无关的任务可以作为非关键任务。In the application startup scenario, the task used to start the application can be regarded as a critical task, and the task unrelated to starting the application can be regarded as a non-critical task.
在应用程序的启动场景中,非关键任务可以包括应用程序中用于启动应用程序的线程之外的其他线程。In the startup scenario of an application, non-critical tasks can include other threads in the application besides the thread used to start the application.
一个实施例中,在应用程序的启动场景中,电子设备执行的关键任务可以包括:launcher线程、用于显示启动动效的线程。Launcher为安卓系统中的桌面启动器。In one embodiment, in the application startup scenario, the key tasks performed by the electronic device may include: a launcher thread and a thread for displaying startup animation effects. Launcher is a desktop launcher in the Android system.
在场景4中,一种可行的资源管控流程可以为:电子设备响应于用户执行的用于请求运行电子设备上安装的应用程序的操作,可以启动该应用程序。电子设备在启动该应用程序的过程中,可以运行有用于启动应用程序的关键线程、和不用于启动应用程序的非关键线程。电子设备可以确定关键线程对电子设备的设备资源的占用量和非关键线程对电子设备的设备资源的占用量,且关键线程对电子设备的设备资源的占用量大于非关键线程对电子设备的设备资源的占用量,以为关键线程分配更多的设备资源。基于确定出的占用量,电子设备可以向关键线程和非关键线程分配设备资源。In scenario 4, a feasible resource management process may be: the electronic device may start the application in response to an operation performed by a user to request the running of an application installed on the electronic device. In the process of starting the application, the electronic device may run a critical thread for starting the application and a non-critical thread that is not used to start the application. The electronic device may determine the amount of device resources occupied by the critical thread and the amount of device resources occupied by the non-critical thread, and the amount of device resources occupied by the critical thread is greater than the amount of device resources occupied by the non-critical thread, so as to allocate more device resources to the critical thread. Based on the determined occupancy, the electronic device may allocate device resources to the critical thread and the non-critical thread.
其中,场景4中的关键线程可以有launcher线程、用于显示启动动效的线程,场景4中的非关键线程可以有后台线程。Among them, the key threads in scene 4 may include a launcher thread and a thread for displaying startup animation effects, and the non-key threads in scene 4 may include a background thread.
在应用程序的启动场景中,通过为关键任务分配更多的设备资源,有助于电子设备及时启动应用程序,从而有助于提升用户体验。In the application startup scenario, allocating more device resources to key tasks helps electronic devices start applications in a timely manner, thereby helping to improve user experience.
本申请一个实施例提供了一种资源管控方法,该方法可以应用于电子设备,该方法可以包括:响应于第一操作,运行第一应用,其中,在第一应用的运行过程中运行有第一线程和第二线程,第一线程为用于响应对第一应用的使用操作的线程,第二线程为不用于响应对第一应用的使用操作的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。该实施例可以适用于上述场景1、场景3。An embodiment of the present application provides a resource management method, which can be applied to an electronic device, and the method may include: in response to a first operation, running a first application, wherein a first thread and a second thread are running during the running of the first application, the first thread is a thread for responding to the use operation of the first application, and the second thread is a thread not for responding to the use operation of the first application; determining the occupation of the device resources of the electronic device by the first thread as a first occupation, and determining the occupation of the device resources of the electronic device by the second thread as a second occupation, wherein the first occupation is greater than the second occupation; allocating the device resources of the electronic device to the first thread based on the first occupation, and allocating the device resources of the electronic device to the second thread based on the second occupation. This embodiment can be applied to the above-mentioned scenarios 1 and 3.
一个实施例中,第一应用为电子设备上安装的任一应用;第一线程包括用户界面线程、渲染线程、动画效果线程中的至少一种。In one embodiment, the first application is any application installed on the electronic device; the first thread includes at least one of a user interface thread, a rendering thread, and an animation effect thread.
一个实施例中,第一应用为电子设备所加载的任一小程序;第一线程包括网页示图类的线程。In one embodiment, the first application is any small program loaded by the electronic device; the first thread includes a thread of the web page illustration class.
一个实施例中,第二线程包括后台线程。In one embodiment, the second thread comprises a background thread.
在应用程序、小程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键线程分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。In the running scenarios of applications and applets, compared with not performing resource control, the resource control method provided in this embodiment helps electronic devices respond to user operations in a timely manner by allocating more device resources to key threads, thereby helping to improve user experience.
本申请一个实施例提供了一种资源管控方法,该方法可以应用于电子设备,该方法可以包括:响应于第一操作,加载第一小程序,其中,在加载第一小程序的过程中运行有第一线程和第二线程,第一线程为用于加载第一小程序的线程,第二线程为不用于加载第一小程序的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。该实施例可以适用于上述场景2。An embodiment of the present application provides a resource management method, which can be applied to an electronic device, and the method may include: in response to a first operation, loading a first applet, wherein a first thread and a second thread are running in the process of loading the first applet, the first thread is a thread for loading the first applet, and the second thread is a thread not used to load the first applet; determining that the occupation of the device resources of the electronic device by the first thread is a first occupation, and determining that the occupation of the device resources of the electronic device by the second thread is a second occupation, wherein the first occupation is greater than the second occupation; allocating the device resources of the electronic device to the first thread based on the first occupation, and allocating the device resources of the electronic device to the second thread based on the second occupation. This embodiment can be applied to the above scenario 2.
在小程序的加载场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键线程分配更多的设备资源,有助于电子设备快速加载小程序,从而有助于提升用户体验。In the mini-program loading scenario, compared with not performing resource management, the resource management method provided in this embodiment helps electronic devices to quickly load mini-programs by allocating more device resources to key threads, thereby helping to improve user experience.
本申请一个实施例提供了一种资源管控方法,该方法可以应用于电子设备,该方法可以包括:响应于第一操作,启动电子设备上安装的第一应用,其中,在启动第一应用的过程中运行有第一线程和第二线程,第一线程为用于启动第一应用的线程,第二线程为不用于启动第一应用的线程;确定第一线程对电子设备的设备资源的占用量为第一占用量,以及确定第二线程对电子设备的设备资源的占用量为第二占用量,其中,第一占用量大于第二占用量;基于第一占用量向第一线程分配电子设备的设备资源,以及基于第二占用量向第二线程分配电子设备的设备资源。该实施例可以适用于上述场景4。An embodiment of the present application provides a resource management method, which can be applied to an electronic device, and the method may include: in response to a first operation, starting a first application installed on the electronic device, wherein a first thread and a second thread are running in the process of starting the first application, the first thread is a thread used to start the first application, and the second thread is a thread not used to start the first application; determining that the occupation of the device resources of the electronic device by the first thread is a first occupation, and determining that the occupation of the device resources of the electronic device by the second thread is a second occupation, wherein the first occupation is greater than the second occupation; allocating the device resources of the electronic device to the first thread based on the first occupation, and allocating the device resources of the electronic device to the second thread based on the second occupation. This embodiment can be applied to the above scenario 4.
在应用程序的启动场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时启动应用程序,从而有助于提升用户体验。在本申请一个实施例中,请参考图4,一种资源管控方法可以包括以下步骤401~步骤403。In the application startup scenario, compared with not performing resource control, the resource control method provided in this embodiment helps the electronic device to start the application in time by allocating more device resources to key tasks, thereby helping to improve the user experience. In one embodiment of the present application, please refer to Figure 4, a resource control method may include the following steps 401 to 403.
步骤401,获取电子设备中的第一任务的第一信息,以及获取电子设备中的第二任务的第二信息,其中,第一信息用于描述第一任务的关键程度,第二信息用于描述第二任务的关键程度,第一任务的关键程度高于第二任务的关键程度。Step 401, obtaining first information of a first task in the electronic device, and obtaining second information of a second task in the electronic device, wherein the first information is used to describe the criticality of the first task, and the second information is used to describe the criticality of the second task, and the criticality of the first task is higher than the criticality of the second task.
电子设备中可以运行一个或者多个任务。一个实施例中,第一任务、第二任务可以为电子设备中运行的、具有不同关键程度的任意两个任务。另一实施例中,第一任务、第二任务还可以为电子设备中运行的、具有不同关键程度的任意两个任务组合,一个任务组合可以包括至少一个任务。第一任务、第二任务均可以具有相应的关键程度。One or more tasks may be executed in the electronic device. In one embodiment, the first task and the second task may be any two tasks with different criticalities executed in the electronic device. In another embodiment, the first task and the second task may also be any two task combinations with different criticalities executed in the electronic device, and a task combination may include at least one task. Both the first task and the second task may have corresponding criticalities.
一个实施例中,可以对电子设备中的一个或者多个任务进行资源管控,第一任务、第二任务均可以为被进行资源管控的任务。In one embodiment, resource control may be performed on one or more tasks in the electronic device, and both the first task and the second task may be tasks subject to resource control.
一个实施例中,可以结合人为定义,确定任务的关键程度。另一实施例中,可以根据任务的属性(比如是否为系统中现有的后台任务),确定任务的关键程度。其中,可以确定后台任务不关键,或者具有较低的关键程度。In one embodiment, the criticality of the task can be determined in combination with human definition. In another embodiment, the criticality of the task can be determined based on the attributes of the task (such as whether it is an existing background task in the system). Among them, it can be determined that the background task is not critical or has a low criticality.
一个实施例中,任务的关键程度可以有关键、不关键的区别。比如,可以对关键任务分配设定好的较大量的设备资源,对非关键任务分配设定好的较少量的设备资源。In one embodiment, the criticality of tasks can be classified into critical and non-critical. For example, a set larger amount of equipment resources can be allocated to critical tasks, and a set smaller amount of equipment resources can be allocated to non-critical tasks.
比如用于描述任务的关键程度的信息可以为0或者1,该信息为0时可以表示任务不关键,该信息为1时可以表示任务关键。For example, the information used to describe the criticality of a task may be 0 or 1. When the information is 0, it may indicate that the task is not critical, and when the information is 1, it may indicate that the task is critical.
另一实施例中,任务的关键程度可以为关键值。比如,关键值越高,关键程度越高。In another embodiment, the criticality of a task may be a critical value. For example, the higher the critical value, the higher the criticality.
又一实施例中,任务的关键程度可以为关键等级。比如,关键等级越高,关键程度越高。In another embodiment, the criticality of the task may be a criticality level. For example, the higher the criticality level, the higher the criticality.
再一实施例中,任务的关键程度可以为关键范围。比如,两个任务的关键值可以不同,但两个任务的关键值均落入同一关键范围内,则可以认为两个任务的关键程度相一致(或称相等、相同)。一个实施例中,若关键值不大于关键范围的上限值,且不小于关键范围的下限值,可以认为关键值落入关键范围。In another embodiment, the criticality of a task may be within a critical range. For example, if the critical values of two tasks are different, but the critical values of the two tasks fall within the same critical range, then the criticality of the two tasks may be considered to be consistent (or equal or the same). In one embodiment, if the critical value is not greater than the upper limit of the critical range and not less than the lower limit of the critical range, then the critical value may be considered to fall within the critical range.
一个实施例中,第一任务可以为关键任务,第二任务可以为非关键任务。In one embodiment, the first task may be a critical task, and the second task may be a non-critical task.
第一信息可作为用于确定第一任务对设备资源的占用量的依据,第二信息可作为用于确定第二任务对设备资源的占用量的依据。关键程度越强,相应任务对设备资源的占用量越大,反之越小。The first information can be used as a basis for determining the amount of equipment resources occupied by the first task, and the second information can be used as a basis for determining the amount of equipment resources occupied by the second task. The higher the criticality, the greater the amount of equipment resources occupied by the corresponding task, and vice versa.
步骤402,根据第一信息确定第一任务对电子设备的设备资源的第一占用量,以及根据第二信息确定第二任务对电子设备的设备资源的第二占用量,其中,第一占用量大于第二占用量。Step 402: determine a first occupation of device resources of the electronic device by a first task according to first information, and determine a second occupation of device resources of the electronic device by a second task according to second information, wherein the first occupation is greater than the second occupation.
步骤402中,可以根据任务的关键程度,确定任务对设备资源的占用量,以便后续可以根据任务对设备资源的占用量,向任务分配设备资源。In step 402, the amount of device resources occupied by the task may be determined according to the criticality of the task, so that device resources may be subsequently allocated to the task according to the amount of device resources occupied by the task.
任务对设备资源的占用量与任务的关键程度可以呈正相关,使得分配至任务的设备资源的量与任务的关键程度呈正相关。其中,若任务的关键程度越高,任务越关键,任务对设备资源的占用量越高,向任务分配的设备资源越多,若任务的关键程度越低,任务越不关键,任务对设备资源的占用量越低,向任务分配的设备资源越少。The amount of equipment resources occupied by a task may be positively correlated with the criticality of the task, so that the amount of equipment resources allocated to the task is positively correlated with the criticality of the task. Among them, if the criticality of the task is higher, the more critical the task is, the higher the amount of equipment resources occupied by the task is, and more equipment resources are allocated to the task; if the criticality of the task is lower, the less critical the task is, the lower the amount of equipment resources occupied by the task is, and fewer equipment resources are allocated to the task.
第一任务的关键程度高于第二任务的关键程度,则第一任务对设备资源的占用量大于第二任务对设备资源的占用量,以为关键任务分配相对更多的设备资源、为非关键任务分配相对更少的设备资源。If the criticality of the first task is higher than that of the second task, the amount of equipment resources occupied by the first task is greater than that of the second task, so that relatively more equipment resources are allocated to the critical task and relatively fewer equipment resources are allocated to the non-critical task.
一个实施例中,与非关键任务(比如任务不关键或任务的关键程度低)相比,关键任务(比如任务关键或任务的关键程度高)对设备资源的占用量的上限可以更高。In one embodiment, compared with non-critical tasks (such as non-critical tasks or tasks with low criticality), critical tasks (such as mission-critical tasks or tasks with high criticality) may have a higher upper limit on the amount of device resources occupied.
另一实施例中,与非关键任务不同,关键任务对设备资源的占用量可以没有上限,即可以对关键任务所能使用的设备资源量(或称设备资源的量)不设上限,使得关键任务最高可使用电子设备的全部有限资源(比如全部CPU资源)。In another embodiment, unlike non-critical tasks, there may be no upper limit on the amount of device resources that a critical task may occupy, that is, there may be no upper limit on the amount of device resources (or the amount of device resources) that a critical task can use, so that a critical task can use up to all the limited resources of the electronic device (such as all CPU resources).
一个实施例中,除了根据第一任务、第二任务的关键程度,还可以根据电子设备中其他任务的关键程度,确定第一任务、第二任务对设备资源的占用量,以向第一任务、第二任务分配设备资源。如此,可以避免一些任务所能使用的设备资源较多,而另一些任务所能使用的设备资源较少甚至无法使用到设备资源,以支持多个任务的均衡运行。In one embodiment, in addition to the criticality of the first task and the second task, the criticality of other tasks in the electronic device can also be used to determine the occupation of the first task and the second task on the device resources, so as to allocate the device resources to the first task and the second task. In this way, it can be avoided that some tasks can use more device resources, while other tasks can use less device resources or even cannot use device resources, so as to support the balanced operation of multiple tasks.
一个实施例中,以CPU资源为例,确定出的任务对设备资源的占用量可以为CPU的数量。比如关键任务可以使用较多数量的CPU,非关键任务可以使用较少数量的CPU。In one embodiment, taking CPU resources as an example, the determined occupation of device resources by a task may be the number of CPUs. For example, a critical task may use a larger number of CPUs, while a non-critical task may use a smaller number of CPUs.
另一实施例中,以CPU资源为例,确定出的任务对设备资源的占用量也可以为任务可用的最大CPU带宽。其中,可以使用配额和时段(或称周期)来指定任务允许使用的最大CPU带宽。配额和时段的单位均可以时间,比如s(秒)、ms(毫秒)。In another embodiment, taking CPU resources as an example, the determined occupation of device resources by a task may also be the maximum CPU bandwidth available to the task. Among them, quotas and time periods (or cycles) may be used to specify the maximum CPU bandwidth allowed to be used by a task. The units of quotas and time periods may be time, such as s (seconds) and ms (milliseconds).
举例来说,假设将任务的运行时间限制为1个CPU。一个例子中,若时段为500ms、配额为500ms,则任务每500ms最多可以使用1个CPU;另一例子中,若时段为250ms、配额为500ms,则任务每250ms最多可以使用2个CPU;再一例子中,若时段为500ms、配额为50ms,则任务每500ms最多可以使用1个CPU的10%。For example, suppose the running time of a task is limited to 1 CPU. In one example, if the period is 500ms and the quota is 500ms, the task can use at most 1 CPU every 500ms; in another example, if the period is 250ms and the quota is 500ms, the task can use at most 2 CPUs every 250ms; in another example, if the period is 500ms and the quota is 50ms, the task can use at most 10% of 1 CPU every 500ms.
一个实施例中,确定出的任务对设备资源的占用量可以为任务对设备资源的使用时长。In one embodiment, the determined amount of device resource occupation by the task may be the usage time of the device resource by the task.
一个实施例中,确定出的任务对设备资源的占用量可以为任务在单位调度窗口内对设备资源的使用时长。另一实施例中,确定出的任务对设备资源的占用量可以为在非单位调度窗口(比如窗口大小可变的窗口)内对设备资源的使用时长。In one embodiment, the determined amount of device resource usage by a task may be the duration of device resource usage by the task in a unit scheduling window. In another embodiment, the determined amount of device resource usage by a task may be the duration of device resource usage in a non-unit scheduling window (e.g., a window with a variable window size).
一个单位调度窗口可以作为一个时间周期。单位调度窗口的时间长度可以按需设定,比如可以设定为1s、500ms、250ms、50ms等。A unit scheduling window can be used as a time period. The time length of the unit scheduling window can be set as needed, for example, it can be set to 1s, 500ms, 250ms, 50ms, etc.
以确定出的任务对设备资源的占用量为任务对设备资源的使用时长为例,若任务使用设备资源的时长达到分配至任务的对设备资源的使用时长,可以控制任务暂停运行,释放任务使用的设备资源以供其他任务使用。Taking the determined task occupation of device resources as the duration of the task's use of device resources as an example, if the duration of the task's use of device resources reaches the duration of the task's use of device resources allocated to the task, the task can be controlled to pause and release the device resources used by the task for use by other tasks.
一个实施例中,为任务分配设备资源可以包括:向任务分配在单位调度窗口内的运行时间(或称运行时长)。比如一个单位调度窗口的时间长度为1s,分配至一个非关键任务的运行时间可以为一个单位调度窗口中的100ms。In one embodiment, allocating device resources to a task may include: allocating a running time (or running length) within a unit scheduling window to the task. For example, if the time length of a unit scheduling window is 1 second, the running time allocated to a non-critical task may be 100 ms within the unit scheduling window.
步骤403,根据第一占用量向第一任务分配电子设备的设备资源,以及根据第二占用量向第二任务分配电子设备的设备资源。Step 403: Allocate device resources of the electronic device to the first task according to the first occupancy, and allocate device resources of the electronic device to the second task according to the second occupancy.
步骤403中,可以根据确定出的占用量,向任务分配设备资源。任务运行时使用的设备资源不超过向任务分配的设备资源。一个实施例中,可以通过设置相应配置信息,来向任务分配设备资源。In step 403, device resources may be allocated to the task according to the determined occupancy. The device resources used when the task is running shall not exceed the device resources allocated to the task. In one embodiment, device resources may be allocated to the task by setting corresponding configuration information.
以占用量为CPU数量为例,向任务分配设备资源时,一个实施例中,可以配置任务所能使用的CPU数量,另一实施例中,也可以配置任务所能使用的相应数量的各个CPU的标识。Taking the occupancy as the number of CPUs as an example, when allocating device resources to a task, in one embodiment, the number of CPUs that the task can use can be configured, and in another embodiment, the identifiers of the corresponding number of CPUs that the task can use can also be configured.
对任务分配设备资源后,可以根据向任务分配的设备资源量,对任务的运行进行控制,以使得任务运行时对设备资源的使用量不超过分配的设备资源量。After the device resources are allocated to the task, the operation of the task can be controlled according to the amount of the device resources allocated to the task, so that the usage of the device resources during the operation of the task does not exceed the allocated amount of device resources.
在本申请一个实施例中,资源管控方法还可以包括:步骤A,控制第一任务运行时对电子设备的设备资源的使用量,使得第一任务运行时对电子设备的设备资源的使用量不超过向第一任务分配的设备资源的量,以及控制第二任务运行时对电子设备的设备资源的使用量,使得第二任务运行时对电子设备的设备资源的使用量不超过向第二任务分配的设备资源的量。In one embodiment of the present application, the resource management method may further include: step A, controlling the usage of device resources of the electronic device when the first task is running, so that the usage of device resources of the electronic device when the first task is running does not exceed the amount of device resources allocated to the first task, and controlling the usage of device resources of the electronic device when the second task is running, so that the usage of device resources of the electronic device when the second task is running does not exceed the amount of device resources allocated to the second task.
在向任务分配设备资源之后,可以根据分配至任务的设备资源的量,控制任务运行时所能使用的设备资源的量。任务运行时所能使用的设备资源不超过分配至任务的设备资源。After allocating device resources to a task, the amount of device resources that can be used when the task is running can be controlled according to the amount of device resources allocated to the task. The device resources that can be used when the task is running shall not exceed the device resources allocated to the task.
一个实施例中,若任务使用的设备资源量达到分配至任务的设备资源量,电子设备可以强制控制任务暂停运行,释放任务使用的设备资源以供其他任务使用。In one embodiment, if the amount of device resources used by a task reaches the amount of device resources allocated to the task, the electronic device may forcibly control the task to pause running, and release the device resources used by the task for use by other tasks.
另一实施例中,可以对任务的信息进行相应配置,使得若任务运行时对设备资源的使用量达到分配至任务的设备资源的量,任务可以自动暂停运行。In another embodiment, the task information may be configured accordingly so that if the usage of the device resources during the execution of the task reaches the amount of the device resources allocated to the task, the task may be automatically suspended.
在本申请一个实施例中,步骤403可以包括:根据第一占用量向第一任务分配运行时间,根据第二占用量向第二任务分配运行时间。基于此,资源管控方法还可以包括:在第一任务的运行时间达到向第一任务分配的运行时间的情况下,释放第一任务运行时使用的电子设备的设备资源,以及在第二任务的运行时间达到向第二任务分配的运行时间的情况下,释放第二任务运行时使用的电子设备的设备资源。In one embodiment of the present application, step 403 may include: allocating running time to the first task according to the first occupancy, and allocating running time to the second task according to the second occupancy. Based on this, the resource management method may also include: when the running time of the first task reaches the running time allocated to the first task, releasing the device resources of the electronic device used when the first task is running, and when the running time of the second task reaches the running time allocated to the second task, releasing the device resources of the electronic device used when the second task is running.
一个实施例中,向任务分配的运行时间可以与任务运行时使用的设备资源的量呈正相关。任务的运行时间越长,对设备资源的使用时长越长,使用的设备资源的量越多。在任务的运行时间达到分配的运行时间时,控制任务暂停运行,释放任务使用的设备资源。In one embodiment, the runtime allocated to a task may be positively correlated with the amount of device resources used when the task is running. The longer the task runtime is, the longer the device resources are used, and the more device resources are used. When the task runtime reaches the allocated runtime, the task is controlled to be suspended, and the device resources used by the task are released.
在本申请一个实施例中,步骤403可以包括:根据第一占用量向第一任务分配在单位调度窗口内的运行时间,以及根据第二占用量向第二任务分配在单位调度窗口内的运行时间,其中,向第一任务分配的在单位调度窗口内的运行时间大于向第二任务分配的在单位调度窗口内的运行时间。In one embodiment of the present application, step 403 may include: allocating running time within the unit scheduling window to the first task according to the first occupancy, and allocating running time within the unit scheduling window to the second task according to the second occupancy, wherein the running time within the unit scheduling window allocated to the first task is greater than the running time within the unit scheduling window allocated to the second task.
以第一任务为例,分配至第一任务的运行时间为在一个单位调度窗口内的、允许第一任务运行的运行时间。Taking the first task as an example, the running time allocated to the first task is the running time within a unit scheduling window that allows the first task to run.
基于此,资源管控方法还包括:在第一任务在当前的单位调度窗口内的运行时间达到向第一任务分配的在单位调度窗口内的运行时间的情况下,释放第一任务在当前的单位调度窗口内运行时使用的电子设备的设备资源,以及在第二任务在当前的单位调度窗口内的运行时间达到向第二任务分配的在单位调度窗口内的运行时间的情况下,释放第二任务在当前的单位调度窗口内运行时使用的电子设备的设备资源。Based on this, the resource management method also includes: when the running time of the first task within the current unit scheduling window reaches the running time within the unit scheduling window allocated to the first task, releasing the device resources of the electronic device used when the first task is running within the current unit scheduling window; and when the running time of the second task within the current unit scheduling window reaches the running time within the unit scheduling window allocated to the second task, releasing the device resources of the electronic device used when the second task is running within the current unit scheduling window.
一个实施例中,对于依次进行的每一个单位调度窗口,以第一任务为例,可以断第一任务在当前单位调度窗口内的运行时间是否达到分配至第一任务的运行时间,若判断为是,则可以控制第一任务暂停运行以处于待运行状态,并释放第一任务使用的设备资源,以供其他任务在当前单位调度窗口内使用。若判断为否,则无需控制第一任务暂停运行,第一任务在当前单位调度窗口内保持继续运行。或者也可以监测第一任务在当前单位调度窗口内的运行时间,在监测到该运行时间达到分配至第一任务的运行时间时,可以控制第一任务暂停运行并释放第一任务使用的设备资源。In one embodiment, for each unit scheduling window that is performed in sequence, taking the first task as an example, it can be determined whether the running time of the first task in the current unit scheduling window reaches the running time allocated to the first task. If it is determined to be yes, the first task can be controlled to suspend running to be in a waiting state, and the equipment resources used by the first task can be released for use by other tasks in the current unit scheduling window. If it is determined to be no, there is no need to control the first task to suspend running, and the first task continues to run in the current unit scheduling window. Alternatively, the running time of the first task in the current unit scheduling window can be monitored. When it is detected that the running time reaches the running time allocated to the first task, the first task can be controlled to suspend running and the equipment resources used by the first task can be released.
通过向任务分配在单位调度窗口内的运行时间,基于各个单位调度窗口的依次进行,可以使得电子设备中各个任务的响应更均衡,避免有些任务长时间处于待运行状态。By allocating the running time within the unit scheduling window to the task, and executing each unit scheduling window in sequence, the response of each task in the electronic device can be made more balanced, and some tasks can be prevented from being in the waiting state for a long time.
一个实施例中,以任务使用CPU资源为例,基于时钟快照度量(clock snapshotsmetric)技术,可以得到如图5所示的一个被限制运行(限制任务运行时对设备的CPU资源的使用)的非关键任务(比如记作CFS.sh 325)的运行情况的示意图。CFS(Completely FairScheduler)的中文释义为完全公平调度器。其中,图5的横轴可以表示时间的变化。In one embodiment, taking the use of CPU resources by a task as an example, based on the clock snapshots metric technology, a schematic diagram of the operation of a non-critical task (e.g., CFS.sh 325) that is restricted (limiting the use of CPU resources of the device when the task is running) can be obtained as shown in FIG5. The Chinese interpretation of CFS (Completely Fair Scheduler) is a completely fair scheduler. Among them, the horizontal axis of FIG5 can represent the change of time.
请参考图5,非关键任务在每一单位调度窗口内,大多时间处于等待CPU资源的待运行状态,少量时间处于获取到CPU资源的运行状态,当该非关键任务的运行时间超过设定的时间值(比如分配至该非关键任务的对设备资源的使用时长)时,可以强制释放该非关键任务获取到的CPU资源,所释放的CPU资源供其他任务使用。Please refer to Figure 5. In each unit scheduling window, non-critical tasks are in a waiting state waiting for CPU resources most of the time, and in a running state after obtaining CPU resources for a short period of time. When the running time of the non-critical task exceeds the set time value (such as the length of time the device resources are allocated to the non-critical task), the CPU resources obtained by the non-critical task can be forcibly released, and the released CPU resources can be used by other tasks.
在设备资源有限的情况下,通过根据任务的关键程度为任务分配相应量的设备资源,可以避免出现关键任务存在较多的待运行状态的情况,如此可以提升关键任务的响应速率,从而提升用户对电子设备的使用体验。When device resources are limited, by allocating a corresponding amount of device resources to tasks based on their criticality, it is possible to avoid a situation where critical tasks have a large number of waiting to be run. This can increase the response rate of critical tasks, thereby improving the user experience of electronic devices.
可以通过降低电子设备中非关键任务的设备资源消耗,从而使得电子设备中的关键任务可以更快的获取更多的设备资源,降低关键任务的响应时间和整体运行过程耗时,便于用户有更好的性能使用体验。By reducing the device resource consumption of non-critical tasks in electronic devices, critical tasks in electronic devices can obtain more device resources faster, reducing the response time of critical tasks and the overall running process time, so that users can have a better performance experience.
电子设备中可以运行一个或者多个任务,一个实施例中,可以任务为单位来分配设备资源,即可以对电子设备中的各个任务分别分配设备资源。One or more tasks may be run in the electronic device. In one embodiment, device resources may be allocated in units of tasks, that is, device resources may be allocated to each task in the electronic device respectively.
另一实施例中,还可根据任务的关键程度,对电子设备中的任务进行分组以得到任务组(或称分组、任务分组),并以组为单位来分配设备资源,即可以对电子设备中的各个任务组分别分配设备资源。In another embodiment, tasks in the electronic device may be grouped according to their criticality to obtain task groups (or groups, task groups), and device resources may be allocated in groups, that is, device resources may be allocated to each task group in the electronic device.
一个实施例中,可以默认将系统现有的非关键的后台任务作为一个任务组,比如记作后台分组(或称background分组),并标记后台分组的关键程度为非关键。In one embodiment, the existing non-critical background tasks of the system may be regarded as a task group by default, such as a background group (or background group), and the criticality of the background group may be marked as non-critical.
除了现有后台任务组成的系统默认任务组,一个实施例中,还可以按需自定义新建任务组。比如可以新建一个包括多个非关键任务的任务组,比如记作低优先级分组,并标记低优先级分组的关键程度为非关键。以及可以新建一个包括多个关键任务的任务组,并标记该任务组的关键程度为关键。In addition to the system default task group composed of existing background tasks, in one embodiment, a new task group can be customized as needed. For example, a new task group including multiple non-critical tasks can be created, such as a low priority group, and the criticality of the low priority group is marked as non-critical. And a new task group including multiple critical tasks can be created, and the criticality of the task group can be marked as critical.
一个实施例中,构建出的任意两个任务组的关键程度可以不同。另一实施例中,构建的任务组中,可以包括相同关键程度的至少两个任务组。In one embodiment, the criticality of any two task groups constructed may be different. In another embodiment, the constructed task groups may include at least two task groups with the same criticality.
在本申请一个实施例中,第一任务为包括一个或者多个子任务的任务组,第二任务为包括一个或者多个子任务的任务组;资源管控方法还包括:控制第一任务中的子任务运行时对电子设备的设备资源的总使用量,使得第一任务中的子任务运行时对电子设备的设备资源的总使用量不超过向第一任务分配的设备资源的量,以及控制第二任务中的子任务运行时对电子设备的设备资源的总使用量,使得第二任务中的子任务运行时对电子设备的设备资源的总使用量不超过向第二任务分配的设备资源的量。In one embodiment of the present application, the first task is a task group including one or more subtasks, and the second task is a task group including one or more subtasks; the resource management method also includes: controlling the total usage of device resources of the electronic device when the subtasks in the first task are running, so that the total usage of device resources of the electronic device when the subtasks in the first task are running does not exceed the amount of device resources allocated to the first task, and controlling the total usage of device resources of the electronic device when the subtasks in the second task are running, so that the total usage of device resources of the electronic device when the subtasks in the second task are running does not exceed the amount of device resources allocated to the second task.
任务组中的各个任务可以作为任务组的子任务。同一任务组中的各个任务的关键程度相一致,比如均为关键任务,或者任务的关键值相同,或者任务的关键等级相同,或者任务的关键值落入同一关键范围。Each task in a task group can be a subtask of the task group. The criticality of each task in the same task group is consistent, for example, they are all critical tasks, or the critical values of the tasks are the same, or the critical levels of the tasks are the same, or the critical values of the tasks fall into the same critical range.
任务组的关键程度可以与任务组中的任务的关键程度相一致。通过根据任务组的关键程度为任务组分配设备资源,以对任务组中的任务分配设备资源,对任务组中的任务所能使用的设备资源进行限制。The criticality of the task group can be consistent with the criticality of the tasks in the task group. By allocating equipment resources to the task group according to the criticality of the task group, equipment resources are allocated to the tasks in the task group, and the equipment resources that can be used by the tasks in the task group are restricted.
一个实施例中,为任务组分配设备资源后,任务组中的任务运行所能使用的设备资源总量,应不超过分配至任务组的设备资源量。其中,对任务组中不同任务对设备资源的使用情况可以不做限定,比如任务组中的各个任务均可竞争分配至任务组的设备资源。In one embodiment, after allocating device resources to a task group, the total amount of device resources that can be used by the tasks in the task group should not exceed the amount of device resources allocated to the task group. There may be no restrictions on the use of device resources by different tasks in the task group, for example, each task in the task group can compete for the device resources allocated to the task group.
通过以任务组为单位进行资源管控,可以对任务组内的任务的设备资源量进行统一限制,便于对相同关键程度任务进行统一的资源管控。通过控制非关键任务组对设备资源的消耗,可以将设备资源留给更关键的任务组来使用,提高更关键的任务的响应效率。By performing resource control based on task groups, the amount of equipment resources for tasks within the task group can be uniformly limited, making it easier to uniformly control resources for tasks of the same criticality. By controlling the consumption of equipment resources by non-critical task groups, equipment resources can be left for more critical task groups to use, thereby improving the response efficiency of more critical tasks.
一个实施例中,电子设备的系统并不会一直处于高负载状态。In one embodiment, the system of the electronic device is not always in a high load state.
考虑到系统低负载状态下,有限的设备资源通常可以支持各个任务的及时响应,各个任务可以不存在较长时间的待运行状态,在该情况下对任务执行的资源管控操作(比如对任务组的运行时间进行限制的操作)对电子设备系统性能的提升帮助不大,则可以仅在系统高负载状态下对任务进行资源管控,在系统低负载状态下不对任务进行资源管控。Considering that when the system is in a low-load state, limited device resources can usually support the timely response of each task, and each task may not be in a waiting state for a long time. In this case, the resource management operations performed on the tasks (such as limiting the running time of the task group) will not help much to improve the performance of the electronic device system. Therefore, resource management can be performed on the tasks only when the system is in a high-load state, and no resource management can be performed on the tasks when the system is in a low-load state.
一个实施例中,资源管控方法还可以包括:检测电子设备的负载;在检测到电子设备的负载达到预先设定的负载阈值的情况下,才执行上述步骤A,否则不执行上述步骤A。In one embodiment, the resource management method may further include: detecting the load of the electronic device; executing the above step A only when it is detected that the load of the electronic device reaches a preset load threshold, otherwise the above step A is not executed.
由于在设备负载较高时,可以直接根据分配至任务的设备资源量控制任务对设备资源的使用量,则可以对分配至任务的设备资源量进行周期性更新或者实时更新。Since the usage of device resources by a task can be directly controlled according to the amount of device resources allocated to the task when the device load is high, the amount of device resources allocated to the task can be updated periodically or in real time.
在本申请一个实施例中,资源管控方法还包括:检测电子设备的负载;在检测到电子设备的负载达到预先设定的负载阈值的情况下,执行获取电子设备中的第一任务的第一信息的步骤。即在检测到电子设备的负载达到预先设定的负载阈值的情况下,才执行步骤401,否则不执行步骤401。In one embodiment of the present application, the resource management method further includes: detecting the load of the electronic device; and when it is detected that the load of the electronic device reaches a preset load threshold, executing the step of acquiring the first information of the first task in the electronic device. That is, step 401 is executed only when it is detected that the load of the electronic device reaches a preset load threshold, otherwise step 401 is not executed.
由于在设备负载较高时,可以先向任务分配设备资源,再根据分配至任务的设备资源量控制任务对设备资源的使用量,则可以无需对分配至任务的设备资源量进行周期性更新或者实时更新。When the device load is high, device resources can be allocated to the task first, and then the usage of the device resources by the task is controlled according to the amount of device resources allocated to the task. Therefore, there is no need to update the amount of device resources allocated to the task periodically or in real time.
一个实施例中,可以实时或者周期性检测电子设备的负载(或称系统负载)。一个实施例中,电子设备的负载可以为电子设备运行所消耗的功率。In one embodiment, the load of the electronic device (or system load) can be detected in real time or periodically. In one embodiment, the load of the electronic device can be the power consumed by the operation of the electronic device.
若检测到的负载达到一定阈值时,才执行资源管控,以对任务使用的资源进行限制,若未达到阈值则不执行资源管控,不对任务使用的资源进行限制。If the detected load reaches a certain threshold, resource control is performed to limit the resources used by the task. If the threshold is not reached, resource control is not performed and the resources used by the task are not limited.
一个实施例中,负载阈值可以按需设定,比如可以根据经验值得到。In one embodiment, the load threshold can be set as needed, for example, based on empirical values.
通过考虑为任务分配设备资源的适用场景,可以在设备负载较重的情况下才开始进行设备资源管控。其中,在设备负载比较重的时候,给关键性较高的任务多分配运行时间(或称分配时间片),给关键性较低的任务少分配运行时间,而在设备负载比较轻的时候不为任务分配运行时间,使得各个任务都去运行。通过限定执行资源管控的生效时机,不仅可以保证任务的响应效率,保证电子设备的良好系统性能,还可简化管控流程。By considering the applicable scenarios for allocating device resources to tasks, device resource management can be started only when the device load is heavy. When the device load is heavy, more running time (or time slices) are allocated to tasks with higher criticality, and less running time is allocated to tasks with lower criticality. When the device load is light, no running time is allocated to tasks, so that all tasks can run. By limiting the effective time of execution resource management, not only can the response efficiency of tasks and the good system performance of electronic equipment be guaranteed, but also the management process can be simplified.
在本申请一个实施例中,第一任务为包括一个或者多个子任务的任务组,第二任务为包括一个或者多个子任务的任务组;资源管控方法还包括:根据任务管理请求,执行任务管理操作;其中,任务管理操作包括:设置第一信息的操作、设置第二信息的操作、删除第一任务的操作、删除第二任务的操作、删除第一任务中任一子任务的操作、删除第二任务中任一子任务的操作、向第一任务中新增子任务的操作、向第二任务中新增子任务的操作、新增包括一个或者多个子任务的第三任务的操作中的一个或者多个。In one embodiment of the present application, the first task is a task group including one or more subtasks, and the second task is a task group including one or more subtasks; the resource management method also includes: performing task management operations according to a task management request; wherein the task management operations include: one or more of the operations of setting first information, setting second information, deleting the first task, deleting the second task, deleting any subtask in the first task, deleting any subtask in the second task, adding a subtask to the first task, adding a subtask to the second task, and adding a third task including one or more subtasks.
以第一信息为例,一个实施例中,设置第一信息的操作可以为初次设置第一信息的操作。另一实施例中,设置第一信息的操作也可以为在初次设置第一信息后,对第一信息进行更新设置的操作。Taking the first information as an example, in one embodiment, the operation of setting the first information may be an operation of setting the first information for the first time. In another embodiment, the operation of setting the first information may also be an operation of updating the first information after the first information is set for the first time.
一个实施例中,在对第一信息进行更新设置的情况下,可以再次执行上述步骤401~步骤403,以更新分配至第一任务对设备资源的占用量。一个实施例中,可以基于任务关键程度的变化,执行相应的任务管理操作。比如,在某一任务的关键程度从关键变化为非关键时,可以将该任务从原有的关键分组转移至另一非关键分组。再比如,在某一任务组的关键程度发生变化时,可以更新对该任务组的关键程度描述信息的设置。In one embodiment, when the first information is updated, the above steps 401 to 403 can be performed again to update the amount of equipment resources occupied by the first task. In one embodiment, corresponding task management operations can be performed based on changes in the criticality of the task. For example, when the criticality of a task changes from critical to non-critical, the task can be transferred from the original critical group to another non-critical group. For another example, when the criticality of a task group changes, the setting of the criticality description information of the task group can be updated.
一个实施例中,可以基于实际应用需求,执行删除任务、增加任务、删除任务组、新增任务组等操作。In one embodiment, operations such as deleting tasks, adding tasks, deleting task groups, and adding new task groups can be performed based on actual application needs.
在本申请一个实施例中,在电子设备上安装的第一应用程序处于运行状态的情况下,第一任务包括用于响应第一操作的任务,第一操作为对第一应用程序的使用操作,第二任务包括不用于响应第一操作的任务。In one embodiment of the present application, when a first application installed on an electronic device is in operation, the first task includes a task for responding to a first operation, which is an operation of using the first application, and the second task includes a task not for responding to the first operation.
这一实施例可以适用于上述场景1。在上述场景1:应用程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。This embodiment can be applied to the above scenario 1. In the above scenario 1: in the application running scenario, compared with not performing resource control, the resource control method provided by this embodiment helps the electronic device to respond to user operations in a timely manner by allocating more device resources to key tasks, thereby helping to improve the user experience.
在本申请一个实施例中,在电子设备加载第二应用程序的过程中,第一任务包括用于加载第二应用程序的任务,第二任务包括不用于加载第二应用程序的任务。In one embodiment of the present application, during the process of the electronic device loading the second application, the first task includes a task for loading the second application, and the second task includes a task not for loading the second application.
这一实施例可以适用于上述场景2。在上述场景2:小程序的加载场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备快速加载小程序,从而有助于提升用户体验。This embodiment can be applied to the above scenario 2. In the above scenario 2: loading of mini-programs, compared with no resource control, the resource control method provided by this embodiment helps electronic devices to quickly load mini-programs by allocating more device resources to key tasks, thereby helping to improve user experience.
在本申请一个实施例中,在电子设备所加载的第三应用程序处于运行状态的情况下,第一任务包括用于响应第二操作的任务,第二操作为对第三应用程序的使用操作,第二任务包括不用于响应第二操作的任务。In one embodiment of the present application, when a third application loaded by the electronic device is in running state, the first task includes a task for responding to a second operation, the second operation is an operation of using the third application, and the second task includes a task not used to respond to the second operation.
这一实施例可以适用于上述场景3。在上述场景3:小程序的运行场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时响应用户操作,从而有助于提升用户体验。This embodiment can be applied to the above scenario 3. In the above scenario 3: in the running scenario of the applet, compared with not performing resource control, the resource control method provided by this embodiment helps the electronic device to respond to user operations in a timely manner by allocating more device resources to key tasks, thereby helping to improve the user experience.
在本申请一个实施例中,在电子设备启动电子设备上安装的第四应用程序的过程中,第一任务包括用于启动第四应用程序的任务,第二任务包括不用于启动第四应用程序的任务。In one embodiment of the present application, in the process of the electronic device launching a fourth application installed on the electronic device, the first task includes a task for launching the fourth application, and the second task includes a task not for launching the fourth application.
这一实施例可以适用于上述场景4。在上述场景4:应用程序的启动场景中,与不进行资源管控相比,该实施例提供的资源管控方法通过为关键任务分配更多的设备资源,有助于电子设备及时启动应用程序,从而有助于提升用户体验。This embodiment can be applied to the above scenario 4. In the above scenario 4: application startup scenario, compared with no resource control, the resource control method provided by this embodiment helps the electronic device to start the application in time by allocating more device resources to key tasks, thereby helping to improve the user experience.
一个实施例中,请参考图6,图6示出了一种分组负载管控系统,该分组负载管控系统可以包括实时负载监控模块601、控制模块602、分组管理模块603。In one embodiment, please refer to FIG. 6 , which shows a group load management and control system. The group load management and control system may include a real-time load monitoring module 601 , a control module 602 , and a group management module 603 .
实时负载监控模块601可以实时监控电子设备的负载。The real-time load monitoring module 601 can monitor the load of the electronic device in real time.
在监测到的负载达到预设的负载阈值时,即达到执行资源管控的生效时机时,控制模块602可以对电子设备中的各个任务组进行资源管控,比如可以限制任务组在单位调度窗口中的运行时间。其中,可以为关键任务组分配较长的运行时间,为非关键任务组分配较短的运行时间。When the monitored load reaches the preset load threshold, that is, when the resource control is effective, the control module 602 can perform resource control on each task group in the electronic device, such as limiting the running time of the task group in the unit scheduling window. Among them, a longer running time can be allocated to the critical task group, and a shorter running time can be allocated to the non-critical task group.
电子设备中的任务组可以通过对电子设备中的任务进行分组得到,同一任务组中的任务的关键程度相一致。The task group in the electronic device can be obtained by grouping the tasks in the electronic device, and the criticality of the tasks in the same task group is consistent.
请参考图6,电子设备中可以包括后台分组、低优先级分组和其他分组。其中,后台分组可以包括电子设备中现有的非关键后台任务,为系统默认分组。低优先级分组可以包括电子设备中的区别于后台任务的其他非关键任务,为系统新建分组。其他分组比如可以为一个任务组,可以包括电子设备中的关键任务,为系统新建分组。Please refer to Figure 6, the electronic device may include background groups, low priority groups and other groups. Among them, the background group may include existing non-critical background tasks in the electronic device, which is the system default group. The low priority group may include other non-critical tasks in the electronic device that are different from the background tasks, which is a new group for the system. Other groups may be, for example, a task group, which may include critical tasks in the electronic device, which is a new group for the system.
经资源管控,可以限制后台分组、低优先级分组的运行时间均为较短的运行时间,限制其他分组的运行时间为较长的运行时间。Through resource management and control, the running time of background groups and low-priority groups can be limited to a shorter running time, and the running time of other groups can be limited to a longer running time.
图6所示实施例可以利用当前系统现有的非关键默认分组、以及新建的低优先级任务分组等分组,并根据分组的关键程度限制对应分组的运行时间,来达到提升系统性能体验的目的。The embodiment shown in FIG6 can utilize the existing non-critical default groups of the current system and newly created low-priority task groups and other groups, and limit the running time of the corresponding groups according to the criticality of the groups, so as to achieve the purpose of improving the system performance experience.
以任务使用CPU资源为例,基于本申请任一实施例提供的资源管控实现方式,可以根据任务的关键程度为任务分配运行时间,为关键的任务多分配运行时间,为不太关键的任务少分配运行时间,如此可以为不同的任务分配与其关键程序相匹配的运行时间。Taking the use of CPU resources by tasks as an example, based on the resource management implementation method provided in any embodiment of the present application, running time can be allocated to tasks according to their criticality, with more running time allocated to critical tasks and less running time allocated to less critical tasks. In this way, different tasks can be allocated running time that matches their critical programs.
不同的运行时间运行相应不同的任务,如此不仅可以在CPU负载较高时保证关键任务的及时响应,通常还可使得CPUutil的值较小,有助于降低CPU功耗。其中,CPUutil可以表示CPU利用率。Running different tasks at different runtimes not only ensures timely response of key tasks when the CPU load is high, but also usually makes the value of CPUutil smaller, which helps reduce CPU power consumption. CPUutil can represent CPU utilization.
请参考以下公式(1)~(4),这四个公式示出了单位调度窗口内任务运行时间和频率关系的推导过程。基于这四个公式的所示内容,可以认为通过对单位调度窗口内的任务运行时间进行控制,可具体降低频率的效果,而CPU功耗主要受频率影响,如此可具有降低CPU功耗的效果。Please refer to the following formulas (1) to (4). These four formulas show the derivation process of the relationship between the task running time and frequency in the unit scheduling window. Based on the contents shown in these four formulas, it can be considered that by controlling the task running time in the unit scheduling window, the frequency effect can be specifically reduced, and the CPU power consumption is mainly affected by the frequency, so it can have the effect of reducing the CPU power consumption.
式中,TaskrunningTime表示任务归一化运行时间,delta表示时间变化值,curfreq表示CPU当前运行频率,maxfreq表示CPU最大运行频率,capacity表示CPU最大频率对应的能力,cpuload表示CPU负载,util即CPUutil表示CPU利用率,schedwindow表示单位调度窗口,Freq表示频率(准备调频到的频点),max表示最大利用率。In the formula, TaskrunningTime represents the normalized running time of the task, delta represents the time change value, curfreq represents the current operating frequency of the CPU, maxfreq represents the maximum operating frequency of the CPU, capacity represents the capacity corresponding to the maximum frequency of the CPU, cpuload represents the CPU load, util (i.e., CPUutil) represents the CPU utilization, schedwindow represents the unit scheduling window, Freq represents the frequency (the frequency point to be adjusted to), and max represents the maximum utilization.
一个实施例中,Freq可以反映CPU被使用的频率。In one embodiment, Freq may reflect the frequency at which the CPU is used.
基于本申请任一实施例提供的资源管控实现方式,可以对单位调度窗口内的任务运行时间进行控制,通过限制单位调度窗口内任务的运行时间可以降低频率(频率计算公式见上述公式(1)~(4)),而CPU功耗主要受频率影响,则通过限制单位调度窗口内任务的运行时间有助于降低CPU功耗。CPU功耗越低,电子设备充电一次所能使用的时长越长,CPU负载对动态功耗模型的影响越小。Based on the resource control implementation method provided in any embodiment of the present application, the task running time within the unit scheduling window can be controlled. By limiting the running time of tasks within the unit scheduling window, the frequency can be reduced (the frequency calculation formula is shown in the above formulas (1) to (4)). Since CPU power consumption is mainly affected by frequency, limiting the running time of tasks within the unit scheduling window helps to reduce CPU power consumption. The lower the CPU power consumption, the longer the electronic device can be used on a single charge, and the smaller the impact of the CPU load on the dynamic power consumption model.
本申请一个实施例还提供一种芯片,该任务处理芯片安装在电子设备(UE)中,芯片包括:处理器,其用于执行存储在存储器上的计算机程序指令,其中,当计算机程序指令被处理器执行时,触发芯片执行本申请任意方法实施例提供的方法步骤。An embodiment of the present application also provides a chip, which is installed in an electronic device (UE), and the chip includes: a processor, which is used to execute computer program instructions stored in a memory, wherein when the computer program instructions are executed by the processor, the chip is triggered to execute the method steps provided by any method embodiment of the present application.
本申请一实施例还提出了一种终端设备,终端设备包括通信模块、用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发终端设备执行本申请任意方法实施例提供的方法步骤。An embodiment of the present application also proposes a terminal device, which includes a communication module, a memory for storing computer program instructions, and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the terminal device is triggered to execute the method steps provided by any method embodiment of the present application.
本申请一实施例还提出了一种服务器设备,服务器设备包括通信模块、用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发服务器设备执行本申请任意方法实施例提供的方法步骤。An embodiment of the present application also proposes a server device, which includes a communication module, a memory for storing computer program instructions, and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the server device is triggered to execute the method steps provided by any method embodiment of the present application.
本申请一个实施例还提供一种电子设备,电子设备包括多根天线、用于存储计算机程序指令的存储器、用于执行计算机程序指令的处理器和通信装置(比如可以基于NR协议实现5G通信的通信模块),其中,当计算机程序指令被该处理器执行时,触发电子设备执行本申请任意方法实施例提供的方法步骤。An embodiment of the present application also provides an electronic device, which includes multiple antennas, a memory for storing computer program instructions, a processor for executing computer program instructions, and a communication device (such as a communication module that can implement 5G communication based on the NR protocol), wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method steps provided by any method embodiment of the present application.
具体的,在本申请一实施例中,一个或多个计算机程序被存储在上述存储器中,该一个或多个计算机程序包括指令,当该指令被上述设备执行时,使得上述设备执行本申请实施例所述的方法步骤。Specifically, in one embodiment of the present application, one or more computer programs are stored in the above-mentioned memory, and the one or more computer programs include instructions. When the instructions are executed by the above-mentioned device, the above-mentioned device executes the method steps described in the embodiment of the present application.
具体的,在本申请一实施例中,电子设备的处理器可以是片上装置SOC(System onChip,系统级芯片),该处理器中可以包括中央处理器(Central Processing Unit,CPU),还可以进一步包括其他类型的处理器。具体的,在本申请一实施例中,电子设备的处理器可以是PWM控制芯片。Specifically, in one embodiment of the present application, the processor of the electronic device may be a system on chip (SOC), which may include a central processing unit (CPU), and may further include other types of processors. Specifically, in one embodiment of the present application, the processor of the electronic device may be a PWM control chip.
具体的,在本申请一实施例中,涉及的处理器可以例如包括CPU、DSP(digitalsignal processor,数字信号处理器)或微控制器,还可包括GPU(graphics processingunit,图形处理器)、嵌入式神经网络处理器(Neural-network Process Units,NPU)和图像信号处理器(Image Signal Processing,ISP),该处理器还可包括必要的硬件加速器或逻辑处理硬件电路,如ASIC,或一个或多个用于控制本申请技术方案程序执行的集成电路等。此外,处理器可以具有操作一个或多个软件程序的功能,软件程序可以存储在存储介质中。Specifically, in one embodiment of the present application, the processor involved may include, for example, a CPU, a DSP (digital signal processor) or a microcontroller, and may also include a GPU (graphics processing unit), an embedded neural network processor (Neural-network Process Units, NPU) and an image signal processor (Image Signal Processing, ISP). The processor may also include necessary hardware accelerators or logic processing hardware circuits, such as ASIC, or one or more integrated circuits for controlling the execution of the program of the technical solution of the present application. In addition, the processor may have the function of operating one or more software programs, and the software programs may be stored in a storage medium.
具体的,在本申请一实施例中,电子设备的存储器可以是只读存储器(read-onlymemory,ROM)、可存储静态信息和指令的其它类型的静态存储设备、随机存取存储器(random access memory,RAM)或可存储信息和指令的其它类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者还可以是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何计算机可读介质。Specifically, in one embodiment of the present application, the memory of the electronic device may be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage devices, or may be any computer-readable medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer.
具体的,在本申请一实施例中,处理器可以和存储器可以合成一个处理装置,更常见的是彼此独立的部件,处理器用于执行存储器中存储的程序代码来实现本申请实施例所述方法。具体实现时,该存储器也可以集成在处理器中,或者,独立于处理器。Specifically, in an embodiment of the present application, the processor and the memory can be combined into a processing device, more commonly, they are independent components, and the processor is used to execute the program code stored in the memory to implement the method described in the embodiment of the present application. In specific implementation, the memory can also be integrated into the processor, or independent of the processor.
进一步的,本申请实施例阐明的设备、装置、模块,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。Furthermore, the devices, apparatuses, and modules described in the embodiments of the present application may be implemented by computer chips or entities, or by products having certain functions.
本领域内的技术人员应明白,本申请实施例可提供为方法、装置、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
在本申请所提供的几个实施例中,任一功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。In the several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
具体的,本申请一实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行本申请实施例提供的方法步骤。Specifically, in one embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is run on a computer, the computer executes the method steps provided in the embodiment of the present application.
本申请一实施例还提供一种计算机程序产品,该计算机程序产品包括计算机程序,当其在计算机上运行时,使得计算机执行本申请实施例提供的方法步骤。An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is run on a computer, the computer executes the method steps provided in the embodiment of the present application.
本申请中的实施例描述是参照根据本申请实施例的方法、设备(装置)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The embodiment description in the present application is described with reference to the flowchart and/or block diagram of the method, equipment (device) and computer program product according to the embodiment of the present application. It should be understood that each flow process and/or box in the flow chart and/or block diagram and the combination of the flow chart and/or box in the flow chart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processing machine or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart or multiple flows and/or one box or multiple boxes of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,可以是电性、机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机装置(可以是个人计算机,服务器,或者网络装置等)或处理器(Processor)执行本申请各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (Processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
本申请实施例中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。In the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
本申请中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
本领域普通技术人员可以意识到,本申请实施例中描述的各单元及算法步骤,能够以电子硬件、计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments of the present application can be implemented by a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211320767.3ACN117931418A (en) | 2022-10-26 | 2022-10-26 | Resource management method, device, chip, electronic device and medium |
| PCT/CN2023/114758WO2024087840A1 (en) | 2022-10-26 | 2023-08-24 | Resource management and control method and apparatus, chip, electronic device, and medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211320767.3ACN117931418A (en) | 2022-10-26 | 2022-10-26 | Resource management method, device, chip, electronic device and medium |
| Publication Number | Publication Date |
|---|---|
| CN117931418Atrue CN117931418A (en) | 2024-04-26 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211320767.3APendingCN117931418A (en) | 2022-10-26 | 2022-10-26 | Resource management method, device, chip, electronic device and medium |
| Country | Link |
|---|---|
| CN (1) | CN117931418A (en) |
| WO (1) | WO2024087840A1 (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101595456A (en)* | 2006-12-27 | 2009-12-02 | 莫尔It资源有限公司 | Method and system for transactional resource control |
| CN105320561A (en)* | 2015-11-09 | 2016-02-10 | 深圳市万普拉斯科技有限公司 | Task management method and system |
| CN106484537A (en)* | 2016-09-30 | 2017-03-08 | 网易(杭州)网络有限公司 | A kind of distribution method of CPU core resource and equipment |
| CN107526640A (en)* | 2017-08-17 | 2017-12-29 | 广东欧珀移动通信有限公司 | Resource management method, device, mobile terminal, and computer-readable storage medium |
| CN110806926A (en)* | 2019-09-05 | 2020-02-18 | 华为技术有限公司 | A resource management and control method and device |
| CN111831433A (en)* | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | Resource allocation method, device, storage medium and electronic device |
| CN113495787A (en)* | 2020-04-03 | 2021-10-12 | Oppo广东移动通信有限公司 | Resource allocation method, device, storage medium and electronic equipment |
| CN113495780A (en)* | 2020-04-07 | 2021-10-12 | Oppo广东移动通信有限公司 | Task scheduling method and device, storage medium and electronic equipment |
| CN113535340A (en)* | 2020-04-13 | 2021-10-22 | 荣耀终端有限公司 | Task scheduling method and device and electronic equipment |
| CN114461360A (en)* | 2022-01-11 | 2022-05-10 | 北京小米移动软件有限公司 | Thread control method, thread control device, terminal and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109388491A (en)* | 2018-08-23 | 2019-02-26 | 深圳点猫科技有限公司 | A kind of method and system for the picture fluency improving education operating system |
| US11106503B2 (en)* | 2019-04-26 | 2021-08-31 | Salesforce.Com, Inc. | Assignment of resources to database connection processes based on application information |
| CN110633137A (en)* | 2019-08-28 | 2019-12-31 | 北京安云世纪科技有限公司 | Method and device for starting installation package of application program and electronic equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101595456A (en)* | 2006-12-27 | 2009-12-02 | 莫尔It资源有限公司 | Method and system for transactional resource control |
| CN105320561A (en)* | 2015-11-09 | 2016-02-10 | 深圳市万普拉斯科技有限公司 | Task management method and system |
| CN106484537A (en)* | 2016-09-30 | 2017-03-08 | 网易(杭州)网络有限公司 | A kind of distribution method of CPU core resource and equipment |
| CN107526640A (en)* | 2017-08-17 | 2017-12-29 | 广东欧珀移动通信有限公司 | Resource management method, device, mobile terminal, and computer-readable storage medium |
| CN110806926A (en)* | 2019-09-05 | 2020-02-18 | 华为技术有限公司 | A resource management and control method and device |
| CN113495787A (en)* | 2020-04-03 | 2021-10-12 | Oppo广东移动通信有限公司 | Resource allocation method, device, storage medium and electronic equipment |
| CN113495780A (en)* | 2020-04-07 | 2021-10-12 | Oppo广东移动通信有限公司 | Task scheduling method and device, storage medium and electronic equipment |
| CN113535340A (en)* | 2020-04-13 | 2021-10-22 | 荣耀终端有限公司 | Task scheduling method and device and electronic equipment |
| CN111831433A (en)* | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | Resource allocation method, device, storage medium and electronic device |
| CN114461360A (en)* | 2022-01-11 | 2022-05-10 | 北京小米移动软件有限公司 | Thread control method, thread control device, terminal and storage medium |
| Publication number | Publication date |
|---|---|
| WO2024087840A1 (en) | 2024-05-02 |
| Publication | Publication Date | Title |
|---|---|---|
| CN112789651B (en) | A frequency adjustment method, device and electronic equipment applied to a terminal | |
| CN111813536B (en) | Task processing method, device, terminal and computer readable storage medium | |
| CN116680153B (en) | Application frame rate smoothing method, electronic device and storage medium | |
| CN111104209B (en) | A method for processing tasks and related equipment | |
| CN112527476B (en) | Resource scheduling method and electronic equipment | |
| CN112947947B (en) | Download method, distribution method, terminal equipment, server and system of installation package | |
| WO2020042112A1 (en) | Terminal and method for evaluating and testing ai task supporting capability of terminal | |
| CN115292052B (en) | Memory reclamation method, electronic device and computer-readable storage medium | |
| CN114968540A (en) | A Frequency Adjustment Method for Internuclear Migration | |
| WO2021052139A1 (en) | Gesture input method and electronic device | |
| CN117130773B (en) | Resource allocation method, device and equipment | |
| WO2021238376A1 (en) | Function pack loading method and apparatus, and server and electronic device | |
| WO2022078105A1 (en) | Memory management method, electronic device, and computer-readable storage medium | |
| WO2021052070A1 (en) | Frame rate identification method and electronic device | |
| CN117687772B (en) | Algorithm scheduling method and electronic equipment | |
| WO2022100141A1 (en) | Plug-in management method, system and apparatus | |
| CN114461589B (en) | Method for reading compressed file, file system and electronic equipment | |
| CN116567132B (en) | Power consumption control method and device | |
| CN116048831A (en) | A target signal processing method and electronic equipment | |
| CN113656089B (en) | Class Validation Methods and Devices in Applications | |
| WO2025036044A1 (en) | Resource scheduling method and apparatus, and electronic device | |
| WO2025026077A1 (en) | Method and apparatus for starting application program, and electronic device | |
| CN116089057B (en) | Resource scheduling method, device, storage medium and program product | |
| CN116048772B (en) | Central processing unit frequency adjustment method, device and terminal equipment | |
| WO2024087840A1 (en) | Resource management and control method and apparatus, chip, electronic device, and medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information | ||
| CB02 | Change of applicant information | Country or region after:China Address after:Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040 Applicant after:Honor Terminal Co.,Ltd. Address before:3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong Applicant before:Honor Device Co.,Ltd. Country or region before:China |