CN115017030A - Resource allocation method, device, electronic equipment and storage medium - Google Patents

Resource allocation method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115017030A
CN115017030A CN202210161267.3A CN202210161267A CN115017030A CN 115017030 A CN115017030 A CN 115017030A CN 202210161267 A CN202210161267 A CN 202210161267A CN 115017030 A CN115017030 A CN 115017030A
Authority
CN
China
Prior art keywords
task
amount
target resource
resource
priority
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210161267.3A
Other languages
Chinese (zh)
Inventor
许龙飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zeku Technology Beijing Corp Ltd
Original Assignee
Zeku Technology Beijing Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zeku Technology Beijing Corp Ltd filed Critical Zeku Technology Beijing Corp Ltd
Priority to CN202210161267.3A priority Critical patent/CN115017030A/en
Publication of CN115017030A publication Critical patent/CN115017030A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application relates to a resource allocation method, a resource allocation device, electronic equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: polling a task set, wherein the task set comprises a plurality of tasks which need to be executed based on the target resource cluster; in response to polling a first task in the set of tasks, determining a priority of the first task and an amount of resources required by the first task; allocating a first target resource in the target resource cluster for the first task based on the priority of the first task, the amount of resources required by the first task, and the amount of free resources of the target resource cluster. In the above scheme, the first target resource is timely determined to be allocated to the task with the reasonable priority and the required resource amount in a polling manner, so that the resources in the target resource cluster are prevented from being in an idle state, and resource waste is prevented.

Description

