Processor resource allocation based on resource allocation error
In a method for resource management, a plurality of application processes is received. At least a processor is allocated to the plurality of application processes. For each of the plurality of application processes allocated to the processor, a quantity of remaining available resources for the respective application process in current predetermined resources of the processor is determined. The quantity of remaining available resources is associated with a quantity of remaining available resources for the respective application process in previous predetermined resources of the processor. A resource allocation command for each of the plurality of application processes is determined based on the quantity of remaining available resources for the respective application process in the current predetermined resources. The resource allocation command indicates whether the respective application process is processed.
1 . A method for resource management, the method comprising:
allocating a processor to the plurality of one or more application processes;
registering, by processing circuitry executing a scheduling process and for each of the one or more application processes, a respective resource requirement weight;
obtaining, for each of the one or more application processes and from a previous resource usage, a quantity of remaining available resources of the processor for the respective application process based on an initial resource allocation allocated by the resource requirement weight of the respective application process;
determining, by the processing circuitry for each of the one or more application processes, a quantity of remaining available resources of the processor for the respective application process in a current resource allocation based on a resource allocation error determined according to the respective quantity of remaining available resources of the processor from the previous resource usage; and
processing, for each of the one or more application processes, a respective resource allocation command based on the quantity of remaining available resources of the processor for the respective application process in the current resource allocation.
2 . The method according to claim 1 , wherein the processor includes a graphics processing unit (GPU).
3 . The method according to claim 1 , wherein the determining, for each of the one or more application processes, the quantity of remaining available resources in the current resource allocation is based on:
a first error between the resource requirement weight of the respective application process and a proportion of resources corresponding to the quantity of the remaining available resources of the processor for the respective application process from the previous resource usage,
a second error between the resource requirement weight of the respective application process and a proportion of resources corresponding to the quantity of the remaining available resources of the processor for the respective application process in the current resource allocation, and
the first error being greater than the second error.
4 . The method according to claim 3 , wherein
the resource requirement weight of each of the one or more application processes indicates a proportion of a required resource quantity of the respective application process, and
the allocating the processor includes:
determining an available resource proportion of each of a plurality of processors, the available resource proportion being a proportion of resources available for processing in the respective processor; and
determining the processor from the plurality of processors to be allocated to the one or more application processes based on the resource requirement weight of each of the one or more application processes and the available resource proportions of the plurality of processors, a sum of the resource requirement weights of the one or more application processes to which the processor is allocated being not greater than the available resource proportion of the processor.
5 . The method according to claim 3 , wherein
the resource allocation command indicates whether a corresponding application process of the one or more application processes is arranged to transmit a processing task to be processed by the processor, the processing of the processing task by the processor corresponding to use of resources of the processor by the corresponding application process;
the determining the quantity of the remaining available resources for the respective application process in the current resource allocation includes determining a first increment corresponding to previous processing of the processing task from the respective application process by the processor.
6 . The method according to claim 5 , wherein the determining the first increment comprises:
determining the first increment based on a processing type of the processing task by the processor, the processing type being at least one of synchronous rendering or asynchronous rendering.
7 . The method according to claim 6 , wherein the determining the first increment comprises:
determining the first increment by marking a start and an end of the previous processing when the processing type is the asynchronous rendering.
8 . The method according to claim 6 , wherein the determining the first increment comprises:
obtaining the first increment from the processor by using a query instruction when the processing type is the synchronous rendering.
9 . The method according to claim 5 , wherein the processing, for each of the one or more application processes, the respective resource allocation command comprises:
determining that the resource allocation command for a first application process of the one or more application processes indicates non-processing of the first application process when the quantity of remaining available resources for the first application process in the current resource allocation is not greater than zero; and
determining, for each of the one or more application processes having more than zero remaining available resources in the current resource allocation, the resource allocation command for the respective application process based on a priority of each of the one or more application processes having more than zero remaining available resources in the current resource allocation.
10 . The method according to claim 9 , wherein
the priority of each of the one or more application processes having more than zero remaining available resources in the current resource allocation is associated with a time length in which the respective application process waits to be processed and a time order in which a latest first increment thereof is determined, and
the determining the resource allocation command for the respective application process based on the priority of each of the one or more application processes includes:
determining the resource allocation command for the respective application process based on the time order in which a latest first increment of the respective application process is determined in a presence of an application process waiting to be processed in a time length satisfying a predetermined condition; and
determining, in an absence of the application process waiting to be processed in the time length satisfying the predetermined condition, the resource allocation command for the respective application process based on the time order in which the latest first increment of the respective application process is determined.
11 . A non-transitory computer-readable storage medium, storing instructions which when executed by processing circuitry cause the processing circuitry to perform the method according to claim 1 .
12 . A method for resource management, the method comprising:
starting a scheduling process, the scheduling process including an allocation thread and a plurality of processing threads corresponding to a plurality of application processors;
starting a plurality of application processes, each of the plurality of application processes including a scheduling library pre-configured by the scheduling process;
allocating, for each of the plurality of application processes, one processor in the plurality of processors and the processing thread corresponding to the one processor to the respective application process through the scheduling library of the respective application process and the allocation thread;
registering, via the scheduling process and for each of the plurality of application processes, a respective resource requirement weight;
obtaining, for each of the plurality of application processes and from a previous resource usage, a quantity of remaining available resources of the corresponding processor for the respective application process based on an initial resource allocation allocated by the resource requirement weight of the respective application process;
determining, for each of the plurality of application processes, a quantity of remaining available resources of the corresponding processor for the respective application process in a current resource allocation based on a resource allocation error determined according to the respective quantity of remaining available resources of the processor from the previous resource usage; and
processing, for each of the plurality of application processes, a respective resource allocation command based on the quantity of remaining available resources for the respective application process in the current resource allocation.
13 . The method according to claim 12 , wherein the plurality of processors includes a graphics processing unit (GPU).
14 . A non-transitory computer-readable storage medium, storing instructions which when executed by a processing circuitry cause the processing circuitry to perform the method according to claim 12 .
15 . A resource management apparatus, comprising:
processing circuitry configured to:
allocate a processor to one or more application processes;
register, by executing a scheduling process and for each of the one or more application processes, a respective resource requirement weight;
obtain, for each of the one or more application processes and from a previous resource usage, a quantity of remaining available resources of the processor for the respective application process based on an initial resource allocation allocated by the resource requirement weight of the respective application process;
determine, for each of the one or more application processes, a quantity of remaining available resources of the processor for the respective application process in a current resource allocation based on a resource allocation error determined according to the respective quantity of remaining available resources of the processor from the previous resource usage; and
process, for each of the one or more application processes, a respective resource allocation command based on the quantity of remaining available resources of the processor for the respective application process in the current resource allocation.
16 . The resource management apparatus according to claim 15 , wherein the processor includes a graphics processing unit (GPU).
17 . The resource management apparatus according to claim 15 , wherein the quantity of remaining available resources in the current resource allocation for each of the one or more application processes is determined based on:
a first error between the resource requirement weight of the respective application process and a proportion of resources corresponding to the quantity of the remaining available resources of the processor for the respective application process from the previous resource usage,
a second error between the resource requirement weight of the respective application process and a proportion of resources corresponding to the quantity of the remaining available resources of the processor for the respective application process in the current resource allocation, and
the first error being greater than the second error.
18 . The resource management apparatus according to claim 17 , wherein
the resource requirement weight of each of the one or more application processes indicates a proportion of a required resource quantity of the respective application process, and
the processing circuitry is configured to:
determine an available resource proportion of each of a plurality of processors, the available resource proportion being a proportion of resources available for processing in the respective processor; and
determine the processor from the plurality of processors to be allocated to the one or more application processes based on the resource requirement weight of each of the one or more application processes and the available resource proportions of the plurality of processors, a sum of the resource requirement weights of the one or more application processes to which the processor is allocated being not greater than the available resource proportion of the processor.
19 . The resource management apparatus according to claim 17 , wherein
the resource allocation command indicates whether a corresponding application process of the one or more application processes is arranged to transmit a processing task to be processed by the processor, the processing of the processing task by the processor corresponding to use of resources of the processor by the corresponding application process, and
to determine the quantity of the remaining available resources for the respective application process in the current resource allocation, the processing circuitry is configured to determine a first increment corresponding to previous processing of the processing task from the respective application process by the processor.
20 . The resource management apparatus according to claim 19 , wherein the processing circuitry is configured to:
determine the first increment based on a processing type of the processing task by the processor, the processing type being at least one of synchronous rendering or asynchronous rendering.