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

By reclaiming resources and matching them to the production line within the first time interval in the electronic device's resource management unit, the problem of resource waste is solved, and resource utilization and equipment performance are improved.

CN114610495BActive Publication Date: 2025-11-07PHYTIUM TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210267751.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-17
Publication Date
2025-11-07
Estimated Expiration
2042-03-17

AI Technical Summary

Technical Problem

In the existing technology, the resource allocation method based on processor core granularity leads to resource waste and low utilization, which cannot meet the resource requirements of the pipeline and affects the performance of electronic devices.

Method used

The resource management unit searches for resources that match the pending tasks in the resource recycling process within the first time interval and allocates them to the pipeline. Unused resources are put into a dormant state to avoid resource waste.

Benefits of technology

It improves resource utilization and the performance of electronic devices, saves power consumption, and enhances task execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114610495B_ABST
    Figure CN114610495B_ABST
Patent Text Reader

Abstract

The application provides a resource management method, an electronic device and a computer readable storage medium. The method comprises the following steps: a resource management unit in the electronic device determines resources required by a to-be-processed task according to the to-be-processed task; the resource management unit searches for resources matched with the resources required by the to-be-processed task in resources recovered in a first time interval; and the resources matched with the resources required by the to-be-processed task are allocated to a pipeline corresponding to the to-be-processed task, so that a processor core executes the pipeline based on the resources matched with the resources required by the to-be-processed task. Through implementation of the application, the resource management unit can allocate resources for the to-be-processed task in the most recently recovered resources, thereby saving power consumption of the electronic device and improving performance of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to computer architecture technology, and in particular, to a resource management method, an electronic device, and a computer readable storage medium. BACKGROUND

[0002] With the improvement of computer architecture and the rapid development of microprocessor technology, the performance of computers has also been greatly improved. Electronic devices based on microprocessor technology usually randomly allocate resources to each processor core in idle resources, so that each processor core in the electronic device can process tasks according to the allocated resources. How to improve the performance of electronic devices through resource allocation is the goal pursued by microprocessor technology. SUMMARY

[0003] The 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 the performance of the electronic device by preferentially allocating resources recovered in a first time interval.

[0004] The technical solutions of the embodiments of the present application are implemented as follows:

[0005] In a first aspect, the embodiments of the present application provide a resource management method, which includes: determining, by a resource management unit in an electronic device, resources required by a to-be-processed task according to the to-be-processed task; searching, by the resource management unit, for resources matching the resources required by the to-be-processed task in resources recovered in a first time interval; and allocating the resources matching the resources required by the to-be-processed task to a pipeline corresponding to the to-be-processed task, so that a processor core executes the pipeline based on the resources matching the resources required by the to-be-processed task.

[0006] Optionally, the resources recovered in the first time interval are resources for executing historical tasks released within a first time interval from a current time in response to the historical tasks corresponding to the resources being completely executed.

[0007] Optionally, the resources recovered in the first time interval are resources corresponding to historical tasks that have been executed released within a first time interval from a current time in response to the historical tasks corresponding to the resources being partially executed.

[0008] Optionally, the resource management unit searches for the resources matching the resources required by the to-be-processed task in the resources recovered in the first time interval, including: searching for resources of the same type as the resources required by the to-be-processed task in the resources recovered in the first time interval; and / or searching for resources greater than or equal to the size of the resources required by the to-be-processed task in the resources recovered in the first time interval.

[0009] Optionally, if there is no resource matching the required resource of the to-be-processed task in the resources recovered in the first time interval, the resource management method further comprises: the resource management unit searching for the resource matching the required resource of the to-be-processed task in all resources included in the electronic device.

[0010] In a second aspect, an embodiment of the present application provides an electronic device, which comprises a resource management unit and a processor core; wherein the resource management unit is configured to determine a required resource of a to-be-processed task, search for a resource matching the required resource of the to-be-processed task in resources recovered in a first time interval, and allocate the resource matching the required resource of the to-be-processed task to a pipeline corresponding to the to-be-processed task; and the processor core is configured to execute the pipeline based on the resource matching the required resource of the to-be-processed task.

[0011] Optionally, the resources recovered in the first time interval are resources for executing historical tasks released within a first time interval from a current time in response to the historical tasks corresponding to the resources being completely executed.

[0012] Optionally, the resources recovered in the first time interval are resources corresponding to historical tasks that have been executed and released within a first time interval from a current time in response to the historical tasks corresponding to the resources being partially executed.

[0013] Optionally, the resource management unit is configured to search for a resource of the same type as the required resource of the to-be-processed task in the resources recovered in the first time interval, and / or search for a resource greater than or equal to the size of the required resource of the to-be-processed task in the resources recovered in the first time interval.

[0014] Optionally, if there is no resource matching the required resource of the to-be-processed task in the resources recovered in the first time interval, the resource management unit is configured to search for the resource matching the required resource of the to-be-processed task in all resources included in the electronic device.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, which comprises a processor, a memory, and a bus; the memory stores executable instructions; the processor communicates with the memory through the bus, and when the processor executes the executable instructions stored in the memory, the resource management method provided by an embodiment of the present application is implemented.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores executable instructions, and when the executable instructions are executed by a processor, the resource management method provided by an embodiment of the present application is implemented.

