CN114610495A - Resource management method, electronic device, and computer-readable storage medium - Google Patents

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

Info

Publication number
CN114610495A
CN114610495A CN202210267751.4A CN202210267751A CN114610495A CN 114610495 A CN114610495 A CN 114610495A CN 202210267751 A CN202210267751 A CN 202210267751A CN 114610495 A CN114610495 A CN 114610495A
Authority
CN
China
Prior art keywords
resources
task
processed
resource
resource management
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.)
Pending
Application number
CN202210267751.4A
Other languages
Chinese (zh)
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 CN202210267751.4A priority Critical patent/CN114610495A/en
Publication of CN114610495A publication Critical patent/CN114610495A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/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/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)

Abstract

The application provides a resource management method, an electronic device and a computer readable storage medium, wherein the method comprises the following steps: a resource management unit in the electronic equipment determines resources required by the task to be processed according to the task to be processed; the resource management unit searches resources matched with the resources required by the task to be processed in the resources recovered in the first time interval; and allocating the resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed, so that the processor cores execute the pipelines based on the resources matched with the resources required by the tasks to be processed. By implementing the method and the device, the resource management unit can allocate resources to the tasks to be processed in the recently recovered resources, so that the power consumption of the electronic equipment can be saved, and the performance of the electronic equipment can be improved.

Description

Resource management method, electronic device, and computer-readable storage medium
Technical Field
The present application relates to computer architecture technologies, and in particular, to a resource management method, an electronic device, and a computer-readable storage medium.
Background
With improvements in computer architectures and rapid advances in microprocessor technology, computer performance has also increased dramatically. Electronic devices based on microprocessor technology typically allocate resources to each processor core randomly among free resources, so that each processor core within the electronic device can process tasks according to the allocated resources. How to improve the performance of electronic devices through resource allocation is a goal pursued by microprocessor technology.
Disclosure of Invention
Embodiments of the present application provide a resource management method, an electronic device, and a computer-readable storage medium, which can save power consumption and improve performance of the electronic device by preferentially allocating resources recovered in a first time interval.
The technical scheme of the embodiment of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a resource management method, including: a resource management unit in the electronic equipment determines resources required by the task to be processed according to the task to be processed; the resource management unit searches resources matched with the resources required by the task to be processed in the resources recovered in the first time interval; and allocating the resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed, so that the processor cores execute the pipelines based on the resources matched with the resources required by the tasks to be processed.
Optionally, the resources recovered in the first time interval are: and responding to the completion of the all execution of the historical tasks corresponding to the resources, and releasing the resources for executing the historical tasks in a first time zone away from the current time.
Optionally, the resources recovered in the first time interval are: and responding to the completion of the execution of the historical task part corresponding to the resource, and releasing the resource corresponding to the executed historical task in a first time zone away from the current moment.
Optionally, the searching, by the resource management unit, for a resource matching the resource required by the task to be processed in the resource recovered in the first time interval includes: searching resources with the same type as the resources required by the task to be processed in the resources recovered in the first time interval; and/or searching for resources with the size larger than or equal to the size of the resources required by the tasks to be processed in the resources recycled in the first time interval.
Optionally, if there is no resource matching with the resource required by the task to be processed in the resources recovered in the first time interval, the resource management method further includes: the resource management unit searches resources matched with the resources required by the tasks to be processed in all the resources included by the electronic equipment.
In a second aspect, an embodiment of the present application provides an electronic device, including: a resource management unit and a processor core; the resource management unit is used for determining resources required by the tasks to be processed according to the tasks to be processed; searching resources matched with resources required by a task to be processed in the resources recovered in the first time interval; distributing resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed; and the processor core is used for executing the pipeline based on the resources matched with the resources required by the task to be processed.
Optionally, the resources recycled in the first time interval are: and responding to the completion of the all execution of the historical tasks corresponding to the resources, and releasing the resources for executing the historical tasks in a first time zone away from the current time.
Optionally, the resources recovered in the first time interval are: and responding to the completion of the execution of the historical task part corresponding to the resource, and releasing the resource corresponding to the executed historical task in a first time zone away from the current time.
Optionally, the resource management unit is configured to search, in the resources recovered in the first time interval, resources of the same type as the resources required by the task to be processed; and/or searching resources which are larger than or equal to the size of the resources required by the task to be processed in the resources recycled in the first time interval.
Optionally, if there is no resource matching the resource required by the task to be processed in the resources recovered in the first time interval, the resource management unit is configured to search for a resource matching the resource required by the task to be processed in all the resources included in the electronic device.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes: a processor, a memory, and a bus; the memory stores executable instructions; the processor and the memory are communicated through the bus, and when the processor executes the executable instructions stored in the memory, the resource management method provided by the embodiment of the application is realized.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores executable instructions for implementing the resource management method provided in the embodiment of the present application when executed by a processor.
In a fifth aspect, the present application provides a computer program product, where the computer program product includes computer programs/instructions, and when the computer programs/instructions are executed by a processor, the resource management method provided by the present application is implemented.
According to the resource management method, the electronic device and the computer-readable storage medium provided by the embodiment of the application, the resource management unit in the electronic device determines the resources required by the task to be processed according to the task to be processed; the resource management unit searches resources matched with the resources required by the task to be processed in the resources recovered in the first time interval; the resources matched with the resources required by the tasks to be processed are distributed to the assembly lines corresponding to the tasks to be processed, so that the processor cores execute the assembly lines based on the resources matched with the resources required by the tasks to be processed, the resource management unit can distribute the resources for the tasks to be processed in the recently recovered resources, the resources recovered before the first time interval are controlled to be in a dormant state, and the resources in the dormant state cannot be distributed to the assembly line to execute the tasks, so that the power consumption of the electronic equipment can be saved, and the performance of the electronic equipment can be improved.
Drawings
FIG. 1 is a flow chart illustrating the processing of instructions in the related art;
FIG. 2 is a schematic view of an alternative processing flow of a resource management method according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating a resource management unit determining resources required by a to-be-processed task according to the to-be-processed task according to an embodiment of the present application;
fig. 4 is a schematic processing flow diagram illustrating a resource management unit allocating resources to a task to be processed in resources recovered in a first time interval according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating resource partitioning for first time interval recycling according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram illustrating partitioning of a sub-resource pool based on a resource allocation policy according to an embodiment of the present application;
FIG. 7 is a schematic diagram of another partitioning sub-resource pools based on a resource allocation policy according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
fig. 9 is a schematic hardware structure diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the attached drawings, the described embodiments should not be considered as limiting the present application, and all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
In the following description, references to the terms "first", "second", and the like, are only to distinguish similar objects and do not denote a particular order, but rather the terms "first", "second", and the like may be used interchangeably with the order specified, where permissible, to enable embodiments of the present application described herein to be practiced otherwise than as specifically 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 application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
It should be understood that, in the various embodiments of the present application, the size of the serial number of each implementation process does not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application will be described, and the terms and expressions referred to in the embodiments of the present application will be used for the following explanation.
1) A processor core: is the most core part inside the processor and can also be called as the processor core.
2) A processor: including one or more processor cores, and other components or devices such as memory.
3) Assembly line: the method is an implementation technology for overlapping execution of a plurality of instructions, each step in a flow line completes one part of the instructions, each step is called as a flow line stage or a flow line section, and the flow line stages are connected in series to form the flow line; instructions enter at one end of the pipeline and exit at the other end of the pipeline through the pipeline stages; each pipeline corresponds to a 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 a process of reading an instruction from a memory. Instruction decoding refers to a process of translating an instruction fetched from a memory, and after decoding, an operand Register index required by the instruction is obtained, and the operand can be read from a general Register File (Register File) by using the operand Register index. The type of computation to be performed after Instruction decode is known and the required operands have been read from the general purpose register set, then Instruction execution (Instruction execution) follows. Instruction execution refers to the process of actually operating on an instruction. For example, if the instruction is an add operation instruction, the operand is added; if the instruction is a subtraction operation, the operand is subtracted. The most common component in the "execute" stage is the ALU, which is a hardware functional unit that implements specific operations. Memory access refers to the process by which memory access instructions read data from memory or write data to memory. Write-back refers to the process of writing back the result of instruction execution to the general register set, if it is a normal operation instruction, the result value comes from the result of the 'execution' stage calculation; if the instruction is a memory read instruction, the result comes from data read from the memory in the 'access' stage.
The resources allocated to a processor core refer to the resources used for the various pipeline stages of the execution pipeline. For example: the resources allocated to the processor core can be branch prediction resources, instruction fetching resources, decoding resources, renaming resources, execution resources and the like; the execution resources may include at least one or more of arithmetic resources, register resources, and memory resources. The memory resources may include buffers and memory, and the buffers 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 a flash memory. The transcoding resources may include at least one transcoder. The renaming resource may include at least one register.
In the related art, a piece of computer equipment internally comprises a plurality of processor cores, and resources in the computer equipment are allocated by taking the processor cores as granularity; specifically, resources corresponding to each processor core are allocated to each processor core; the resources among the processor cores are independent from one another, and the processor core A cannot use the resources allocated to the processor core B when executing the task; likewise, processor core B cannot accommodate the resources allocated to processor core a while executing tasks. The applicant finds that when the resources in the computer device are allocated by taking the processor cores as the granularity, at least the following problems exist: when a pipeline executed by a certain processor core needs stronger resources, the resources allocated to the processor core cannot meet the requirements of the pipeline on the resources, and the task execution efficiency is low; when a pipeline executed by a certain processor core needs weak resources, part of the resources allocated to the processor core are idle, and the resources cannot be effectively utilized.
As shown in fig. 2, an optional processing flow of the resource management method provided in the embodiment of the present application at least includes the following steps:
s101, a resource management unit in the electronic equipment determines resources required by the task to be processed according to the task to be processed.
In the embodiment of the application, the resource management unit in the electronic device determines the resources required by the task to be processed according to the task to be processed, and can allocate the resources according to the requirement of the task to be processed on the resources, so that the problem of resource waste in the related art is avoided, and the resource utilization rate is improved.
In some embodiments, a pending task may refer to a task to be executed by a processor core within an electronic device, one pending task corresponding to a pipeline.
In some optional embodiments, the resource management unit in the electronic device determines a schematic diagram of resources required by the task to be processed according to the task to be processed, as shown in fig. 3, at least including the following steps:
s101a, the resource management unit in the electronic equipment determines the information of the task to be processed.
In some embodiments, the information of the pending task may include at least one or more of: the type of the task to be processed, the name of the task to be processed, the application program corresponding to the task to be processed and the execution period of the task to be processed.
S101b, the resource management unit determines the resource needed by the task to be processed based on the information of the task to be processed.
In some embodiments, the resource management unit determines the resources required by the task to be processed based on the information of the task to be processed, including: the resource management unit determines the type, intensity (size), and the like of resources required by the task to be processed based on the information of the task to be processed.
S102, the resource management unit searches resources matched with the resources needed by the task to be processed in the resources recovered in the first time interval.
In some embodiments, the resources recovered for the first time interval are: and responding to the completion of the all execution of the historical tasks corresponding to the resources, and releasing the resources for executing the historical tasks in a first time zone away from the current time.
Specifically, the historical task may be a task that has been completely executed before the current time, or may be a task that has been partially executed before the current time. The first time interval at the current time is a time period before the current time, for example, an hour before the current time, tens of minutes before the current time, seconds before the current time, or tens of milliseconds before the current time. In this embodiment, when all the historical tasks are executed, the resources corresponding to the historical tasks are released, and meanwhile, the resource management unit may recycle the resources corresponding to the historical tasks. When all the historical tasks are executed or after the historical tasks are executed, if the resources are the resources released in the first time interval at the current moment for executing the historical tasks, the resources can be regarded as the resources recycled by the resource management unit in the first time interval.
In this embodiment, after the pipeline corresponding to the historical task is completely executed, the resource corresponding to the historical task is released, so that when an error occurs in one or more pipeline stages of the pipeline corresponding to the historical task, the resource corresponding to the historical task can be reused to execute the task in the one or more pipeline stages again, and the successful execution of the historical task can be ensured. Meanwhile, the resources which are released in the first time interval from the current time and used for executing the historical tasks are used as the resources recovered in the first time interval in response to the completion of the execution of all the historical tasks corresponding to the resources, so that the resources in the nearest time interval at the current time can be obtained, various resources for executing the historical tasks can be simultaneously obtained and used for executing the tasks to be processed, and the resources recovered before the first time interval are controlled to be in a dormant state.
In some embodiments, the resources recovered for the first time interval are: and responding to the completion of the execution of the historical task part corresponding to the resource, and releasing the resource corresponding to the executed historical task in a first time zone away from the current time.
In this embodiment, when the execution of the history task is completed partially, the resource corresponding to the executed history task is released, and meanwhile, the resource management unit may recycle the resource corresponding to the executed history task. When the historical task part is executed or after the historical task part is executed, if the resource of the executed historical task is released in the first time interval at the current moment, the resource can be considered to be the resource recycled by the resource management unit in the first time interval.
In this embodiment, after the pipeline part corresponding to the historical task is executed, the resource corresponding to the completed historical task is released, so that the resource corresponding to the completed historical task can be released in time, and the utilization rate of the resource is improved. Meanwhile, the resources of the executed historical tasks released in a first time interval from the current time in response to the completion of the execution of the historical task part corresponding to the resources are taken as the resources recovered in the first time interval, the resources in the nearest time interval at the current time can be obtained and used for the execution of the tasks to be processed, and the resources recovered before the first time interval are controlled to be in a dormant state.
In this embodiment, the process of recovering the resource corresponding to the historical task will be described according to the following steps:
in step S201, a resource management unit in the electronic device receives a task end instruction sent by a processor core in the electronic device.
In some embodiments, the resource management unit receives a task end instruction sent by the processor core; the task ending instruction is used for representing that the task executed by the processor core is completely ended or is not completely ended (partially completed), and instructing the resource management unit to recycle the resource which is completely executed.
For example, if the task ending instruction represents that the tasks executed by the processor cores are all ended, the resource management unit is instructed to recycle all the resources allocated by the resource management unit; or, if the task ending instruction represents that the task part executed by the processor core is completed, the resource management unit is instructed to recycle the resource which is completed.
The executed resources (or sub-resources) comprise resources (or sub-resources) corresponding to the executed tasks in the process of executing the tasks by the processor cores; for example, the task includes instruction fetching, decoding, executing, accessing and writing back, and after the processor core completes the instruction fetching, the resource (or sub-resource) required for the instruction fetching is the resource for completion of the execution; or after the processor core finishes the instruction fetching and the decoding, the resources (or sub-resources) required by the instruction fetching and the decoding are the resources finished by the execution.
Step S202, the resource management unit determines, based on the task ending instruction, a resource for executing a task corresponding to the task ending instruction.
In some embodiments, in response to the task not completely ending, the resource management unit determines at least one sub-resource corresponding to the task ending instruction; the resource management unit confirms that at least one sub-resource is a resource for executing a task corresponding to the task ending instruction; and at least one sub-resource comprises a sub-resource which is executed in all sub-resources for executing the task.
In specific implementation, the task ending instruction may be periodically sent to the resource management unit by the processor core in the process of executing the task; or the processor core sends the executed subtasks to the resource management unit in the process of executing the tasks; the task ending instruction may include a progress of the processor core to execute the task.
Further, in specific implementation, in response to that the task ending instruction is periodically sent to the resource management unit by the processor core in the process of executing the task, the resource management unit determines, based on the task ending instruction, that the sub-resource corresponding to the executed sub-task in the task is the resource for executing the task corresponding to the task ending instruction. For example, the task comprises five subtasks, namely instruction fetching, decoding, execution, access and write-back, and when the processor core executes and does not execute to complete the access, the processor core periodically sends a task ending instruction to the resource management unit; and the resource management unit confirms the sub-resources required by value taking, decoding and execution before access storage as the resources of the task corresponding to the task ending instruction.
Or, in specific implementation, in response to that the task ending instruction is sent to the resource management unit by the processor core in the process of executing the task, the resource management unit determines, based on the task ending instruction, that at least one sub-resource executed and completed in the task is a resource for executing the task corresponding to the task ending instruction. For example, the task comprises instruction fetching, decoding, execution, memory access and write back, and when the processor core completes the memory access, a task ending instruction is sent to the resource management unit; the resource management unit confirms that the sub-resources required by the access and storage are the resources of the task corresponding to the task ending instruction; obviously, after the sub-resources required by the value taking, decoding and execution are finished, the task ending instruction sent by the processor core is recycled.
In some embodiments, in response to the task being completely finished, the resource management unit determines all sub-resources corresponding to the task-finished instruction; the resource management unit confirms that all the sub-resources are resources for executing the task corresponding to the task ending instruction; and all the sub-resources comprise sub-resources which are executed in all the resources for executing the task.
In specific implementation, the task ending instruction may be periodically sent to the resource management unit by the processor core in the process of executing the task; or the processor core sends the executed part to the resource management unit in the process of executing the task; the processor core can also send the data to the resource management unit after executing all tasks; the task ending instruction may include a progress of the processor core executing the task.
Further, in specific implementation, in response to that the task ending instruction is sent by the processor core in the process of executing the task (including sending periodically or sending after completing one subtask), the resource management device may temporarily suspend the task ending instruction, and after all subtasks included in the task are completed, confirm that all the sub resources corresponding to the task are resources for executing the task corresponding to the task ending instruction; or, in response to the task ending instruction being sent by the processor core after the task is completely ended, the resource management unit determines that all sub-resources corresponding to the task are resources for executing the task corresponding to the task ending instruction.
In step S203, the resource management unit recovers the resource.
In some embodiments, the resource management unit reclaims resources such that the reclaimed resources may or may not be allocated when subsequently allocating resources for the pending task.
In this way, the resource management unit in the electronic device receives a task ending instruction sent by the processor core in the electronic device; the resource management unit determines to execute the resource of the task corresponding to the task ending instruction based on the task ending instruction; the resource management unit recovers resources; the resource is distributed to a pipeline corresponding to the task to be processed by the resource management unit according to the task; under the condition that the tasks are completely finished or the subtasks are finished, the resource management unit can recycle the resources (or the sub-resources) which are finished according to the task finishing instruction, so that the resource allocation and execution of other tasks are facilitated, and the resource utilization rate and the task execution efficiency are improved.
In some embodiments, the optional recycling process for the resources corresponding to the historical tasks further includes the following steps:
in step S200, a processor core in the electronic device sends a task ending instruction to a resource management unit in the electronic device.
In some embodiments, a processor core within an electronic device sends a task end instruction to a resource management unit within the electronic device; the task ending instruction is used for the resource management unit to recycle and execute the resources of the task corresponding to the task ending instruction.
In some embodiments, in the case that the task is not completely ended, the processor core sends a task ending instruction to the resource management unit, so that the resource management unit recovers sub-resources that are completely executed in all resources for executing the task; alternatively, when all tasks are completed, the processor core transmits a task completion instruction to the resource management unit to cause the resource management unit to collect all resources for executing the tasks.
During specific implementation, the processor core can periodically send a task ending instruction to the resource management unit in the task execution process; or, the processor core may also send a task end instruction to the resource management unit for the executed subtasks in the task execution process; alternatively, the processor core may send a task end instruction to the resource management unit after executing all tasks.
Therefore, the processor core in the electronic equipment flexibly sends a task ending instruction to the resource management unit in the electronic equipment according to the task execution condition, so that the resource management unit can flexibly recover part or all resources, resource allocation and execution of other tasks are facilitated, and the resource utilization rate and the task execution efficiency are improved.
In some embodiments, after the resource management unit determines, for the task to be processed, the type of the resource required by the task to be processed and the strength (size) of the resource, the resource management unit searches for a resource matching the resource required by the task to be processed from among the resources recovered in the first time interval, including at least the following steps: searching resources with the same type as the resources required by the task to be processed in the resources recovered in the first time interval; and/or searching resources which are larger than or equal to the size of the resources required by the task to be processed in the resources recycled in the first time interval.
Specifically, as an example, if the branch prediction sub-resource, the instruction fetch sub-resource, the decode sub-resource, the rename sub-resource, and the execution sub-resource corresponding to the historical task are released in the first time interval, the resources recovered in the first time interval include the branch prediction sub-resource, the instruction fetch sub-resource, the decode sub-resource, the rename sub-resource, and the execution sub-resource released by the historical task. The resource management unit determines the type of the resource required by the task to be processed, and comprises the following steps: and the sizes of the branch prediction sub-resources, the instruction fetching sub-resources, the decoding sub-resources and the execution sub-resources are larger than the size of the resources required by the task to be processed, so that the resources with the size matched with the resources required by the task to be processed can be randomly selected from the branch prediction sub-resources, the instruction fetching sub-resources, the decoding sub-resources and the execution sub-resources and are distributed to the task to be processed.
In this embodiment, the asset management unit searches for a resource of the same type as a resource required by a task to be processed in the resources recovered in the first time interval; and/or searching for resources with the size larger than or equal to the size of the resources required by the task to be processed in the resources recovered in the first time interval, performing resource matching according to the type and size of the resources required by the task to be processed, and quickly matching the task to be processed with proper resources.
In some embodiments, a specific process of the resource management unit searching for a resource matching with a resource required by a task to be processed in the resources recovered in the first time interval is shown in fig. 4, and includes:
in step S102a, the resource management unit in the electronic device determines a resource allocation policy based on the resources required by the task to be processed.
In step S102b, the resource management unit allocates resources for the to-be-processed task in the resources recovered in the first time interval based on the resource allocation policy.
With respect to step S102a, the determining, by the resource management unit, a specific implementation process of the resource allocation policy based on the resource required by the task to be processed may include: the resource management unit first determines a resource allocation policy based on the strength of the resources required by the task to be processed.
In some embodiments, the resources required for a task may be divided into a number of different intensity levels based on intensity. As an example, resources required by a task are divided into two levels based on intensity, and in response to that the intensity of the resources required by the task to be processed meets a first condition, the resource allocation policy is determined to be a first resource allocation policy; and determining the resource allocation strategy to be a second resource allocation strategy in response to the fact that the strength of the resources required by the task to be processed meets a second condition. The resources with the strength meeting the first condition are weak resources, and the resources with the strength meeting the second condition are strong resources; for weak resources, dividing available resources recovered in a first time interval based on a first resource allocation strategy; for strong resources, the available resources recovered for the first time interval are partitioned based on a second resource allocation policy. As an example, the first condition may be that the strength of the resource is less than a first strength threshold, the second condition may be that the strength of the resource is greater than a second strength threshold, the first strength threshold and the second strength threshold both being used to characterize the strength or size of the resource, the first strength threshold being less than or equal to the second strength threshold, wherein the size of the resource allocated based on the first resource allocation policy is less than the size of the resource allocated based on the second resource allocation policy.
In the above, the resource required by the task is divided into two levels based on the strength, and in specific implementation, the resource required by the task may be divided into three levels or more than three levels based on the strength, which is not limited in the embodiment of the present application. And the resource allocation strategies corresponding to all the intensity levels are different.
Dividing available memory resources recycled in the first time interval into N parts based on a first resource allocation strategy, wherein the size of each part of memory resources is X; dividing the available memory resources recycled in the first time interval into M parts based on a second resource allocation strategy, wherein the size of each part of the memory resources is Y; wherein N is more than M, and X is less than Y.
In the above description, taking the average division of the resources (such as available memory resources) recovered in the first time interval into multiple parts as an example, in a specific implementation, the resources recovered in the first time interval may also be unevenly divided, for example, the multiple parts of the resources obtained by dividing the resources recovered in the first time interval are different in size, or the parts of the resources obtained by dividing the resources recovered in the first time interval are the same in size and different in size.
For step S102b, the specific implementation process of the resource management unit allocating resources for the task to be processed based on the resource allocation policy may include: for each type of resource recovered in the first time interval, the resource management unit divides each type of resource into at least one sub-resource pool based on the resource allocation strategy; and determining that the resource in one of the at least one sub-resource pool is the resource required by the task to be processed.
In some embodiments, each type of resource recycled for the first time interval may include branch prediction resources, instruction fetching resources, transcoding resources, renaming resources, arithmetic resources, register resources, and memory resources.
Taking the example that the resource recovered in the first time interval is a branch prediction resource, the resource management unit divides the branch prediction resource into one or more branch prediction sub-resource pools based on the resource allocation policy, and the size of the resource included in each branch prediction sub-resource pool is the same or different. The resource management unit selects one branch prediction sub-resource pool meeting the requirement of the task to be processed from the plurality of branch prediction sub-resource pools, and resources in the selected branch prediction sub-resource pool are resources used for performing branch prediction on the task to be processed.
The above description has been made of a process of determining a resource for performing branch prediction, taking only a branch prediction resource as an example. In specific implementation, the process of determining resources for instruction fetching, decoding, renaming, calculating, storing, accessing, and the like is the same as the process of determining resources for branch prediction, and details are not described in the embodiments of the present application.
In the embodiment of the application, each type of resource recovered in a first time interval is divided into a resource pool, a resource allocation strategy is determined based on the strength of the resource required by a task to be processed, and each resource pool is divided into a plurality of sub-resource pools with the same or different sizes according to the resource allocation strategy; the method and the device can distribute the required resources for the tasks from the plurality of sub-resource pools according to the requirements of the tasks. Therefore, the execution efficiency of the tasks is improved, the utilization rate of resources is improved, and the performance of the electronic equipment is improved.
Based on the flow shown in fig. 4, it can be understood that in the embodiment of the present application, each type of resource recovered in the first time interval is divided into one resource pool, and a resource required for executing the task to be processed is allocated to the task to be processed in the resource pool recovered in the first time interval according to the resource required by the task to be processed.
In specific implementation, the resource division diagram recovered in the first time interval is as shown in fig. 5: dividing branch prediction resources recovered in a first time interval into a branch prediction resource pool, dividing fetch resources recovered in the first time interval into a fetch resource pool, dividing decoding resources recovered in the first time interval into a decoding resource pool, dividing renaming resources recovered in the first time interval into a renaming resource pool, and dividing execution resources recovered in the first time interval into an execution resource pool; wherein the execution resources may include: one or more of register resources, memory resources, and computational resources. All the resource pools are connected through a connection network; the connection network may be a hardware network based on switch control, or may be any other network, which is not limited in the embodiments of the present application.
In the resource division diagram shown in fig. 5, the resource management unit performs resource management on all resource pools; in a specific implementation, the resource management unit may further include a plurality of resource management sub-units, and each resource management sub-unit performs resource management on different resource pools. As an example, the resource management unit includes a branch prediction resource sub-management unit, an instruction resource sub-management unit, a decode resource sub-management unit, a rename resource sub-management unit, and an execution resource sub-management unit; the branch prediction resource sub-management unit is used for performing resource management on resources in a branch prediction resource pool, the fetch resource sub-management unit is used for performing resource management on the resources in the fetch resource pool, the decoding resource sub-management unit is used for performing resource management on the resources in the decoding resource pool, the renaming resource sub-management unit is used for performing resource management on the resources in the renaming resource pool, and the execution resource sub-management unit is used for managing the resources in the execution resource pool.
For the resource division diagram shown in fig. 5, each resource pool may 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 according to different resource allocation policies; the sub resource pools with the same size refer to resources of the same type, and the sizes of the resources included in each sub resource pool are the same; the sub resource pools with different sizes refer to that the sizes of the resources included in the sub resource pools are partially or totally different for the same type of resources.
Dividing each resource pool into sub-resource pools in an organization mode with the same size, for example, dividing each sub-resource pool in an organization mode of minimum resources, so that resources recovered in a first time interval can support the maximum number of processor cores to execute tasks in parallel, the task parallel processing capability is improved, and the performance of the electronic equipment is further improved.
Dividing each resource pool into sub-resource pools in an organization mode with different sizes, so that the resource management unit can allocate required resources to the tasks according to the requirements of the tasks on each type of resources; the problem that resources are wasted or the resources are insufficient to support the processor cores to execute tasks due to the fact that fixed resources are allocated to each processor core in the related technology is solved, the task execution efficiency and the resource utilization rate are improved, and then the performance of the electronic equipment is improved.
In the embodiment of the application, if the resource in a certain sub-resource pool allocated for the task to be executed is idle or residual, the idle or residual resource can be set to be in the sleep mode, so that the idle or residual resource is not used for executing the task, and the power consumption is reduced. The idle or residual resources can be removed from the sub-resource pool, and the idle or residual resources are divided into other sub-resource pools, so that the idle or residual resources are fully utilized, and the utilization rate of the resources is improved.
In some embodiments, if there is no resource matching the resource required by the task to be processed in the resources recovered in the first time interval, the resource management unit searches for a resource matching the resource required by the task to be processed in all the resources included in the electronic device.
Specifically, if some types of resources required by the task to be processed do not exist in the resources recovered in the first time interval, or the size of the existing resources does not match the size of the resources required by the task to be processed, the resource management unit preferentially searches the resources recovered in the first time interval for the resources matched with other types of resources required by the task to be processed, or preferentially allocates the resources in the resources recovered in the first time interval to the task to be processed, and searches all the resources included in the electronic device for the types of resources that do not exist in the first time interval or the portions with insufficient resource size.
In this embodiment, a resource matching the resource required by the task to be processed does not exist in the resources recovered in the first time interval, and the resource management unit searches for the resource matching the resource required by the task to be processed from all the resources included in the electronic device, so that the matched resource can be allocated to the task to be processed, and the requirement of the task to be processed on the resource is met.
S103, allocating the resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed, so that the processor cores execute the pipelines based on the resources matched with the resources required by the tasks to be processed.
According to the resource management method provided by the embodiment of the application, the resource management unit in the electronic equipment determines the resources required by the task to be processed according to the task to be processed; the resource management unit searches resources matched with the resources required by the task to be processed in the resources recovered in the first time interval; the resources matched with the resources required by the tasks to be processed are distributed to the assembly lines corresponding to the tasks to be processed, so that the processor cores execute the assembly lines based on the resources matched with the resources required by the tasks to be processed, the resource management unit can distribute the resources for the tasks to be processed in the recently recovered resources, the resources recovered before the first time interval are controlled to be in a dormant state, and the resources in the dormant state cannot be distributed to the assembly line to execute the tasks, so that the power consumption of the electronic equipment can be saved, and the performance of the electronic equipment can be improved.
In some embodiments, the resource management unit may be a program installed on the electronic device; alternatively, the resource management unit may be a hardware component within the electronic device; alternatively, 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 resource management method provided in the embodiments of the present application is characterized by being implemented in a software manner; the program installed on the electronic device may be an application installed on the electronic device, or may be an applet loaded by an application installed on the electronic device.
During specific implementation, a program installed on the electronic equipment determines information of a task to be processed, and determines resources required by the task to be processed according to the information of the task to be processed; searching resources matched with the resources required by the task to be processed in the resources recovered in the first time interval, sending the resources matched with the resources required by the task to be processed to a corresponding hardware component in the electronic equipment by a program installed on the electronic equipment, and executing the task to be processed by the hardware component based on the resources matched with the resources required by the task to be processed.
In other embodiments, if the resource management unit is a hardware component in the electronic device, the resource management method provided in the embodiments of the present application is implemented in a hardware manner.
When the method is specifically implemented, a hardware component in the electronic equipment determines resources required by the task to be processed according to the information of the task to be processed; searching resources matched with the resources required by the task to be processed in the resources recovered in the first time interval, and executing the task to be processed based on the resources matched with the resources required by the task to be processed.
In still other embodiments, if the resource management unit includes a program installed on the electronic device and a hardware component in the electronic device, the resource management method provided by the embodiments of the present application is implemented in a combination of software and hardware.
When the method is specifically implemented, a hardware component in the electronic equipment sends information of a task to be processed to a program installed on the electronic equipment; determining resources required by the task to be processed by a program installed on the electronic equipment according to the information of the task to be processed; searching resources matched with the resources required by the task to be processed in the resources recovered in the first time interval, sending the resources matched with the resources required by the task to be processed to a corresponding hardware component in the electronic equipment, and executing the task to be processed by the hardware component based on the resources matched with the resources required by the task to be processed.
Or, in specific implementation, a hardware component in the electronic device sends information of the task to be processed to a program installed on the electronic device; the method comprises the steps that a program installed on the electronic equipment determines resources needed by a task to be processed according to information of the task to be processed, the resources needed by the task to be processed are sent to corresponding hardware components in the electronic equipment, the hardware components search resources matched with the resources needed by the task to be processed in resources recovered in a first time interval based on the resources needed by the task to be processed, and the task to be processed is executed based on the resources matched with the resources needed by the task to be processed.
It should be noted that since the advent of the first general purpose computer, computer technology has evolved rapidly over the decades, with the rapid evolution of computer technology benefiting from improvements in computer architecture and advances in computer manufacturing technology. The contribution of computer production technology to the development of computer technology has been stable; however, as the computer architecture has been improved for decades, the space for improving the computer architecture is becoming increasingly narrow, and therefore any small improvement on the computer architecture will have a significant impact on the performance of the processor and the development of computer technology.
An embodiment of the present application further provides an electronic device, which is configured to implement the resource management method shown in fig. 2 to 7. As shown in fig. 8, the schematic structural diagram of the electronic device at least includes: a resource management unit 701 and a processor core 702; wherein the content of the first and second substances,
a resource management unit 701, configured to determine, according to the task to be processed, a resource required by the task to be processed; searching resources matched with resources required by a task to be processed in the resources recovered in the first time interval; distributing resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed;
and the processor core 702 is used for executing the pipeline based on the resources matched with the resources required by the task to be processed.
In some optional embodiments, the resources recovered for the first time interval are: and responding to the completion of the all execution of the historical tasks corresponding to the resources, and releasing the resources for executing the historical tasks in a first time zone away from the current time.
In some optional embodiments, the resources recovered for the first time interval are: and responding to the completion of the execution of the historical task part corresponding to the resource, and releasing the resource corresponding to the executed historical task in a first time zone away from the current time.
In some optional embodiments, the resource management unit 701 is configured to search, in the resources recycled in the first time interval, for resources of the same type as the resources required by the task to be processed; and/or searching resources which are larger than or equal to the size of the resources required by the task to be processed in the resources recycled in the first time interval.
In some optional embodiments, if there is no resource matching with the resource required by the task to be processed in the resources recovered in the first time interval, the resource management unit 701 is configured to search, from all resources included in the electronic device, for a resource matching with the resource required by the task to be processed.
It should be noted that, the description of the electronic device in the embodiment of the present application is similar to the description of the embodiment of the resource management method, and has similar beneficial effects to the embodiment of the method, and therefore, the description is omitted here. The technical details that are not used up in the electronic device provided by the embodiment of the present application can be understood from the description of any one of fig. 2 to 7.
An exemplary application of the electronic device provided in the embodiments of the present application is described below, and the electronic device provided in the embodiments of the present application 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 services. 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, and the like. The terminal device and the server may be directly or indirectly connected through wired or wireless communication, and the embodiment of the present application is not limited herein.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an electronic device 400 provided in an embodiment of the present application, where the electronic device 400 shown in fig. 9 includes: at least one processor 410, memory 450, and bus 440; the various components in electronic device 400 are coupled together by a bus 440. It is understood that bus 440 is used to enable communications among the components. Bus 440 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration the various busses are labeled as bus 440 in figure 9.
The Processor 410 may be an integrated circuit chip having Signal processing capabilities, such as a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like, wherein the general purpose Processor may be a microprocessor or any conventional Processor, or the like.
The memory 450 stores executable instructions for implementing a resource management method provided by the embodiment of the present application, where the resource management method can be implemented by the resource management unit 701 in the electronic device shown in fig. 8; the memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard disk drives, optical disk drives, and the like. Memory 450 optionally includes one or more storage devices physically located remote from processor 410.
In some embodiments, memory 450 is capable of storing data, examples of which include programs, modules, and data structures, or a subset or superset thereof, to support various operations.
In some embodiments, the electronic device 400 may further include:
an operating system 451, including system programs for handling various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and handling hardware-based tasks;
a network communication module 452 for communicating to other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: bluetooth, wireless compatibility authentication (WiFi), and Universal Serial Bus (USB), among others.
Embodiments of the present application provide a computer-readable storage medium storing executable instructions, which when executed by a processor, will cause the processor to perform a resource management method provided by embodiments of the present application, for example, the resource management method shown in fig. 2 to 7.
In some embodiments, the computer-readable storage medium may be memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
In some embodiments, executable instructions may be written in any form of programming language (including compiled or interpreted languages), in the form of programs, software modules, scripts or code, and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
By way of example, executable instructions may be deployed to be executed on one computing device or on multiple computing devices at one site or distributed across multiple sites and interconnected by a communication network.
Embodiments of the present application provide a computer program product, which includes a computer program/instruction, and when the computer program/instruction is executed by a processor, the computer program/instruction implements the resource management method described in the present application.
The above description is only an example of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, and improvement made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims (10)

1. A method for resource management, the method comprising:
a resource management unit in the electronic equipment determines resources required by the task to be processed according to the task to be processed;
the resource management unit searches resources matched with the resources required by the task to be processed in the resources recovered in the first time interval;
and allocating resources matched with the resources required by the tasks to be processed to pipelines corresponding to the tasks to be processed, so that the processor cores execute the pipelines based on the resources matched with the resources required by the tasks to be processed.
2. The method of claim 1, wherein the resources recycled for the first time interval are: responding to the completion of all the historical tasks corresponding to the resources, and releasing the resources for executing the historical tasks in a first time zone away from the current time.
3. The method of claim 1, wherein the resources recovered for the first time interval are: responding to the completion of the execution of the historical task part corresponding to the resource, and releasing the executed resource corresponding to the historical task in a first time zone away from the current moment.
4. The method according to claim 1, wherein the resource management unit searches for a resource matching the resource required by the task to be processed in the resources recycled in the first time interval, and comprises:
searching resources with the same type as the resources required by the task to be processed in the resources recovered in the first time interval;
and/or searching resources with the size larger than or equal to the size of the resources required by the task to be processed in the resources recycled in the first time interval.
5. The method according to claim 1, wherein if there is no resource matching the resource required by the task to be processed in the recovered resources in the first time interval, the method further comprises:
and the resource management unit searches resources matched with the resources required by the task to be processed in all the resources included in the electronic equipment.
6. An electronic device, characterized in that the electronic device comprises: a resource management unit and a processor core; wherein the content of the first and second substances,
the resource management unit is used for determining resources required by the tasks to be processed according to the tasks to be processed; searching resources matched with the resources required by the task to be processed in the resources recovered in the first time interval; distributing resources matched with the resources required by the tasks to be processed to the pipelines corresponding to the tasks to be processed;
and the processor core is used for executing the pipeline based on the resources matched with the resources required by the task to be processed.
7. The electronic device of claim 6,
the resource management unit is used for searching resources which are the same as the resource types required by the tasks to be processed in the resources recovered in the first time interval; and/or searching resources with the size larger than or equal to the size of the resources required by the task to be processed in the resources recycled in the first time interval.
8. An electronic device, characterized in that the electronic device comprises:
a processor, a memory, and a bus;
the memory stores executable instructions;
the processor and the memory are communicated through the bus, and when the processor executes the executable instructions stored in the memory, the resource management method of any one of claims 1 to 5 is realized.
9. A computer-readable storage medium having stored thereon executable instructions for, when executed by a processor, implementing the resource management method of any one of claims 1 to 5.
10. A computer program product, characterized in that the computer program product comprises a computer program/instructions which, when executed by a processor, implements the resource management method of any of claims 1 to 5.
CN202210267751.4A 2022-03-17 2022-03-17 Resource management method, electronic device, and computer-readable storage medium Pending CN114610495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210267751.4A CN114610495A (en) 2022-03-17 2022-03-17 Resource management method, electronic device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210267751.4A CN114610495A (en) 2022-03-17 2022-03-17 Resource management method, electronic device, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
CN114610495A true CN114610495A (en) 2022-06-10

