Hardware resource allocation method and device, equipment and storage medium

By introducing a dynamic resource allocation method in the hardware resource manager, selecting the target resource according to the hardware resource state and weight coefficient, the resource allocation imbalance caused by static allocation strategies is solved, and resource utilization and system performance are improved.

CN119127504APending Publication Date: 2024-12-13BEIJING SUIYUAN INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411263729.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing hardware resource manager adopts a static resource allocation strategy, which is unable to adapt to changes in system load and task requirements in a timely manner, resulting in unbalanced resource allocation and reducing resource utilization and system performance.

Method used

By introducing a dynamic resource allocation method in the resource manager, selecting the appropriate resource allocation method and target hardware resources based on the state and weight coefficient of the hardware resources, ensuring that the resources are consistent at the same time to avoid waiting and waste.

Benefits of technology

It improves resource utilization and system performance, avoids resource allocation imbalances, and ensures efficient allocation and release of resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127504A_ABST
    Figure CN119127504A_ABST
Patent Text Reader

Abstract

The invention discloses a hardware resource allocation method and device, equipment and a storage medium. The method comprises the following steps: determining a hardware resource allocation mode according to a first resource state management instruction, and obtaining hardware resource application information according to a second resource state management instruction; when the hardware resource allocation mode is determined to be resource selection allocation and the hardware resource selection mode is unified standard selection, determining a plurality of pre-selected hardware resources with the same resource state according to the resource states corresponding to the plurality of hardware resources in the hardware resource selection range; and according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type, determining a plurality of target hardware resources meeting the quantity of the applied hardware resources from the plurality of pre-selected hardware resources. The method provided by the invention can adapt to different scheduling conditions, avoid imbalance of resource allocation, and improve the resource utilization rate and the system performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of resource allocation, and in particular to a method, device, equipment and storage medium for hardware resource allocation. Background Art

[0002] As hardware technology continues to develop, new hardware resources continue to emerge. The system directly manages the allocation, error feedback, and scheduling of more hardware resources, resulting in a larger pipeline depth and higher latency, which may affect the overall performance and response speed of the system. Therefore, technicians often use hardware resource managers to independently manage and schedule hardware resources.

[0003] Existing hardware resource managers usually use static resource allocation strategies to allocate fixed hardware resources to tasks of the same type. When the system load or task requirements change, the original static allocation strategy of the hardware resource manager cannot adapt to the new situation in time; at the same time, it will also cause some tasks to be allocated corresponding hardware resources first, while other tasks need to wait for a long time because the allocated hardware resources are occupied, and other unoccupied resources are idle, resulting in an imbalance in resource allocation, thereby reducing resource utilization and system performance. Summary of the invention

[0004] Based on the above problems, the present application provides a hardware resource allocation method, device, equipment and storage medium, the purpose of which is to adapt to different scheduling situations, avoid resource allocation imbalance, and improve resource utilization and system performance.

[0005] The embodiments of the present application disclose the following technical solutions:

[0006] In a first aspect, the present application provides a hardware resource allocation method, which is applied to a resource manager, comprising:

[0007] Determine a hardware resource allocation method according to the first resource status management instruction, and obtain hardware resource application information according to the second resource status management instruction; the hardware resource application information includes the number of hardware resources applied for, the hardware resource selection range, the hardware resource selection method, the type of hardware resources applied for, and the weight coefficients corresponding to the respective types of hardware resources applied for;

[0008] When it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is unified standard selection, a plurality of pre-selected hardware resources having the same resource status are determined according to resource statuses corresponding to the plurality of hardware resources within the hardware resource selection range;

[0009] According to the requested hardware resource type and the weight coefficient corresponding to the requested hardware resource type, a plurality of target hardware resources that meet the requested hardware resource quantity are determined from the plurality of pre-selected hardware resources.

[0010] Optionally, in the method as described above, the resource manager includes a state management module; the determining of multiple pre-selected hardware resources having the same resource state according to the resource states corresponding to the multiple hardware resources within the hardware resource selection range includes:

[0011] The resource states corresponding to the plurality of hardware resources within the hardware resource selection range are obtained from the state management module, and a plurality of first pre-selected hardware resources whose resource states are all in idle state are selected.

[0012] Optionally, in the method as described above, determining multiple target hardware resources that meet the number of hardware resources applied for from the multiple pre-selected hardware resources according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type includes:

[0013] Comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity;

[0014] When it is determined that the number of first pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the multiple first pre-selected hardware resources are calculated according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource type contained in each of the multiple first pre-selected hardware resources;

[0015] From the plurality of first pre-selected hardware resources, a first pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

[0016] Optionally, in the method as described above, determining multiple target hardware resources that meet the number of hardware resources applied for from the multiple pre-selected hardware resources according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type includes:

[0017] Comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity;

[0018] When it is determined that the number of the first pre-selected hardware resources is less than the number of the applied hardware resources, re-acquiring the resource states corresponding to the multiple hardware resources within the hardware resource selection range from the state management module, and selecting multiple second pre-selected hardware resources whose resource states corresponding to the multiple hardware resources within the hardware resource selection range are all busy;

[0019] Comparing the second pre-selected hardware resource quantity with the applied hardware resource quantity;

[0020] When it is determined that the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the plurality of second pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of each of the applied hardware resource types contained in the plurality of second pre-selected hardware resources;

[0021] From the plurality of second pre-selected hardware resources, a second pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

[0022] Optionally, in the method described above, when it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is preferential selection, the method further includes:

[0023] Acquire a plurality of third pre-selected hardware resources within the hardware resource selection range from the state management module;

[0024] Calculate the weighted total values ​​corresponding to the plurality of third pre-selected hardware resources respectively according to the weight coefficients corresponding to the respective applied hardware resource types and the resource capacities of the applied hardware resource types respectively contained in the plurality of third pre-selected hardware resources;

[0025] From the plurality of third pre-selected hardware resources, a third pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

[0026] Optionally, the method as described above, calculating the weighted total value corresponding to the target pre-selected hardware resource according to the weight coefficient corresponding to the applied hardware resource type of the target pre-selected hardware resource and the resource capacity of the applied hardware resource type of the target pre-selected hardware resource, includes:

[0027] According to the applied hardware resource type, determining the resource capacity corresponding to each of the applied hardware resource types from the target pre-selected hardware resources;

[0028] The weighted total values ​​corresponding to the target pre-selected hardware resources are obtained by weighted summing the resource capacities corresponding to the respective applied hardware resource types and the weight coefficients corresponding to the respective applied hardware resource types.

[0029] Optionally, in the method described above, the hardware resource application information further includes an application tag, and after determining the hardware resource allocation method according to the first resource status management instruction, the method further includes:

[0030] When it is determined that the hardware resource allocation method is allocation by querying the history record table, querying the history record table according to the application mark to obtain the historical application record corresponding to the application mark;

[0031] According to the hardware resource allocation information in the historical application record corresponding to the application mark, the target hardware resource corresponding to the hardware resource application information is selected.

[0032] Optionally, the method as described above further includes:

[0033] If the resource states corresponding to the multiple target hardware resources are in an idle state, applying for resources for the multiple target hardware resources, and updating the resource states corresponding to the multiple target hardware resources to a busy state;

[0034] or,

[0035] If the resource status corresponding to the multiple target hardware resources is in a busy state, the resource status corresponding to the multiple target hardware resources is monitored. When it is determined that the resource status corresponding to the multiple target hardware resources are all updated to an idle state, resource application is performed for the multiple target hardware resources and the resource status corresponding to the multiple target hardware resources is updated to a busy state.

[0036] In a second aspect, the present application provides a hardware resource allocation device, comprising:

[0037] A hardware resource application module, used to determine the hardware resource allocation method according to the first resource status management instruction, and obtain hardware resource application information according to the second resource status management instruction; the hardware resource application information includes the number of hardware resources applied for, the hardware resource selection range, the hardware resource selection method, the type of hardware resources applied for, and the weight coefficients corresponding to the respective types of hardware resources applied for;

[0038] A hardware resource selection module, for determining, when it is determined that the hardware resource allocation mode is allocation through resource selection and the hardware resource selection mode is unified standard selection, a plurality of pre-selected hardware resources with the same resource status according to the resource statuses corresponding to the plurality of hardware resources within the hardware resource selection range;

[0039] The hardware resource allocation module is used to determine a plurality of target hardware resources that meet the quantity of the applied hardware resources from the plurality of pre-selected hardware resources according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type.

[0040] In a third aspect, the present application provides a resource manager, which is used to execute the hardware resource allocation method described in any of the above embodiments.

[0041] In a fourth aspect, the present application provides an electronic device, the device comprising: a processor, and a memory communicatively connected to the processor;

[0042] The memory stores computer-executable instructions;

[0043] The processor executes the computer-executable instructions stored in the memory to implement the hardware resource allocation method described in any one of the above embodiments.

[0044] In a fifth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the hardware resource allocation method described in any of the above embodiments.

[0045] The method of the present application determines the hardware resource allocation mode through the first resource status management instruction, and obtains the hardware resource application information according to the second resource status management instruction; when the hardware resource allocation mode is determined to be allocated through resource selection, the dynamic allocation of hardware resources is realized through resource selection allocation to adapt to different scheduling situations. At the same time, when the hardware resource selection mode is determined to be selected as a unified standard, in order to ensure that the selected target hardware resources have the same resource status at the same time and are applied for release at the same time, multiple pre-selected hardware resources with the same resource status are determined according to the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range; according to at least one applied hardware resource type and at least one weight coefficient corresponding to each of the multiple applied hardware resource types, multiple target hardware resources that meet the number of applied hardware resources are determined from the multiple pre-selected hardware resources, avoiding the situation that the hardware resource application needs to wait for a long time due to the inconsistent resource status of the target hardware resources and some hardware resources that have not been applied for release are wasted, resulting in an imbalance in resource allocation, thereby improving resource utilization and system performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0047] Figure 1 A flowchart of an embodiment of a hardware resource allocation method provided in the present application;

[0048] Figure 2A A flowchart of another embodiment of a hardware resource allocation method provided by the present application;

[0049] Figure 2B This is a schematic diagram of the state management module managing hardware resources in this embodiment;

[0050] Figure 3 A flowchart of another embodiment of a method for allocating hardware resources provided by the present application;

[0051] Figure 4A A flowchart of another embodiment of a method for allocating hardware resources provided by the present application;

[0052] Figure 4B A schematic diagram of different hardware resource selection methods in the embodiments of the present application;

[0053] Figure 5A A flowchart of another embodiment of a method for allocating hardware resources provided by the present application;

[0054] Figure 5B A flowchart of an embodiment of a resource application release error in an embodiment of the present application;

[0055] Figure 6 A schematic diagram of the structure of an embodiment of a hardware resource allocation device provided by the present application;

[0056] Figure 7 A schematic diagram of the structure of another embodiment of a hardware resource allocation device provided by the present application;

[0057] Figure 8 A schematic diagram of the structure of an embodiment of an electronic device provided by the present application;

[0058] Fig. 9 A schematic diagram of the structure of an embodiment of a resource manager provided in this application. DETAILED DESCRIPTION

[0059] As described above, current hardware resource managers usually adopt a static resource allocation strategy to allocate fixed hardware resources to tasks of the same type.

[0060] After research, the inventor provides a hardware resource allocation method, device, equipment and storage medium to solve the technical problem in the prior art that the hardware resource manager cannot adapt to new situations in time and resource allocation is unbalanced, thereby reducing resource utilization and system performance.

[0061] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0062] See also Figure 1 , which is a flow chart of an embodiment of a method for allocating hardware resources provided in an embodiment of the present application, and the method is applied to a resource manager. The method includes:

[0063] S101: Determine a hardware resource allocation method according to a first resource status management instruction, and obtain hardware resource application information according to a second resource status management instruction.

[0064] In this embodiment, before receiving the first resource status management instruction, the resource manager can be initialized by initializing or updating the resource information instruction InitRscCredit(). The hardware resource allocation method is then determined by the first resource status management instruction. Specifically, if the first resource status management instruction is ReleaseRscByType(), it means that the hardware resource allocation method is allocation through resource selection; if the first resource status management instruction is ReleaseRscByTag(), it means that the hardware resource allocation method is allocation by querying the history record table. In addition, the hardware resource application information can also be obtained according to the second resource status management instruction. As an example, the second resource status management instruction is the resource information application instruction RequestRsc().

[0065] The hardware resource application information may include, but is not limited to: the number of hardware resources applied for, the hardware resource selection range, the hardware resource selection method, the type of hardware resources applied for, and the weight coefficients corresponding to each of the types of hardware resources applied for.

[0066] Among them, the number of applied hardware resources is the number of hardware resources required in this application. The hardware resource selection range is the range of selectable hardware resources. As an example, in the hardware resource selection range, "0" can be used to indicate that the hardware resource is not selectable, and "1" can be used to indicate that the hardware resource is selectable. For example, taking the hardware resource selection range of 1111011101 as an example, from left to right, representing the hardware resources numbered 9 to 0, it means that the hardware resources corresponding to number 1 and number 5 are not selectable, and the remaining hardware resources are selectable. The hardware resource selection methods include preferential selection and unified standard selection.

[0067] As an example, the obtained hardware resource application information may be in the form of an application information table as shown in Table 1 below:

[0068] Table 1 Application Information Form

[0069] Req_ip_num Req_ip_mask tag Req_rsc0_credit Req_rsc0_weight

[0070] Among them, Req_ip_num is the number of hardware resources requested;

[0071] Req_ip_mask is the hardware resource selection range;

[0072] Tag is the application tag of this application, and the tag is unique;

[0073] Req_rscN_credit is the number of resource type N requested;

[0074] Req_rscN_weightt is the weight of the resource type N requested.

[0075] S102: When it is determined that the hardware resource allocation method is allocation through resource selection and the hardware resource selection method is unified standard selection, a plurality of pre-selected hardware resources having the same resource status are determined according to resource statuses corresponding to a plurality of hardware resources within the hardware resource selection range.

[0076] The unified standard selection is a selection standard for unifying the resource status of hardware resources; for example, a plurality of hardware resources whose resource statuses are all idle are uniformly selected; or a plurality of hardware resources whose resource statuses are all busy are uniformly selected.

[0077] In this embodiment, when it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is unified standard selection, multiple selectable hardware resources are obtained according to the hardware resource selection range, and the resource status corresponding to each of these hardware resources is obtained, and multiple pre-selected hardware resources with the same resource status are screened out. Among them, the pre-selected hardware resources are multiple hardware resources with the same resource status.

[0078] S103: Determine a plurality of target hardware resources that meet the quantity of the requested hardware resources from a plurality of pre-selected hardware resources according to the requested hardware resource type and the weight coefficient corresponding to the requested hardware resource type.

[0079] In this embodiment, according to the requested hardware resource type in the hardware resource application information and the weight coefficient corresponding to the requested hardware resource type, the resource capacity corresponding to the requested hardware resource type in each pre-selected hardware resource is obtained from the screened multiple pre-selected hardware resources, so as to calculate the resource capacity corresponding to the requested hardware resource type and the weight coefficient corresponding to the requested hardware resource type to obtain the weighted total value corresponding to each pre-selected hardware resource. Further, according to the size of the weighted total value corresponding to each pre-selected hardware resource, multiple target hardware resources with a larger weighted total value and meeting the number of requested hardware resources are determined to complete the allocation of hardware resources.

[0080] It is understandable that the resource status management instruction transmits information through the interface; when the hardware resource application information is obtained according to the second resource status management instruction, the obtained hardware resource application information may be one or more. When multiple hardware resource application information is obtained from multiple interfaces, application arbitration may be performed, and from the multiple hardware resource application information, the hardware resource application information obtained from the interface with the front interface number sequence is preferentially selected for hardware resource allocation according to the interface number sequence. In this embodiment, the hardware resource allocation method is determined by the first resource status management instruction, and the hardware resource application information is obtained according to the second resource status management instruction; when the hardware resource allocation method is determined to be allocation through resource selection, dynamic allocation of hardware resources is realized through resource selection allocation; at the same time, when the hardware resource selection method is determined to be unified standard selection, in order to ensure that the selected target hardware resources have the same resource status at the same time and are applied for release at the same time, multiple pre-selected hardware resources with the same resource status are determined according to the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range; according to at least one applied hardware resource type and at least one weight coefficient corresponding to each of the multiple applied hardware resource types, multiple target hardware resources that meet the applied hardware resource quantity are determined from the multiple pre-selected hardware resources, thereby avoiding the situation that the hardware resource application needs to wait for a long time due to inconsistent resource status of the target hardware resources and some hardware resources that have not been applied for release are wasted, resulting in an imbalance in resource allocation, thereby improving resource utilization and system performance.

[0081] See also Figure 2A , which is a flowchart of another embodiment of a hardware resource allocation method provided in an embodiment of the present application; different from Figure 1 ,exist Figure 2A A specific implementation method for determining target hardware resources when the same resource state is idle is shown. Figure 2A Introduced in S1021 and S1031-S1033.

[0082] The resource manager includes a state management module, and a specific implementation of "determining multiple pre-selected hardware resources with the same resource state according to the resource states corresponding to the multiple hardware resources within the hardware resource selection range" in S102 includes:

[0083] S1021: Obtain resource states corresponding to a plurality of hardware resources within a hardware resource selection range from a state management module, and select a plurality of first pre-selected hardware resources whose resource states are all in an idle state.

[0084] Among them, Figure 2B As shown, the state management module manages multiple hardware resources; each hardware resource includes multiple resource types; and each resource type stores the resource capacity of the resource type.

[0085] In this embodiment, the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range is obtained from the status management module. The resource status of the hardware resources can be represented and distinguished by the application value. For example, "0" indicates that the application cannot be made; "1" indicates a busy state; and "2" indicates an idle state. According to the resource status of the multiple hardware resources, multiple first pre-selected hardware resources whose resource statuses are all idle states (corresponding application values ​​are "2") are selected.

[0086] In this embodiment, by obtaining the resource states corresponding to the multiple hardware resources within the hardware resource selection range from the state management module, multiple first pre-selected hardware resources whose resource states are all in the idle state are selected. Compared with the prior art, the method of the present application can ensure that the hardware resources that can be used and are in the idle state can be used in a timely and effective manner by selecting the hardware resources in the idle state, thereby avoiding waste caused by idle resources.

[0087] At this time, after selecting a plurality of first pre-selected hardware resources whose resource states are all in an idle state, a specific implementation method of "determining a plurality of target hardware resources that meet the number of applied hardware resources from the plurality of pre-selected hardware resources according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type" in S103 includes:

[0088] S1031: Compare the first pre-selected hardware resource quantity with the applied hardware resource quantity.

[0089] In this embodiment, the quantity of the first pre-selected hardware resources whose resource status is idle is compared with the quantity of the applied hardware resources.

[0090] S1032: When it is determined that the number of first pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the multiple first pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource types contained in each of the multiple first pre-selected hardware resources.

[0091] In this embodiment, if the number of first pre-selected hardware resources is greater than or equal to the number of applied hardware resources, then it is determined that the plurality of first pre-selected hardware resources in the idle state are sufficient and can all be allocated to the current resource application. When the number of first pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the applied hardware resource types in the hardware resource application information and the resource capacity of each of the plurality of first pre-selected hardware resources containing the corresponding applied hardware resource type are calculated respectively for subsequent determination of the target hardware resources.

[0092] It is understandable that when the number of first pre-selected hardware resources is equal to the number of applied hardware resources, the weighted total values ​​corresponding to the plurality of first pre-selected hardware resources may not be calculated, and the corresponding hardware resources may be directly used as target hardware resources.

[0093] S1033: Selecting, from among the plurality of first pre-selected hardware resources, a first pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value as the target hardware resource.

[0094] In this embodiment, according to the weighted total values ​​corresponding to the plurality of first pre-selected hardware resources, the first pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is determined as the target hardware resource.

[0095] In this embodiment, the first pre-selected hardware resource quantity is compared with the applied hardware resource quantity; when it is determined that the first pre-selected hardware resource quantity is greater than or equal to the applied hardware resource quantity, the weighted total values ​​corresponding to the multiple first pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to the applied hardware resource types and the resource capacity of the applied hardware resource types contained in the multiple first pre-selected hardware resources; from the multiple first pre-selected hardware resources, the first pre-selected hardware resource that meets the applied hardware resource quantity and has the largest weighted total value is selected as the target hardware resource. Compared with the prior art, the method of the present application ensures that there are enough idle hardware resources that can be used for resource allocation first, reduce resource waste, and improve resource utilization by comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity; and by calculating the weighted total values ​​corresponding to the multiple first pre-selected hardware resources and selecting the resource with the largest weighted total value as the target hardware resource, it can ensure that the selected resource is optimal in terms of comprehensive performance, so that the allocated hardware resources can meet the performance requirements without causing resource waste.

[0096] Combination Figure 2A As shown, before executing S1021 and S1031-S1033, refer to the previous embodiment and execute S101 to determine the hardware resource allocation method and obtain the hardware resource application information;

[0097] See also Figure 3 , which is a flowchart of another embodiment of a hardware resource allocation method provided in an embodiment of the present application; different from Figure 2A ,exist Figure 3 The present invention shows a specific implementation method of determining the target hardware resource according to the same resource status being busy after comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity, if the first pre-selected hardware resource quantity does not reach the applied hardware resource quantity, specifically combining Figure 3 Introduced in S1034-S1037.

[0098] S1034: When it is determined that the number of first pre-selected hardware resources is less than the number of applied hardware resources, the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range is obtained from the status management module again, and multiple second pre-selected hardware resources whose resource status corresponding to each of the multiple hardware resources within the hardware resource selection range is all busy are selected.

[0099] In this embodiment, if the number of first pre-selected hardware resources is less than the number of requested hardware resources, it is determined that the plurality of first pre-selected hardware resources in the idle state are insufficient to be allocated to the current resource application. The resource states corresponding to the plurality of hardware resources within the hardware resource selection range are obtained again from the state management module; according to the resource states of the plurality of hardware resources, a plurality of second pre-selected hardware resources whose resource states are all busy (the corresponding application value is "1") are selected.

[0100] S1035: Compare the second pre-selected hardware resource quantity with the applied hardware resource quantity.

[0101] In this embodiment, the number of second pre-selected hardware resources whose resource status is busy is compared with the number of applied hardware resources.

[0102] S1036: When it is determined that the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the multiple second pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource types contained in each of the multiple second pre-selected hardware resources.

[0103] In this embodiment, if the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, then it is determined that the multiple second pre-selected hardware resources in the busy state are sufficient and can all be allocated to the current resource application. When the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the applied hardware resource types in the hardware resource application information and the resource capacity of each of the multiple second pre-selected hardware resources containing the corresponding applied hardware resource type are calculated respectively, so as to be used for the subsequent determination of the target hardware resources.

[0104] It can be understood that if the number of first pre-selected hardware resources and the number of second pre-selected hardware resources are both less than the number of applied hardware resources, in order to meet the number of applied hardware resources, all the determined first pre-selected hardware resources are selected; except for the number of first pre-selected hardware resources, the remaining number selects hardware resources with larger weights among multiple second pre-selected hardware resources.

[0105] S1037: Select, from the plurality of second pre-selected hardware resources, a second pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value as the target hardware resource.

[0106] In this embodiment, according to the weighted total values ​​corresponding to the plurality of second pre-selected hardware resources, the second pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is determined as the target hardware resource.

[0107] In this embodiment, when it is determined that the number of first pre-selected hardware resources is less than the number of applied hardware resources, multiple second pre-selected hardware resources whose resource states are all busy are re-selected from the state management module; the number of second pre-selected hardware resources is compared with the number of applied hardware resources; when it is determined that the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the multiple second pre-selected hardware resources are calculated; from the multiple second pre-selected hardware resources, the second pre-selected hardware resources that meet the number of applied hardware resources and have the largest weighted total value are selected as the target hardware resources. Compared with the prior art, the method of the present application re-selects the hardware resources in the busy state when it is determined that the hardware resources in the idle state are insufficient to meet the number of applied hardware resources, thereby avoiding the situation where part of the allocated hardware resources are in the busy state and part are in the idle state, which results in that the current hardware resource application cannot fully apply for the release of the required hardware resources, and the allocated hardware resources in the idle state cannot be allocated again, thereby improving the balance of hardware resource allocation.

[0108] Combination Figure 3 As shown, before executing S1034-S1037, refer to the previous embodiment and execute S101 and S1021 to determine the hardware resource allocation method and obtain the hardware resource application information; and determine multiple first pre-selected hardware resources.

[0109] See also Figure 4A , which is a flow chart of another embodiment of a method for allocating hardware resources provided in an embodiment of the present application; when it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is preferential selection, after S101, it may also include:

[0110] S1041: Acquire a plurality of third pre-selected hardware resources within the hardware resource selection range from the state management module.

[0111] In this embodiment, a plurality of selectable third pre-selected hardware resources are obtained from the state management module according to the hardware resource selection range in the hardware resource application information.

[0112] S1042: Calculate the weighted total values ​​corresponding to the plurality of third pre-selected hardware resources respectively according to the weight coefficients corresponding to the respective applied hardware resource types and the resource capacities of the applied hardware resource types respectively contained in the plurality of third pre-selected hardware resources.

[0113] In this embodiment, based on the weight coefficient corresponding to each applied hardware resource type in the hardware resource application information, and the resource capacity of each of the multiple third pre-selected hardware resources containing the corresponding applied hardware resource type, the weighted total value corresponding to each of the third pre-selected hardware resources is calculated for subsequent determination of the target hardware resources.

[0114] S1043: Selecting, from the plurality of third pre-selected hardware resources, a third pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value as the target hardware resource.

[0115] In this embodiment, according to the weighted total values ​​corresponding to the plurality of second pre-selected hardware resources, the second pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is determined as the target hardware resource.

[0116] In this embodiment, multiple third pre-selected hardware resources within the hardware resource selection range are obtained from the state management module; the weighted total values ​​corresponding to each of the multiple third pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource types contained in each of the multiple third pre-selected hardware resources; from the multiple third pre-selected hardware resources, the third pre-selected hardware resources that meet the number of applied hardware resources and have the largest weighted total value are selected as the target hardware resources. Compared with the prior art, the method of the present application calculates the weighted total values ​​corresponding to each of the multiple third pre-selected hardware resources within the hardware resource selection range and selects the optimal resource, so that the system can ensure that the hardware resources applied for release are fully utilized and reduce resource waste. At the same time, by dynamically adjusting the resource allocation strategy according to actual needs, it can adapt to different application scenarios and load conditions.

[0117] by Figure 4B As shown in the example, if the number of applied hardware resources is 1 and the hardware resource selection range is 10101, if the hardware resource selection method adopted is preferential selection, the weighted total value corresponding to each hardware resource is calculated to obtain the weighted total value of the hardware resources within the hardware resource selection range; wherein sort1~3 represent the size sorting of the weighted total values ​​corresponding to each hardware resource; for the unselectable hardware resources, the sort corresponding to the hardware resource is 0. Specifically, the weighted total value of hardware resource 2 is the highest, the weighted total value of hardware resource 4 is the second highest, and the weighted total value of hardware resource 0 is the lowest. Therefore, hardware resource 2 is selected as the target hardware resource. If the hardware resource selection method adopted is unified standard selection, the hardware resource corresponding to the application value of 2 is selected as the first pre-selected hardware resource, that is, hardware resource 4 and hardware resource 0. Since the number of applied hardware resources is 1, the first pre-selected hardware resource is greater than the number of applied hardware resources, and the weighted total values ​​corresponding to hardware resource 4 and hardware resource 0 are calculated; specifically, the weighted total value of hardware resource 4 is higher than the weighted total value of hardware resource 0, and hardware resource 4 is determined as the target hardware resource.

[0118] Further, based on the above embodiments, when the number of the determined multiple first pre-selected hardware resources, multiple second pre-selected hardware resources, and multiple third pre-selected hardware resources is greater than the number of applied hardware resources, it is necessary to select hardware resources that meet the number of applied hardware resources by calculating the weighted total value.

[0119] At this time, a specific implementation method of calculating the weighted total value corresponding to the target pre-selected hardware resource according to the weight coefficient corresponding to the applied hardware resource type of the target pre-selected hardware resource and the resource capacity of the applied hardware resource type of the target pre-selected hardware resource includes:

[0120] According to the applied hardware resource type, the resource capacity corresponding to each applied hardware resource type is determined from the target pre-selected hardware resources.

[0121] In this embodiment, the target pre-selected hardware resource is any one of the plurality of first pre-selected hardware resources, the plurality of second pre-selected hardware resources, and the plurality of third pre-selected hardware resources. According to the requested hardware resource type in the hardware resource application information, the resource capacity corresponding to each requested hardware resource type is determined from the target pre-selected hardware resources.

[0122] The weighted total values ​​corresponding to the target pre-selected hardware resources are obtained by weighted summing the resource capacities corresponding to the respective applied hardware resource types and the weight coefficients corresponding to the respective applied hardware resource types.

[0123] In this embodiment, for the target pre-selected hardware resources, the product of the resource capacity and the resource capacity for each applied hardware resource type is calculated according to the resource capacity corresponding to each applied hardware resource type and the weight coefficient corresponding to each applied hardware resource type; and the product results of multiple applied hardware resource types are summed to obtain the weighted total value corresponding to each target pre-selected hardware resource.

[0124] In this embodiment, according to the applied hardware resource type, the resource capacity corresponding to each applied hardware resource type is determined from the target pre-selected hardware resources; according to the weighted sum of the resource capacity corresponding to each applied hardware resource type and the weight coefficient corresponding to each applied hardware resource type, the weighted total value corresponding to each target pre-selected hardware resource is obtained. Compared with the prior art, the method of the present application can more accurately evaluate the applicability of each target pre-selected hardware resource for a specific application requirement by combining the resource capacity and the weight coefficient for weighted summation, thereby improving the accuracy of evaluating resource applicability and resource utilization efficiency.

[0125] See also Figure 5A , which is a flowchart of another embodiment of a hardware resource allocation method provided in an embodiment of the present application. Figure 1-4BThe hardware resource allocation method is an embodiment corresponding to allocation through resource selection. The hardware resource application information also includes an application tag, and the historical application records can be stored in a history record table. When the application resource information with the same application tag is obtained again, according to the user's need for rapid allocation of hardware resources, rapid allocation can be achieved by querying the history record table. Figure 5A A specific implementation method of allocating resources to the query history table using hardware resource allocation is demonstrated.

[0126] After determining the hardware resource allocation method according to the first resource status management instruction, the method further includes:

[0127] S1051: When it is determined that the hardware resource allocation method is allocation by querying the history record table, query the history record table according to the application tag to obtain the historical application record corresponding to the application tag.

[0128] Among them, the application mark is the only mark for this application.

[0129] In this embodiment, if the hardware resource allocation method adopted is allocation by querying the history record table, the history record table is called for querying according to the application tag in the hardware resource application information, and the historical application record corresponding to the application tag is obtained from the history record table. The historical application record is a historical application record corresponding to the resource allocation by resource selection allocation when the hardware resource allocation method adopted in the past was historically adopted; it includes an occupation tag, the number of hardware resource types applied for, the hardware resources applied for, and the application tag. For example, the style of the history record table can be shown in Table 2:

[0130] Table 2 History table

[0131] Alloc Rsc0_credit Rsc1_credit … Ip_mask Tags

[0132] Among them, Alloc represents whether the historical record is occupied; Rsc0_credit represents the number of successful applications for hardware resource type 0; Rsc1_credit represents the number of successful applications for hardware resource type 1; Ip_mask represents the IP of the successful application; Tag is the application tag, representing the flag of this application.

[0133] S1052: Select a target hardware resource corresponding to the hardware resource application information according to the hardware resource allocation information in the historical application record corresponding to the application mark.

[0134] In this embodiment, according to the obtained historical application records with the same application mark, the allocation information of the hardware resources allocated to the same application in the historical applications is determined, and the corresponding hardware resources are selected as the target hardware resources.

[0135] In this embodiment, when it is determined that the hardware resource allocation method is to allocate by querying the historical record table, the historical record table is queried according to the application tag to obtain the historical application record corresponding to the application tag; according to the hardware resource allocation information in the historical application record corresponding to the application tag, the target hardware resource corresponding to the hardware resource application information is selected. Compared with the prior art, the method of the present application can quickly locate the historical application record related to the current application tag by directly querying the historical record table, thereby quickly obtaining the hardware resource information that has been allocated before, avoiding the process of re-evaluating all available resources, and improving the efficiency of resource allocation.

[0136] Further, based on the above embodiment, after determining a plurality of target hardware resources, an application for releasing the target hardware resources may be made, and the method may further include:

[0137] If the resource states corresponding to the multiple target hardware resources are in an idle state, resource applications are made for the multiple target hardware resources, and the resource states corresponding to the multiple target hardware resources are updated to be in a busy state.

[0138] In this embodiment, if the resource states corresponding to the determined target hardware resources are all idle states, indicating that the target hardware resources are not occupied, resource applications will be made for the determined multiple target hardware resources, and the resource states corresponding to the multiple target hardware resources for which resource applications are made in the status management module will be updated to busy states to perform resource status management.

[0139] or,

[0140] If the resource status corresponding to multiple target hardware resources is busy, the resource status corresponding to the multiple target hardware resources is monitored. When it is determined that the resource status corresponding to the multiple target hardware resources are all updated to idle status, the multiple target hardware resources are released and the resource status corresponding to the multiple target hardware resources is updated to busy status in the status management module.

[0141] In this embodiment, if the resource states corresponding to the determined target hardware resources are all busy, indicating that the target hardware resources are occupied, the resource states corresponding to the multiple target hardware resources in the state management module are monitored in real time. When the resource states corresponding to the multiple target hardware resources are monitored to be updated to the idle state, it can be determined that the target hardware resources have ended being occupied, the determined multiple target hardware resources are released, and the resource states corresponding to the multiple target hardware resources are updated to the busy state in the state management module.

[0142] It is understandable that the resource state of the hardware resource includes an idle state (the application value is 2), a busy state (the application value is 1), and a non-applicable state (the application value is 0). When the hardware resource is applied, the application value of the applied hardware resource is reduced by one, for example, the idle state (the application value is 2) is changed to a busy state (the application value is 1). For releasing the occupied hardware resources, the resource state of the hardware resources that can be released includes a busy state (the application value is 1), and a non-applicable state (the application value is 0). After the hardware resource is released, the application value of the hardware resource is added by one accordingly, that is, the resource state is updated to an idle state (the application value is 2) and a busy state (the application value is 1) accordingly.

[0143] In this embodiment, if the resource status corresponding to multiple target hardware resources is an idle state, then multiple target hardware resources are applied for resources, and the resource status corresponding to multiple target hardware resources is updated to a busy state; or, if the resource status corresponding to multiple target hardware resources is a busy state, the resource status corresponding to multiple target hardware resources is monitored, and when it is determined that the resource status corresponding to multiple target hardware resources are all updated to an idle state, multiple target hardware resources are applied for resources and the resource status corresponding to multiple target hardware resources is updated to a busy state in the status management module. Compared with the prior art, the method of the present application obtains the resource status corresponding to multiple target hardware resources to determine whether the target hardware resources can be directly applied for release, and updates the resource status corresponding to the target hardware resources in real time, thereby ensuring that the hardware resources can be applied for release in time when they are not in use, so as to be used by other processes or tasks, thereby improving the utilization rate of hardware resources and reducing the resource waste and waiting time caused by resource occupation.

[0144] Further, based on the above embodiment, when applying for target hardware resources by using different hardware resource allocation methods, resource application release errors may occur. Figure 5B , which is a schematic diagram of an embodiment of the resource application release error in the embodiment of the present application. Figure 5B In the figure, the solid line represents a flow chart showing a hardware resource allocation method in which a corresponding resource application release error is allocated by resource selection; the dotted line represents a flow chart showing a hardware resource allocation method in which a resource application release error is allocated by querying a history record table; the method may include:

[0145] S501: When a resource release error is detected, an error mark is made on the hardware resource application information and an interrupt flag is set to 1 to interrupt the resource application release operation and perform software context protection.

[0146] If the current hardware resource allocation mode is allocation by resource selection and the resource application release error is hardware resource application release overflow, then continue to execute S502. If the current hardware resource allocation mode is allocation by querying the history record table and the resource application release error is failure to query the history record, then execute S503.

[0147] S502: query the resource status of the hardware resources in the status management module in real time, and then execute S504.

[0148] S503: determine the error record by querying the history record table and delete the error record; and query the resource status of the hardware resources in the status management module, and then execute S504.

[0149] S504: Determine whether the software processing interrupt is completed; when the current hardware resource allocation method is allocation through resource selection, if the judgment is yes, execute S505-S506; if the judgment is no, repeat S502; when the current hardware resource allocation method is allocation by querying the historical record table, if the judgment is yes, execute S506; if the judgment is no, repeat S503.

[0150] S505: Initializing the resource status of the hardware resources;

[0151] S506: Clear the error flag of the hardware resource application information; and trigger the interrupt flag to be set to 0 to re-acquire the resource status management instruction to perform resource application.

[0152] See also Figure 6 , which is a schematic diagram of the structure of an embodiment of a hardware resource allocation device provided in an embodiment of the present application. The device 60 includes: a hardware resource application module 61, a hardware resource selection module 62 and a hardware resource allocation module 63.

[0153] Specifically, the hardware resource application module 61 is used to determine the hardware resource allocation method according to the first resource status management instruction, and obtain hardware resource application information according to the second resource status management instruction; the hardware resource application information includes the number of applied hardware resources, the hardware resource selection range, the hardware resource selection method, the applied hardware resource type and the weight coefficient corresponding to each of the applied hardware resource types;

[0154] The hardware resource selection module 62 is used to determine a plurality of pre-selected hardware resources with the same resource status according to the resource statuses corresponding to the plurality of hardware resources within the hardware resource selection range when it is determined that the hardware resource allocation mode is allocation through resource selection and the hardware resource selection mode is unified standard selection;

[0155] The hardware resource allocation module 63 is used to determine a plurality of target hardware resources that meet the requested hardware resource quantity from the plurality of pre-selected hardware resources according to the requested hardware resource type and the weight coefficient corresponding to the requested hardware resource type.

[0156] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0157] Further, based on the above embodiment, the hardware resource selection module 62 is specifically used to obtain the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range from the status management module, and select multiple first pre-selected hardware resources whose resource statuses are all idle.

[0158] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0159] Further, based on the above embodiment, the hardware resource allocation module 63 is specifically used to compare the first pre-selected hardware resource quantity with the applied hardware resource quantity; when it is determined that the first pre-selected hardware resource quantity is greater than or equal to the applied hardware resource quantity, the weighted total value corresponding to each of the multiple first pre-selected hardware resources is calculated according to the weight coefficient corresponding to each of the applied hardware resource types, and the resource capacity of the applied hardware resource type contained in each of the multiple first pre-selected hardware resources; from the multiple first pre-selected hardware resources, the first pre-selected hardware resource that meets the applied hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

[0160] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0161] Further, on the basis of the above-mentioned embodiment, the hardware resource allocation module 63 is further specifically used to compare the first pre-selected hardware resource quantity with the applied hardware resource quantity; when it is determined that the first pre-selected hardware resource quantity is less than the applied hardware resource quantity, re-acquire the resource status corresponding to each of the multiple hardware resources within the hardware resource selection range from the status management module, and select multiple second pre-selected hardware resources whose resource status corresponding to each of the multiple hardware resources within the hardware resource selection range is busy; compare the second pre-selected hardware resource quantity with the applied hardware resource quantity; when it is determined that the second pre-selected hardware resource quantity is greater than or equal to the applied hardware resource quantity, calculate the weighted total value corresponding to each of the multiple second pre-selected hardware resources according to the weight coefficient corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource type contained in each of the multiple second pre-selected hardware resources; and select the second pre-selected hardware resource that meets the applied hardware resource quantity and has the largest weighted total value from the multiple second pre-selected hardware resources as the target hardware resource.

[0162] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0163] Further, on the basis of the above embodiment, the hardware resource selection module 62 is specifically used to obtain multiple third pre-selected hardware resources within the hardware resource selection range from the status management module when it is determined that the hardware resource allocation method is allocation through resource selection and the hardware resource selection method is preferential selection; according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource types contained in each of the multiple third pre-selected hardware resources, respectively calculate the weighted total values ​​corresponding to each of the multiple third pre-selected hardware resources; from the multiple third pre-selected hardware resources, select the third pre-selected hardware resources that meet the applied hardware resource quantity and have the largest weighted total value as the target hardware resource.

[0164] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0165] Further, based on the above-mentioned embodiment, the hardware resource selection module 62 is specifically used to determine the resource capacity corresponding to each of the applied hardware resource types from the target pre-selected hardware resources according to the applied hardware resource type; and to obtain the weighted total value corresponding to each of the target pre-selected hardware resources by weighted summing up the resource capacity corresponding to each of the applied hardware resource types and the weight coefficient corresponding to each of the applied hardware resource types.

[0166] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0167] Further, based on the above embodiments, see Figure 7 , which is a schematic diagram of the structure of an embodiment of a hardware resource allocation device provided in an embodiment of the present application; the device also includes a historical record table query module 64;

[0168] The history record table query module 64 is specifically used to query the history record table according to the application tag when it is determined that the hardware resource allocation method is allocated by querying the history record table, and obtain the historical application record corresponding to the application tag; according to the hardware resource allocation information in the historical application record corresponding to the application tag, select the target hardware resource corresponding to the hardware resource release information.

[0169] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0170] Further, on the basis of the above embodiment, the hardware resource allocation module 63 is also specifically used to release the resources of the multiple target hardware resources and update the resource status corresponding to the multiple target hardware resources to a busy state if the resource status corresponding to the multiple target hardware resources is an idle state; or, if the resource status corresponding to the multiple target hardware resources is a busy state, monitor the resource status corresponding to the multiple target hardware resources, and when it is determined that the resource status corresponding to the multiple target hardware resources are all updated to an idle state, release the resources of the multiple target hardware resources and update the resource status corresponding to the multiple target hardware resources to a busy state.

[0171] A hardware resource allocation device provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0172] See also Figure 8 , which is a schematic diagram of the structure of an embodiment of an electronic device provided by the present application. The electronic device 80 may include: a processor 81 and a memory 82.

[0173] The processor 81 is in communication connection with the memory 82 , and the memory 82 is used to store computer-executable instructions; the processor 81 is configured to execute the technical solution in any of the aforementioned method embodiments by executing the computer-executable instructions stored in the memory 82 .

[0174] Optionally, the memory 82 may be independent or integrated with the processor 81. Optionally, when the memory 82 is a device independent of the processor 81, the electronic device 80 may further include: a bus for connecting the above devices.

[0175] The electronic device is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.

[0176] The present application also provides a resource manager. Fig. 9 , which is a schematic diagram of the structure of an embodiment of a resource manager provided by the present application. The resource manager 90 may include: a resource application module 91, a resource selection module 92, a history record module 93 and a state management module 94.

[0177] Specifically, the resource application module 91 is used to receive a receiving instruction through an interface, obtain a hardware resource allocation mode and hardware resource application information. If there are multiple interfaces receiving multiple hardware resource application information, one hardware resource application information is determined through application arbitration for subsequent processing.

[0178] The resource selection module 92 is used to perform resource selection when it is determined that the hardware resource allocation method is allocation through resource selection, including unified standard selection and optimal selection, so as to determine the target hardware resources; and store the hardware resource selection result in the history recording module 93.

[0179] The history record module 93 is used to call this module to query when it is determined that the hardware resource allocation method is to allocate by querying the history record table, so as to obtain the hardware resource corresponding to the application mark as the target hardware resource.

[0180] The state management module 94 is used to manage multiple hardware resources.

[0181] A resource manager provided in an embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0182] An embodiment of the present application also provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement the method described above. The implementation principles and technical effects are similar and will not be repeated here.

[0183] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0184] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for allocating hardware resources, applied to a resource manager, characterized in that: include: Determine a hardware resource allocation method according to the first resource status management instruction, and obtain hardware resource application information according to the second resource status management instruction; The hardware resource application information includes the number of hardware resources applied for, the hardware resource selection range, the hardware resource selection method, the type of hardware resources applied for, and the weight coefficients corresponding to the types of hardware resources applied for; When it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is unified standard selection, a plurality of pre-selected hardware resources having the same resource status are determined according to resource statuses corresponding to the plurality of hardware resources within the hardware resource selection range; According to the requested hardware resource type and the weight coefficient corresponding to the requested hardware resource type, a plurality of target hardware resources that meet the requested hardware resource quantity are determined from the plurality of pre-selected hardware resources.

2. The method according to claim 1, characterized in that The resource manager includes a state management module; the method of determining a plurality of pre-selected hardware resources having the same resource state according to the resource states corresponding to the plurality of hardware resources within the hardware resource selection range includes: The resource states corresponding to the plurality of hardware resources within the hardware resource selection range are obtained from the state management module, and a plurality of first pre-selected hardware resources whose resource states are all in idle state are selected.

3. The method according to claim 2, characterized in that The step of determining, according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type, a plurality of target hardware resources that meet the applied hardware resource quantity from the plurality of pre-selected hardware resources comprises: Comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity; When it is determined that the number of first pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the multiple first pre-selected hardware resources are calculated according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of the applied hardware resource type contained in each of the multiple first pre-selected hardware resources; From the plurality of first pre-selected hardware resources, a first pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

4. The method according to claim 2, characterized in that: The step of determining, according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type, a plurality of target hardware resources that meet the applied hardware resource quantity from the plurality of pre-selected hardware resources comprises: Comparing the first pre-selected hardware resource quantity with the applied hardware resource quantity; When it is determined that the number of the first pre-selected hardware resources is less than the number of the applied hardware resources, re-acquiring the resource states corresponding to the multiple hardware resources within the hardware resource selection range from the state management module, and selecting multiple second pre-selected hardware resources whose resource states corresponding to the multiple hardware resources within the hardware resource selection range are all busy; Comparing the second pre-selected hardware resource quantity with the applied hardware resource quantity; When it is determined that the number of second pre-selected hardware resources is greater than or equal to the number of applied hardware resources, the weighted total values ​​corresponding to each of the plurality of second pre-selected hardware resources are calculated respectively according to the weight coefficients corresponding to each of the applied hardware resource types and the resource capacity of each of the applied hardware resource types contained in the plurality of second pre-selected hardware resources; From the plurality of second pre-selected hardware resources, a second pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

5. The method according to claim 1, characterized in that When it is determined that the hardware resource allocation method is allocation through resource selection, and the hardware resource selection method is preferential selection, the method further includes: Acquire a plurality of third pre-selected hardware resources within the hardware resource selection range from the state management module; Calculate the weighted total values ​​corresponding to the plurality of third pre-selected hardware resources respectively according to the weight coefficients corresponding to the respective applied hardware resource types and the resource capacities of the applied hardware resource types respectively contained in the plurality of third pre-selected hardware resources; From the plurality of third pre-selected hardware resources, a third pre-selected hardware resource that meets the requested hardware resource quantity and has the largest weighted total value is selected as the target hardware resource.

6. The method according to any one of claims 3 to 5, characterized in that: Calculating a weighted total value corresponding to the target pre-selected hardware resource according to a weight coefficient corresponding to the applied hardware resource type of the target pre-selected hardware resource and a resource capacity of the applied hardware resource type of the target pre-selected hardware resource includes: According to the applied hardware resource type, determining the resource capacity corresponding to each of the applied hardware resource types from the target pre-selected hardware resources; The weighted total values ​​corresponding to the target pre-selected hardware resources are obtained by weighted summing the resource capacities corresponding to the respective applied hardware resource types and the weight coefficients corresponding to the respective applied hardware resource types.

7. The method according to claim 1, characterized in that The hardware resource application information also includes an application tag. After determining the hardware resource allocation method according to the first resource status management instruction, the method further includes: When it is determined that the hardware resource allocation method is allocation by querying the history record table, querying the history record table according to the application mark to obtain the historical application record corresponding to the application mark; According to the hardware resource allocation information in the historical application record corresponding to the application mark, the target hardware resource corresponding to the hardware resource application information is selected.

8. The method according to claim 1, characterized in that Also includes: If the resource states corresponding to the multiple target hardware resources are in an idle state, applying for resources for the multiple target hardware resources, and updating the resource states corresponding to the multiple target hardware resources to a busy state; or, If the resource status corresponding to the multiple target hardware resources is in a busy state, the resource status corresponding to the multiple target hardware resources is monitored. When it is determined that the resource status corresponding to the multiple target hardware resources are all updated to an idle state, resource application is performed for the multiple target hardware resources and the resource status corresponding to the multiple target hardware resources is updated to a busy state.

9. A hardware resource allocation device, characterized in that: include: A hardware resource application module, used to determine the hardware resource allocation method according to the first resource status management instruction, and obtain hardware resource application information according to the second resource status management instruction; the hardware resource application information includes the number of hardware resources applied for, the hardware resource selection range, the hardware resource selection method, the type of hardware resources applied for, and the weight coefficients corresponding to the respective types of hardware resources applied for; A hardware resource selection module, for determining, when it is determined that the hardware resource allocation mode is allocation through resource selection and the hardware resource selection mode is unified standard selection, a plurality of pre-selected hardware resources with the same resource status according to the resource statuses corresponding to the plurality of hardware resources within the hardware resource selection range; The hardware resource allocation module is used to determine a plurality of target hardware resources that meet the quantity of the applied hardware resources from the plurality of pre-selected hardware resources according to the applied hardware resource type and the weight coefficient corresponding to the applied hardware resource type.

10. A resource manager, characterized in that: The resource manager is used to execute the method according to any one of claims 1 to 8.

11. An electronic device, characterized in that: The device comprises: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.