[0017] In a fifth aspect, an embodiment of the present application provides a computer program product, which comprises computer programs / instructions, and when the computer programs / instructions are executed by a processor, the resource management method provided by an embodiment of the present application is implemented.

[0018] The resource management method, the electronic device and the computer readable storage medium provided by the embodiments of the present application can save the power consumption of the electronic device and improve the performance of the electronic device. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 is a processing flow diagram of instructions in the related art;

[0020] Figure 2 is an optional processing flow diagram of the resource management method provided by the embodiments of the present application;

[0021] Figure 3 is a diagram for determining the resources required by the to-be-processed task by the resource management unit according to the to-be-processed task;

[0022] Figure 4 is a processing flow diagram of the resource management unit allocating resources for the to-be-processed task in the resources recovered in the first time interval;

[0023] Figure 5 is a division diagram of the resources recovered in the first time interval;

[0024] Figure 6 is a diagram for dividing a sub-resource pool based on a resource allocation strategy provided by the embodiments of the present application;

[0025] Figure 7 is another diagram for dividing a sub-resource pool based on a resource allocation strategy provided by the embodiments of the present application;

[0026] Figure 8 is a composition structure diagram of the electronic device provided by the embodiments of the present application;

[0027] Figure 9 is a hardware structure diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0028] In order to make the purposes, technical solutions and advantages of the present application clearer, the following further describes the present application in conjunction with the accompanying drawings, the described embodiments should not be regarded as limiting the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0029] In the following description, "some embodiments" are referred to, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0030] In the following description, the term "first\second" is only to distinguish similar objects, and does not represent a specific order of the objects, and it can be understood that "first\second" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

[0032] It should be understood that in various embodiments of the present application, the size of the serial number of each implementation process does not mean the order of execution, and the execution order 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.

[0033] Before further detailing the embodiments of the present application, the terms and terms involved in the embodiments of the present application are explained, and the terms and terms involved in the embodiments of the present application are applicable to the following explanations.

[0034] 1) Processor core: the most core part inside the processor, also known as processor core.

[0035] 2) Processor: including one or more processor cores, and other components or devices such as memory.

[0036] 3) Pipeline: an implementation technology for overlapping execution of multiple instructions, each step in the pipeline completes a part of the instruction, each step is called a pipeline stage or a pipeline section, the pipeline stages are connected in front and back, forming a pipeline; instructions enter one end of the pipeline and exit the other end of the pipeline through these pipeline stages; each pipeline corresponds to a task.

[0037] For the processing flow of instructions in a pipeline, such as Figure 1As shown, the life cycle of an instruction in a pipeline includes fetch, decode, execute, memory access, and write back. The instruction fetch refers to the process of reading an instruction from memory. The instruction decode refers to the process of translating the fetched instruction. After decoding, the instruction operand register index is obtained, which can be used to read the operands from the general register file. After decoding, the type of calculation required is known, and the required operands have been read from the general register file. Then, the instruction execute refers to the process of performing the actual operation on the instruction. For example, if the instruction is an addition operation instruction, the operands are added; if it is a subtraction operation instruction, the operands are subtracted. The most common component in the "execute" stage is the ALU, which is a hardware functional unit that implements specific operations. The memory access refers to the process of reading data from memory or writing data to memory. The write back refers to the process of writing the results of the instruction execution back to the general register file. If it is a normal operation instruction, the result value comes from the calculation result of the "execute" stage; if it is a memory read instruction, the result comes from the data read from the memory in the "memory access" stage.

[0038] The resources allocated to the processor core refer to the resources used to execute each pipeline stage of the pipeline. For example, the resources allocated to the processor core can be branch prediction resources, instruction fetch resources, decoding resources, renaming resources, execution resources, etc. The execution resources can include at least one of operation resources, register resources, and memory resources. The memory resources can include a cache and a memory, and the cache can include at least one of an L1 cache, an L2 cache, and an L3 cache. The memory can be any type of memory such as a flash memory. The decoding resources can include at least one decoder. The renaming resources can include at least one register.

[0039] In the related art, a computer device internally includes multiple processor cores, and resources in the computer device are allocated in granularity of the processor cores; specifically, each processor core is allocated resources corresponding to the processor core; resources among the processor cores are independent of each other, and a processor core A cannot use resources allocated to a processor core B when the processor core A executes a task; similarly, the processor core B cannot use resources allocated to the processor core A when the processor core B executes a task. The applicant finds that when resources in the computer device are allocated in granularity of the processor cores, at least the following problems exist: when a pipeline executed by a certain processor core needs strong resources, the resources allocated to the processor core cannot meet the demand of the pipeline for the resources, and the efficiency of executing the task is low; when a pipeline executed by a certain processor core needs weak resources, part of the resources allocated to the processor core is idle, and the resources cannot be effectively utilized.

[0040] An optional processing flow of the resource management method provided by the embodiment of the present application, as shown in Figure 2 , at least includes the following steps:

[0041] S101, a resource management unit in an electronic device determines resources required by a to-be-processed task according to the to-be-processed task.

[0042] In the embodiment of the present application, the resource management unit in the electronic device determines the resources required by the to-be-processed task according to the to-be-processed task, can allocate resources according to the demand of the to-be-processed task for the resources, avoids the problem of resource waste in the related art, and improves the resource utilization rate.

[0043] In some embodiments, the to-be-processed task can refer to a task to be executed by a processor core in the electronic device, and one to-be-processed task corresponds to one pipeline.