Resource allocation method, device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a resource allocation method, a resource allocation device, electronic equipment and a storage medium.
Background
In the process of performing simulation test through Field Programmable Gate Array (FPGA) software, resources need to be allocated to a simulation task for the simulation task to be called when the simulation task is executed.
In the related art, a time axis is configured for each simulation task according to the theoretical execution time of each simulation task, so that resources are allocated for the simulation tasks through the preset time axis in the simulation test process, and a simulation figure can be tested.
However, in the actual simulation test process, the execution time of the simulation task of the FPGA software is uncontrollable, and the allocable resources are limited, so that allocating the resources to the simulation task by using the preset time axis may cause the idle resources of the simulation task in the idle time, which results in resource waste.
Disclosure of Invention
The embodiment of the application provides a resource allocation method, a resource allocation device, an electronic device and a storage medium, which can improve the resource utilization rate and avoid resource waste. The technical scheme is as follows:
in one aspect, a resource allocation method is provided, and the method includes:
polling a task set, wherein the task set comprises a plurality of tasks which need to be executed based on a target resource cluster;
in response to polling a first task of the set of tasks, determining a priority of the first task and an amount of resources required by the first task;
allocating a first target resource in the target resource cluster for the first task based on the priority of the first task, the amount of resources required by the first task, and the amount of free resources of the target resource cluster.
In another aspect, a resource allocation method is provided, and the method includes:
in response to receiving a third task, determining an amount of resources required for the third task;
determining a total amount of resources required for at least one task not executed in a set of tasks executed based on the target resource cluster;
determining an amount of free resources of the target resource cluster based on the total amount of resources and the total amount of resources of the target resource cluster;
and if the idle resource amount of the target resource cluster is not less than the resource amount required by the third task, allocating a second target resource in the target resource cluster to the third task.
In another aspect, an apparatus for resource allocation is provided, the apparatus comprising:
the polling module is used for polling a task set, and the task set comprises a plurality of tasks which need to be executed based on a target resource cluster;
a first determining module to determine a priority of a first task and an amount of resources required by the first task in response to polling the first task in the set of tasks;
a first allocating module, configured to allocate a first target resource in the target resource cluster to the first task based on the priority of the first task, the amount of the resource required by the first task, and the amount of the idle resource of the target resource cluster.
In another aspect, an apparatus for resource allocation is provided, the apparatus including:
a second determining module, configured to determine, in response to receiving a third task, an amount of resources required by the third task;
a third determining module, configured to determine a total amount of resources required for at least one task that is not executed in the task set executed based on the target resource cluster;
a fourth determining module, configured to determine an amount of idle resources of the target resource cluster based on the total amount of resources and the total amount of resources of the target resource cluster;
and the second allocation module is used for allocating a second target resource in the target resource cluster to the third task if the free resource amount of the target resource cluster is not less than the resource amount required by the third task.
In another aspect, an electronic device is provided, the electronic device comprising a processor and a memory; the memory stores at least one program code for execution by the processor to implement the resource allocation method as described in the above aspect.
In another aspect, a computer-readable storage medium is provided, which stores at least one program code for execution by a processor to implement the resource allocation method as described in the above aspect.
In another aspect, a computer program product is provided, having stored at least one program code for execution by a processor to implement the resource allocation method as described in the above aspect.
In the embodiment of the application, the task set is polled, and the first target resource in the target resource cluster is allocated to the first task by combining the priority of the first task and the resource amount required by the first task, so that in the process of executing a plurality of tasks in the task set based on the target resource cluster, the first target resource is timely allocated to the task with reasonable priority and required resource amount in a polling mode, the resource in the target resource cluster is prevented from being in an idle state, and the resource waste is prevented.
Drawings
Fig. 1 illustrates an implementation environment related to a resource allocation method according to an exemplary embodiment of the present application;
FIG. 2 illustrates a flow chart of a resource allocation method according to an exemplary embodiment of the present application;
FIG. 3 illustrates a flow chart of a resource allocation method according to an exemplary embodiment of the present application;
FIG. 4 illustrates a flow chart of a resource allocation method according to an exemplary embodiment of the present application;
FIG. 5 illustrates a flow chart of a resource allocation method according to an exemplary embodiment of the present application;
FIG. 6 illustrates a flow chart of a resource allocation method according to an exemplary embodiment of the present application;
FIG. 7 is a flow chart illustrating a method of resource allocation in accordance with an exemplary embodiment of the present application;
fig. 8 is a block diagram illustrating a resource allocation apparatus according to an exemplary embodiment of the present application;
fig. 9 is a block diagram illustrating a structure of a resource allocation apparatus according to an exemplary embodiment of the present application;
FIG. 10 is a block diagram illustrating a server according to an exemplary embodiment of the present application;
fig. 11 shows a block diagram of a terminal according to an exemplary embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, the following detailed description of the embodiments of the present application will be made with reference to the accompanying drawings.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals referred to in this application are authorized by the user or fully authorized by various parties, and the collection, use and processing of the relevant data are subject to relevant laws and regulations and standards in relevant countries and regions. For example, the set of tasks referred to in this application are all obtained with sufficient authorization.
Referring to fig. 1, an implementation environment related to a resource allocation method according to an exemplary embodiment of the present application is shown. The implementation environment includes: a terminal 10, a server 20 and a resource cluster 30. The terminal 10 and the server 20 can exchange information with each other through a network, wherein the network is a wired network or a wireless network.
In some embodiments, the resource cluster 30 is a hardware resource cluster 30 or a software resource cluster 30. In the embodiment of the present disclosure, the resource cluster 30 is taken as an example of the hardware resource cluster 30. Accordingly, the resource cluster 30 includes a plurality of hardware resources therein. In some embodiments, the plurality of hardware resources are Field Programmable Gate Array (FPGA) resources. The resource cluster 30 is used to provide resources for the simulation task. Either the server 20 or the terminal 10 may be used to manage the resources in the resource cluster 30.
In some embodiments, the terminal 10 may be any electronic device such as a smartphone, a tablet, a laptop, a desktop Computer, an e-book reader, a multimedia playing device, a wearable device, a PC (Personal Computer), a smart appliance, or an in-vehicle terminal 10. The terminal 10 has installed therein a target application, which is software for performing simulation tasks, which in some embodiments are FPGA simulation tasks. Accordingly, the terminal 10 executes the simulation based on the target application, and uploads the simulation result to the server 20. In some embodiments, the terminal 10 displays an input interface of the target application through which user input of a task to be PFGA simulated is received.
In some embodiments, the server 20 may be an independent physical server 20, a server 20 cluster or a distributed system formed by a plurality of physical servers 20, or a cloud server 20 providing at least one basic cloud computing service of a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), and a big data and artificial intelligence platform. The server 20 stores task sets, each task set including a plurality of tasks, and the tasks in the same task set are executed in the same resource cluster 30.
Referring to fig. 2, a flowchart of a resource allocation method according to an exemplary embodiment of the present application is shown. The method comprises the following steps:
step S201: the server polls a task set comprising a plurality of tasks that need to be performed on a target resource cluster basis.
The server performs traversal on the task set once every preset time length, so that polling on the task set is realized. The preset duration can be set as required, and in the embodiment of the present application, the preset duration is not specifically limited. For example, the preset time period is 30 seconds, 35 seconds, or the like.
In some embodiments, the server obtains the adding time of a plurality of tasks in the task set; polling the set of tasks based on the add time of the plurality of tasks. Prior to this step, the server retrieves the set of tasks from the database, see fig. 3. The database is the database integrated in the server, or the database is a separate database other than the server, which is not particularly limited in the embodiment of the present application. The add time of each task is the time that the task is added to the set of tasks. In some embodiments, the task set stores task information for a plurality of tasks in the form of a list. And the sequence of the tasks in the task list is determined according to the adding time of the tasks.
In the embodiment of the application, the server polls the task set based on the time sequence, so that the task added first has a chance to be executed first, and the fairness and the rationality of task scheduling are guaranteed through a first-in first-out mechanism.
Step S202: in response to polling a first task in the set of tasks, the server determines a priority of the first task and an amount of resources required by the first task.
The priority of the first task indicates a priority level of the first task being executed. In some embodiments, the priority of the first task is noted when the first task is added to the set of tasks. In some embodiments, the priority of the first task is determined based on a number of times the first task is traversed, the priority of the first task being positively correlated with the number of times the first task is traversed. I.e., the greater the number of times the first task is traversed, the higher the priority of the first task. It should be noted that the initial priority of the first task may be the same or different. In the embodiments of the present application, this is not particularly limited.
The amount of resources required for the first task is the amount of resources that need to be occupied in the target resource cluster when executing the first task. In some embodiments, a task set includes task information for a plurality of tasks, the task information including a priority for each task and an amount of resources required for the task. Accordingly, in this step, referring to fig. 3, the server acquires the task information of the first task, thereby determining the priority of the first task and the amount of resources required by the first task.
Step S203: the server allocates a first target resource in the target resource cluster to the first task based on the priority of the first task, the amount of resources required by the first task, and the amount of free resources of the target resource cluster.
In this step, the server determines whether the priority of the first task is greater than a preset threshold, determines whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task, and determines whether to allocate a first target resource in the target resource cluster to the first task based on the determination result.
The free resource amount of the target resource cluster is the resource amount of the unoccupied resource in the target resource cluster. In some embodiments, the server determines free resources in the target resource cluster, and determines the total resource amount of the free resources as the free resource amount of the target resource cluster. In some embodiments, the server determines an occupied resource from the target resource cluster, determines a resource amount of the occupied resource, and determines a difference between a total resource amount of the target resource cluster and the resource amount of the occupied resource as a free resource amount of the target resource cluster.
It should be noted that, in this step, the server may first determine whether the priority of the first task is greater than a preset threshold, and then determine whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task; the server may also determine whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task, and then determine whether the priority of the first task is greater than a preset threshold; the server can also simultaneously judge whether the priority of the first task is greater than a preset threshold value and judge whether the idle resource quantity of the target resource cluster is less than the resource quantity required by the first task. In this embodiment, the sequence of determining, by the server, whether the priority is greater than the preset threshold and determining whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task is not particularly limited.
In the embodiment of the application, the task set is polled, and the first target resource in the target resource cluster is allocated to the first task by combining the priority of the first task and the resource amount required by the first task, so that in the process of executing a plurality of tasks in the task set based on the target resource cluster, the first target resource is timely determined to be allocated to the task with reasonable priority and required resource amount in a polling mode, the resource in the target resource cluster is prevented from being in an idle state, and the resource waste is prevented.
Referring to fig. 4, a flowchart of a resource allocation method according to an exemplary embodiment of the present application is shown. The method comprises the following steps:
step S401: the server polls a task set that includes a plurality of tasks that need to be performed based on the target resource cluster.
This step is the same as the principle of step S201, and is not described herein again.
Step S402: in response to polling a first task in the set of tasks, the server determines a priority of the first task and an amount of resources required by the first task.
The principle of this step is the same as that of step S202, and is not described herein again.
Step S403: the server determines whether the priority of the first task is greater than a preset threshold value, and determines whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task.
Referring to fig. 3, in this step and step S203, the server determines whether the priority of the first task is greater than the preset threshold, and determines whether the amount of idle resources of the target resource cluster is less than the amount of resources required by the first task.
Step S404: if the priority of the first task is greater than a preset threshold and the free resource amount is not less than the resource amount required by the first task, the server allocates a first target resource in the target resource cluster to the first task.
And if the priority of the first task is greater than a preset threshold value, the first task is a high-level task, and the server processes the first task preferentially. If the free resource amount of the target resource cluster is not less than the resource amount required by the first task, the server determines that the free resource amount of the target resource cluster is enough to support the first task to execute, so that part or all of the free resource of the target resource cluster is allocated to the first task as the first target resource, and the first target resource can be called when the first task is executed.
Step S405: and if the priority of the first task is not greater than the preset threshold, the server determines the priorities of other tasks in the task set.
In this step, the server determines task information of other tasks, thereby determining priorities of the other tasks. And determining whether a second task with the priority greater than a preset threshold exists from the task set, if so, executing the step S407 by the server, and if not, executing the step S406 by the server.
Step S406: and if the second task with the priority greater than the preset threshold does not exist in the task set and the idle resource amount is not less than the resource amount required by the first task, allocating a first target resource in the target resource cluster to the first task.
Referring to fig. 3, if there is no second task with a priority greater than a preset threshold in the task set, it is determined that there is no high-level task that needs priority processing, and the server may allocate a first target resource in the target resource cluster to the first task.
The principle of the server allocating the first target resource to the first task is the same as the principle of step S303, and is not described herein again.
Step S407: and if the second task with the priority higher than the preset threshold exists in the task set, the server increases the priority of the first task.
Referring to fig. 3, if there is a second task with a priority greater than a preset threshold in the task set, it is determined that there is a high-level task that needs to be processed preferentially, and the server determines that resources are allocated preferentially to the second task, so that resources are not allocated to the first task temporarily, and the priority of the first task is increased by a preset level. For example, the priority of the first task is increased by one.
Step S408: the server updates the priority of the first task to the task set.
In this step, the server updates the priority of the first task to a database for storing the set of tasks.
In the embodiment of the application, the priorities of other tasks in the task set are determined, so that when a second task with the priority higher than a preset threshold exists in the task set, the server does not allocate resources to the first task, but improves the priority of the first task, and therefore the problem that the quantity of idle resources in a target resource cluster is not enough to execute the second task all the time, but enough to execute a plurality of subsequent tasks occupying few resources is solved, the server only executes the tasks occupying few resources all the time, but the second task cannot execute all the time, and only when no high-priority task exists in the task set, a first-in first-out mechanism is adopted, and fairness and reasonability of the resource allocation mechanism are guaranteed.
In the embodiment of the application, the task set is polled, and the first target resource in the target resource cluster is allocated to the first task by combining the priority of the first task and the resource amount required by the first task, so that in the process of executing a plurality of tasks in the task set based on the target resource cluster, the first target resource is timely determined to be allocated to the task with reasonable priority and required resource amount in a polling mode, the resource in the target resource cluster is prevented from being in an idle state, and the resource waste is prevented.
Referring to fig. 5, a flowchart illustrating a resource allocation method according to an exemplary embodiment of the present application is shown. The method comprises the following steps:
step S501: the server polls a task set comprising a plurality of tasks that need to be performed on a target resource cluster basis.
This step is the same as the principle of step S201, and is not described herein again.
Step S502: in response to polling a first task in the set of tasks, the server determines a priority of the first task and an amount of resources required by the first task.
The principle of this step is the same as that of step S202, and is not described herein again.
Step S503: and if the idle resource amount is less than the resource amount required by the first task and the priority of the first task is less than a preset threshold, improving the priority of the first task.
This step is the same as the step 407 in principle, and is not described herein again.
Step S504: the server updates the priority of the first task to the task set.
This step is the same as step 408 in principle, and is not described herein again.
It should be noted that, if the idle resources of the target resource cluster are smaller than the resources required by the first task and the priority of the first task is not smaller than the preset threshold, the server waits to execute the first task. Correspondingly, the server determines whether the idle resource amount of the current target resource cluster is smaller than the resource amount required by the first task during the next pass, and if the idle resource amount of the target resource cluster is not smaller than the resource amount required by the first task, the first target resource in the target resource cluster is allocated to the first task; if the free resource amount of the target resource cluster is still smaller than the resource amount required by the first task, the server continues to wait for executing the first task. In some embodiments, the server detects an occupied state of a resource in the resource cluster, and in response to a release of the resource in the target resource cluster, the server determines whether an amount of idle resources of the target resource cluster is less than an amount of resources required by a first task after the resource is released, and allocates a first target resource in the target resource cluster to the first task if the amount of idle resources of the target resource cluster is not less than the amount of resources required by the first task after the resource is released; and if the free resource amount in the target resource cluster is still smaller than the resource amount required by the first task after the resources are released, the server continues to wait for executing the first task.
In the embodiment of the application, when the amount of the idle resources of the target resource cluster is less than the amount of the resources required by the first task, the priority of the first task is increased until the priority of the first task is greater than a preset threshold value, so that the first task can be executed in the subsequent traversal process, and therefore, the problem that the server only always executes the tasks occupying few resources and the first task cannot be executed under the condition that the amount of the idle resources of the current target resource cluster is not enough to execute the first task but enough to execute a plurality of subsequent tasks occupying few resources is prevented, and fairness and reasonability of a resource allocation mechanism are guaranteed.
Referring to fig. 6, a flowchart of a resource allocation method according to an exemplary embodiment of the present application is shown. The method comprises the following steps:
step 6501: in response to receiving the third task, the terminal determines an amount of resources required for the third task.
And the terminal displays an input interface, and the input interface is used for inputting a third task to be executed and configuring task information for the third task. In some embodiments, the input interface comprises a resource requirement option and a task harness filling option, and the terminal receives task information of a third task input in the input interface. Referring to fig. 7, in this step, the terminal receives the third task.
Step S602: the terminal determines a total amount of resources required for at least one task not executed in the set of tasks executed based on the target resource cluster.
In this step, the terminal determines at least one task that is not currently executed in the task set, determines task information of each task in the at least one task that is not currently executed, thereby determining an amount of resources required for each task, and determines a sum of the amounts of resources required for each task as a total amount of resources required for the at least one task.
Step S603: and the terminal determines the idle resource amount of the target resource cluster based on the total resource amount and the total resource amount of the target resource cluster.
The free resources of the target resource cluster are the resource amount of the target resource cluster except the occupied resource amount and the resource amount required when at least one task which is not executed currently is executed. Referring to fig. 7, in this step, the terminal determines all the resource amounts of the target resource cluster and the resource amount of the occupied resource, and determines the resource amount of all the resources of the target resource cluster, the resource amount of the occupied resource, and the difference between the total resource amounts required by the at least one unexecuted task as the idle resource amount of the target panelist cluster.
Step S604: and if the idle resource amount of the target resource cluster is not less than the resource amount required by the third task, the terminal allocates a second target resource in the target resource cluster to the third task.
The principle of this step is the same as that of step S404, and is not described herein again.
Step S604: and if the idle resource amount of the target resource cluster is less than the resource amount required by the third task, sending task information of the third task to a server, wherein the server is used for adding the third task to the task set based on the task information of the third task.
Referring to fig. 7, in this step, if the amount of free resources of the target resource cluster is less than the amount of resources required by the third task, the terminal sends task information of the third task to the server, so that the server adds the third task to the task set.
Step S605: and the server receives a third task sent by the terminal, wherein the third task is a task to be executed received by the terminal.
Step 606: the server adds the third task to the set of tasks based on the time of the third task.
And when the free resource amount of the target resource cluster is smaller than the resource amount required by the third task, adding the third task into the task set so that the server can allocate resources for the third task again in the subsequent polling service set.
In the embodiment of the application, when the terminal receives the third task, if the amount of the idle resources in the target resource set satisfies the amount of the resources required by the third task, the second target resource is allocated to the third task, so that when the idle resources satisfy the resources required by the third task, the terminal does not need to send task information of the third task to the server, the process of processing the third task is simplified, and the processing efficiency is improved.
Referring to fig. 8, a block diagram of a resource allocation apparatus according to an embodiment of the present application is shown. The resource allocation means may be implemented as all or part of the processor in software, hardware or a combination of both. The device includes:
a polling module 801, configured to poll a task set, where the task set includes a plurality of tasks that need to be executed based on a target resource cluster;
a first determining module 802 for determining a priority of a first task and an amount of resources required by the first task in response to polling the first task in the set of tasks;
a first allocating module 803, configured to allocate a first target resource in the target resource cluster to the first task based on the priority of the first task, the amount of resources required by the first task, and the amount of free resources of the target resource cluster.
In some embodiments, the first distribution module 803 includes:
a first allocating unit, configured to allocate a first target resource in the target resource cluster to the first task if the priority of the first task is greater than a preset threshold and the amount of the idle resource is not less than the amount of the resource required by the first task.
In some embodiments, the apparatus further comprises:
a fifth determining module, configured to determine priorities of other tasks in the task set if the priority of the first task is not greater than a preset threshold;
the first allocating module 803 is further configured to allocate a first target resource in the target resource cluster to the first task if there is no second task in the task set whose priority is greater than the preset threshold and the amount of the free resource is not less than the amount of the resource required by the first task.
In some embodiments, the apparatus further comprises:
the priority adjusting module is used for increasing the priority of the first task if a second task with the priority greater than the preset threshold exists in the task set;
and the updating module is used for updating the priority of the first task to the task set.
In some embodiments, the priority adjustment module is configured to increase the priority of the first task if the amount of the idle resources is less than the amount of the resources required by the first task and the priority of the first task is less than a preset threshold;
the updating module is used for updating the priority of the first task to the task set.
In some embodiments, the polling module 801 includes:
the acquisition unit is used for acquiring the adding time of a plurality of tasks in the task set;
and the polling unit is used for polling the task set based on the adding time of the plurality of tasks.
In some embodiments, the apparatus further comprises:
the receiving module is used for receiving a third task sent by the terminal, wherein the third task is a task to be executed and received by the terminal;
an adding module for adding the third task to the task set based on the time of the third task.
In the embodiment of the application, the task set is polled, and the first target resource in the target resource cluster is allocated to the first task by combining the priority of the first task and the resource amount required by the first task, so that in the process of executing a plurality of tasks in the task set based on the target resource cluster, the first target resource is timely allocated to the task with reasonable priority and required resource amount in a polling mode, the resource in the target resource cluster is prevented from being in an idle state, and the resource waste is prevented.
Referring to fig. 9, a block diagram of a resource allocation apparatus according to an embodiment of the present application is shown. The resource allocation means may be implemented as all or part of the processor in software, hardware or a combination of both. The device includes:
a second determining module 901, configured to determine, in response to receiving a third task, an amount of resources required by the third task;
a third determining module 902, configured to determine a total amount of resources required for at least one task that is not executed in the task set executed based on the target resource cluster;
a fourth determining module 903, configured to determine an amount of idle resources of the target resource cluster based on the total resource amount and the total resource amount of the target resource cluster;
a second allocating module 904, configured to allocate a second target resource in the target resource cluster to the third task if the amount of the idle resource of the target resource cluster is not less than the amount of the resource required by the third task.
In some embodiments, the apparatus further comprises:
a sending module, configured to send task information of the third task to a server if the amount of idle resources of the target resource cluster is less than the amount of resources required by the third task, where the server is configured to add the third task to the task set based on the task information of the third task.
In the embodiment of the application, when the terminal receives the third task, if the amount of the idle resources in the target resource set satisfies the amount of the resources required by the third task, the second target resource is allocated to the third task, so that when the idle resources satisfy the resources required by the third task, the terminal does not need to send task information of the third task to the server, the process of processing the third task is simplified, and the processing efficiency is improved.
Referring to fig. 10, a block diagram of a server 1000 according to an exemplary embodiment of the present application is shown. The server 1000 may generate large differences due to different configurations or performances, and may include one or more processors (CPUs) 1010 and one or more memories 1020, where the memory 1020 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1010 to implement the resource allocation methods provided by the above-mentioned method embodiments. Of course, the server 1000 may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the server 1000 may also include other components for implementing the functions of the device, which are not described herein again.
Referring to fig. 11, a block diagram of a terminal 1100 according to an exemplary embodiment of the present application is shown. In some embodiments, the terminal 1100 is an electronic device such as any one of a smartphone, a tablet, a notebook, an e-book reader, a multimedia player device, a wearable device, a PC (Personal Computer), and a smart appliance capable of wirelessly charging other devices. Terminal 1100 in the present application may include one or more of the following components: a processor 1110, a memory 1120.
In some embodiments, processor 1110 includes one or more processing cores. The processor 1110 interfaces with various interfaces and circuitry throughout the various portions of the terminal 1100, and performs various functions of the terminal 1100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1120, and invoking data stored in the memory 1120. Optionally, the processor 1110 is implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1110 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Neural-Network Processing Unit (NPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is responsible for rendering and drawing the content that the display screen 1130 needs to display; the NPU is used for realizing an Artificial Intelligence (AI) function; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1110, but may be implemented by one chip.
In some embodiments, Memory 1120 includes Random Access Memory (RAM), and may also include Read-Only Memory (Read-Only Memory). Optionally, the memory 1120 includes a non-transitory computer-readable medium. The memory 1120 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 1120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like; the storage data area may store data (such as audio data, a phonebook) created according to the use of the terminal 1100, and the like.
In some embodiments, terminal 1100 also includes a display screen. A display screen is a display component for displaying a user interface. Optionally, the display screen is a display screen with a touch function, and through the touch function, a user may perform touch operation on the display screen by using any suitable object such as a finger, a touch pen, and the like. The display screen is typically provided on the front panel of the terminal 1100. The display screen may be designed as a full-face screen, curved screen, odd-shaped screen, double-face screen, or folding screen. The display screen may also be designed as a combination of a full screen and a curved screen, a combination of a special screen and a curved screen, and the like, which is not limited in this embodiment.
In addition, those skilled in the art will appreciate that the configuration of terminal 1100 illustrated in the above-described figures does not constitute a limitation of terminal 1100, and that terminal 1100 may include more or less components than those illustrated, or some of the components may be combined, or a different arrangement of components. For example, the terminal 1100 further includes at least one of a microphone, a speaker, a radio frequency circuit, an input unit, a sensor, an audio circuit, a Wireless Fidelity (Wi-Fi) module, and a power supply, which are not described herein again.
It should be noted that, in the case where the device is provided as an external device, the external device may have a structure similar to that of the terminal 1100, and may include at least one or more of the following components: the device comprises a processor, a memory, a power management module and a Bluetooth module. The structure of the external device will not be described herein.
The embodiment of the present application further provides a computer-readable medium, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the resource allocation method shown in the above embodiments.
The embodiment of the present application further provides a computer program product, where the computer program product stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the resource allocation method shown in the above embodiments.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (13)

1. A method for resource allocation, the method comprising:
polling a task set, wherein the task set comprises a plurality of tasks which need to be executed based on a target resource cluster;
in response to polling a first task of the set of tasks, determining a priority of the first task and an amount of resources required by the first task;
allocating a first target resource in the target resource cluster for the first task based on the priority of the first task, the amount of resources required by the first task, and the amount of free resources of the target resource cluster.
2. The method of claim 1, wherein the allocating a first target resource of the target resource cluster for the first task based on the priority of the first task, the amount of resources required for the first task, and the amount of free resources of the target resource cluster comprises:
and if the priority of the first task is greater than a preset threshold value and the idle resource amount is not less than the resource amount required by the first task, allocating a first target resource in the target resource cluster to the first task.
3. The method of claim 2, further comprising:
if the priority of the first task is not greater than a preset threshold, determining the priorities of other tasks in the task set;
and if a second task with the priority greater than the preset threshold does not exist in the task set and the idle resource amount is not less than the resource amount required by the first task, allocating a first target resource in the target resource cluster to the first task.
4. The method of claim 3, further comprising:
if a second task with the priority greater than the preset threshold exists in the task set, the priority of the first task is improved;
and updating the priority of the first task to the task set.
5. The method of claim 1, wherein the allocating a first target resource of the target resource cluster for the first task based on the priority of the first task, the amount of resources required for the first task, and the amount of free resources of the target resource cluster comprises:
if the free resource amount is smaller than the resource amount required by the first task and the priority of the first task is smaller than a preset threshold value, improving the priority of the first task;
updating the priority of the first task to the set of tasks.
6. The method of claim 1, wherein polling the set of tasks comprises:
acquiring the adding time of a plurality of tasks in the task set;
polling the set of tasks based on the add times of the plurality of tasks.
7. The method of claim 6, further comprising:
receiving a third task sent by a terminal, wherein the third task is a task to be executed and received by the terminal;
adding the third task to the set of tasks based on a time of the third task.
8. A method for resource allocation, the method comprising:
in response to receiving a third task, determining an amount of resources required for the third task;
determining a total amount of resources required for at least one task not executed in the set of tasks executed based on the target resource cluster;
determining an amount of free resources of the target resource cluster based on the total amount of resources and the total amount of resources of the target resource cluster;
and if the idle resource amount of the target resource cluster is not less than the resource amount required by the third task, allocating a second target resource in the target resource cluster to the third task.
9. The method of claim 8, further comprising:
and if the free resource amount of the target resource cluster is less than the resource amount required by the third task, sending task information of the third task to a server, wherein the server is used for adding the third task to the task set based on the task information of the third task.
10. An apparatus for resource allocation, the apparatus comprising:
the polling module is used for polling a task set, and the task set comprises a plurality of tasks which need to be executed based on a target resource cluster;
a first determining module to determine a priority of a first task and an amount of resources required by the first task in response to polling the first task in the set of tasks;
a first allocating module, configured to allocate a first target resource in the target resource cluster to the first task based on the priority of the first task, the amount of the resource required by the first task, and the amount of the idle resource of the target resource cluster.
11. An apparatus for resource allocation, the apparatus comprising:
a second determining module, configured to determine, in response to receiving a third task, an amount of resources required by the third task;
a third determining module, configured to determine a total amount of resources required for at least one task that is not executed in the task set executed based on the target resource cluster;
a fourth determining module, configured to determine an amount of idle resources of the target resource cluster based on the total amount of resources and the total amount of resources of the target resource cluster;
and the second allocation module is used for allocating a second target resource in the target resource cluster to the third task if the free resource amount of the target resource cluster is not less than the resource amount required by the third task.
12. An electronic device, wherein the electronic device comprises a processor and a memory; the memory stores at least one program code for execution by the processor to implement the resource allocation method of any of claims 1 to 7; alternatively, the at least one program code is for execution by the processor to implement the resource allocation method of any of claims 8 to 9.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium stores at least one program code for execution by a processor to implement the resource allocation method of any one of claims 1 to 7; alternatively, the at least one program code for execution by a processor to perform the method of resource allocation of any of claims 8 to 9.
CN202210161267.3A 2022-02-22 2022-02-22 Resource allocation method, device, electronic equipment and storage medium Pending CN115017030A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210161267.3A CN115017030A (en) 2022-02-22 2022-02-22 Resource allocation method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210161267.3A CN115017030A (en) 2022-02-22 2022-02-22 Resource allocation method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115017030A true CN115017030A (en) 2022-09-06

Family

ID=83066979

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210161267.3A Pending CN115017030A (en) 2022-02-22 2022-02-22 Resource allocation method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115017030A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501506A (en) * 2023-06-27 2023-07-28 苏州仰思坪半导体有限公司 Resource polling arbitration method, device, medium and computing equipment
CN116701001A (en) * 2023-08-08 2023-09-05 国网浙江省电力有限公司信息通信分公司 Target task allocation method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501506A (en) * 2023-06-27 2023-07-28 苏州仰思坪半导体有限公司 Resource polling arbitration method, device, medium and computing equipment
CN116501506B (en) * 2023-06-27 2023-09-12 苏州仰思坪半导体有限公司 Resource polling arbitration method, device, medium and computing equipment
CN116701001A (en) * 2023-08-08 2023-09-05 国网浙江省电力有限公司信息通信分公司 Target task allocation method and device, electronic equipment and storage medium
CN116701001B (en) * 2023-08-08 2023-10-20 国网浙江省电力有限公司信息通信分公司 Target task allocation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108572833B (en) Automatic application updates
JP2021516395A (en) Resource configuration method, equipment, terminals, and storage media
CN110808922B (en) Message processing method and device, storage medium and electronic equipment
CN115017030A (en) Resource allocation method, device, electronic equipment and storage medium
EP3779690A1 (en) Processor core scheduling method and apparatus, terminal, and storage medium
CN111241051A (en) Batch data processing method and device, terminal equipment and storage medium
CN113285886B (en) Bandwidth allocation method and device, electronic equipment and readable storage medium
EP3525101A1 (en) Data backup method, apparatus, storage medium, and terminal
CN111338745A (en) Deployment method and device of virtual machine and intelligent equipment
CN114116092A (en) Cloud desktop system processing method, cloud desktop system control method and related equipment
CN111191162A (en) Data processing method and equipment
CN114253704A (en) Method and device for allocating resources
CN112286930A (en) Method, device, storage medium and electronic equipment for resource sharing of redis business side
CN114745338B (en) Flow control method, device, storage medium and server
CN114402313A (en) Label updating method and device, electronic equipment and storage medium
CN116450290A (en) Computer resource management method and device, cloud server and storage medium
CN111694670B (en) Resource allocation method, apparatus, device and computer readable medium
CN114675954A (en) Task scheduling method and device
CN113268414A (en) Distribution method and device of experimental versions, storage medium and computer equipment
CN112148448B (en) Resource allocation method, apparatus, device and computer readable medium
CN117891618B (en) Resource task processing method and device of artificial intelligent model training platform
CN110278331B (en) System attribute feedback method, device, terminal and storage medium
CN113568708B (en) Platform creation method, device and equipment
CN113835846B (en) Method and device for creating k8s cluster and computer-readable storage medium
CN113687870B (en) Terminal operation optimization method and device, storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination