Resource allocation method and device

By determining the corresponding resource ID interval for the received resource request in the resource ID array and allocating the spare resource ID, the problem of unbalanced resource allocation is solved, and the balance and efficiency of resource allocation are achieved.

CN113138850BActive Publication Date: 2025-03-04TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010066931.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-20
Publication Date
2025-03-04
Estimated Expiration
2040-01-20

AI Technical Summary

Technical Problem

In resource allocation scenarios, how to ensure the balance of resource allocation, especially when the number of resource IDs is insufficient, priority needs to be re-modified.

Method used

By determining the corresponding resource ID interval for the priority corresponding to the received resource request in the resource ID array, and allocating the free resource ID to the resource applicant within the interval, thereby allocating resources to the resource applicant according to the resource ID.

Benefits of technology

This method ensures the balance of resource allocation, avoids the need to re-modify priority due to insufficient resource IDs, shortens the time-consuming resource allocation, and maintains the priority of resource requests unchanged.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113138850B_ABST
    Figure CN113138850B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a resource allocation method and device. The method includes: receiving a resource request from a resource applicant, the resource request corresponds to a priority X, where X is an integer; determining a corresponding resource ID interval for the priority X in a resource ID array, wherein there are free resource IDs in the resource ID interval, and the resource ID is used to determine the order of resource allocation for the resource applicant; allocating free resource IDs to the resource applicant within the resource ID interval; and allocating resources to the resource applicant according to the resource ID. The technical solution of the embodiments of the present application can improve the balance of resource allocation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource allocation method and device. Background Art

[0002] In resource allocation scenarios, such as allocating CPU resources to data to be processed, resources are usually allocated to the data to be processed according to the resource ID corresponding to the data to be processed, where the data to be processed has a priority. When applying for a resource ID of a certain priority for the data to be processed, if the number of resource IDs is insufficient, the priority is modified to reapply for the resource ID. However, how to ensure the balance of resource allocation is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The embodiments of the present application provide a resource allocation method, apparatus, computer-readable medium, and electronic device, thereby ensuring the balance of resource allocation at least to a certain extent.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a resource allocation method is provided, comprising: receiving a resource request from a resource applicant, the resource request corresponding to a priority level X, wherein X is an integer; determining a corresponding resource ID interval for the priority level X in a resource ID array, wherein there are free resource IDs within the resource ID interval, and the resource ID is used to determine an order in which resources are allocated to the resource applicant; allocating free resource IDs to the resource applicant within the resource ID interval; and allocating resources to the resource applicant based on the resource ID.

[0006] According to one aspect of an embodiment of the present application, a resource allocation device is provided, comprising: a receiving unit, used to receive a resource request from a resource applicant, the resource request corresponding to a priority level X, wherein X is an integer; a determining unit, used to determine a corresponding resource ID interval for the priority level X in a resource ID array; a first allocation unit, used to allocate a vacant resource ID to the resource applicant within the resource ID interval, the resource ID being used to determine an order of allocating resources to the resource applicant; and a second allocation unit, used to allocate resources to the resource applicant based on the resource ID.

[0007] In some embodiments of the present application, based on the aforementioned scheme, the resource ID array includes at least one resource ID interval, wherein one resource ID interval corresponds to one priority, and the at least one resource ID interval is arranged in ascending or descending order; the one resource ID interval includes at least one resource ID, wherein the at least one resource ID is arranged in ascending or descending order.

[0008] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a detection unit, which is used to detect whether there are any free resource IDs in the resource ID array before determining the corresponding resource ID interval for the priority X in the resource ID array; and a feedback unit, which is used to feedback the resource request failure to the resource applicant when there are no free resource IDs in the resource ID array.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the determination unit is configured to: when there are no free resource IDs in the resource ID interval corresponding to the priority level X, and there are free resource IDs in the resource ID interval corresponding to the adjacent priority level of the priority level X, adjust the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority level X so that there are free resource IDs in the resource ID interval corresponding to the priority level X.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priority of the priority X includes priority X-1, and the determination unit is configured to: when there is a vacant resource ID in the resource ID interval corresponding to the priority X-1, adjust the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priority of the priority X includes priority X+1, and the determination unit is configured to: when there is a vacant resource ID in the resource ID interval corresponding to the priority X+1, adjust the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0012] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priorities of the priority X include priority X+1 and priority X-1, and the determination unit is configured to: when there are free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1, determine the number of free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is less than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjust the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is greater than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjust the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0013] In some embodiments of the present application, based on the aforementioned scheme, the determination unit is configured to: when there are no vacant resource IDs in the resource ID interval corresponding to the priority X and the adjacent priority levels of the priority X, and when there are vacant resource IDs in the resource ID interval corresponding to the priority XN or the priority X+N, adjust the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X and the adjacent priority levels of the priority X so that there are vacant resource IDs in the resource ID interval corresponding to the priority X, and N is an integer greater than 1.