[0044] In some optional embodiments, a schematic diagram in which the resource management unit in the electronic device determines the resources required by the to-be-processed task according to the to-be-processed task, as shown in Figure 3 , at least includes the following steps:

[0045] S101a, the resource management unit in the electronic device determines information of the to-be-processed task.

[0046] In some embodiments, the information of the to-be-processed task can include one or more of the following: a type of the to-be-processed task, a name of the to-be-processed task, an application program corresponding to the to-be-processed task, and an execution period of the to-be-processed task.

[0047] S101b, the resource management unit determines the resources required by the to-be-processed task based on the information of the to-be-processed task.

[0048] In some embodiments, the resource management unit determines the resource required by the to-be-processed task based on the information of the to-be-processed task, including: the resource management unit determines the resource type, intensity (size), etc. required by the to-be-processed task based on the information of the to-be-processed task.

[0049] In S102, the resource management unit searches for the resource matching the resource required by the to-be-processed task from the resources recovered in the first time interval.

[0050] In some embodiments, the resources recovered in the first time interval are: the resources used for executing the historical task released within the first time interval from the current time in response to the historical task corresponding to the resources being completely executed.

[0051] Specifically, the historical task can be a task that has been completely executed before the current time, or a task that has been partially executed before the current time. The first time interval from the current time is a period of time before the current time, for example, one hour before the current time, tens of minutes before the current time, minutes before the current time, seconds before the current time, or tens of milliseconds before the current time, etc. In this embodiment, when the historical task is completely executed, the resource corresponding to the historical task will be released, and at the same time, the resource management unit can recover the resource corresponding to the historical task. If the resource used for executing the historical task is released within the first time interval from the current time when or after the historical task is completely executed, it can be considered that the resource management unit recovers the resource in the first time interval.

[0052] In this embodiment, the release of the resource corresponding to the historical task is performed after the pipeline corresponding to the historical task is completely executed, 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 used again to re-execute the task of the one or more pipeline stages, thereby ensuring the smooth execution of the historical task. At the same time, the resource used for executing the historical task released within the first time interval from the current time in response to the historical task corresponding to the resource being completely executed can obtain the resource in the most recent period from the current time, and can also obtain various resources used for executing the historical task, which can be used for the execution of the to-be-processed task, and the resources recovered before the first time interval can be controlled to be in a dormant state.

[0053] In some embodiments, the resources recovered in the first time interval are: the resources corresponding to the executed historical task released within the first time interval from the current time in response to the historical task corresponding to the resources being partially executed.

[0054] In this embodiment, when the historical task is partially completed, the resources corresponding to the executed historical task will be released. Simultaneously, the resource management unit can reclaim the resources corresponding to the completed historical task. If the resources of the executed historical task are released within the first time interval at the current moment, or after the completion of the historical task, they can be considered resources reclaimed by the resource management unit within the first time interval.

[0055] In this embodiment, the resources corresponding to the completed historical task are released immediately after the pipeline portion corresponding to the historical task has been completed. This allows for timely release of resources associated with completed historical tasks, improving resource utilization. Simultaneously, resources from executed historical tasks released within a first time interval prior to the current time are considered as resources reclaimed within that first time interval. This allows for the acquisition of resources from the most recent time period for the execution of pending tasks, while resources reclaimed before the first time interval remain in a dormant state.

[0056] In this embodiment, the process of recovering resources corresponding to historical tasks will be described according to the following steps:

[0057] In step S201, the resource management unit within the electronic device receives a task termination instruction sent by the processor core within the electronic device.

[0058] In some embodiments, the resource management unit receives a task termination instruction sent by the processor core; the task termination instruction is used to indicate whether the task executed by the processor core has been completely completed or not completely completed (partially completed), and instructs the resource management unit to reclaim the resources that have been completed.

[0059] For example, if the task completion instruction indicates that all tasks executed by the processor core have been completed, it instructs the resource management unit to reclaim all resources allocated by the resource management unit; or, if the task completion instruction indicates that the tasks executed by the processor core have been partially completed, it instructs the resource management unit to reclaim the resources that have been completed.

[0060] Among them, the resources (or sub-resources) that have been completed include the resources (or sub-resources) corresponding to the tasks that have been completed by the processor core during the execution of the task; for example, the task includes fetching, decoding, executing, accessing memory and writing back. After the processor core completes the fetching, the resources (or sub-resources) required for the fetching are the resources that have been completed; or, after the processor core completes the fetching and decoding, the resources (or sub-resources) required for the fetching and decoding are the resources that have been completed.

[0061] In step S202, the resource management unit determines the resources of the task corresponding to the task ending instruction based on the task ending instruction.

[0062] In some embodiments, in response to the task not being completely finished, the resource management unit confirms at least one sub-resource corresponding to the task end instruction; the resource management unit confirms that the at least one sub-resource is a resource for executing a task corresponding to the task end instruction; wherein the at least one sub-resource includes a sub-resource that is finished in all sub-resources for executing the task.

[0063] In implementation, the task end instruction can be periodically sent by the processor core to the resource management unit in the process of executing the task; or the task end instruction can be sent by the processor core to the resource management unit for a sub-task that is finished in the process of executing the task; wherein the task end instruction can include a progress of the processor core executing the task.

