Resource allocation method, storage medium and terminal device
By obtaining service processes and available resource data in the terminal device, determining the resource allocation policy set and optimizing allocation, the lag caused by insufficient resources is solved, and resource utilization and overall performance are improved.
Patent Information
- Application Number
- CN202010313629.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-20
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-04-20
AI Technical Summary
When a terminal device requests resources at the same time when multiple tasks are requested, insufficient hardware resources lead to uneven resource allocation, affecting the operation of other tasks, and causing user operations to be stuttered.
By obtaining the available resource data of the service process that requests resources and the terminal equipment, determining the resource allocation policy set of each service process, and selecting the target resource allocation strategy based on resource utilization and benefits, realizing optimized resource allocation.
It improves the utilization rate of terminal device resources, avoids lags in other service processes caused by a large amount of resources occupied by a service process, and realizes the global optimal resource allocation of the service process.
Smart Images

Figure CN113535378B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of terminal equipment, and in particular to a resource allocation method, a storage medium and a terminal equipment. Background Art
[0002] With the continuous development of terminal devices, the functions of terminal devices are also becoming stronger. At the same time, the hardware requirements for terminal devices are also increasing, for example, the requirements for memory and CPU, especially embedded devices often have the problem of insufficient hardware resources (such as low memory and CPU performance). When multiple tasks request resources from the terminal device at the same time, the available resources of the terminal device itself cannot meet the required resources of all tasks, and the resources will be concentrated on a certain task, affecting the use of other personnel and causing user operation jams. For example, when obtaining multiple pictures from the terminal device at the same time, the terminal device allocates a large amount of CPU and memory resources to the picture download task, affecting the use of other background programs and causing user operation jams. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a resource allocation method, a storage medium and a terminal device in view of the deficiencies of the prior art.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:
[0005] A resource allocation method, wherein the method comprises:
[0006] Acquire a plurality of service processes requesting resources and available resource data configured by the terminal device, wherein each of the plurality of service processes includes the requested resource data;
[0007] For each service process, determining a resource allocation strategy set corresponding to the service process according to the available resource data and the requested resource data corresponding to the service process;
[0008] In the resource allocation strategy set corresponding to each service process, a preset number of candidate resource allocation strategies are selected to form a resource strategy set corresponding to each service process;
[0009] The target resource allocation strategy corresponding to the terminal device is determined according to the resource strategy set corresponding to each service process, and resources are allocated according to the target resource allocation strategy.
[0010] The resource allocation method, wherein the requested resource data includes several requested resource types and the requested quantities corresponding to each requested resource type, and the available resource data includes several available resource types and the available quantities corresponding to each available resource type, wherein the several available resource types include the several requested resource types.
[0011] The resource allocation method, wherein for each service process, determining the resource allocation strategy set corresponding to the service process according to the available resource data and the requested resource data corresponding to the service process specifically includes:
[0012] For each requested resource type in each service process, determining a resource quantity threshold according to the request quantity corresponding to the requested resource type and the available quantity corresponding to the target available resource type, wherein the target available resource type is the same as the requested resource type;
[0013] Selecting a number of resource allocation quantities for each requested resource type, wherein each of the number of resource allocation quantities is different from each other, and each resource allocation quantity is less than or equal to a resource quantity threshold corresponding to the requested resource type;
[0014] The resource allocation quantities corresponding to each requested resource type are combined to obtain a resource allocation strategy set corresponding to the service process, wherein the resource allocation strategy set includes a plurality of resource allocation strategies, and each of the plurality of resource allocation strategies is different from each other.
[0015] The resource allocation method, wherein the resource allocation strategy set includes several resource allocation strategies, and each of the several resource allocation strategies has at least one resource classification quantity corresponding to a requested resource type that is not zero.
[0016] The resource allocation method, wherein the step of selecting a preset number of candidate resource allocation strategies from the resource allocation strategy set corresponding to each service process to form a resource strategy set corresponding to each service process specifically includes:
[0017] For each service process, calculate the resource utilization rate corresponding to each resource allocation strategy in the resource allocation strategy set corresponding to the service process;
[0018] In the order of the utilization rates of each resource from large to small, a preset number of resource allocation strategies are selected from the resource allocation strategy set corresponding to the service process to form a resource strategy set corresponding to the service process.
[0019] The resource allocation method, wherein determining a target resource allocation strategy corresponding to a terminal device according to a resource strategy set corresponding to each service process, and performing resource allocation according to the target resource allocation strategy specifically comprises:
[0020] Selecting a candidate allocation strategy from the resource strategy set corresponding to each service process to form a plurality of candidate allocation strategy combinations;
[0021] Calculate the resource benefits of each candidate allocation strategy combination respectively, and determine the target resource allocation strategy based on all resource benefits;
[0022] Resource allocation is performed according to the target resource allocation strategy.
[0023] The resource allocation method, wherein the target resource allocation strategy is a resource allocation strategy with the highest resource benefit.
[0024] The resource allocation method, wherein the step of selecting a candidate allocation strategy from a resource strategy set corresponding to each service process to form a combination of several candidate allocation strategies specifically includes:
[0025] For each service process, a candidate allocation strategy is selected from the resource strategy set corresponding to the service process;
[0026] Combining the candidate allocation strategies selected by each service process to obtain a candidate allocation strategy combination;
[0027] Repeat the step of selecting a candidate allocation strategy from the resource strategy set corresponding to each service process, until all combinations of candidate allocation strategies in each service process are obtained, so as to obtain several candidate allocation strategy combinations, wherein each candidate allocation strategy combination in the several candidate allocation strategy combinations is different from each other.
[0028] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any of the resource allocation methods described above.
[0029] A terminal device comprises: a processor, a memory and a communication bus; the memory stores a computer-readable program executable by the processor;
[0030] The communication bus realizes the connection and communication between the processor and the memory;
[0031] When the processor executes the computer-readable program, the steps in any of the resource allocation methods described above are implemented.
[0032] Beneficial effects: Compared with the prior art, the present invention provides a resource allocation method, storage medium and terminal device, which obtains a number of service processes requesting resources and the available resource data configured by the terminal device to determine a preset number of candidate resource allocation strategies for each service process, and then determines the target resource allocation strategy corresponding to the terminal device according to the resource strategy set corresponding to each service process, and allocates resources according to the target resource allocation strategy. In this way, the global optimization of each service process under the terminal device can be achieved on the basis of achieving the optimal local resource utilization of the service process, thereby improving the utilization of resources in the terminal device and avoiding the problem of other service processes being stuck due to a certain service process occupying a large amount of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 The present invention provides a flow chart of the resource allocation method.
[0034] Figure 2 This is a structural principle diagram of the terminal device provided by the present invention. DETAILED DESCRIPTION
[0035] The present invention provides a resource allocation method, storage medium and terminal device. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.
[0036] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0037] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0038] This embodiment provides a resource allocation method, which can be applied to an electronic device with a front camera or a rear camera function, and the electronic device can be implemented in various forms. For example, a PC, a server, a mobile phone, a tablet computer, a PDA, etc. In addition, the function implemented by the method can be implemented by calling a program code by a processor in the electronic device, and of course the program code can be stored in a computer storage medium. It can be seen that the electronic device at least includes a processor and a storage medium.
[0039] like Figure 1 As shown, this implementation provides a resource allocation method, which may include the following steps:
[0040] S10. Acquire several service processes requesting resources and available resource data configured by the terminal device, wherein each of the several service processes includes requested resource data.
[0041] Specifically, the several service processes are service processes running in the terminal device that need to obtain resources from the terminal device. Each of the several service processes is a task that the terminal device needs to execute. The requested resource data includes several requested resource types and the request quantity corresponding to each requested resource type, that is, the requested resource data includes the resource types of all resources that the service process needs to request and the quantity corresponding to each resource type. For example, the requested resource data corresponding to service process A is memory 3, CPU 2, and bandwidth 1, then the requested resource types that service process A needs to request are memory, CPU, and bandwidth, respectively, wherein the request quantity corresponding to the memory is 3, the request data corresponding to the CPU is 2, and the request data corresponding to the bandwidth is 1.
[0042] The available resource data includes several available resource types and the available quantity corresponding to each available resource type, wherein the several available resource types include several requested resource types. It can be understood that each service process requests the terminal device for resources that the terminal device can provide. For example, the several available resource types may include memory, CPU, and bandwidth, and the corresponding requested resource types of service process B include memory and CPU. Of course, it is worth noting that the several available resource types included in the available resource data are all available resource types that can be provided by the terminal device, and the terminal device can obtain the available resource data by reading its own configuration information.
[0043] S20: For each service process, determine a resource allocation policy set corresponding to the service process according to the available resource data and the requested resource data corresponding to the service process.
[0044] Specifically, the resource allocation strategy set includes several resource allocation strategies, each of which is a way for the terminal device to allocate resources to the service process, and the resource allocation strategy includes the number of resources allocated by the terminal device for the resources corresponding to each requested resource type, which is recorded as the allocated resource quantity. It can be understood that each resource allocation strategy includes the allocated resource quantity corresponding to each requested resource type, and the resource quantity corresponding to each requested resource type that the terminal device needs to allocate to the service process can be determined based on the resource allocation strategy. For example, the requested resource types of service process A are memory, CPU, and bandwidth, respectively, and the resource allocation strategy corresponding to the service process includes the allocated resource quantity A corresponding to the memory, the allocated resource quantity B corresponding to the CPU, and the allocated resource quantity C corresponding to the bandwidth.
[0045] In an implementation of this embodiment, for each service process, determining the resource allocation strategy set corresponding to the service process according to the available resource data and the requested resource data corresponding to the service process specifically includes:
[0046] S21. For each requested resource type in each service process, determine a resource quantity threshold value according to the request quantity corresponding to the requested resource type and the available quantity corresponding to the target available resource type, wherein the target available resource type is the same as the requested resource type;
[0047] S22, selecting a number of resource allocation quantities for each requested resource type, wherein each of the number of resource allocation quantities is different from each other, and each resource allocation data is less than or equal to a resource quantity threshold corresponding to the requested resource type;
[0048] S23. Combining several resource allocation quantities corresponding to each requested resource type to obtain a resource allocation strategy set corresponding to the service process, wherein the resource allocation strategy set includes several resource allocation strategies, and each resource allocation strategy in the several resource allocation strategies is different from each other.
[0049] Specifically, in step S21, the resource quantity threshold is the maximum number of resources that the terminal device can allocate for the requested resource type. For example, if the resource data threshold corresponding to the memory in service process A is 5, then the terminal device can allocate a maximum of 5 memories for service process A. In this embodiment, the resource quantity threshold is determined based on the request quantity corresponding to the requested resource type and the available quantity corresponding to the target available resource type, wherein the target available resource type is an available resource type that is the same as the requested resource type among several available resource types. For example, if the requested resource type is memory, then the target available resource type is also memory.
[0050] Furthermore, when determining the resource quantity threshold value based on the request quantity and the available quantity, the request quantity may be used as the resource quantity threshold value, the available quantity may be used as the resource data threshold value, or the minimum value between the request quantity and the available quantity may be used as the resource data threshold value. In one implementation of this embodiment, the minimum value between the request quantity and the available quantity is used as the resource data threshold value. Thus, after obtaining the request quantity corresponding to the requested resource type and the available quantity corresponding to the target available resource type, the obtained request quantity may be compared with the obtained available quantity, and the smaller of the two may be selected as the resource data threshold value. For example, when the request quantity is greater than or equal to the available quantity, the available quantity is used as the resource quantity threshold value; conversely, when the request quantity is less than the available quantity, the request quantity is used as the resource quantity threshold value.
[0051] Further, in step S22, the resource allocation quantity is the resource quantity allocated by the terminal device for the resource request, each of the several resource allocation quantities is greater than or equal to 0, and less than or equal to the resource quantity threshold, and the resource allocation quantities are different from each other. It can be understood that each resource allocation quantity is a quantity between 0 and the resource quantity threshold, for example, if the resource quantity threshold is 3, then the resource allocation quantity can be 1, 2, etc. In addition, the number of the several resource allocation quantities can be less than the number of all integers between 0 and the resource quantity threshold, and can also be equal to the number of all integers between 0 and the resource quantity threshold, wherein all integers between 0 and the resource quantity threshold include 0 and the resource quantity threshold.
[0052] In one implementation of this embodiment, the number of resource allocation quantities is equal to the number of all integers between 0 and the resource quantity threshold, that is, the resource allocation quantities may be 0, 1, ..., N, where N is the resource quantity threshold. Thus, for each resource type requested by the service process, a number of resource allocation data may be obtained. For example, if the resource types requested by service process A include memory and CPU, the resource quantity threshold corresponding to the memory is 2, and the resource quantity threshold corresponding to the CPU is 3, then the resource allocation quantities corresponding to the memory are 0, 1, and 2, respectively, and the resource allocation quantities corresponding to the CPU are 0, 1, 2, and 3, respectively.
[0053] Further, in the step S23, after obtaining a number of resource allocation quantities corresponding to each requested resource type, the number of resource allocation quantities corresponding to each requested resource is taken as an allocation quantity set, and then a resource allocation quantity is randomly selected from each allocation quantity set for combination to obtain a number of resource allocation strategies, and the obtained number of resource allocation strategies constitute the resource allocation strategy set of the service process, wherein the resource allocation strategies in the resource allocation strategy set are different from each other. Of course, it is worth noting that each of the several resource allocation strategies has at least one resource classification quantity corresponding to a requested resource type that is not zero, that is, the resource allocation strategy set does not include a resource allocation strategy in which the resource allocation quantities corresponding to each requested resource type are all 0, that is, there is at least one resource allocation quantity corresponding to a requested resource type in the resource allocation strategy that is not zero.
[0054] For example: service process A requests resources including memory and CPU. The allocation quantity set corresponding to memory is {0, 1, 2}, and the allocation quantity set corresponding to CPU is {0, 1, 2, 3}. Then the resource allocation strategy corresponding to service process A can be expressed in the form of (memory quantity, CPU quantity). Then the resource allocation strategies corresponding to the service processes are (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2) and (2, 3). Then the resource allocation strategy set corresponding to service process A is {(0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)}.
[0055] S30. Selecting a preset number of candidate resource allocation strategies from the resource allocation strategy set corresponding to each service process to form a resource strategy set corresponding to each service process.
[0056] Specifically, the preset number may be pre-set, or may be determined according to the number of resource allocation policies in the resource allocation policy set, for example, the preset number is half of the resource allocation policy, etc. In addition, the preset number of candidate resource allocation resources may be randomly selected from the resource allocation policy set, or may be selected according to preset conditions, for example, selected according to resource utilization rates corresponding to the resource allocation policies, etc.
[0057] In an implementation of this embodiment, selecting a preset number of candidate resource allocation strategies from the resource allocation strategy set corresponding to each service process to form a resource strategy set corresponding to each service process specifically includes:
[0058] S31. For each service process, calculate the resource utilization rate corresponding to each resource allocation strategy in the resource allocation strategy set corresponding to the service process;
[0059] S32. Selecting a preset number of resource allocation strategies from the resource allocation strategy set corresponding to the service process in descending order of resource utilization, so as to form a resource strategy set corresponding to the service process.
[0060] Specifically, in step S31, the resource utilization is the minimum value of the first resource utilization corresponding to each request resource type in the service process, and the first resource utilization corresponding to each request resource type is calculated according to the available quantity of the available resource type corresponding to the resource request type and the allocated resource quantity corresponding to the request resource type in the resource allocation policy. Thus, the process of calculating the resource utilization corresponding to each resource allocation strategy in the resource allocation strategy set corresponding to the service process may include: for each resource allocation strategy of the service process, obtaining the resource allocation quantity corresponding to each request resource type in the resource allocation strategy, the actual usage quantity of the request resource type in the service process, and the available quantity corresponding to the request type; and calculating the first resource utilization corresponding to the request type according to the resource allocation quantity, the actual usage quantity and the available quantity. Among them, the actual usage quantity refers to the sum of the usage quantities allocated by the service process for each request task corresponding to itself. It can be understood that each service process corresponds to multiple tasks, each task requests resources from the service process, and the usage quantity is the resource quantity allocated by the service process for each task, and the actual usage quantity is the sum of the usage quantities corresponding to the request resource type allocated to all tasks in the service process.
[0061] In an implementation of this embodiment, the calculation formula of the first resource utilization rate may be:
[0062]
[0063] in, Indicates service process mi The first resource utilization of the requested resource type K, R k (m i ) indicates the service process m i The number of resource allocations of the requested resource type K, Indicates service process m i The usage quantity of requested resource type K allocated for task t, PM k (m i ) indicates the available quantity corresponding to the requested resource type K.
[0064] Furthermore, for each resource allocation strategy, after the first resource utilization corresponding to each requested resource type is calculated, the minimum first resource utilization among the first resource utilizations is selected, and the minimum first resource utilization is used as the resource utilization corresponding to the resource allocation strategy. The expression can be:
[0065]
[0066] in, Indicates service process m i The first resource utilization of the requested resource type k, R k (m i ) indicates the service process m i The number of resource allocations of requested resource type k, Indicates service process m i The usage quantity of requested resource type k allocated for task t, PM k (m i ) indicates the available quantity corresponding to the requested resource type K.
[0067] Further, in step S32, after obtaining the resource utilization rate corresponding to each resource allocation strategy, in the resource allocation strategy set, a preset number of resource allocation strategies are selected in descending order according to the resource utilization rate corresponding to each resource allocation strategy, and a resource strategy set is formed according to the selected preset number of resource allocation strategies, wherein the resource strategy set includes the selected preset number of resource allocation strategies. The preset number is a pre-set positive integer, such as 3, 4, etc. Of course, in actual applications, the preset number can be determined according to the number of service processes actually in use. When the number of service processes is large, the preset number can be small; conversely, when the number of service processes is small, the preset number can be large.
[0068] S40: Determine a target resource allocation strategy corresponding to the terminal device according to a resource strategy set corresponding to each service process, and perform resource allocation according to the target resource allocation strategy.
[0069] Specifically, the target resource allocation strategy refers to the strategy finally determined by the terminal device to allocate resources to each service process. That is to say, the target resource allocation strategy includes the allocation quantity corresponding to each requested resource type in each service process, and the terminal device will allocate resources corresponding to each requested resource type to the service process according to the allocation quantity.
[0070] In an implementation of this embodiment, determining a target resource allocation policy corresponding to a terminal device according to a resource policy set corresponding to each service process, and performing resource allocation according to the target resource allocation policy specifically includes:
[0071] Selecting a candidate allocation strategy from the resource strategy set corresponding to each service process to form a plurality of candidate allocation strategy combinations;
[0072] Calculate the resource benefits of each candidate allocation strategy combination respectively, and determine the target resource allocation strategy based on all resource benefits;
[0073] Resource allocation is performed according to the target resource allocation strategy.
[0074] Specifically, each of the several candidate allocation strategy combinations includes a candidate allocation strategy for each service process, which is a resource allocation strategy in the resource strategy set corresponding to the service process, and any two of the several candidate allocation strategy combinations have at least one service process whose corresponding resource allocation strategy is different. For example, the service process is divided into service process A and service process B. The resource policy set corresponding to service process A includes resource allocation policy A1, resource allocation policy B1 and resource allocation policy C1; the resource policy set corresponding to service process B includes resource allocation policy A2, resource allocation policy B2 and resource allocation policy C2; then when candidate allocation policy combination A among several candidate allocation policy combinations is composed of resource allocation policy A1 and resource allocation policy A2, other candidate allocation policy combinations among the several candidate allocation policy combinations cannot be composed of resource allocation policy A1 and resource allocation policy A2, such as candidate allocation policy combination B among several candidate allocation policy combinations, candidate allocation policy combination B cannot be composed of resource allocation policy A1 and resource allocation policy A2, it can be composed of resource allocation policy A1 and resource allocation policy B2, it can be composed of resource allocation policy A1 and resource allocation policy C2, etc.
[0075] Furthermore, the calculation formula for the resource benefit of the candidate allocation strategy combination can be:
[0076]
[0077]
[0078] Among them, A represents the resource allocation strategy combination, m i represents the i-th service process, r ik Indicates service process m i The number of resources required by task t for the requested resource type k; R k (m i ) indicates the service process m i The number of resource allocations of the requested resource type k; RT i For service process m i The corresponding maximum response time, ERT i For service process m i The corresponding response time, Cost i For service process m i The corresponding maximum cost; For service process m i The resource benefit is expressed as:
[0079]
[0080] Among them, β represents the weight relationship parameter between fairness and resource utilization, β∈[0,1); v(A) is the fairness deviation value, ske(m i ) is the utilization skewness of the resource type on the terminal device, A represents the resource allocation strategy, and m i represents the i-th service process, Indicates service process m i The first resource utilization of the requested resource type k, For service process m i The average value of the first resource utilization of all corresponding request resource types; K is the service process m i The number of all corresponding requested resource types; R k (m i ) indicates the service process m i The number of resource allocations for the requested resource type k; λ, α are the allocation coefficients.
[0081] Further, in an implementation of this embodiment, selecting a candidate allocation strategy from the resource strategy set corresponding to each service process to form a plurality of candidate allocation strategy combinations specifically includes:
[0082] Combining the candidate allocation strategies selected by each service process to obtain a candidate allocation strategy combination;
[0083] Repeat the step of selecting a candidate allocation strategy from the resource strategy set corresponding to each service process, until all combinations of candidate allocation strategies in each service process are obtained, so as to obtain several candidate allocation strategy combinations, wherein each candidate allocation strategy combination in the several candidate allocation strategy combinations is different from each other.
[0084] Specifically, after the resource policy set corresponding to each service process is obtained, a resource policy is randomly selected from each resource policy set for combination to obtain several resource policy combinations. For example, several service processes include service process A and service process B; the request resource types corresponding to service process A and service process B are both memory and CPU, and the resource allocation policies corresponding to service process A and service process B can be expressed in the form of (memory quantity, CPU quantity). Assuming that the resource policy set corresponding to service process A is {(0,1), (1,2)}, and the resource policy set corresponding to service process B is {(1,1), (2,2)}, then the candidate allocation policies corresponding to service process A and service process B are combined into {(0,1), (1,1)}, {(0,1), (2,2)}, {(1,2), (1,1)} and {(1,2), (2,2)}.
[0085] Based on the above resource allocation method, this embodiment provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps in the resource allocation method, storage medium and terminal device as described in the above embodiment.
[0086] Based on the above resource allocation method, the present invention also provides a terminal device, such as Figure 2 As shown, it includes at least one processor (processor) 20; display screen 21; and memory (memory) 22, and may also include a communications interface (Communications Interface) 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22 and the communication interface 23 can communicate with each other through the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logic instructions in the memory 22 to execute the method in the above embodiment.
[0087] In addition, the logic instructions in the memory 22 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0088] The memory 22 is a computer-readable storage medium that can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 22, that is, implementing the methods in the above embodiments.
[0089] The memory 22 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient storage medium.
[0090] In addition, the specific process of loading and executing the multiple instruction processors in the above-mentioned storage medium and the terminal device has been described in detail in the above-mentioned method, and will not be described one by one here.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A resource allocation method, characterized in that: The method comprises: Acquire a plurality of service processes requesting resources and available resource data configured by the terminal device, wherein each of the plurality of service processes includes the requested resource data; For each service process, determining a resource allocation strategy set corresponding to the service process according to the available resource data and the requested resource data corresponding to the service process; In the resource allocation strategy set corresponding to each service process, a preset number of candidate resource allocation strategies are selected to form a resource strategy set corresponding to each service process; Determine the target resource allocation strategy corresponding to the terminal device according to the resource strategy set corresponding to each service process, and perform resource allocation according to the target resource allocation strategy; The requested resource data includes a number of requested resource types and a requested quantity corresponding to each requested resource type, and the available resource data includes a number of available resource types and an available quantity corresponding to each available resource type, wherein the number of available resource types includes the number of requested resource types; The step of determining, for each service process, according to the available resource data and the requested resource data corresponding to the service process, a resource allocation strategy set corresponding to the service process specifically includes: For each requested resource type in each service process, determining a resource quantity threshold value according to a request quantity corresponding to the requested resource type and an available quantity corresponding to the available resource type, wherein the available resource type is the same as the requested resource type; Selecting a number of resource allocation quantities for each requested resource type, wherein each of the number of resource allocation quantities is different from each other, and each resource allocation quantity is less than or equal to a resource quantity threshold corresponding to the requested resource type; Combining a number of resource allocation quantities corresponding to each requested resource type to obtain a resource allocation strategy set corresponding to the service process, wherein the resource allocation strategy set includes a number of resource allocation strategies, and each resource allocation strategy in the number of resource allocation strategies is different from each other; The step of selecting a preset number of candidate resource allocation strategies from the resource allocation strategy set corresponding to each service process to form a resource strategy set corresponding to each service process specifically includes: For each service process, calculate the resource utilization rate corresponding to each resource allocation strategy in the resource allocation strategy set corresponding to the service process; Selecting a preset number of resource allocation strategies from the resource allocation strategy set corresponding to the service process in descending order of resource utilization, so as to form a resource strategy set corresponding to the service process; Determining a target resource allocation strategy corresponding to the terminal device according to a resource strategy set corresponding to each service process, and performing resource allocation according to the target resource allocation strategy specifically includes: Selecting a candidate allocation strategy from the resource strategy set corresponding to each service process to form a plurality of candidate allocation strategy combinations; Calculate the resource benefits of each candidate allocation strategy combination respectively, and determine the target resource allocation strategy based on all resource benefits; Resource allocation is performed according to the target resource allocation strategy.
2. The resource allocation method according to claim 1, characterized in that: The resource allocation strategy set includes a plurality of resource allocation strategies, and each of the plurality of resource allocation strategies has at least one requested resource type whose corresponding resource classification quantity is not zero.
3. The resource allocation method according to claim 1, characterized in that: The target resource allocation strategy is a resource allocation strategy with the highest resource benefit.
4. The resource allocation method according to claim 1, characterized in that: The step of selecting a candidate allocation strategy from the resource strategy set corresponding to each service process to form a combination of several candidate allocation strategies specifically includes: For each service process, a candidate allocation strategy is selected from the resource strategy set corresponding to the service process; Combining the candidate allocation strategies selected by each service process to obtain a candidate allocation strategy combination; Repeat the step of selecting a candidate allocation strategy from the resource strategy set corresponding to each service process until all combinations of candidate allocation strategies in each service process are obtained to obtain several candidate allocation strategy combinations, wherein each candidate allocation strategy combination in the several candidate allocation strategy combinations is different from each other.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the resource allocation method according to any one of claims 1 to 4.
6. A terminal device, characterized in that: include: Processor, memory and communication bus; The memory stores a computer-readable program executable by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, the steps in the resource allocation method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Foreground program allocating system and realizing method
CN102567113A
Cloud computing task scheduling method based on tabu search and load balancing
CN104331321A
CPU (central processing unit) resource allocation method and device and electronic equipment
CN105988872A
Computer cluster job scheduling method and device
CN106776025A
Resource processing method and device, computer readable storage medium and mobile terminal
CN107391259A