[0014] In some embodiments of the present application, based on the aforementioned scheme, the first allocation unit is configured to: determine the free resource ID with the smallest ID value within the resource ID interval; and allocate the free resource ID with the smallest ID value to the resource applicant.

[0015] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the resource allocation method as described in the above embodiment is implemented.

[0016] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the resource allocation method as described in the above embodiments.

[0017] In the technical solutions provided by some embodiments of the present application, by determining the corresponding resource ID interval for the priority corresponding to the received resource request in the resource ID array, and allocating a spare resource ID to the resource applicant within the resource ID interval, resources can be allocated to the resource applicant according to the resource ID. Since there are spare resource IDs in the resource ID interval corresponding to the priority X determined in the resource ID array, when allocating resource IDs to the resource applicant, there will be no situation where the priority needs to be modified again due to insufficient number of resource IDs. Therefore, the time spent in allocating resource IDs to the resource requester can be shortened while the priority corresponding to its resource request is not modified. This ensures the balance of resource allocation to the resource requester.

[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0021] Figure 2 An application scenario diagram of a resource allocation method according to an embodiment of the present application is shown;

[0022] Figure 3 A flow chart of a resource allocation method according to an embodiment of the present application is shown;

[0023] Figure 4 A diagram showing a resource ID array according to an embodiment of the present application is shown;

[0024] Figure 5 A flowchart of a method before determining a corresponding resource ID interval for the priority level X in a resource ID array according to an embodiment of the present application is shown;

[0025] Figure 6 A schematic diagram showing a resource ID allocation process according to an embodiment of the present application is shown;

[0026] Figure 7 A schematic diagram showing a resource ID allocation process according to an embodiment of the present application is shown;

[0027] Figure 8 A schematic diagram showing a resource ID allocation process according to an embodiment of the present application is shown;

[0028] Fig. 9 A schematic diagram showing a resource ID allocation process according to an embodiment of the present application is shown;

[0029] Fig.10 A schematic diagram showing a resource ID allocation process according to an embodiment of the present application is shown;

[0030] Fig.11 A detailed flow chart of allocating a vacant resource ID to the resource applicant within the resource ID interval according to an embodiment of the present application is shown;

[0031] Fig.12 A block diagram of a resource allocation device according to an embodiment of the present application is shown;

[0032] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0034] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0035] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0036] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0037] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.

[0038] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 The embodiment of the present invention is a schematic diagram of a mobile phone 101, a tablet computer 102, a portable computer 103, a desktop computer, etc., a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as a wired communication link, a wireless communication link, etc.

[0039] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0040] In one embodiment of the present application, a resource requester may upload a resource request (for example, a user request for CPU resources to process data) to server 105 using a terminal device. After server 105 obtains a resource request uploaded by the terminal device, it may determine a corresponding resource ID interval with free resource IDs in the resource ID array according to the priority corresponding to the resource request, allocate a free resource ID to the resource applicant within the resource ID interval, and finally allocate resources to the resource applicant according to the resource ID.

[0041] It should be noted that the resource allocation method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the resource allocation device is generally arranged in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, so as to execute the resource allocation scheme provided in the embodiment of the present application.

[0042] It should be noted that the resource allocation method described in this application can have a variety of application scenarios. For details, please refer to Figure 2 To understand.

[0043] like Figure 2, which shows an application scenario diagram of a resource allocation method according to an embodiment of the present application.

[0044] exist Figure 2 In the scenario shown, the resource requester may be a video data production terminal 201, and the original video data 202 produced by the video data production terminal generally needs to undergo special processing (such as rendering processing, compression processing, and transcoding processing, etc.) before it can be used normally. Among them, the special processing may be implemented by a video data processing system (or CPU) 203. Then in the present application, for the resource requester, the resource may be the video data processing system (or CPU). In this scenario, it may include multiple original video data processing requests, wherein different original video data processing requests have different priorities, and resource IDs are allocated to the original video data by the priorities corresponding to the original video data processing requests, so that the video data processing system (or CPU) can process the original video data in an orderly manner according to the order of resource IDs.

[0045] It should be explained here that the priority is used to indicate the priority of allocating resources. In the above scenario, different priorities of different video raw data processing requests can be understood as different urgency of processing different video raw data. Specifically, the higher the priority, the more urgent it is.

[0046] In the present application, the resource allocation method may also be applied to other scenarios, for example, processing messages through a message processing system.

[0047] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0048] According to a first aspect of the present disclosure, a resource allocation method is provided.

[0049] See also Figure 3 , shows a flow chart of a resource allocation method according to an embodiment of the present application. The resource allocation method can be executed by a device having a computing processing function, such as Figure 1 , or by the server 105 shown in Figure 1 The terminal device shown in the figure is used for execution. Figure 3 As shown, the resource allocation method at least includes steps 310 to 370:

[0050] Step 310: Receive a resource request from a resource applicant, where the resource request corresponds to a priority level X, where X is an integer.

[0051] Step 330: determine a corresponding resource ID interval for the priority level X in a resource ID array, wherein there are vacant resource IDs in the resource ID interval, and the resource IDs are used to determine the order of allocating resources to the resource applicants.

[0052] Step 350: Allocate a vacant resource ID to the resource applicant within the resource ID interval.

[0053] Step 370: Allocate resources to the resource applicant according to the resource ID.

[0054] The following is a detailed description of the above implementation steps:

[0055] In step 310, a resource request from a resource applicant is received, wherein the resource request corresponds to a priority level X, where X is an integer.

[0056] In the present application, the resource applicant may refer to a subject having resource requirements, for example, a subject requiring CPU resources to process data.

[0057] In the present application, the resource request of the resource applicant can correspond to a priority X, wherein the priority X can be used to indicate the priority of allocating resources to the resource applicant, that is, the higher the priority X corresponding to the resource request, the higher the priority of allocating resources to the resource applicant.

[0058] In one embodiment of the present application, there are resource request A and resource request B, wherein, if the priority of resource request A is "level 2" and the priority of resource request B is "level 3", since the priority of resource request A is higher than the priority of resource request B, when allocating resources to resource request A and resource request B, resource request A will be allocated resources before resource request B.

[0059] Continue to refer to Figure 3 In step 330 and step 350, a corresponding resource ID interval is determined for the priority level X in the resource ID array, and there are free resource IDs in the resource ID interval. The resource IDs are used to determine the order of resource allocation to the resource applicants; and free resource IDs are allocated to the resource applicants in the resource ID interval.

[0060] In the present application, the resource ID array includes at least one resource ID interval, wherein one resource ID interval corresponds to one priority, and the at least one resource ID interval is arranged in ascending or descending order. In addition, the one resource ID interval includes at least one resource ID, wherein the at least one resource ID is arranged in ascending or descending order.

[0061] Specifically, one resource ID interval corresponds to one priority level, which may be a one-to-one correspondence in terms of numerical values. For example, the first resource ID interval corresponds to a "level 1" priority level, and the nth resource ID interval corresponds to a "level n" priority level.

[0062] In order to enable those skilled in the art to more intuitively understand the resource ID array, the following will refer to Figure 4 Explain with a specific example.

[0063] See also Figure 4 , showing a display diagram of a resource ID array according to an embodiment of the present application.

[0064] like Figure 4 , the resource ID array shown includes 10 resource ID intervals and 100 resource IDs, wherein one resource ID interval includes 10 consecutive resource IDs. Specifically, the 10 resource ID intervals correspond to 10 priorities in sequence. For example, the first resource ID interval including resource ID1 to resource ID10 corresponds to the "level 1" priority. It should be noted that the number of resource IDs included in each resource ID interval does not need to be the same as Figure 4 The resource IDs are kept the same as shown, that is, the number of resource IDs included in different resource ID intervals may also be different according to actual conditions. In addition, the resource IDs are used to determine the order in which resources are allocated to the resource applicants, such as Figure 4 As shown in the dashed box 401, resource ID 81 indicates that the resource request at this location will be allocated resources at the 81st time.