Family

ID=81864260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210267751.4A Pending CN114610495A (en) 2022-03-17 2022-03-17 Resource management method, electronic device, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN114610495A (en)

Similar Documents

Publication Publication Date Title
US9710309B2 (en) Task scheduling in big and little cores
CN105074666B (en) Operating system executing on processors with different instruction set architectures
US9027005B2 (en) Single code set applications executing in a multiple platform system
EP3285166B1 (en) Optimizing a distribution of applications executing in a multiple platform system
US8984200B2 (en) Task scheduling in big and little cores
US20150143380A1 (en) Scheduling workloads and making provision decisions of computer resources in a computing environment
US20130311751A1 (en) System and data loading method
JP2012108576A (en) Multi-core processor, process execution method, and program
EP2504759A1 (en) Method and system for enabling access to functionality provided by resources outside of an operating system environment
CN114968373A (en) Instruction dispatching method and device, electronic equipment and computer readable storage medium
CN115981685A (en) Application upgrading method and device, computing equipment and chip system
US20180267829A1 (en) Method for configuring an it system, corresponding computer program and it system
CN114610494A (en) Resource allocation method, electronic device and computer-readable storage medium
CN105677481A (en) Method and system for processing data and electronic equipment
CN114610495A (en) Resource management method, electronic device, and computer-readable storage medium
CN114356586B (en) Processor and electronic equipment
CN111782335A (en) Extended application mechanism through in-process operating system
CN114625538A (en) Resource recovery method and device, electronic equipment and computer readable storage medium
WO2014188642A1 (en) Scheduling system, scheduling method, and recording medium
CN114610395A (en) Instruction dispatching method and device, electronic equipment and computer-readable storage medium
CN114064128B (en) Kernel restarting method
US20080077925A1 (en) Fault Tolerant System for Execution of Parallel Jobs
CN114625537A (en) Resource allocation method, electronic device and computer-readable storage medium
CN112099799B (en) NUMA-aware multi-copy optimization method and system for SMP system read-only code segments
CN115220908A (en) Resource scheduling method, 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