[go: up one dir, main page]

CN114610494B - Resource allocation method, electronic device and computer readable storage medium - Google Patents

Resource allocation method, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN114610494B
CN114610494B CN202210267345.8A CN202210267345A CN114610494B CN 114610494 B CN114610494 B CN 114610494B CN 202210267345 A CN202210267345 A CN 202210267345A CN 114610494 B CN114610494 B CN 114610494B
Authority
CN
China
Prior art keywords
resources
resource
task
executed
resource allocation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210267345.8A
Other languages
Chinese (zh)
Other versions
CN114610494A (en
Inventor
赵天磊
窦强
张承义
高军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Phytium Technology Co Ltd
Original Assignee
Phytium Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Phytium Technology Co Ltd filed Critical Phytium Technology Co Ltd
Priority to CN202210267345.8A priority Critical patent/CN114610494B/en
Publication of CN114610494A publication Critical patent/CN114610494A/en
Application granted granted Critical
Publication of CN114610494B publication Critical patent/CN114610494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure relates to computer architecture technology, and more particularly, to a resource allocation method, an electronic device, and a computer-readable storage medium, where a resource management unit in the electronic device determines, according to each task to be executed, a resource required by each task to be executed; the resource management unit determines the resource allocation priority of the tasks to be executed based on the resources required by the tasks to be executed, allocates resources for each task to be executed according to the resource allocation priority, and the resources are used for the processor cores in the electronic equipment to execute the tasks to be executed. According to the resource allocation method provided by the embodiment of the disclosure, when a plurality of tasks to be executed exist, resources can be allocated according to the priority of the tasks to be processed on the demands of the resources, so that not only can the resource waste be avoided, but also the resource utilization rate can be improved, and the execution efficiency of the tasks to be executed can be improved.

Description

Resource allocation method, electronic device and computer readable storage medium
Technical Field
The present disclosure relates to computer architecture technology, and more particularly, to a resource allocation method, an electronic device, and a computer-readable storage medium.
Background
With the improvement of computer architecture and the rapid development of microprocessor technology, the performance of computers has also improved greatly. Microprocessor technology-based electronic devices typically allocate resources within the electronic device at a granularity of processor cores such that each processor core within the electronic device is capable of processing tasks in accordance with the allocated resources. Therefore, how to improve the utilization of resources within an electronic device and the efficiency of a processor core in performing multiple tasks in a multitasking situation is a constantly pursuing goal of microprocessor technology.
Disclosure of Invention
To solve at least the above technical problems in the prior art, embodiments of the present disclosure provide a resource allocation method, an electronic device, and a computer-readable storage medium.
The technical scheme of the embodiment of the disclosure is realized as follows:
in a first aspect, an embodiment of the present disclosure provides a resource allocation method, where a resource management unit in an electronic device determines, according to each task to be executed, a resource required by a pipeline corresponding to each task to be executed, where the resource management unit determines, based on the resource required by the pipeline corresponding to the task to be executed, a resource allocation priority of the pipeline corresponding to the task to be executed, and allocates, according to the resource allocation priority, a resource to each pipeline corresponding to the task to be executed, where the resource is used for a processor core in the electronic device to execute the task to be executed.
In some embodiments, the resource management unit determines the resource allocation priority of the task to be executed based on the resources required by the task to be executed, including determining, for the same type of resources, the resource allocation priority of the type of resources allocated to the task to be executed according to the number of resources required by each task to be executed.
In some embodiments, the determining the resource allocation priority of the type of resources allocated to the task to be executed according to the number of resources required by each task to be executed includes determining that the resource allocation priority of the type of resources allocated to the task to be executed with the largest number of resources required is the highest, and determining that the resource allocation priority of the type of resources allocated to the task to be executed with the smallest number of resources required is the lowest.
In some alternative embodiments, the resource management unit determines the resource allocation priority of the task to be executed based on the resources required by the task to be executed, including determining, for the same type of resources, the resource allocation priority of the type of resources allocated to the task to be executed according to the number of resources required by each task to be executed in the available resources of the electronic device.
In some alternative embodiments, the determining the resource allocation priority for allocating the type of resources to the tasks to be executed according to the number of resources required by each task to be executed in the available resources of the electronic device includes determining that the resource allocation priority of the task to be executed with the largest number of required resources among the available resources of the electronic device is the lowest, and determining that the priority of the task to be executed with the lowest number of required resources among the available resources of the electronic device is the highest.
In a second aspect, an embodiment of the disclosure provides an electronic device, which includes a resource management unit and a processor core, wherein the resource management unit is configured to determine resources required by pipelines corresponding to each task to be executed according to each task to be executed, determine resource allocation priorities of pipelines corresponding to the task to be executed based on the resources required by the pipelines corresponding to the task to be executed, and allocate resources for the pipelines corresponding to the task to be executed according to the resource allocation priorities, and the processor core is configured to execute the task to be executed according to the resources.
In some optional embodiments, the resource management unit is further configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to each task to be performed according to the number of resources required for the task to be performed.
In some alternative embodiments, the resource management unit is further configured to determine that the resource allocation priority for allocating the type of resource to the task to be executed with the largest number of required resources is the highest, and determine that the resource allocation priority for allocating the type of resource to the task to be executed with the smallest number of required resources is the lowest.
In some optional embodiments, the resource management unit is further configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to the task to be performed according to the number of resources required to be able to satisfy each task to be performed in the available resources of the electronic device.
In some optional embodiments, the resource management unit is further configured to determine that, among the available resources of the electronic device, a resource allocation priority capable of satisfying the task to be executed with the largest number of required resources is the lowest, and determine that, among the available resources of the electronic device, a priority capable of satisfying the task to be executed with the lowest number of required resources is the highest.
In a third aspect, an embodiment of the present disclosure provides an electronic device, where the electronic device includes a processor, a memory, and a bus, where the memory stores executable instructions, and where communication is performed between the processor and the memory through the bus, and where the processor implements the above-mentioned resource allocation method when executing the executable instructions stored in the memory.
In a fourth aspect, an embodiment of the present disclosure provides a computer readable storage medium storing executable instructions for implementing the above-described resource allocation method when executed by a processor.
In a fifth aspect, the disclosed embodiments provide a computer program product comprising computer programs/instructions which, when executed by a processor, implement a resource allocation method.
The resource allocation method provided by the embodiment of the disclosure comprises the steps that a resource management unit in electronic equipment respectively determines resources required by each task to be executed according to each task to be executed, the resource management unit determines resource allocation priority of the task to be executed based on the resources required by the task to be executed, and allocates resources for each task to be executed according to the resource allocation priority, wherein the resources are used for processor cores in the electronic equipment to execute the task to be executed. Therefore, when a plurality of tasks to be executed exist, resources can be allocated according to the priority of the tasks to be processed on the demands of the resources, so that not only can the waste of the resources be avoided, but also the utilization rate of the resources be improved, and the execution efficiency of the tasks to be executed can be improved.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings, in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
FIG. 1 is a schematic diagram of a process flow of an instruction in the related art;
FIG. 2 is a schematic diagram of an alternative process flow of a resource allocation method provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a resource management unit according to an embodiment of the present disclosure for determining a resource allocation priority of a task to be performed based on a resource required by the task to be performed;
FIG. 4 is a schematic diagram of another resource management unit according to an embodiment of the present disclosure for determining a resource allocation priority of a task to be performed based on resources required for the task to be performed;
FIG. 5 is a schematic diagram of resource partitioning within an electronic device provided by an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of partitioning sub-resource pools provided by an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of another partitioning sub-resource pools provided by embodiments of the present disclosure;
Fig. 8 is a schematic diagram of a composition structure of an electronic device provided in an embodiment of the present disclosure;
fig. 9 is a schematic hardware structure of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present disclosure more apparent, the present disclosure will be further described in detail with reference to the accompanying drawings, and the described embodiments should not be construed as limiting the present disclosure, and all other embodiments obtained by those skilled in the art without making inventive efforts are within the scope of protection of the present disclosure.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
In the following description, the terms "first", "second", and the like are merely used to distinguish between similar objects and do not represent a particular ordering of the objects, it being understood that the "first", "second", or the like may be interchanged with one another, if permitted, to enable embodiments of the disclosure described herein to be implemented in an order other than that illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used herein is for the purpose of describing embodiments of the present disclosure only and is not intended to be limiting of the present disclosure.
It should be understood that, in various embodiments of the present disclosure, the size of the sequence number of each implementation process does not mean that the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
Before explaining the embodiments of the present disclosure in further detail, terms and terminology involved in the embodiments of the present disclosure are explained, and the terms and terminology involved in the embodiments of the present disclosure are applicable to the following explanation.
1) Processor cores, which are the core-most portions of the processor interior, may also be referred to as processor cores.
2) Processor-including one or more processor cores, as well as other components or devices such as memory.
3) The pipeline is an implementation technology for executing a plurality of instructions in an overlapped mode, each step in the pipeline is used for completing a part of the instructions, each step is called a pipeline stage or a pipeline section, the pipeline stages are connected front and back to form the pipeline, the instructions enter at one end of the pipeline and exit at the other end of the pipeline through the pipeline stages, and each pipeline corresponds to one task.
For the processing flow of an instruction in a pipeline, as shown in fig. 1, the life cycle of an instruction in a pipeline includes fetching, decoding, executing, accessing and writing back. Instruction fetching refers to the process of fetching instructions from memory. Instruction decoding refers to the process of translating an instruction fetched from memory, and after decoding, the instruction's required operand register index is obtained, which can be used to read operands from a general purpose register set (REGISTER FILE). The type of computation required after instruction decoding is known and the required operands have been read from the general purpose register set, then instruction execution is performed (Instruction Execute). Instruction execution refers to the process of actually operating on an instruction. For example, if the instruction is an add instruction, the operands are added, and if the instruction is a subtract instruction, the operands are subtracted. The most common component in the "execute" stage is the ALU, which is a hardware functional unit that performs specific operations. Memory access refers to the process by which memory access instructions read data from memory or write data to memory. The write-back refers to the process of writing the result of instruction execution back to the general register set, and if the result is a common operation instruction, the result value is derived from the result calculated in the "execution" stage, and if the result is a memory read instruction, the result is derived from the data read from the memory in the "memory access" stage.
The resources allocated to the processor cores refer to resources for the various pipeline stages of the execution pipeline. For example, the resources allocated to the processor core may be branch prediction resources, instruction fetch resources, decode resources, rename resources, execution resources, etc., wherein the execution resources may include at least one or more of an operation resource, a register resource, and a memory resource. The memory resource may include a buffer and a memory, and the buffer may include at least one or more of an L1 buffer, an L2 buffer, and an L3 buffer. The memory may be any type of memory such as flash memory. The decoding resources may include at least one decoder. The rename resource may include at least one register.
In the related art, a computer device includes a plurality of processor cores, and resources in the computer device are allocated with the processor cores as granularity, specifically, resources corresponding to the processor cores are allocated to each processor core, the resources between the processor cores are mutually independent, the processor core a cannot use the resources allocated to the processor core B when executing a task, and similarly, the processor core B cannot be suitable for the resources allocated to the processor core a when executing a task. The inventor finds that when the processor core is used as granularity to allocate the resources in the computer equipment, at least the following problems are existed that when the pipeline executed by a certain processor core needs stronger resources, the resources allocated to the processor core can not meet the demands of the pipeline on the resources, the efficiency of executing tasks is low, and when the pipeline executed by a certain processor core needs weaker resources, part of the resources allocated to the processor core are idle, and the resources can not be effectively utilized.
Aiming at the problems of low resource utilization rate and low task execution efficiency in the related technology of resource allocation, the embodiment of the disclosure provides a resource allocation method, electronic equipment and a computer readable storage medium, which can improve the resource utilization rate and the task execution efficiency to be processed.
An optional process flow of the resource allocation method provided in the embodiments of the present disclosure, as shown in fig. 2, at least includes the following steps:
in step S101, a resource management unit in the electronic equipment respectively determines resources required by a pipeline corresponding to each task to be executed according to each task to be executed.
For example, a task to be processed may refer to a task to be executed by a processor core within an electronic device, where a task to be processed corresponds to a pipeline.
For example, the resources required for each task to be executed may refer to the number of resources required by the pipeline stage or pipeline segment of each step when the corresponding instruction is completed by executing a pipeline of the task to be executed.
For example, the resources include one or more of branch prediction resources, fetch resources, decode resources, rename resources, or execution unit resources.
Step S102, the resource management unit determines the resource allocation priority of the pipeline corresponding to the task to be executed based on the resources required by the task to be executed.
In some embodiments, the resource management unit obtains resources in the resource pool and allocates the resources according to the resource allocation priority. The electronic equipment comprises a plurality of types of resource pools, and each type of resource pool comprises a plurality of sub-resource pools. The connection modes of the resource pools of various types and the division modes of the sub-resource pools are described below.
In some embodiments, for the same type of resource, a resource allocation priority for allocating that type of resource to the task to be performed is determined based on the number of resources required for each task to be performed. In the plurality of tasks to be executed, the number of demands of each pipeline for the same type of resource is different, and therefore, the allocation priority of the resource can be set according to the amount of demand for the resource.
For example, as shown in fig. 3, step S102 includes at least the following steps:
Step S102-a1, determining that the resource allocation priority for allocating the type of resources to the task to be executed with the largest number of required resources is highest;
Step S102-a2 is to determine that the resource allocation priority for allocating the type of resource to the task to be executed with the least number of required resources is the lowest.
For example, the resource allocation method includes two tasks to be executed, namely a first task to be executed and a second task to be executed, and when the resource allocation is performed, resource priority allocation needs to be performed on the required quantity of the resources according to the first task to be executed and the second task to be executed. For example, for the same type of resource, such as a branch prediction resource, the number of resources required to execute the first task pipeline to be executed is greater than the number of resources required to execute the second task pipeline to be executed, where the resource allocation priority is set such that the priority of the first task to be executed is greater than the priority of the second task to be executed.
By adopting the resource allocation mode, resources are preferentially allocated to the tasks to be executed with a large number of required resources, so that the full utilization of the resources is facilitated, namely, the required resources with a rear priority are small in number according to the resource allocation priority, and the probability of allocating fewer resources to the tasks to be executed with a small number of required resources is higher under the condition that the number of the resources in the resource pool is fixed.
In some embodiments, for the same type of resource, a resource allocation priority for allocating the type of resource to the task to be performed is determined according to the number of resources required to be able to satisfy each task to be performed among the available resources of the electronic device. The number of resources in each type of resource pool is fixed among the plurality of tasks to be executed, and therefore, the allocation priority of the resources can be set according to the number of resources required by the available resources to be able to satisfy each task to be executed.
For example, as shown in fig. 4, step S102 includes at least the following steps:
Step S102-b1, determining that the resource allocation priority of the task to be executed, which can meet the maximum number of needed resources, is the lowest in the available resources of the electronic equipment;
Step S102-b2, determining that the resource allocation priority of the task to be executed, which can meet the minimum number of required resources, is highest in the available resources of the electronic device.
For example, when the number of required resources is large, it is indicated that there are more sub-resource pools capable of meeting the requirements of the current task to be executed, and when the number of required resources is small, it is indicated that there are fewer sub-resource pools capable of meeting the requirements of the current task to be executed, and the resource allocation priority can be set according to such conditions, that is, the higher the resource allocation priority is when the number of required resources is small, and the lower the resource allocation priority is otherwise.
For example, two tasks to be performed, namely a first task to be performed and a second task to be performed, are included. For example, the first task to be executed and the second task to be executed may require different amounts of one type of resource, such as branch prediction resources. For example, the number of resources of one type that are required to satisfy the first task to be executed is smaller than the number of resources of one type that are required to satisfy the second task to be executed, for example, the number of resources of one type that are required to satisfy the first task to be executed is 3, and the number of resources of one type that are required to satisfy the second task to be executed is 4, in which case the resource allocation priority is set such that the priority of the first task to be executed is greater than the priority of the second task to be executed.
By adopting the resource allocation mode, fewer resources are satisfied for the task to be executed, and fewer kinds of resources are adapted to the task to be executed, so that the resource allocation is required to be performed preferentially in order to enable the task to be executed to obtain the adapted resources, and further the resource allocation is more reasonable.
In some embodiments, for the same type of resource, a resource allocation priority for allocating the type of resource to the task to be performed is determined according to the number of resources required for each task to be performed and according to the number of resources required to be able to satisfy each task to be performed among the available resources of the electronic device.
For example, in resource allocation, the priority of the number of resources required for each task to be executed is higher than the priority of the number of resources required for each task to be executed in the available resources, or the priority of the number of resources required for each task to be executed is lower than the priority of the number of resources required for each task to be executed in the available resources.
And step S103, allocating resources for pipelines corresponding to each task to be executed according to the resource allocation priority, wherein the resources are used for processor cores in the electronic equipment to execute the task to be executed.
In some embodiments, for each type of resource within the electronic device, the resource management unit divides each type of resource into at least one sub-resource pool, and determines the resource within one sub-resource pool of each type of resource as the target resource. And the resource management unit acquires corresponding target resources according to the resource allocation priority.
Taking the example that the resources in the electronic device are branch prediction resources, the resource management unit divides the branch prediction resources into one or more branch prediction sub-resource pools, and the sizes of the resources included in each branch prediction sub-resource pool are the same or different, wherein the size of the resources can be interpreted as that the number of resource units included in large resources is large, and the number of the resource units included in small resources is small. According to the resource allocation priority, the resource management unit selects one branch prediction sub-resource pool meeting the requirements of the task to be processed from a plurality of branch prediction sub-resource pools, and the resources in the selected branch prediction sub-resource pool are target resources for branch prediction of the task to be processed.
The above description has been made using only the branch prediction resource as an example, and the procedure of determining the target resource for branch prediction is described. In specific implementation, the process of determining the target resource for fetching, decoding, renaming, operating, storing, accessing, etc. is the same as the process of determining the target resource for performing branch prediction, and detailed descriptions of the embodiments of the present disclosure are omitted.
In some embodiments, the resource management unit may be a program installed on the electronic device, or the resource management unit may be a hardware component within the electronic device, or the resource management unit includes a program installed on the electronic device and a hardware component within the electronic device.
In some embodiments, if the resource management unit is a program installed on the electronic device, the method for allocating resources provided by the embodiments of the disclosure is characterized in that the method is implemented in a software manner, where the program installed on the electronic device may be an application program installed on the electronic device or an applet loaded by the application program installed on the electronic device.
In specific implementation, a program installed on the electronic device determines resources required by each task to be executed, determines resource allocation priorities of the tasks to be executed based on the resources required by the tasks to be executed, and sends target resources to corresponding hardware components in the electronic device according to the resource allocation priorities, wherein the hardware components execute the tasks to be processed based on the target resources.
In other embodiments, if the resource management unit is a hardware component within the electronic device, the method for allocating resources provided by the embodiments of the disclosure is characterized to be implemented in hardware.
In specific implementation, a hardware component in the electronic device determines resources required by each task to be executed according to each task to be executed, determines resource allocation priority of the task to be executed based on the resources required by the task to be executed, and executes the task to be processed based on the allocated target resources.
In some embodiments, if the resource management unit includes a program installed on the electronic device and a hardware component within the electronic device, the resource allocation method provided by the embodiments of the disclosure is characterized to be implemented in a combination of software and hardware.
The method comprises the steps that when the method is implemented, a hardware component in the electronic device sends each task to be executed to a program installed on the electronic device, the program installed on the electronic device respectively determines resources required by each task to be executed according to each task to be executed, determines resource allocation priority of the task to be executed based on the resources required by the task to be executed, sends the allocated target resources to corresponding hardware components in the electronic device, and the hardware component executes the task to be processed based on the target resources.
The program installed on the electronic equipment respectively determines resources required by each task to be executed according to each task to be executed, determines resource allocation priority of the task to be executed based on the resources required by the task to be executed, and sends the resource allocation priority to a corresponding hardware component in the electronic equipment, and the hardware component allocates target resources for the task to be processed based on the resource allocation priority and executes the task to be processed based on the target resources.
Based on the resource allocation method shown in fig. 2, it can be understood that in the embodiment of the present disclosure, each type of resource included in an electronic device is divided into a resource pool, and resources required for executing a task to be processed are allocated to the task to be processed from the resource pool according to the resource allocation priority of the task to be processed.
In specific implementation, as shown in fig. 5, the resource partitioning diagram in the electronic device includes partitioning the branch prediction resources included in the electronic device into a branch prediction resource pool, partitioning the instruction fetching resources included in the electronic device into an instruction fetching resource pool, partitioning the decoding resources included in the electronic device into a decoding resource pool, partitioning the renaming resources included in the electronic device into a renaming resource pool, and partitioning the execution resources included in the electronic device into an execution resource pool, where the execution resources may include one or more of a register resource, a memory resource, and an operation resource. For example, the resource pools are connected through a connection network, wherein the connection network may be a hardware network based on switch control, or may be any other network, and the embodiment of the disclosure is not limited.
In the resource partitioning diagram shown in fig. 5, the resource management unit manages all the resource pools, and in specific implementation, the resource management unit may further include a plurality of resource management subunits, where each resource management subunit manages different resource pools respectively. For example, the resource management unit comprises a branch prediction resource sub-management unit, a finger taking resource sub-management unit, a decoding resource sub-management unit, a renaming resource sub-management unit and an execution resource sub-management unit, wherein the branch prediction resource sub-management unit is used for carrying out resource management on resources in a branch prediction resource pool, the finger taking resource sub-management unit is used for carrying out resource management on the resources in the finger taking resource pool, the decoding resource sub-management unit is used for carrying out resource management on the resources in the decoding resource pool, the renaming resource sub-management unit is used for carrying out resource management on the resources in the renaming resource pool, and the execution resource sub-management unit is used for carrying out resource management on the resources in the execution resource pool.
For the resource division schematic diagram shown in fig. 5, according to different resource allocation strategies, each resource pool can be divided into a plurality of sub-resource pools with the same size as shown in fig. 6 and a plurality of sub-resource pools with different sizes as shown in fig. 7, wherein the sub-resource pools with the same size are the same for the resources of the same type, the sub-resource pools with different sizes are the same for the resources of the same type, and the sub-resource pools with different sizes are different or all the resources of the same type.
A schematic diagram of partitioning sub-resource pools based on a resource allocation policy shown in fig. 6 and another schematic diagram of partitioning sub-resource pools based on a resource allocation policy shown in fig. 7 are respectively described below.
For FIG. 6, the sub-resource pools are divided by the resource allocation policy in an organization manner of the minimum resources, the resources included in each sub-resource pool are the minimum units of the type of resources, and thus, the maximum number of sub-resource pools can be divided for each resource pool to support the maximum number of processor cores to execute the maximum number of tasks in parallel. For example, the branch prediction resource pool, the finger resource pool, the decoding resource pool, the renaming resource pool and the execution resource pool are all divided according to the minimum unit of resources, the branch prediction resource pool is divided into eight branch prediction sub-resource pools, the finger resource pool is divided into eight finger resource sub-resource pools, the decoding resource pool is divided into eight decoding sub-resource pools, the renaming resource pool is divided into eight renaming sub-resource pools, and the execution resource pool is divided into eight execution sub-resource pools. Each sub-resource pool may be used for one processor core to perform tasks, and the resources shown in fig. 6 may support eight processor cores to perform eight tasks in parallel.
When dividing the sub-resource pool for each resource pool, there may be a case that the number of sub-resource pools obtained by dividing each resource pool is different, for example, the branch prediction resource pool is divided into eight branch prediction sub-resource pools, the finger fetch resource pool is divided into six finger fetch resource sub-resource pools, the decoding resource pool is divided into seven decoding sub-resource pools, the renaming resource pool is divided into eight renaming sub-resource pools, and the execution resource pool is divided into six execution sub-resource pools. In this scenario, five processor cores can be supported to execute six tasks in parallel.
In the embodiment of the disclosure, each resource pool is divided into sub-resource pools in a mode of organizing the minimum resources, so that the resources in the electronic equipment can support the maximum number of processor cores to execute tasks in parallel, the task parallel processing capacity is improved, and the performance of the electronic equipment is further improved.
For fig. 7, each resource pool is divided into sub-resource pools in an organization manner with different sizes based on a resource allocation policy, and for the same type of resource, the sizes of the resources included in the plurality of sub-resource pools are partially or completely different. Thus, aiming at the sub-resource pool with more resources, the processor core is supported to execute the task with strong resource demand, and the processing efficiency and the processing capacity of the task are improved. For example, each of the branch prediction resource pool, the fetch resource pool, the decode resource pool, the rename resource pool, and the execute resource pool is divided into sub-resource pools in an organization manner with different sizes, the branch prediction resource pool is divided into five branch prediction sub-resource pools, the five branch prediction sub-resource pools have different sizes, and the other parts are the same, the size of the first branch prediction sub-resource pool is larger than the size of the second branch prediction sub-resource pool, and the sizes of the third branch prediction sub-resource pool, the fourth branch prediction sub-resource pool, and the fifth branch prediction sub-resource pool are all the same in fig. 7. The first branch predictor resource pool is suitable for tasks with high demand on branch prediction resources, the third branch predictor resource pool, the fourth branch predictor resource pool and the fifth branch predictor resource pool are suitable for tasks with low demand on branch prediction resources, and the second branch predictor resource pool is suitable for tasks with moderate demand on branch prediction resources (the demand on the branch prediction resources is between the highest and the lowest). The size of the sub-resource pool refers to how many resources are included in the sub-resource pool.
For a task, a required sub-resource pool can be arbitrarily selected from each resource pool according to the task to be executed and the resource allocation priority of the task to be executed, for example, a first branch prediction sub-resource pool, a second finger fetching sub-resource pool, a second decoding sub-resource pool, a third renaming sub-resource pool and a first execution sub-resource pool are allocated for the task to be executed under the condition of the current priority.
In the embodiment of the present disclosure, if there is a free or remaining resource in a certain sub-resource pool allocated for a task to be executed, the free or remaining resource may be set to a sleep mode, so that the free or remaining resource is not used for executing the task, thereby reducing power consumption. The free or residual resources can be removed from the sub-resource pool, and the free or residual resources are divided into other sub-resource pools, so that the free or residual resources are fully utilized, and the utilization rate of the resources is improved.
In the embodiment of the disclosure, each resource pool is divided into sub-resource pools in an organization mode with different sizes, so that a resource management unit can allocate required resources for each type of resource according to the demands of the task, the problem that resources are wasted or insufficient to support the processor cores to execute the task due to the fact that fixed resources are allocated for each processor core in the related technology is avoided, the task execution efficiency and the resource utilization rate are improved, and the performance of the electronic equipment is further improved.
In the embodiment of the disclosure, a resource management unit in the electronic equipment respectively determines resources required by each task to be executed according to each task to be executed, the resource management unit determines the resource allocation priority of the task to be executed based on the resources required by the task to be executed, and allocates resources for each task to be executed according to the resource allocation priority, wherein the resources are used for a processor core in the electronic equipment to execute the task to be executed. Therefore, when a plurality of tasks to be executed exist, resources can be allocated according to the priority of the tasks to be processed on the demands of the resources, so that not only can the waste of the resources be avoided, but also the utilization rate of the resources be improved, and the execution efficiency of the tasks to be executed can be improved.
It should be noted that, since the advent of the first general-purpose electronic computer, computer technology has been rapidly developed over several decades, and the rapid development of computer technology has benefited from improvements in computer architecture and development of computer production technology. The contribution of computer production technology to the development of computer technology has been stable, however, as computer architecture has undergone decades of improvement, the space for improvement of computer architecture has become increasingly smaller, and any small improvement to computer architecture will have a significant impact on the performance of processors and the development of computer technology.
The embodiment of the present disclosure further provides an electronic device 800, configured to implement the resource allocation method shown in fig. 2 to 7. As shown in fig. 8, the electronic device 800 includes at least a resource management unit 801 and a processor core 802, wherein,
The resource management unit 801 is configured to determine resources required for each task to be executed according to each task to be executed, respectively;
determining the resource allocation priority of the tasks to be executed based on the resources required by the tasks to be executed, and allocating resources for each task to be executed according to the resource allocation priority;
The processor core 802 is configured to perform tasks to be performed according to the resources.
In some embodiments, the resource management unit 801 is configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to each task to be performed according to the number of resources required for the task to be performed.
In some embodiments, the resource management unit 801 is configured to determine that the resource allocation priority for allocating the type of resource to the task to be executed with the largest amount of required resources is the highest
And determining that the resource allocation priority for allocating the type of resources to the task to be executed with the minimum required resource quantity is the lowest.
In some embodiments, the resource management unit 801 is configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to the task to be performed according to the number of resources required to be able to satisfy each task to be performed among the available resources of the electronic device.
In some embodiments, the resource management unit 801 is configured to determine that, among the available resources of the electronic device, the resource allocation priority that can satisfy the task to be performed that requires the greatest amount of resources is the lowest
And determining the highest priority of the tasks to be executed, which can meet the minimum number of required resources, in the available resources of the electronic equipment.
In some embodiments, the resource management unit 801 is a program installed on an electronic device, or the resource management unit 801 is a hardware component within an electronic device.
In some embodiments, resource management unit 801 includes programs installed on an electronic device and hardware components within the electronic device.
In some embodiments, the hardware component determines resources required by each task to be executed according to each task to be executed, and sends the resources required by each task to be executed to the program;
the program determines a resource allocation priority of the task to be executed based on the resources required for the task to be executed, and sends the resource allocation priority to the hardware component.
It should be noted that, in the embodiment of the present disclosure, the description of the electronic device is similar to the description of the embodiment of the resource allocation method, and has similar beneficial effects as the embodiment of the method, so that a detailed description is omitted. The technical details of the electronic device provided in the embodiments of the present disclosure may be understood from the description of any one of fig. 2 to fig. 7.
An exemplary application of the electronic device provided by the embodiments of the present disclosure is described below, where the electronic device provided by the embodiments of the present disclosure may be implemented as an electronic device, and the electronic device may be a server or a terminal device.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing service. The terminal device may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal device and the server may be directly or indirectly connected through wired or wireless communication, and embodiments of the present disclosure are not limited herein.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an electronic device 900 according to an embodiment of the present disclosure, where the electronic device 900 shown in fig. 9 includes at least one processor 910, a memory 950, and a bus 940, and the components in the electronic device 900 are coupled together by the bus 940. It is to be appreciated that bus 940 is used to enable connected communications between these components. The bus 940 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration, the various buses are labeled as bus 940 in fig. 9.
The Processor 910 may be an integrated circuit chip having signal processing capabilities such as a general purpose Processor, such as a microprocessor or any conventional Processor, or the like, a digital signal Processor (DSP, digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
The memory 950 stores therein executable instructions for implementing the resource allocation method provided by the embodiments of the present disclosure, which may be implemented by the resource management unit 801 in the electronic device shown in fig. 8, and the memory 950 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard drives, optical drives, and the like. Memory 950 optionally includes one or more storage devices physically remote from processor 910.
In some embodiments, memory 950 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or subsets or supersets thereof.
In some embodiments, the electronic device 900 may further include:
an operating system 951 comprising system programs, e.g., a framework layer, a core library layer, a driver layer, etc., for handling various basic system services and performing hardware-related tasks, for implementing various basic services and handling hardware-based tasks;
Network communication module 952 is used to reach other computing devices via one or more (wired or wireless) network interfaces 920, exemplary network interfaces 920 include bluetooth, wireless compatibility authentication (WiFi), and universal serial bus (USB, universal Serial Bus), among others.
The disclosed embodiments provide a computer readable storage medium having stored therein executable instructions that, when executed by a processor, will cause the processor to perform the resource allocation method provided by the disclosed embodiments, for example, as shown in fig. 2-7.
In some embodiments, the computer readable storage medium may be FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM, or various devices including one or any combination of the above.
In some embodiments, the executable instructions may be in the form of programs, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and they may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
For example, the executable instructions may be deployed to be executed on one computing device or on multiple computing devices located at one site or distributed across multiple sites and interconnected by a communication network.
Embodiments of the present disclosure provide a computer program product comprising computer programs/instructions which, when executed by a processor, implement the resource allocation method of the present disclosure.
The foregoing is merely exemplary embodiments of the present disclosure and is not intended to limit the scope of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. that are within the spirit and scope of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (13)

1. A method of resource allocation, the method comprising:
A resource management unit in the electronic equipment respectively determines resources required by a pipeline corresponding to each task to be executed according to each task to be executed;
the resource management unit determines the resource allocation priority of the pipeline corresponding to the task to be executed based on the resources required by the pipeline corresponding to the task to be executed;
Allocating resources for pipelines corresponding to each task to be executed according to the resource allocation priority, wherein the resources are used for processor cores in the electronic equipment to execute the task to be executed;
The electronic equipment comprises a plurality of types of resource pools, each type of resource pool comprises a plurality of sub-resource pools, and the resource management unit acquires resources in the resource pools and allocates the resources according to the resource allocation priority.
2. The resource allocation method according to claim 1, wherein the resource management unit determines the resource allocation priority of the task to be executed based on the resources required for the task to be executed, comprising:
And determining the resource allocation priority of the type of resources allocated to the tasks to be executed according to the number of the resources required by each task to be executed aiming at the resources of the same type.
3. The resource allocation method according to claim 2, wherein the determining a resource allocation priority for allocating the type of resource to each of the tasks to be performed according to the number of resources required for the task to be performed comprises:
determining that the resource allocation priority for allocating the type of resources to the task to be executed with the largest number of required resources is highest;
and determining that the resource allocation priority for allocating the type of resources to the task to be executed with the minimum required resource quantity is the lowest.
4. The resource allocation method according to claim 1, wherein the resource management unit determines the resource allocation priority of the task to be executed based on the resources required for the task to be executed, comprising:
And determining the resource allocation priority of the type of resources allocated to the tasks to be executed according to the quantity of the resources required by each task to be executed in the available resources of the electronic equipment aiming at the resources of the same type.
5. The method for allocating resources according to claim 4, wherein the determining a resource allocation priority for allocating the type of resources to the tasks to be performed according to the number of resources required to satisfy each of the tasks to be performed among the available resources of the electronic device comprises:
Determining that the resource allocation priority of the task to be executed, which can meet the maximum number of required resources, is the lowest in the available resources of the electronic equipment;
And determining that the resource allocation priority of the task to be executed, which can meet the minimum number of required resources, is highest in the available resources of the electronic equipment.
6. An electronic device is characterized by comprising a resource management unit and a processor core;
The resource management unit is configured to respectively determine resources required by pipelines corresponding to each task to be executed according to each task to be executed, determine resource allocation priority of the pipelines corresponding to the task to be executed based on the resources required by the pipelines corresponding to the task to be executed, and allocate resources for the pipelines corresponding to the task to be executed according to the resource allocation priority;
The processor core is configured to execute the task to be executed according to the resource;
The electronic equipment comprises a plurality of types of resource pools, each type of resource pool comprises a plurality of sub-resource pools, and the resource management unit acquires resources in the resource pools and allocates the resources according to the resource allocation priority.
7. The electronic device of claim 6, wherein the resource management unit is further configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to each of the tasks to be performed based on the number of resources required for the task to be performed.
8. The electronic device of claim 7, wherein the resource management unit is further configured to determine a resource allocation priority that allocates the type of resource to the task to be performed that requires the largest amount of resources, and
And determining that the resource allocation priority for allocating the type of resources to the task to be executed with the minimum required resource quantity is the lowest.
9. The electronic device of claim 6, wherein the resource management unit is further configured to determine, for the same type of resource, a resource allocation priority for allocating the type of resource to the task to be performed based on the number of resources required to satisfy each task to be performed among the available resources of the electronic device.
10. The electronic device of claim 9, wherein the resource management unit is further configured to determine that, of the available resources of the electronic device, a resource allocation priority that can satisfy a task to be performed that requires a largest amount of resources is the lowest, and
And determining the highest priority of the tasks to be executed, which can meet the minimum number of required resources, in the available resources of the electronic equipment.
11. An electronic device, the electronic device comprising:
a processor, a memory, and a bus;
the memory stores executable instructions;
The method for allocating resources according to any one of claims 1 to 5, wherein the processor communicates with the memory via the bus, and the processor executes executable instructions stored in the memory.
12. A computer readable storage medium storing executable instructions for implementing the resource allocation method of any one of claims 1 to 5 when executed by a processor.
13. A computer program product, characterized in that it comprises a computer program/instruction which, when executed by a processor, implements the resource allocation method of any of claims 1 to 5.
CN202210267345.8A 2022-03-17 2022-03-17 Resource allocation method, electronic device and computer readable storage medium Active CN114610494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210267345.8A CN114610494B (en) 2022-03-17 2022-03-17 Resource allocation method, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210267345.8A CN114610494B (en) 2022-03-17 2022-03-17 Resource allocation method, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114610494A CN114610494A (en) 2022-06-10
CN114610494B true CN114610494B (en) 2025-02-28

Family

ID=81864435

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210267345.8A Active CN114610494B (en) 2022-03-17 2022-03-17 Resource allocation method, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114610494B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076092B (en) * 2023-10-13 2024-01-19 成都登临科技有限公司 Multi-dimensional data task processing method and device, electronic equipment and storage medium
CN118430111A (en) * 2024-06-20 2024-08-02 北京七人科技有限公司 A smart doorbell user behavior analysis system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176852A (en) * 2020-01-15 2020-05-19 上海依图网络科技有限公司 Resource allocation method, device, chip and computer readable storage medium
CN111752615A (en) * 2019-03-29 2020-10-09 英特尔公司 Apparatus, method and system for ensuring quality of service of multithreaded processor cores
CN112698943A (en) * 2020-12-29 2021-04-23 北京顺达同行科技有限公司 Resource allocation method, device, computer equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8335911B2 (en) * 2009-05-21 2012-12-18 Oracle America, Inc. Dynamic allocation of resources in a threaded, heterogeneous processor
CN102122275A (en) * 2010-01-08 2011-07-13 上海芯豪微电子有限公司 Configurable processor
US9348602B1 (en) * 2013-09-03 2016-05-24 Amazon Technologies, Inc. Resource allocation for staged execution pipelining
CN103744735B (en) * 2014-01-09 2017-07-25 福建星网锐捷网络有限公司 The dispatching method and device of a kind of multi-core resource
US11531552B2 (en) * 2017-02-06 2022-12-20 Microsoft Technology Licensing, Llc Executing multiple programs simultaneously on a processor core
CN113918220B (en) * 2020-07-08 2025-06-24 上海寒武纪信息科技有限公司 Pipeline control method, operation module and related products

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111752615A (en) * 2019-03-29 2020-10-09 英特尔公司 Apparatus, method and system for ensuring quality of service of multithreaded processor cores
CN111176852A (en) * 2020-01-15 2020-05-19 上海依图网络科技有限公司 Resource allocation method, device, chip and computer readable storage medium
CN112698943A (en) * 2020-12-29 2021-04-23 北京顺达同行科技有限公司 Resource allocation method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN114610494A (en) 2022-06-10

Similar Documents

Publication Publication Date Title
CN105074666B (en) Operating system executing on processors with different instruction set architectures
US8972699B2 (en) Multicore interface with dynamic task management capability and task loading and offloading method thereof
KR101378390B1 (en) System and method to allocate portions of a shared stack
CN114610494B (en) Resource allocation method, electronic device and computer readable storage medium
KR20180020985A (en) Decoupled processor instruction window and operand buffer
CN106575220B (en) Multiple clustered VLIW processing cores
EP4099161A1 (en) Multi-core processor, multi-core processor processing method and related device
CN114968373A (en) Instruction dispatching method and device, electronic equipment and computer readable storage medium
CN117501254A (en) Providing atomicity for complex operations using near-memory computation
CN117808048A (en) Operator execution method, device, equipment and storage medium
CN118093024A (en) Instruction dispatch method, dispatch device and related equipment
US9235417B2 (en) Real time instruction tracing compression of RET instructions
CN109388429B (en) Task distribution method for MHP heterogeneous multi-pipeline processor
CN109408118B (en) MHP heterogeneous multi-pipeline processor
US11144322B2 (en) Code and data sharing among multiple independent processors
CN119127308A (en) A GPU-based RISC-V instruction set optimization method, system, device, and medium
US20130166887A1 (en) Data processing apparatus and data processing method
CN114625537A (en) Resource allocation method, electronic device and computer-readable storage medium
CN114610395B (en) Instruction dispatch method, apparatus, electronic device and computer-readable storage medium
CN118245187A (en) Thread scheduling method and device, electronic device and storage medium
KR101250892B1 (en) Operating system fast run command
US9619277B2 (en) Computer with plurality of processors sharing process queue, and process dispatch processing method
CN114356586B (en) Processor and electronic equipment
US20150363227A1 (en) Data processing unit and method for operating a data processing unit
CN114721725B (en) Branch instruction execution method and device, electronic equipment and storage medium

Legal Events

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
GR01 Patent grant
GR01 Patent grant