[0065] It should be noted that Figure 4 The resource ID array shown is only an example of the present application. It should be understood by those skilled in the art that the resource ID array may also include various other forms.

[0066] In one embodiment of the present application, before determining the corresponding resource ID interval for the priority X in the resource ID array, the following may also be implemented: Figure 5 Steps shown.

[0067] See also Figure 5 , shows a flow chart of a method before determining a corresponding resource ID interval for the priority X in a resource ID array according to an embodiment of the present application, which may specifically include steps 321 to 322:

[0068] Step 321, detecting whether there is any free resource ID in the resource ID array.

[0069] Step 322: When there is no free resource ID in the resource ID array, feedback of resource request failure is sent to the resource applicant.

[0070] Specifically, the absence of any free resource ID in the resource ID array may mean that all resource IDs in the ID array have been allocated to resource requests. Figure 4 , it can be considered Figure 4 All resource IDs shown have been allocated. If a resource request is received from a resource applicant at this time, since there are no free resource IDs in the resource ID array, a failure of the resource request is fed back to the resource applicant.

[0071] In one embodiment of the present application, determining a corresponding resource ID interval for the priority level X in the resource ID array may include the following situation: when there are no free resource IDs in the resource ID interval corresponding to the priority level X, and there are free resource IDs in the resource ID interval corresponding to an adjacent priority level of the priority level X, adjusting the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority level X so that there are free resource IDs in the resource ID interval corresponding to the priority level X.

[0072] Specifically, the above embodiments may include the following specific situations:

[0073] In a specific implementation of one embodiment, the adjacent priority of the priority X may include priority X-1, and the adjustment of the upper limit resource ID or lower limit resource ID of the resource ID interval corresponding to the priority X may include: when there is a vacant resource ID in the resource ID interval corresponding to the priority X-1, adjusting the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X.

[0074] It should be noted that in this application, the upper limit resource ID and the lower limit resource ID respectively refer to the highest resource ID and the lowest resource ID in a resource ID interval corresponding to a priority level. For example, the resource ID interval corresponding to priority 8 includes resource IDs "80, 81, 82, 83, 84, 85, 86, 87, 89". Then, the upper limit resource ID in the resource ID interval corresponding to priority 8 is "89" and the lower limit resource ID is "80".

[0075] In order to make those skilled in the art understand this specific implementation more intuitively, the following will refer to Figure 6 Explain with a specific example.

[0076] See also Figure 6 , showing a schematic diagram of a resource ID allocation process according to an embodiment of the present application.

[0077] like Figure 6After receiving a resource request with a priority level of "level 5", as shown in state 1, since there is no free resource ID in the resource ID interval corresponding to the priority level of "level 5", but there is a free resource ID in the resource ID interval corresponding to the priority level of "level 4", therefore, as shown in the dotted box 601, the upper limit resource ID 40 (free resource ID) in the resource ID interval corresponding to the priority level of "level 4" is adjusted to the lower limit resource ID 40 of the resource ID interval corresponding to the priority level of "level 5", and as shown in state 2, the resource ID 40 is allocated to the resource request with a priority level of "level 5".

[0078] In a specific implementation of one embodiment, the adjacent priority of the priority X may include priority X+1, and the adjustment of the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X may include: when there is a vacant resource ID in the resource ID interval corresponding to the priority X+1, adjusting the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0079] In order to make those skilled in the art understand this specific implementation more intuitively, the following will refer to Figure 7 Explain with a specific example.

[0080] See also Figure 7 , showing a schematic diagram of a resource ID allocation process according to an embodiment of the present application.

[0081] like Figure 7 After receiving a resource request with a priority level of "level 5", as shown in state 1, since there is no free resource ID in the resource ID interval corresponding to the "level 5" priority, but there is a free resource ID in the resource ID interval corresponding to the "level 6" priority, therefore, as shown in the dotted box 701, the "level 6" resource request with the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority is first transferred to the resource ID58 in the resource ID interval corresponding to the "level 6" priority, and then, as shown in state 2, the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority (which is a free resource ID at this time) is adjusted to the upper limit resource ID51 of the resource ID interval corresponding to the "level 5" priority, and as shown in state 3, the resource ID51 is assigned to the resource request with a priority level of "level 5".

[0082] In a specific implementation of one embodiment, the adjacent priorities of the priority X may include priority X+1 and priority X-1, and the adjustment of the upper limit resource ID or lower limit resource ID of the resource ID interval corresponding to the priority X may include: when there are free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1, determining the number of free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is less than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjusting the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is greater than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjusting the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0083] In order to make those skilled in the art understand this specific implementation more intuitively, the following will refer to Figure 8 Explain with a specific example.

[0084] See also Figure 8 , showing a schematic diagram of a resource ID allocation process according to an embodiment of the present application.

[0085] like Figure 8 , after receiving a resource request with a priority level of "level 5", as shown in state 1, there are no free resource IDs in the resource ID interval corresponding to the priority level of "level 5", but there are free resource IDs in the resource ID interval corresponding to the priority level of "level 4" and the resource ID interval corresponding to the priority level of "level 6". Further, as shown in dotted boxes 801 and 802, the number of free resource IDs in the resource ID interval corresponding to the priority level of "level 6" (there are 3 free resource IDs) is greater than the number of free resource IDs in the resource ID interval corresponding to the priority level of "level 4" (there are 2 free resource IDs). Therefore, as shown in the dotted box 803, the "level 6" resource request of the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority is first transferred to the resource ID58 in the resource ID interval corresponding to the "level 6" priority. As shown in state 2, the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority (at this time it is an empty resource ID) is adjusted to the upper limit resource ID51 of the resource ID interval corresponding to the "level 5" priority. And as shown in state 3, the resource ID51 is assigned to the resource request with a priority of "level 5".

[0086] In one embodiment of the present application, determining the corresponding resource ID interval for the priority X in the resource ID array may also include the following situation: when there is no free resource ID in the resource ID interval corresponding to the priority X and the adjacent priority of the priority X, and there is a free resource ID in the resource ID interval corresponding to the priority XN or the priority X+N, the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X and the adjacent priority of the priority X is adjusted so that there is a free resource ID in the resource ID interval corresponding to the priority X. It should be noted that in the present application, the adjacent priority of the priority X is not limited to priority X-1 and priority X+1, but may also be priority X-N+1 and priority X+N-1 (for example, it may be priority X-2 and priority X-2, or priority X-3 and priority X-3, etc.). In addition, it should be noted that N is an integer greater than 1.

[0087] In order to make those skilled in the art understand this embodiment more intuitively, Fig. 9 and Fig.10 This is explained with two specific examples.

[0088] See also Fig. 9 , showing a schematic diagram of a resource ID allocation process according to an embodiment of the present application.

[0089] like Fig. 9 After receiving a resource request with a priority level of "level 6", as shown in state 1, since there are no free resource IDs in the resource ID intervals corresponding to the "level 6" priority and the "level 5" priority, but there are free resource IDs in the resource ID interval corresponding to the "level 4" priority, as shown in state 2, the upper limit resource ID 40 (the free resource ID at this time) in the resource ID interval corresponding to the "level 4" priority is adjusted to the lower limit resource ID 40 of the resource ID interval corresponding to the "level 5" priority, and continue as shown in the dotted box 901 and the dotted box 902, The "level 5" resource request of the upper limit resource ID50 in the resource ID interval corresponding to the "level 5" priority is transferred to the resource ID40 in the resource ID interval corresponding to the "level 5" priority (at this time, resource ID40 belongs to the resource ID interval corresponding to the "level 5" priority); further, the upper limit resource ID50 in the resource ID interval corresponding to the "level 5" priority (at this time, it is an empty resource ID) is adjusted to the lower limit resource ID50 of the resource ID interval corresponding to the "level 6" priority; as shown in state 3, the resource ID50 is assigned to the resource request with a priority of "level 6".

[0090] See also Fig.10, showing a schematic diagram of a resource ID allocation process according to an embodiment of the present application.

[0091] like Fig.10 , after receiving a resource request with a priority of "level 4", as shown in state 1, since there are no free resource IDs in the resource ID intervals corresponding to the "level 4" priority and the "level 5" priority, but there are free resource IDs in the resource ID interval corresponding to the "level 6" priority, as shown in dotted boxes 1001 and 1002, the "level 6" resource request with the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority is first transferred to the resource ID57 in the resource ID interval corresponding to the "level 6" priority, as shown in state 2, the lower limit resource ID51 in the resource ID interval corresponding to the "level 6" priority (which is a free resource ID at this time) is adjusted to "5 The upper limit resource ID51 of the resource ID interval corresponding to the "level" priority is transferred to the resource ID51 in the resource ID interval corresponding to the "level" priority (at this time, resource ID51 belongs to the resource ID interval corresponding to the "level 6" priority), as shown in state 2, the lower limit resource ID41 in the resource ID interval corresponding to the "level 5" priority (at this time, it is a free resource ID) is adjusted to the upper limit resource ID41 of the resource ID interval corresponding to the "level 4" priority, and as shown in state 3, the resource ID41 is assigned to the resource request with a priority of "level 4".

[0092] In one embodiment of the present application, the allocation of a vacant resource ID to the resource applicant within the resource ID interval may be performed as follows: Fig.11 The steps shown are implemented.

[0093] See also Fig.11 , shows a detailed flow chart of allocating a vacant resource ID to the resource applicant within the resource ID interval according to an embodiment of the present application, which may specifically include steps 351 to 352:

[0094] Step 351, determining a free resource ID with the smallest ID value within the resource ID interval.

[0095] Step 352: Allocate the vacant resource ID with the smallest ID value to the resource applicant.

[0096] It is understandable that when there are multiple free resource IDs in the resource ID interval corresponding to the priority X, the free resource ID with the smallest ID value is allocated to the resource application. Specifically, for example, after receiving a resource request with a priority of "level 6", if resource ID56, resource ID57 and resource ID58 in the resource ID interval corresponding to the priority of "level 6" are all free resource IDs, resource ID56 can be allocated to the resource request with a priority of "level 6".

[0097] Continue to refer to Figure 3 In step 370, resources are allocated to the resource applicant according to the resource ID.

[0098] Specifically, in the present application, resources are allocated to the resource applicant according to the resource ID. The resources can be allocated to the resource applicant in sequence according to the ID order of the resource ID. For example, resources can be allocated to the resource applicant corresponding to resource ID1 first, and then to the resource applicant corresponding to resource ID2, and finally to the resource applicant corresponding to the largest resource ID.

[0099] In the technical solutions provided by some embodiments of the present application, by determining the corresponding resource ID interval for the priority corresponding to the received resource request in the resource ID array, and allocating a spare resource ID to the resource applicant within the resource ID interval, resources can be allocated to the resource applicant according to the resource ID. Since there are spare resource IDs in the resource ID interval corresponding to the priority X determined in the resource ID array, when allocating resource IDs to the resource applicant, there will be no situation where the priority needs to be modified again due to insufficient number of resource IDs. Therefore, the time spent in allocating resource IDs to the resource requester can be shortened while the priority corresponding to its resource request is not modified. This ensures the balance of resource allocation to the resource requester.

[0100] The following describes an apparatus embodiment of the present application, which can be used to execute the resource allocation method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the resource allocation method of the present application.

[0101] Fig.12 A block diagram of a resource allocation device according to an embodiment of the present application is shown.

[0102] Reference Fig.12 As shown, a resource allocation device 1200 according to an embodiment of the present application includes: a receiving unit 1201 , a determining unit 1202 , a first allocation unit 1203 and a second allocation unit 1204 .

[0103] Among them, the receiving unit 1201 is used to receive a resource request from a resource applicant, and the resource request corresponds to a priority level X, where X is an integer; the determining unit 1202 is used to determine a corresponding resource ID interval for the priority level X in a resource ID array; the first allocation unit 1203 is used to allocate a vacant resource ID to the resource applicant within the resource ID interval, and the resource ID is used to determine the order of resource allocation to the resource applicant; the second allocation unit 1204 is used to allocate resources to the resource applicant according to the resource ID.