[0064] Further, in implementation, in response to the task end instruction being periodically sent by the processor core to the resource management unit in the process of executing the task, the resource management unit determines, based on the task end instruction, a sub-resource corresponding to a sub-task that is finished in the task as a resource for executing a task corresponding to the task end instruction. For example, the task includes five sub-tasks, i.e. instruction fetch, decoding, execution, memory access and write back; the processor core periodically sends a task end instruction to the resource management unit when executing and not finishing the memory access; the resource management unit confirms that sub-resources required by the instruction fetch, decoding and execution before the memory access are resources for the task corresponding to the task end instruction.

[0065] Or, in implementation, in response to the task end instruction being sent by the processor core to the resource management unit for a part that is finished in the process of executing the task, the resource management unit determines, based on the task end instruction, at least one sub-resource that is finished in the task as a resource for executing a task corresponding to the task end instruction. For example, the task includes instruction fetch, decoding, execution, memory access and write back; the processor core sends a task end instruction to the resource management unit when the memory access is finished; the resource management unit confirms that a sub-resource required by the memory access is a resource for the task corresponding to the task end instruction; obviously, sub-resources required by the instruction fetch, decoding and execution are recycled through the task end instruction sent by the processor core after the instruction fetch, decoding and execution are finished.

[0066] In some embodiments, in response to the task being completely finished, the resource management unit confirms all sub-resources corresponding to the task end instruction; the resource management unit confirms that all sub-resources are resources for executing a task corresponding to the task end instruction; wherein all sub-resources include sub-resources that are finished in all resources for executing the task.

[0067] In implementation, the task end instruction can be periodically sent by the processor core to the resource management unit during execution of the task, can be sent by the processor core to the resource management unit for a completed part of the task, or can be sent by the processor core to the resource management unit after execution of the entire task, wherein the task end instruction can include a progress of the processor core in executing the task.

[0068] Further, in implementation, in response to the task end instruction being periodically sent or sent after execution of a subtask, the resource management device can temporarily suspend the task end instruction, and after all subtasks included in the task are completed, confirm that all sub-resources corresponding to the task are resources for the task corresponding to the task end instruction; or in response to the task end instruction being sent after the entire task is completed, the resource management unit confirms that all sub-resources corresponding to the task are resources for the task corresponding to the task end instruction.

[0069] In step S203, the resource management unit recovers the resources.

[0070] In some embodiments, the resource management unit recovers the resources, so that the recovered resources can be allocated or not allocated when subsequent tasks are allocated resources.

[0071] In this way, the resource management unit in the electronic device receives a task end instruction sent by a processor core in the electronic device, determines resources for a task corresponding to the task end instruction based on the task end instruction, recovers the resources, and allocates the resources to a pipeline corresponding to a to-be-processed task according to the task. In the case that the entire task is completed or a subtask is completed, the resource management unit can recover the completed resources (or sub-resources) according to the task end instruction, so as to facilitate resource allocation and execution of other tasks, and improve resource utilization and execution efficiency of the task.

[0072] In some embodiments, the optional recovery process of the resources corresponding to the historical task further includes the following steps:

[0073] In step S200, a processor core in an electronic device sends a task end instruction to a resource management unit in the electronic device.

[0074] In some embodiments, a processor core in an electronic device sends a task end instruction to a resource management unit in the electronic device, and the task end instruction is used by the resource management unit to recover resources for a task corresponding to the task end instruction.

[0075] In some embodiments, the processor core sends a task end instruction to the resource management unit to make the resource management unit reclaim the sub-resources that have completed execution from all the resources used to execute the task, when the task is not completely finished; or the processor core sends a task end instruction to the resource management unit to make the resource management unit reclaim all the resources used to execute the task, when the task is completely finished.

[0076] In implementation, the processor core can periodically send a task end instruction to the resource management unit during execution of the task; or the processor core can send a task end instruction to the resource management unit for a sub-task that has completed execution during execution of the task; or the processor core can send a task end instruction to the resource management unit after execution of all the tasks.

[0077] In this way, the processor core in the electronic device flexibly sends a task end instruction to the resource management unit in the electronic device according to the execution of the task, so that the resource management unit can flexibly reclaim part or all of the resources to facilitate resource allocation and execution of other tasks, and improve resource utilization and execution efficiency of the task.

[0078] In some embodiments, for a to-be-processed task, after the resource management unit determines the type of resource required by the to-be-processed task and the strength (size) of the resource, the resource management unit searches for a resource matching the resource required by the to-be-processed task from the resources reclaimed in the first time interval, including at least the following steps: searching for a resource of the same type as the resource required by the to-be-processed task from the resources reclaimed in the first time interval; and / or searching for a resource greater than or equal to the size of the resource required by the to-be-processed task from the resources reclaimed in the first time interval.

[0079] Specifically, as an example, if the branch prediction sub-resource, the instruction fetching sub-resource, the decoding sub-resource, the renaming sub-resource and the execution sub-resource corresponding to the historical task are released in the first time interval, the resources reclaimed in the first time interval include the branch prediction sub-resource, the instruction fetching sub-resource, the decoding sub-resource, the renaming sub-resource and the execution sub-resource released by the historical task. The resource management unit determines that the type of resource required by the to-be-processed task includes a branch prediction resource, an instruction fetching resource, a decoding resource and an execution resource, and the size of the branch prediction sub-resource, the instruction fetching sub-resource, the decoding sub-resource and the execution sub-resource is greater than the size of the resource required by the to-be-processed task, then a resource of a size matching the resource required by the to-be-processed task can be selected from the branch prediction sub-resource, the instruction fetching sub-resource, the decoding sub-resource and the execution sub-resource to allocate to the to-be-processed task.

[0080] In the embodiment, the asset management unit finds the resource of the same type as the resource required by the to-be-processed task in the resources recovered in the first time interval; and / or finds the resource greater than or equal to the size of the resource required by the to-be-processed task in the resources recovered in the first time interval. According to the type and size of the resource required by the to-be-processed task, the resource is matched, the to-be-processed task can be quickly matched to the appropriate resource, and since the allocated resource meets the demand of the to-be-processed task for the resource, the execution efficiency of the to-be-processed task can be improved.

[0081] In some embodiments, the specific process of the resource management unit finding the resource matching the resource required by the to-be-processed task in the resources recovered in the first time interval includes: Figure 4 As shown in the figure, the process includes:

[0082] In step S102a, the resource management unit in the electronic device determines the resource allocation strategy based on the resource required by the to-be-processed task.

[0083] 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 strategy.

[0084] For step S102a, the specific implementation process of the resource management unit determining the resource allocation strategy based on the resource required by the to-be-processed task can include: the resource management unit first determines the resource allocation strategy based on the intensity of the resource required by the to-be-processed task.

[0085] In some embodiments, the resource required by the task can be divided into multiple different intensity levels based on intensity. As an example, the resource required by the task is divided into two levels based on intensity, in response to the intensity of the resource required by the to-be-processed task meeting a first condition, the resource allocation strategy is determined as a first resource allocation strategy; in response to the intensity of the resource required by the to-be-processed task meeting a second condition, the resource allocation strategy is determined as a second resource allocation strategy. Wherein, the resource whose intensity meets the first condition is a weak resource, and the resource whose intensity meets the second condition is a strong resource; for the weak resource, the available resources recovered in the first time interval are divided based on the first resource allocation strategy; for the strong resource, the available resources recovered in the first time interval are divided based on the second resource allocation strategy. As an example, the first condition can be that the intensity of the resource is less than a first intensity threshold, and the second condition can be that the intensity of the resource is greater than a second intensity threshold, the first intensity threshold and the second intensity threshold are both used to represent the intensity or size of the resource, the first intensity threshold is less than or equal to the second intensity threshold, and the size of the resource allocated based on the first resource allocation strategy is less than the size of the resource allocated based on the second resource allocation strategy.

[0086] The above is described by taking the task required resource being divided into two levels based on intensity as an example. In actual implementation, the task required resource can also be divided into three levels or more levels based on intensity, which is not limited in the embodiments of the present application. The resource allocation strategy corresponding to each intensity level is different.

[0087] Taking the memory resource recovered in the first time interval as an example, the available memory resource recovered in the first time interval is divided into N parts based on the first resource allocation strategy, and the size of each part of the memory resource is X; the available memory resource recovered in the first time interval is divided into M parts based on the second resource allocation strategy, and the size of each part of the memory resource is Y; wherein N>M and XY.

[0088] The above is described by taking the resource recovered in the first time interval (such as the available memory resource) being evenly divided into multiple parts as an example. In actual implementation, the resource recovered in the first time interval can also be unevenly divided, such as the sizes of the multiple resources obtained by dividing the resource recovered in the first time interval are different, or part of the sizes of the resources obtained by dividing the resource recovered in the first time interval are the same and part of the sizes are different.

[0089] For step S102b, the specific implementation process of the resource management unit allocating resources for the to-be-processed task based on the resource allocation strategy can 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 determines the resource in one of the at least one sub-resource pool as the resource required by the to-be-processed task.

[0090] In some embodiments, each type of resource recovered in the first time interval can include branch prediction resource, instruction fetching resource, decoding resource, renaming resource, operation resource, register resource, and memory resource.

[0091] Taking the resource recovered in the first time interval being branch prediction resource as an example, the resource management unit divides the branch prediction resource into one or more branch prediction sub-resource pools based on the resource allocation strategy, and each branch prediction sub-resource pool includes resources of the same or different sizes. The resource management unit selects a branch prediction sub-resource pool satisfying the demand of the to-be-processed task from the multiple branch prediction sub-resource pools, and the resource in the selected branch prediction sub-resource pool is the resource used for branch prediction of the to-be-processed task.

[0092] The above only takes branch prediction resource as an example to describe the process of determining the resource for branch prediction. In actual implementation, the process of determining the resource for instruction fetching, decoding, renaming, operation, storage, access, etc. is the same as the process of determining the resource for branch prediction, which is not described in detail in the embodiments of the present application.

[0093] In the embodiment of the present application, the first time interval recycled each type of resource is divided into a resource pool, the resource allocation strategy is determined based on the intensity of the required resources of the to-be-processed task, 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 required resources of the task can be allocated from the plurality of sub-resource pools according to the demand of the task. In this way, not only the execution efficiency of the task is improved, but also the utilization rate of the resources is improved, and thus the performance of the electronic device is improved.

[0094] Based on Figure 4 As shown in the flow, it can be understood that the first time interval recycled each type of resource is divided into a resource pool, and the required resources of the to-be-processed task are allocated in the resource pool recycled in the first time interval to execute the required resources of the to-be-processed task.

[0095] In specific implementation, the resource division schematic diagram of the first time interval recycled resources is as shown in Figure 5 As shown in the figure: the branch prediction resources recycled in the first time interval are divided into a branch prediction resource pool, the instruction fetching resources recycled in the first time interval are divided into an instruction fetching resource pool, the decoding resources recycled in the first time interval are divided into a decoding resource pool, the renaming resources recycled in the first time interval are divided into a renaming resource pool, and the execution resources recycled in the first time interval are divided into an execution resource pool; wherein, the execution resources can include one or more of register resources, memory resources and operation resources. The resource pools are connected through a connection network; wherein, the connection network can be a hardware network based on switch control, or any other form of network, which is not limited in the embodiment of the present application.

[0096] Figure 5 In the resource division schematic diagram shown, the resource management unit manages all the resource pools; in specific implementation, the resource management unit can also include a plurality of resource management sub-units, and each resource management sub-unit manages different resource pools. As an example, the resource management unit includes a branch prediction resource sub-management unit, an instruction fetching 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 managing the resources in the branch prediction resource pool, the instruction fetching resource sub-management unit is used for managing the resources in the instruction fetching resource pool, the decoding resource sub-management unit is used for managing the resources in the decoding resource pool, the renaming resource sub-management unit is used for managing 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.

[0097] For Figure 5The resource division schematic diagram shown, according to different resource allocation strategies, each resource pool can be divided into, for example Figure 6 The plurality of sub-resource pools with the same size as shown, and the plurality of sub-resource pools with different sizes as shown; wherein the sub-resource pool with the same size refers to the same type of resource, each sub-resource pool includes the same size of resources; the sub-resource pool with different sizes refers to the same type of resource, and the size of the resources included in the plurality of sub-resource pools is partially or totally different. Figure 7

[0098] Each resource pool is divided into sub-resource pools in the same size organization mode, such as the organization mode of the smallest resource, so that the resources recovered in the first time interval can support the maximum number of processor cores to execute tasks in parallel, improve the processing capacity of task parallelism, and further improve the performance of the electronic device.

[0099] Each resource pool is divided into sub-resource pools in different sizes, so that the resource management unit can allocate the required resources to the task according to the demand of the task for each type of resource; avoid the problem of resource waste or insufficient resources to support the processor core to execute the task caused by allocating fixed resources to each processor core in the related art, improve the efficiency of task execution and the utilization rate of resources, and further improve the performance of the electronic device.

[0100] In the embodiment of the application, if there is idle or remaining resource in the sub-resource pool allocated to the task to be executed, the idle or remaining resource can be set to sleep mode, so that the idle or remaining resource is not used to execute the task, and the power consumption is reduced. The idle or remaining resource can also be removed from the sub-resource pool and divided into other sub-resource pools, so that the idle or remaining resource is fully utilized and the utilization rate of the resource is improved.

[0101] In some embodiments, if there is no resource matching the required resource of the task to be processed in the resources recovered in the first time interval, the resource management unit searches for the resource matching the required resource of the task to be processed in all resources included in the electronic device.

[0102] Specifically, if there is no certain type of resource required by the task to be processed in the resources recovered in the first time interval, or the size of the existing resource does not match the size of the resource required by the task to be processed, the resource management unit preferentially searches for the resource matching other resource types required by the task to be processed in the resources recovered in the first time interval, or preferentially allocates the resource in the resources recovered in the first time interval to the task to be processed, and then searches for the resource from all resources included in the electronic device for the resource type that does not exist in the first time interval or the part of the resource size that is not enough.

[0103] ​In the embodiment, the resource management unit searches for the resource matching the resource required by the to-be-processed task from all the resources included in the electronic device, so that the matching resource can be allocated to the to-be-processed task, and the requirement of the to-be-processed task for the resource is met.

[0104] In S103, the resource matching the resource required by the to-be-processed task is allocated to the pipeline corresponding to the to-be-processed task, so that the processor core executes the pipeline based on the resource matching the resource required by the to-be-processed task.

[0105] The resource management method provided by the embodiment can allocate the resource to the to-be-processed task in the recently recycled resource, control the resource recycled before the first time interval to be in the dormant state, and save the power consumption of the electronic device and improve the performance of the electronic device.

[0106] In some embodiments, the resource management unit can be a program installed on the electronic device, or the resource management unit can be a hardware component in the electronic device, or the resource management unit includes the program installed on the electronic device and the hardware component in the electronic device.

[0107] In some embodiments, if the resource management unit is the program installed on the electronic device, the resource management method provided by the embodiment is implemented in the form of software; the program installed on the electronic device can be an application installed on the electronic device, or a small program loaded by the application installed on the electronic device.

[0108] In the specific implementation, the program installed on the electronic device determines the information of the to-be-processed task, determines the resource required by the to-be-processed task according to the information of the to-be-processed task, searches for the resource matching the resource required by the to-be-processed task in the resource recycled in the first time interval, and sends the resource matching the resource required by the to-be-processed task to the corresponding hardware component in the electronic device, so that the hardware component executes the to-be-processed task based on the resource matching the resource required by the to-be-processed task.

[0109] In other embodiments, if the resource management unit is the hardware component in the electronic device, the resource management method provided by the embodiment is implemented in the form of hardware.

[0110] In a specific implementation, the hardware component in the electronic device determines the required resource of the to-be-processed task according to the information of the to-be-processed task; and the required resource of the to-be-processed task is searched for in the resources recycled in the first time interval, and the to-be-processed task is executed based on the resource matched with the required resource of the to-be-processed task.

[0111] In some other embodiments, if the resource management unit includes the program installed on the electronic device and the 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.

[0112] In a specific implementation, the hardware component in the electronic device sends the information of the to-be-processed task to the program installed on the electronic device; the program installed on the electronic device determines the required resource of the to-be-processed task according to the information of the to-be-processed task; the required resource of the to-be-processed task is searched for in the resources recycled in the first time interval, and the resource matched with the required resource of the to-be-processed task is sent to the corresponding hardware component in the electronic device, and the to-be-processed task is executed by the hardware component based on the resource matched with the required resource of the to-be-processed task.

[0113] Alternatively, in a specific implementation, the hardware component in the electronic device sends the information of the to-be-processed task to the program installed on the electronic device; the program installed on the electronic device determines the required resource of the to-be-processed task according to the information of the to-be-processed task, and sends the required resource of the to-be-processed task to the corresponding hardware component in the electronic device, and the to-be-processed task is executed by the hardware component based on the required resource of the to-be-processed task, the resource matched with the required resource of the to-be-processed task is searched for in the resources recycled in the first time interval, and the to-be-processed task is executed based on the resource matched with the required resource of the to-be-processed task.

[0114] It should be noted that since the first general-purpose electronic computer was invented, computer technology has developed rapidly in the past few decades. The rapid development of computer technology is due to the improvement of computer architecture and the development of computer production technology. The contribution of computer production technology to the development of computer technology has been stable. However, due to the improvement of computer architecture for decades, the improvement space of computer architecture is becoming smaller and smaller, so any small improvement of computer architecture will have a relatively obvious impact on the performance of the processor and the development of computer technology.

[0115] The embodiments of the present application also provide an electronic device for implementing the resource management method shown in the above Figures 2 to 7 The structural diagram of the electronic device is shown in FIG. 7, which at least includes a resource management unit 701 and a processor core 702; wherein, Figure 8

[0116] ​The resource management unit 701 is configured to determine the resource required by the to-be-processed task according to the to-be-processed task, find the resource matching the resource required by the to-be-processed task from the resources recovered in the first time interval, and allocate the resource matching the resource required by the to-be-processed task to the pipeline corresponding to the to-be-processed task.

[0117] The processor core 702 is configured to execute the pipeline based on the resource matching the resource required by the to-be-processed task.

[0118] In some optional embodiments, the resources recovered in the first time interval are the resources used for executing the historical tasks and released within the first time interval from the current time in response to the historical tasks corresponding to the resources being completely executed.

[0119] In some optional embodiments, the resources recovered in the first time interval are the resources corresponding to the historical tasks that are partially executed and released within the first time interval from the current time in response to the historical tasks corresponding to the resources being partially executed.

[0120] In some optional embodiments, the resource management unit 701 is configured to find the resource of the same type as the resource required by the to-be-processed task from the resources recovered in the first time interval, and / or find the resource greater than or equal to the size of the resource required by the to-be-processed task from the resources recovered in the first time interval.

[0121] In some optional embodiments, if there is no resource matching the resource required by the to-be-processed task in the resources recovered in the first time interval, the resource management unit 701 is configured to find the resource matching the resource required by the to-be-processed task from all the resources included in the electronic device.

[0122] It should be noted that the description of the electronic device in the embodiments of the present application is similar to the description of the above-mentioned resource management method embodiments, and has similar beneficial effects to the method embodiments, and thus is not described herein. For the technical details of the electronic device provided in the embodiments of the present application, they can be understood according to the description of any one of the accompanying drawings. Figures 2 to 7

[0123] The following describes an exemplary application of the electronic device provided in the embodiments of the present application. The electronic device provided in the embodiments of the present application can be implemented as an electronic device, which can be a server or a terminal device.

[0124] The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected through wired or wireless communication, and the embodiments of the present application do not limit this.​

[0125] See Figure 9 , Figure 9 This is a schematic diagram of the structure of the electronic device 400 provided in the embodiments of this application. Figure 9 The illustrated electronic device 400 includes at least one processor 410, a memory 450, and a bus 440; the various components of the electronic device 400 are coupled together via the bus 440. It is understood that the bus 440 is used to implement communication between these components. In addition to a data bus, the bus 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 9 The general labeled all buses as Bus 440.

[0126] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0127] The memory 450 stores executable instructions for implementing the resource management method provided in the embodiments of this application. The resource management method can be implemented by... Figure 8 The resource management unit 701 in the illustrated electronic device is implemented; the memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.

[0128] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof.

[0129] In some embodiments, the electronic device 400 may further include:

[0130] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;

[0131] The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including Bluetooth, WiFi, and Universal Serial Bus (USB).

[0132] The embodiment of the present application provides a computer readable storage medium storing executable instructions, wherein the executable instructions are stored, and when the executable instructions are executed by a processor, the processor executes a resource management method provided by the embodiment of the present application, for example, as shown in the following. Figures 2 to 7 The resource management method is shown.

[0133] In some embodiments, the computer readable storage medium can be FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc, or CD-ROM memory, and the like; and can also be various devices including one or any combination of the above storage.

[0134] In some embodiments, the executable instructions can be in the form of programs, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and can be deployed in any form, including being deployed as independent programs or being deployed as modules, components, subroutines or other units suitable for use in a computing environment.

[0135] As an example, the executable instructions can be deployed to execute on one computing device, or on multiple computing devices located in one place, or on multiple computing devices distributed in multiple places and interconnected through a communication network.

[0136] The embodiment of the present application provides a computer program product, the computer program product includes computer programs / instructions, and the computer programs / instructions are executed by a processor to realize the resource management method described in the present application.

[0137] The above is only an embodiment of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement and improvement within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A resource management method characterized by, The application is applied to a processor, and the processor comprises a resource management unit and at least one processor core; the processor core comprises at least the following pipeline resources: branch prediction resources, instruction fetch resources, decoding resources, renaming resources and execution resources; the branch prediction resources, the instruction fetch resources, the decoding resources, the renaming resources and the execution resources are connected through a connection network respectively; the method comprises the following steps: The resource management unit determines the pipeline resources required by the to-be-processed task according to the to-be-processed task; the to-be-processed task refers to a task to be executed by a processor core in an electronic device; The resource management unit searches for resources matching the resources required by the to-be-processed task in resources recycled in a first time interval; the resources recycled in the first time interval are resources for executing historical tasks released within a first time interval from the current time in response to the resources corresponding to the historical tasks being completely executed, or resources corresponding to the historical tasks that have been executed released within a first time interval from the current time in response to the resources corresponding to the historical tasks being partially executed; the first time interval is a period of time before the current time; the recycling process of the resources corresponding to the historical tasks comprises the following steps: the resource management unit receives a task end instruction sent by the processor core; based on the task end instruction, the resources of the task corresponding to the task end instruction are determined; the resources of the task corresponding to the task end instruction are recycled; the task end instruction is periodically sent by the processor core to the resource management unit during the execution of the historical task, or is sent by the processor core to the resource management unit for the historical subtask that has been executed during the execution of the historical task; The resources matching the resources required by the to-be-processed task are allocated to the pipeline corresponding to the to-be-processed task, so that the processor core executes the pipeline based on the resources matching the resources required by the to-be-processed task.

2. The method of claim 1, wherein, The resource management unit searches for resources matching the resources required by the to-be-processed task in resources recycled in a first time interval, which comprises the following steps: In the resources recycled in the first time interval, resources of the same type as the resources required by the to-be-processed task are searched for; And / or, in the resources recycled in the first time interval, resources greater than or equal to the size of the resources required by the to-be-processed task are searched for.

3. The method of claim 1, wherein, If there is no resource matching the resources required by the to-be-processed task in the resources recycled in the first time interval, the method further comprises the following steps: The resource management unit searches for resources matching the resources required by the to-be-processed task in all resources included in the electronic device.

4. An electronic device, comprising: The electronic device comprises a resource management unit and a processor core; the processor core comprises at least the following pipeline resources: branch prediction resource, instruction fetch resource, decoding resource, renaming resource and execution resource; the branch prediction resource is connected with the instruction fetch resource, the instruction fetch resource is connected with the decoding resource, the decoding resource is connected with the renaming resource, and the renaming resource is connected with the execution resource through a connection network; wherein, The resource management unit is configured to: determine the resources required by a to-be-processed task; search for resources matching the resources required by the to-be-processed task from resources recovered in a first time interval; and allocate the resources matching the resources required by the to-be-processed task to a pipeline corresponding to the to-be-processed task. The to-be-processed task refers to a task to be executed by a processor core in the electronic device. The resources required by the to-be-processed task refer to resources used to execute each pipeline stage of the pipeline, including branch prediction resource, instruction fetch resource, decoding resource, renaming resource and execution resource. The resources recovered in the first time interval are: resources used to execute a historical task released within a first time interval from the current time in response to the historical task corresponding to the resources being completely executed, or resources corresponding to the historical task released within a first time interval from the current time in response to the historical task corresponding to the resources being partially executed. The first time interval is a period of time before the current time. The recovery process of the resources corresponding to the historical task comprises: the resource management unit receiving a task end instruction sent by the processor core; determining the resources of a task corresponding to the task end instruction based on the task end instruction; and recovering the resources of the task corresponding to the task end instruction. The task end instruction is periodically sent by the processor core to the resource management unit during execution of the historical task, or is sent by the processor core to the resource management unit for a historical subtask that is executed. The processor core is configured to execute the pipeline based on the resources matching the resources required by the to-be-processed task.

5. The electronic device of claim 4, wherein The resource management unit is configured to search for resources of the same type as the resources required by the to-be-processed task from the resources recovered in the first time interval, and / or search for resources greater than or equal to the size of the resources required by the to-be-processed task from the resources recovered in the first time interval.

6. An electronic device, comprising: The electronic device comprises: a processor, a memory and a bus; The memory stores executable instructions; The processor and the memory communicate through the bus. When the processor executes the executable instructions stored in the memory, the resource management method of any one of claims 1 to 3 is implemented.

7. A computer readable storage medium characterized in that, The executable instructions are stored in the memory, and when executed by the processor, the resource management method of any one of claims 1 to 3 is implemented.

8. A computer program product, characterised in that, The computer program product comprises computer programs / instructions which, when executed by a processor, implement the resource management method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Resource allocation method, device and equipment

    CN112099956A