[0104] In some embodiments of the present application, based on the aforementioned scheme, the resource ID array includes at least one resource ID interval, wherein one resource ID interval corresponds to one priority, and the at least one resource ID interval is arranged in ascending or descending order; the one resource ID interval includes at least one resource ID, wherein the at least one resource ID is arranged in ascending or descending order.

[0105] In some embodiments of the present application, based on the aforementioned scheme, the device also includes: a detection unit, which is used to detect whether there are any free resource IDs in the resource ID array before determining the corresponding resource ID interval for the priority X in the resource ID array; and a feedback unit, which is used to feedback the resource request failure to the resource applicant when there are no free resource IDs in the resource ID array.

[0106] In some embodiments of the present application, based on the aforementioned scheme, the determination unit 1202 is configured to: when there are no vacant resource IDs in the resource ID interval corresponding to the priority level X, and there are vacant resource IDs in the resource ID interval corresponding to the adjacent priority level of the priority level X, adjust the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority level X so that there are vacant resource IDs in the resource ID interval corresponding to the priority level X.

[0107] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priority of the priority X includes priority X-1, and the determination unit 1202 is configured to: when there is a vacant resource ID in the resource ID interval corresponding to the priority X-1, adjust the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X.

[0108] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priority of the priority X includes priority X+1, and the determination unit 1202 is configured to: when there is a vacant resource ID in the resource ID interval corresponding to the priority X+1, adjust the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0109] In some embodiments of the present application, based on the aforementioned scheme, the adjacent priorities of the priority X include priority X+1 and priority X-1, and the determination unit 1202 is configured to: when there are free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1, determine the number of free resource IDs in the resource ID intervals corresponding to the priority X+1 and priority X-1; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is less than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjust the upper limit resource ID in the resource ID interval corresponding to the priority X-1 to the lower limit resource ID of the resource ID interval corresponding to the priority X; when the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is greater than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, adjust the lower limit resource ID in the resource ID interval corresponding to the priority X+1 to the upper limit resource ID of the resource ID interval corresponding to the priority X.

[0110] In some embodiments of the present application, based on the aforementioned scheme, the determination unit 1202 is configured to: when there are no vacant resource IDs in the resource ID interval corresponding to the priority X and the adjacent priority levels of the priority X, and when there are vacant resource IDs in the resource ID interval corresponding to the priority XN or the priority X+N, adjust the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X and the adjacent priority levels of the priority X so that there are vacant resource IDs in the resource ID interval corresponding to the priority X, and N is an integer greater than 1.

[0111] In some embodiments of the present application, based on the aforementioned scheme, the first allocation unit 1203 is configured to: determine the free resource ID with the smallest ID value within the resource ID interval; and allocate the free resource ID with the smallest ID value to the resource applicant.

[0112] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0113] It should be noted that Fig.13The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0114] like Fig.13 As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1302 or the program loaded from the storage part 1308 to the random access memory (RAM) 1303, such as executing the method described in the above embodiment. In RAM 1303, various programs and data required for system operation are also stored. CPU 1301, ROM 1302 and RAM 1303 are connected to each other through bus 1304. Input / output (I / O) interface 1305 is also connected to bus 1304.

[0115] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.

[0116] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1309, and / or installed from a removable medium 1311. When the computer program is executed by a central processing unit (CPU) 1301, various functions defined in the system of the present application are executed.

[0117] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0118] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0119] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0120] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0121] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0122] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0123] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0124] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A resource allocation method, characterized in that: The method comprises: Receive a resource request from a resource applicant, where the resource request corresponds to a priority level X, where X is an integer; When there is no free resource ID in the resource ID interval corresponding to the priority level X, and there is a free resource ID in the resource ID interval corresponding to the adjacent priority level of the priority level X, the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority level X is adjusted so that there is a free resource ID in the resource ID interval corresponding to the priority level X, and there is a free resource ID in the resource ID interval, and the resource ID is used to determine the order of resource allocation to the resource applicant; the resource ID array includes at least one resource ID interval, wherein one resource ID interval corresponds to one priority level, and the at least one resource ID interval is arranged in ascending or descending order; the one resource ID interval includes at least one resource ID, wherein the at least one resource ID is arranged in ascending or descending order; Allocating a vacant resource ID to the resource applicant within the resource ID interval; Allocate resources to the resource applicant according to the resource ID.

2. The method according to claim 1, characterized in that Before determining a corresponding resource ID interval for the priority level X in the resource ID array, the method further comprises: Check whether there are any free resource IDs in the resource ID array; When there is no free resource ID in the resource ID array, a resource request failure is fed back to the resource applicant.

3. The method according to claim 1, characterized in that The adjacent priority of the priority X includes the priority X-1, and the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X is adjusted, including: When there is a vacant resource ID in the resource ID interval corresponding to the priority X-1, the upper limit resource ID in the resource ID interval corresponding to the priority X-1 is adjusted to the lower limit resource ID of the resource ID interval corresponding to the priority X.

4. The method according to claim 1, characterized in that: The adjacent priority of the priority X includes the priority X+1, and the adjusting of the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X includes: When there are vacant resource IDs in the resource ID interval corresponding to the priority X+1, the lower limit resource ID in the resource ID interval corresponding to the priority X+1 is adjusted to the upper limit resource ID of the resource ID interval corresponding to the priority X.

5. The method according to claim 1, characterized in that The adjacent priorities of the priority X include priority X+1 and priority X-1, and the adjusting of the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X includes: When there are free resource IDs in the resource ID intervals corresponding to the priority levels X+1 and X-1, determine the number of free resource IDs in the resource ID intervals corresponding to the priority levels X+1 and X-1; When the number of free resource IDs in the resource ID interval corresponding to the priority X+1 is less than the number of free resource IDs in the resource ID interval corresponding to the priority X-1, the upper limit resource ID in the resource ID interval corresponding to the priority X-1 is adjusted to the lower limit resource ID of the resource ID interval corresponding to the priority X; When the number of vacant resource IDs in the resource ID interval corresponding to the priority X+1 is greater than the number of vacant resource IDs in the resource ID interval corresponding to the priority X-1, the lower limit resource ID in the resource ID interval corresponding to the priority X+1 is adjusted to the upper limit resource ID of the resource ID interval corresponding to the priority X.

6. The method according to claim 1, characterized in that The method further comprises: When there are no vacant resource IDs in the resource ID interval corresponding to the priority level X and the adjacent priority levels of the priority level X, and there are vacant resource IDs in the resource ID interval corresponding to the priority level XN or the priority level X+N, the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority level X and the adjacent priority levels of the priority level X is adjusted so that there are vacant resource IDs in the resource ID interval corresponding to the priority level X, where N is an integer greater than 1.

7. The method according to claim 1, characterized in that Allocating a vacant resource ID to the resource applicant within the resource ID interval includes: Determine a free resource ID with the smallest ID value within the resource ID interval; The resource applicant is allocated the vacant resource ID with the smallest ID value.

8. A resource allocation device, characterized in that: include: A receiving unit, used to receive a resource request from a resource applicant, wherein the resource request corresponds to a priority level X, where X is an integer; A determination unit, used to adjust the upper limit resource ID or the lower limit resource ID of the resource ID interval corresponding to the priority X when there is no free resource ID in the resource ID interval corresponding to the priority X, and there is a free resource ID in the resource ID interval corresponding to the adjacent priority of the priority X, so that there is a free resource ID in the resource ID interval corresponding to the priority X, and there is a free resource ID in the resource ID interval, and the resource ID is used to determine the order of resource allocation to the resource applicant; the resource ID array includes at least one resource ID interval, wherein one resource ID interval corresponds to one priority, and the at least one resource ID interval is arranged in ascending or descending order; the one resource ID interval includes at least one resource ID, wherein the at least one resource ID is arranged in ascending or descending order; A first allocation unit is used to allocate a vacant resource ID to the resource applicant within the resource ID interval; The second allocation unit is used to allocate resources to the resource applicant according to the resource ID.

9. An electronic device, characterized in that: include: one or more processors; A storage device, used for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the resource allocation method according to any one of claims 1 to 7.

10. A computer-readable medium, characterized in that The computer readable medium stores a computer program, and when the computer program is executed by a processor, the resource allocation method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Resource control method and apparatus, and bus system server

    CN107948095A

  • FC Interface card exchange resource identifier processing method and related component

    CN109634888A