CN111124644B - Method, device and system for determining task scheduling resources - Google Patents

Method, device and system for determining task scheduling resources Download PDF

Info

Publication number
CN111124644B
CN111124644B CN201911333419.8A CN201911333419A CN111124644B CN 111124644 B CN111124644 B CN 111124644B CN 201911333419 A CN201911333419 A CN 201911333419A CN 111124644 B CN111124644 B CN 111124644B
Authority
CN
China
Prior art keywords
task
time
scheduling
ordered array
time period
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.)
Active
Application number
CN201911333419.8A
Other languages
Chinese (zh)
Other versions
CN111124644A (en
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.)
Nanjing Kuangyun Technology Co ltd
Beijing Kuangshi Technology Co Ltd
Original Assignee
Nanjing Kuangyun Technology Co ltd
Beijing Kuangshi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Kuangyun Technology Co ltd, Beijing Kuangshi Technology Co Ltd filed Critical Nanjing Kuangyun Technology Co ltd
Priority to CN201911333419.8A priority Critical patent/CN111124644B/en
Publication of CN111124644A publication Critical patent/CN111124644A/en
Application granted granted Critical
Publication of CN111124644B publication Critical patent/CN111124644B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • 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

Abstract

The invention provides a method, a device and a system for determining task scheduling resources, which relate to the technical field of computers and comprise the following steps: acquiring an execution time period of a task; the task comprises a pre-creation task and an existing task which has time intersection with the pre-creation task; generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the execution time period of each task; determining a resource scheduling amount by comparing the start time in the first ordered array with the end time in the second ordered array; the resource scheduling amount is used for representing the maximum scheduling number of computational power resources in the execution time period of the task; and determining feasibility of scheduling computational resources in an execution time period corresponding to the pre-created task based on the resource scheduling amount. The method and the device can effectively determine the feasibility of the computational resource scheduling.

Description

Method, device and system for determining task scheduling resources
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and a system for determining task scheduling resources.
Background
In many computer-based production systems (e.g., a portrait system), server computing resources may be allocated for use by multiple tasks, and are fixed. When creating a task, it is necessary to ensure that the resources used cannot exceed the upper limit that the server can provide, to avoid potential performance crisis and operational conflicts. Based on the method, whether the new task can be continuously created or not can be determined by calculating the number of used resources before the task is pre-created or the task in the current period is scheduled to be executed. Since the pre-creation task requires immediate return of results, the efficiency of resource determination is very important.
The current determination method of the number of resources is mainly as follows: when a task is pre-created, whether the resources of the cross task in the time period of the newly-created task reach the upper limit is judged, if so, a plurality of time periods are divided according to the total execution time corresponding to the existing task, and then whether the number of the resources in each time period reaches the upper limit is judged. The resource determining method is complex and long in time consumption, and the determining efficiency is low.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, and a system for determining task scheduling resources, which can effectively improve the efficiency of determining feasibility of computing resource scheduling.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for determining task scheduling resources, where computing resources of a scheduling system are required when a task is executed, and the method includes: acquiring an execution time period of a task; the tasks comprise pre-creation tasks and existing tasks with time intersection with the pre-creation tasks; generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the execution time period of each task; tagging a resource allocation amount by comparing a start time in the first ordered array with an end time in the second ordered array; wherein the resource scheduling amount is used to characterize a maximum scheduled number of the computing resources within an execution time period of the task; and determining feasibility of scheduling the computational resources in the execution time period corresponding to the pre-created task based on the resource scheduling amount.
Further, the step of marking the resource scheduling amount by comparing the start time in the first ordered array with the end time in the second ordered array comprises: taking the starting time arranged at the head in the first ordered array and the ending time arranged at the head in the second ordered array as a current time pair; for each current time pair, the following operations are performed: comparing the size relation between the starting time and the ending time of the current time pair; if the starting time in the current time pair is less than the ending time, increasing the preset scheduling parameter of the computational power resource, and determining the larger value of the scheduling parameter after the increasing operation and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity; updating the starting time in the current time pair based on the arrangement sequence of the starting time in the first ordered array to obtain a new current time pair; if the starting time in the current time pair is not less than the ending time, reducing the scheduling parameter, and determining the larger value of the scheduling parameter after the reduction operation and the temporary maximum scheduling amount as a new temporary maximum scheduling amount; updating the end time in the current time pair based on the arrangement sequence of the end time in the second ordered array to obtain a new current time pair; when the first ordered array or the second ordered array is traversed, marking the temporary maximum scheduling amount as a resource scheduling amount; wherein the initial value of the scheduling parameter and the initial value of the temporary maximum scheduling amount are both 0.
Further, the step of updating the start times in the current time pair based on the arrangement order of the start times in the first ordered array to obtain a new current time pair includes: determining a target start time in the first ordered array based on an order of the start times in the first ordered array; wherein the target start time is a next start time adjacent to a start time in the current time pair; and combining the target starting time and the ending time in the current time pair into a new current time pair.
Further, the step of updating the end time in the current time pair based on the arrangement order of the end times in the second ordered array to obtain a new current time pair includes: determining a target end time in the second ordered array based on an order of arrangement of end times in the second ordered array; wherein the target end time is a next end time adjacent to an end time in the current time pair; and forming a new current time pair by the starting time in the current time pair and the target ending time.
Further, the step of determining feasibility of scheduling the computational resource in the execution time period corresponding to the pre-creation task based on the resource scheduling amount includes: judging whether the resource scheduling amount is less than or equal to a preset resource scheduling amount threshold value or not; if the number of the pre-created tasks is smaller than or equal to the number of the pre-created tasks, determining that the execution time period corresponding to the pre-created tasks is feasible, and establishing the pre-created tasks in the corresponding execution time period; if the execution time interval is larger than the preset execution time interval, determining that the execution time interval corresponding to the pre-created task is not feasible, and canceling the establishment of the pre-created task in the corresponding execution time interval.
Further, the step of obtaining the execution time period of the task includes: when the pre-created task comprises a plurality of different tasks, based on the execution time period of the existing task and the execution time period of the pre-created task, the existing task which has intersection with the execution time period of each pre-created task is obtained.
Further, the step of generating a first ordered array corresponding to the start time and a second ordered array corresponding to the end time based on the execution time period of each task includes: performing ascending sequencing on the starting time in the execution time period of each task to obtain a first ordered array; and sequencing the end time in the execution time period of each task in an ascending order to obtain a second ordered array.
Further, the method further comprises: when one task schedules a plurality of computing resources, the task is disassembled into a plurality of subtasks, and each subtask schedules one computing resource; and determining the execution time segment of the task as the execution time segment of each subtask.
In a second aspect, an embodiment of the present invention further provides a device for determining task scheduling resources, where the task needs to schedule computational resources of a system when executed, and the device includes: the time period acquisition module is used for acquiring the execution time period of the task; the task comprises a pre-creation task and an existing task which has time intersection with the pre-creation task; the time sequencing module is used for generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the execution time period of each task; a scheduling amount marking module for marking the amount of resource scheduling by comparing the start time in the first ordered array with the end time in the second ordered array; wherein the resource scheduling amount is used to characterize a maximum scheduled number of the computational resources over an execution time period of the task; and the resource determining module is used for determining the feasibility of scheduling the computational resources in the execution time period corresponding to the pre-created task based on the resource scheduling amount.
In a third aspect, an embodiment of the present invention provides a system for determining task scheduling resources, where the system includes: a processor and a storage device; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of any of the first aspects.
In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the method in any one of the above first aspect.
The embodiment of the invention provides a method, a device and a system for determining task scheduling resources, wherein computational resources of the system need to be scheduled during task execution, and based on the method, a first ordered array corresponding to start time and a second ordered array corresponding to end time are generated based on acquired execution time periods of various tasks; then marking the resource scheduling amount by comparing the start time in the first ordered array with the end time in the second ordered array; and finally, determining feasibility of scheduling computational resources in the execution time period corresponding to the pre-created task based on the resource scheduling amount. Compared with the mode that time periods need to be divided firstly and then the number of occupied resources is compared for each time period respectively in the prior art, the resource scheduling amount representing the maximum scheduling number of resources can be determined only by comparing the starting time with the ending time based on the first ordered array and the second ordered array.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the above-described technology of the disclosure.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for determining task scheduling resources according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a task execution time period provided by an embodiment of the invention;
FIG. 4 is a schematic diagram illustrating a staggered comparison of time pairs provided by an embodiment of the present invention;
fig. 5 is a schematic view illustrating an application scenario of a method for determining task scheduling resources according to an embodiment of the present invention;
fig. 6 shows a block diagram of a determining apparatus for task scheduling resources according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Considering that the existing resource determining method creates a new task and the number of intersection tasks in the total time period of the new task is greater than the upper limit of the number of tasks, the total time period of the new task needs to be divided into a plurality of time periods according to the starting time and the ending time of the existing task, and then the feasibility of resource scheduling needs to be respectively judged for each time period. The determination method is quite complex and takes a long time, so that the judgment efficiency of the resource feasibility is low. Based on this, in order to solve the above problems, embodiments of the present invention provide a method, an apparatus, and a system for determining task scheduling resources, which can effectively improve the determination efficiency for the feasibility of computing resource scheduling. The technology can be applied to any scene needing resource allocation, such as a portrait system, a vehicle detection system or a conference management system, and for understanding, the following detailed description of the embodiments of the present invention is provided.
The first embodiment is as follows:
first, an example electronic device 100 for implementing the method, apparatus and system for determining task scheduling resources according to the embodiment of the present invention is described with reference to fig. 1.
As shown in fig. 1, an electronic device 100 includes one or more processors 102, one or more memory devices 104, an input device 106, an output device 108, and an image capture device 110, which are interconnected via a bus system 112 and/or other type of connection mechanism (not shown). It should be noted that the components and structure of the electronic device 100 shown in fig. 1 are only exemplary and not limiting, and the electronic device may have some of the components shown in fig. 1 and may also have other components and structures not shown in fig. 1, as desired.
The processor 102 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 100 to perform desired functions.
The storage 104 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, etc. On which one or more computer program instructions may be stored that may be executed by processor 102 to implement client-side functionality (implemented by the processor) and/or other desired functionality in embodiments of the invention described below. Various applications and various data, such as various data used and/or generated by the applications, may also be stored in the computer-readable storage medium.
The input device 106 may be a device used by a user to input instructions and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.
The output device 108 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, and the like.
The image capture device 110 may take images (e.g., photographs, videos, etc.) desired by the user and store the taken images in the storage device 104 for use by other components.
Exemplary electronic devices for implementing the method, apparatus and system for determining task scheduling resources according to the embodiments of the present invention may be implemented as smart terminals, such as smart phones, tablet computers, servers and the like.
Example two:
in the computer field, a task needs to schedule computational resources of a system when being executed (for convenience of description, computational resources may also be simply referred to as resources). When a user needs to create a new task, in order to determine whether the current server computing resources can meet the creation of the new task, the embodiment provides a method for determining task scheduling resources. Referring to a flowchart of a method for determining task scheduling resources shown in fig. 2, the method may include the following steps S202 to S208:
step S202, acquiring the execution time period of the task; the tasks comprise pre-creation tasks and existing tasks with time intersection with the pre-creation tasks. In practical applications, the task may be, for example, an image analysis task of multiple cameras in a portrait system, and execution time periods corresponding to the image analysis tasks of the multiple cameras may overlap, so when creating a new task, it is necessary to ensure that resources scheduled by the new task and an existing task do not exceed an upper limit of resources that can be provided by a server, so as to avoid potential performance crisis and operation conflicts.
In this embodiment, the size of a single computational resource may be predefined, such as defining one computational resource to occupy one CPU, two servers, or one conference room. When one task schedules a plurality of computing resources, the task can be disassembled into a plurality of subtasks, each subtask schedules one computing resource, and the execution time segment of the task is determined as the execution time segment of each subtask. That is, for a task a with an execution time period of (S0, T0) and scheduling x computational resources, the task a is divided into x subtasks a scheduling one computational resource 1 、a 2 …a x The execution time period of each subtask is (S0, T0). It can be understood that the number of subtasks is the same as the number of resources scheduled by task a, and the total number of scheduled computational resources remains the same before and after task disassembly. Based on this, by the above-mentioned disassembling of the task scheduling a plurality of computing resources, the number of the execution time periods of the task is the same as the number of the task scheduling resources, which is beneficial to simplifying the calculation of the number of the resources scheduled by the task, thereby improving the determination efficiency for the resource scheduling feasibility.
Step S204, a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time are generated based on the execution time period of each task.
The execution period is typically a period of time determined by a start time and an end time; based on this, the first ordered array in this embodiment may be an array in which the start time is sorted from small to large, and the second ordered array may be an array in which the end time is sorted from small to large.
Step S206, marking the resource scheduling amount by comparing the starting time in the first ordered array with the ending time in the second ordered array; wherein the resource scheduling amount is used to characterize a maximum scheduled number of computational resources within an execution time period of the task.
It is understood that there are multiple start times in the first ordered array and multiple end times in the second ordered array, one start time and one end time are compared each time, and a new resource scheduling amount can be determined each time of comparison; and when the comparison between the first ordered array and the second ordered array is finished, obtaining the final resource scheduling amount.
Step S208, based on the resource scheduling amount, determining feasibility of scheduling computing resources in the execution time period corresponding to the pre-created task.
In this embodiment, the determined resource scheduling amount may be compared with a preset resource scheduling amount threshold, and feasibility of scheduling the computational resource in the execution time period corresponding to the pre-created task may be determined according to the comparison result. If the task is determined to be feasible, the current computational resource can support the creation of a new task; if it is determined to be infeasible, it indicates that the current computational resource is not sufficient for the creation of the new task. The resource scheduling amount threshold is preset according to the server computing resources in actual production.
It can be further understood that the present embodiment is directed to a case where the total amount of resources scheduled by all existing tasks is greater than or equal to the threshold value of the resource scheduling amount, otherwise, a new task may be created directly.
The method for determining the task scheduling resources provided by the embodiment of the invention comprises the steps of firstly generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the acquired execution time period of each task; then, marking the resource scheduling amount by comparing the starting time in the first ordered array with the ending time in the second ordered array; and finally, determining feasibility of scheduling computational resources in the execution time period corresponding to the pre-created task based on the resource scheduling amount. Compared with the mode that time periods need to be divided firstly and then the number of occupied resources is compared for each time period respectively in the prior art, the resource scheduling amount representing the maximum scheduling number of resources can be determined only by comparing the starting time with the ending time based on the first ordered array and the second ordered array, the comparison times are obviously reduced by the mode, and therefore the determination efficiency for the feasibility of computing power resource scheduling is effectively improved.
The present embodiment is described with respect to the manner of acquiring the execution time period of the task in step S202, and the following three examples can be referred to.
Example one: when the pre-created task is a task and the task needs to schedule a resource, first, a first time period (S0, T0) corresponding to the pre-created task is obtained, wherein S0 and T0 respectively represent the starting time and the ending time of the first time period. And then, based on the execution time period of the existing task and the first time period (S0, T0), acquiring the existing task with intersection with the first time period (S0, T0). And finally, acquiring a second time period corresponding to the existing tasks with intersection, wherein the second time period of each existing task can be (S1, T1), (S2, T2), \8230; (Sn, tn). Based on this, { (S0, T0), (S1, T1), (S2, T2), \8230; (Sn, tn) } collectively constitute an execution time period of the task.
Example two: when the pre-created task is a task needing to schedule a plurality of resources or the pre-created task is a plurality of same tasks, firstly, a plurality of first time periods corresponding to the pre-created task are obtained, and each first time period is (S0, T0); then, based on the execution time period of the existing task and the first time period, the existing task which has intersection with the first time period is obtained; and finally, acquiring a second time period corresponding to the existing tasks with the intersection. Referring to the first example, the execution time period of the task in this embodiment may be represented as: { (S0, T0), \8230 { (S0, T0), (S1, T1), (S2, T2), \8230 { (Sn, tn) }.
Example three: when the pre-created tasks are a plurality of different tasks, the existing tasks with intersection with the execution time period of each pre-created task are obtained based on the execution time period of the existing tasks and the execution time period of the pre-created tasks. Referring to the above two examples, the execution period of the pre-created task in this example may be represented as:
Figure BDA0002327097530000101
wherein k representsThe number of tasks of the pre-created task. In this case, the execution period of the task may be expressed as:
Figure BDA0002327097530000102
according to the execution time period given by the above example, the present embodiment provides a method for generating an ordered array, which may include: the starting time in the execution time period of each task is sorted in an ascending order to obtain a first ordered array; and sequencing the ending time in the execution time period of each task in an ascending way to obtain a second ordered array.
Referring to the schematic diagram of the execution period of the task as shown in fig. 3, the following execution periods are exemplarily illustrated: (S0, T0), (S1, T1), (S2, T2), (S3, T3) and (S4, T4). Based on this, the first ordered array is: { (S1) 1 ,(S0) 2 ,(S2) 3 ,(S3) 4 ,(S4) 5 And in order to easily determine the position indicated by the first cursor, the value of the first cursor can be set to increase along with the increase of the arrangement sequence of the start time. Accordingly, the second ordered array is: { (T2) 1 ,(T1) 2 ,(T4) 3 ,(T0) 4 ,(T3) 5 And in order to easily determine the position indicated by the second cursor, the value of the second cursor can be set to increase with the increase of the arrangement order of the end times.
Based on the first ordered array and the second ordered array, a possible embodiment of marking the resource scheduling amount by comparing the start time and the end time in a staggered manner is provided, referring to the following steps one to three:
and step one, taking the starting time arranged at the head in the first ordered array and the ending time arranged at the head in the second ordered array as a current time pair. For each current time pair, the following operations are performed as shown in step two:
step two, comparing the size relation between the starting time and the ending time of the current time pair; according to the comparison result, the following step (1) or step (2) is performed.
(1) If the starting time in the current time pair is less than the ending time, performing increasing operation on a preset scheduling parameter of the computing power resource, wherein the increasing operation can be represented as C' = C +1; wherein, C' represents the corresponding scheduling parameter of the current time pair, namely the scheduling parameter after the operation is added; and C is the scheduling parameter corresponding to the last time pair. Determining the larger value of the scheduling parameter C' after the operation is added and the temporary maximum scheduling amount as a new temporary maximum scheduling amount; the new temporary maximum amount of scheduling may be expressed as: c' max =max(C′,C max ) (ii) a Wherein, C' max Representing a new temporary maximum measure, i.e. the current time versus the corresponding temporary maximum measure, C max Representing the amount of temporary maximum modulation corresponding to the last time. It is understood that the initial value of the scheduling parameter and the initial value of the temporary maximum scheduling amount in the present embodiment are both 0.
And updating the starting time in the current time pair based on the arrangement sequence of the starting times in the first ordered array to obtain a new current time pair. In particular implementation, the target start time may be first determined in the first ordered array based on the order of the start times in the first ordered array; wherein, the target start time is the next start time adjacent to the start time in the current time pair, and the position of the target start time can be represented by the value of the first cursor i; for example, if the position of the start time in the current time pair in the first ordered array is i, the position of the target start time in the first ordered array is i' = i +1. The target start time and the end time of the current time pair are then grouped into a new current time pair.
(2) If the starting time in the current time pair is not less than the ending time, the scheduling parameter is reduced, and the reduction operation can be represented as C' = C-1. And determining the larger value of the scheduling parameter after the reduction operation and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity.
And updating the ending time in the current time pair based on the arrangement sequence of the ending time in the second ordered array to obtain a new current time pair. In particular implementation, the target end time may be first determined in the second ordered array based on the order of the end times in the second ordered array; the target end time is the next end time adjacent to the end time in the current time pair, and the position of the target end time can be represented by the numerical value of the second cursor j; for example, if the position of the end time in the current time pair in the second ordered array is j, then the position of the target end time in the second ordered array is j' = j +1. The start time in the current time pair and the target end time are then combined into a new current time pair.
The above steps (1) and (2) can be understood as that, for any time pair, if the starting time is less than the ending time, the first vernier i is added by 1, and the second vernier j is unchanged to determine the next time pair; if the start time is not less than the end time, the first cursor i is unchanged and the second cursor j is incremented by 1 to determine the next time pair.
For the convenience of understanding, the current time pair composed of the start time arranged at the head and the end time arranged at the head in the above step one is described as an example. It is easy to think that the start time arranged at the head is necessarily smaller than the end time arranged at the head, in which case the second time pair is determined by adding 1 to the first cursor i, while the second cursor j is unchanged, i.e. the second time pair is the start time arranged at the second bit and the end time arranged at the head.
And step three, marking the temporary maximum scheduling amount as the resource scheduling amount when the first ordered array or the second ordered array is traversed.
To facilitate understanding of the above steps one to three, a schematic diagram of a staggered comparison manner of time pairs shown in fig. 4 is given according to an example of the execution time period provided in fig. 3, and referring to fig. 4, the present embodiment provides a specific determination example of the resource scheduling amount. In this example, the initial value of the scheduling parameter and the initial value of the temporary maximum scheduling amount are both 0, and the initial value of the first vernier and the initial value of the second vernier are both 1.
As can be seen from the first cursor and the second cursor, the time pair at which the comparison starts is (S1, T2), and for the current time pair (S1, T2), S1 < T2, C '= C +1=0+1=1,c = C' max =max(C′,C max ) = max (1, 0) =1, i '= i +1=1+1, j' = j =1; the next time pair thus determined is (S0, T2);
for the current time pair (S0, T2), S0 < T2, then C '= C +1=1+1=2,C' max =max(C′,C max ) = max (2, 1) =2, i '= i +1=2+1, j' = j =1; the next time pair thus determined is (S2, T2);
for the current time pair (S2, T2), S2 < T2, then C '= C +1=2+1=3,C' max =max(C′,C max ) Max (3,2) =3,i '= i +1=3+1,j' = j =1; the next time pair thus determined is (S3, T2);
for the current time pair (S3, T2), S3 > T2, then C '= C-1=3-1=2,c' max =max(C′,C max ) = max (2, 3) =3, i '= i =4, j' = j +1=1+1; the next time pair thus determined is (S3, T1);
for the current time pair (S3, T1), S3 > T1, then C '= C-1=2-1=1, C' max =max(C′,C max ) = max (1, 3) =3, i '= i =4, j' = j +1=2+1; the next time pair thus determined is (S3, T4);
for the current time pair (S3, T4), S3 < T4, then C '= C +1=1+1=2,C' max =max(C′,C max ) Max (2,3) =3,i '= i +1=4+1,j' = j =3; the next time pair thus determined is (S4, T4);
for the current time pair (S4, T4), S4 < T4, then C '= C +1=2+1=3,C' max =max(C′,C max ) Max (3,3) =3,i '= i +1=5+1,j' = j =3; at this point, the start time in the first ordered array has completedTraversing, and measuring the finally determined temporary maximum modulation amount C' max =3 as the resource scheduling amount.
After traversing the first ordered array or the second ordered array to finally determine the resource scheduling amount, determining feasibility of scheduling computational resources in an execution time period corresponding to the pre-created task based on the resource scheduling amount, wherein the step comprises the following steps: judging resource modulation amount C' max Whether the resource scheduling amount is less than or equal to a preset resource scheduling amount threshold value M; if the calculation capacity resource is smaller than or equal to the preset calculation capacity resource, determining that the calculation capacity resource is feasible to be scheduled in the execution time period corresponding to the preset task, and establishing the preset task in the corresponding execution time period; if the number of the computing resources is larger than the preset number, determining that the computing resources are not feasible to be scheduled in the execution time period corresponding to the pre-created task, and canceling the pre-created task from being established in the corresponding execution time period.
In summary, compared with the manner that time periods need to be divided first and then the number of occupied resources is compared for each time period in the prior art, the resource scheduling amount representing the number of tasks can be determined only by comparing the start time and the end time based on the first ordered array and the second ordered array, and the manner obviously reduces the comparison times, thereby effectively improving the determination efficiency for the feasibility of computing power resource scheduling.
Further, in practical production applications, the method for determining task scheduling resources described in the foregoing embodiments may be packaged as a common method or a computing service interface. Referring to fig. 5, taking a computing service interface as an example, the incoming parameters include an execution time period of a task, and the feasibility of scheduling computing resources in the execution time period corresponding to a pre-created task may be directly determined through the computing service interface encapsulated with the determination method of task scheduling resources. The method is convenient for practical production application, and can effectively improve the determination efficiency of feasibility of computing resource scheduling.
Example three:
referring to fig. 6, a block diagram of a device for determining task scheduling resources, where a task needs to schedule computational resources of a system when executing the task, includes:
a time period obtaining module 602, configured to obtain an execution time period of a task; the tasks comprise pre-created tasks and existing tasks with time intersection with the pre-created tasks;
a time sorting module 604, configured to generate a first ordered array corresponding to the start time and a second ordered array corresponding to the end time based on the execution time period of each task;
a scheduling amount marking module 606 for marking the resource scheduling amount by comparing the start time in the first ordered array with the end time in the second ordered array; the resource scheduling amount is used for representing the maximum scheduling number of computational power resources in the execution time period of the task;
a resource determining module 608, configured to determine feasibility of scheduling computing resources in an execution time period corresponding to the pre-created task based on the resource scheduling amount.
The device for determining the task scheduling resources provided by the embodiment of the invention firstly generates a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the acquired execution time period of each task; then, determining the resource scheduling amount by comparing the starting time in the first ordered array with the ending time in the second ordered array; and finally, determining feasibility of scheduling computational resources in an execution time period corresponding to the pre-created task based on the resource scheduling amount. Compared with the mode that time periods need to be divided firstly and then the number of occupied resources is compared for each time period respectively in the prior art, the resource scheduling amount representing the maximum scheduling number of resources can be determined only by comparing the starting time with the ending time based on the first ordered array and the second ordered array.
In some embodiments, the schedule marking module 606 is further configured to: taking the starting time arranged at the head in the first ordered array and the ending time arranged at the head in the second ordered array as a current time pair; for each current time pair, the following operations are performed: comparing the size relation between the starting time and the ending time of the current time pair; if the starting time in the current time pair is less than the ending time, increasing the preset scheduling parameter of the computational power resource, and determining the larger value of the scheduling parameter after the increasing operation and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity; updating the starting time in the current time pair based on the arrangement sequence of the starting time in the first ordered array to obtain a new current time pair; if the starting time in the current time pair is not less than the ending time, reducing the scheduling parameter, and determining the larger value of the reduced scheduling parameter and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity; updating the end time in the current time pair based on the arrangement sequence of the end time in the second ordered array to obtain a new current time pair; when the first ordered array or the second ordered array is traversed, taking the temporary maximum scheduling amount as a resource scheduling amount; wherein, the initial value of the scheduling parameter and the initial value of the temporary maximum scheduling quantity are both 0.
In some embodiments, the schedule marking module 606 is further configured to: determining a target start time in the first ordered array based on the order of the start times in the first ordered array; wherein the target start time is the next start time adjacent to the start time in the current time pair; and forming a new current time pair by the target starting time and the ending time in the current time pair.
In some embodiments, the schedule marking module 606 is further configured to: determining a target end time in the second ordered array based on the order of the end times in the second ordered array; wherein the target end time is the next end time adjacent to the end time in the current time pair; and forming a new current time pair by the starting time in the current time pair and the target ending time.
In some embodiments, the resource determination module 608 is further configured to: judging whether the resource scheduling amount is less than or equal to a preset resource scheduling amount threshold value or not; if the calculation capacity resource is smaller than or equal to the preset calculation capacity resource, determining that the calculation capacity resource is feasible to be scheduled in the execution time period corresponding to the preset task, and establishing the preset task in the corresponding execution time period; if the number of the computing resources is larger than the preset number, determining that the computing resources are not feasible to be scheduled in the execution time period corresponding to the pre-created task, and canceling the pre-created task from being established in the corresponding execution time period.
In some embodiments, the time period acquisition module 602 is further configured to: when the pre-created tasks include a plurality of different tasks, the existing tasks with intersection with the execution time period of each pre-created task are acquired based on the execution time periods of the existing tasks and the execution time periods of the pre-created tasks.
In some implementations, the time ordering module 604 is further to: carrying out ascending sequencing on the starting time in the execution time period of each task to obtain a first ordered array; and sequencing the end time in the execution time period of each task in an ascending order to obtain a second ordered array.
The device provided in this embodiment has the same implementation principle and technical effects as those of the foregoing embodiment, and for the sake of brief description, reference may be made to corresponding contents in the foregoing embodiment.
Example four:
based on the foregoing embodiments, this embodiment provides a system for determining task scheduling resources, where the system includes: a processor and a storage device; the storage device stores a computer program, and the computer program, when executed by the processor, executes any one of the determination methods for task scheduling resources provided in embodiment two.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
Further, the present embodiment also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processing device to perform the steps of any one of the methods provided in the second embodiment, or the computer program is executed by the processing device to perform the steps of any one of the methods provided in the third embodiment.
The method, the apparatus, and the computer program product of the system for determining task scheduling resources provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
The functions may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (11)

1. A method for determining task scheduling resources, wherein the task requires computational resources of a scheduling system when executed, the method comprising:
acquiring an execution time period of a task; the task comprises a pre-creation task and an existing task which has time intersection with the pre-creation task;
generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the execution time period of each task;
tagging a resource allocation amount by comparing a start time in the first ordered array with an end time in the second ordered array; wherein the resource scheduling amount is used to characterize a maximum scheduled number of the computing resources within an execution time period of the task;
determining feasibility of scheduling the computational power resource in an execution time period corresponding to the pre-creation task based on the resource scheduling amount;
wherein marking the resource scheduling amount by comparing the start time in the first ordered array with the end time in the second ordered array comprises:
updating a temporary maximum scheduling amount based on the size relation between the starting time and the ending time, and marking the resource scheduling amount based on the temporary maximum scheduling amount, wherein the initial value of the temporary maximum scheduling amount is 0.
2. The method according to claim 1, wherein the step of updating the temporary maximum scheduling amount based on the size relationship between the start time and the end time and marking the resource scheduling amount based on the temporary maximum scheduling amount comprises:
taking the starting time arranged at the head in the first ordered array and the ending time arranged at the head in the second ordered array as a current time pair;
for each current time pair, the following operations are performed:
comparing the size relation between the starting time and the ending time of the current time pair;
if the starting time in the current time pair is less than the ending time, increasing the preset scheduling parameter of the computational power resource, and determining the larger value of the scheduling parameter after the increasing operation and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity; updating the starting time in the current time pair based on the arrangement sequence of the starting time in the first ordered array to obtain a new current time pair;
if the starting time in the current time pair is not less than the ending time, reducing the scheduling parameter, and determining the larger value of the reduced scheduling parameter and the temporary maximum scheduling quantity as a new temporary maximum scheduling quantity; updating the end time in the current time pair based on the arrangement sequence of the end time in the second ordered array to obtain a new current time pair;
when the first ordered array or the second ordered array is traversed, marking the temporary maximum scheduling amount as a resource scheduling amount;
wherein the initial value of the scheduling parameter is 0.
3. The method of claim 2, wherein the step of updating the start times in the current time pair based on the rank order of the start times in the first ordered array to obtain a new current time pair comprises:
determining a target start time in the first ordered array based on an order of the start times in the first ordered array; wherein the target start time is a next start time adjacent to a start time in the current time pair;
and forming a new current time pair by the target starting time and the end time in the current time pair.
4. The method of claim 2, wherein the step of updating the ending time in the current time pair based on the ranking order of the ending times in the second ordered array to obtain a new current time pair comprises:
determining a target end time in the second ordered array based on an order of arrangement of end times in the second ordered array; wherein the target end time is a next end time adjacent to an end time in the current time pair;
and forming a new current time pair by the starting time in the current time pair and the target ending time.
5. The method of claim 1, wherein the step of determining feasibility of scheduling the computing resource for the execution time period corresponding to the pre-created task based on the resource scheduling amount comprises:
judging whether the resource scheduling amount is less than or equal to a preset resource scheduling amount threshold value or not;
if the calculation capacity resource is smaller than or equal to the preset calculation capacity resource, determining that the calculation capacity resource is feasible to be scheduled in the execution time period corresponding to the preset creation task, and establishing the preset creation task in the corresponding execution time period;
if the number of the computing resources is larger than the preset threshold, determining that the computing resources are not feasible to be scheduled in the execution time period corresponding to the pre-created task, and canceling to establish the pre-created task in the corresponding execution time period.
6. The method of claim 1, wherein the step of obtaining a time period for execution of the task comprises:
when the pre-created task comprises a plurality of different tasks, based on the execution time period of the existing task and the execution time period of the pre-created task, the existing task which has intersection with the execution time period of each pre-created task is obtained.
7. The method of claim 1, wherein the step of generating a first ordered array corresponding to a start time and a second ordered array corresponding to an end time based on the execution time period of each of the tasks comprises:
performing ascending sequencing on the starting time in the execution time period of each task to obtain a first ordered array;
and sequencing the end time in the execution time period of each task in an ascending order to obtain a second ordered array.
8. The method of claim 1, further comprising:
when one task schedules a plurality of computing resources, the task is disassembled into a plurality of subtasks, and each subtask schedules one computing resource;
and determining the execution time period of the task as the execution time period of each subtask.
9. An apparatus for determining scheduling resources for a task, wherein the task requires computational resources of a scheduling system when executed, the apparatus comprising:
the time period acquisition module is used for acquiring the execution time period of the task; the task comprises a pre-creation task and an existing task which has time intersection with the pre-creation task;
the time sorting module is used for generating a first ordered array corresponding to the starting time and a second ordered array corresponding to the ending time based on the execution time period of each task;
a scheduling amount marking module for marking the amount of resource scheduling by comparing the start time in the first ordered array with the end time in the second ordered array; wherein the resource scheduling amount is used to characterize a maximum scheduled number of the computing resources within an execution time period of the task;
a resource determining module, configured to determine feasibility of scheduling the computational resource in an execution time period corresponding to the pre-creation task based on the resource scheduling amount;
wherein the adjustment quantity marking module is further configured to: updating a temporary maximum scheduling amount based on the size relation between the starting time and the ending time, and marking the resource scheduling amount based on the temporary maximum scheduling amount, wherein the initial value of the temporary maximum scheduling amount is 0.
10. A system for determining task scheduling resources, the system comprising: a processor and a storage device;
the storage device has stored thereon a computer program which, when executed by the processor, performs the method of any one of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of the preceding claims 1 to 8.
CN201911333419.8A 2019-12-19 2019-12-19 Method, device and system for determining task scheduling resources Active CN111124644B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911333419.8A CN111124644B (en) 2019-12-19 2019-12-19 Method, device and system for determining task scheduling resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911333419.8A CN111124644B (en) 2019-12-19 2019-12-19 Method, device and system for determining task scheduling resources

Publications (2)

Publication Number Publication Date
CN111124644A CN111124644A (en) 2020-05-08
CN111124644B true CN111124644B (en) 2023-04-04

Family

ID=70500966

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911333419.8A Active CN111124644B (en) 2019-12-19 2019-12-19 Method, device and system for determining task scheduling resources

Country Status (1)

Country Link
CN (1) CN111124644B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111869303B (en) * 2020-06-03 2023-10-17 北京小米移动软件有限公司 Resource scheduling method, device, communication equipment and storage medium
CN112203057B (en) * 2020-10-10 2022-06-03 重庆紫光华山智安科技有限公司 Analysis task creating method, device, server and computer-readable storage medium
CN112053099B (en) * 2020-10-14 2023-11-17 国网北京市电力公司 Road lamp construction resource scheduling method, system, storage medium and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017166643A1 (en) * 2016-03-31 2017-10-05 乐视控股(北京)有限公司 Method and device for quantifying task resources
CN107291548A (en) * 2016-03-31 2017-10-24 阿里巴巴集团控股有限公司 The resource regulating method and device of task
CN107656813A (en) * 2017-09-29 2018-02-02 上海联影医疗科技有限公司 The method, apparatus and terminal of a kind of load dispatch
CN109710407A (en) * 2018-12-21 2019-05-03 浪潮电子信息产业股份有限公司 Distributed system real-time task scheduling method, device, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10802880B2 (en) * 2017-09-19 2020-10-13 Huawei Technologies Co., Ltd. System and method for distributed resource requirement and allocation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017166643A1 (en) * 2016-03-31 2017-10-05 乐视控股(北京)有限公司 Method and device for quantifying task resources
CN107291548A (en) * 2016-03-31 2017-10-24 阿里巴巴集团控股有限公司 The resource regulating method and device of task
CN107656813A (en) * 2017-09-29 2018-02-02 上海联影医疗科技有限公司 The method, apparatus and terminal of a kind of load dispatch
CN109710407A (en) * 2018-12-21 2019-05-03 浪潮电子信息产业股份有限公司 Distributed system real-time task scheduling method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111124644A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN110390387B (en) Assessment of resources used by deep learning applications
JP6983154B2 (en) Processing graphs
CN111124644B (en) Method, device and system for determining task scheduling resources
Das et al. Performance optimization for edge-cloud serverless platforms via dynamic task placement
US10783002B1 (en) Cost determination of a service call
JP2018533795A (en) Stream based accelerator processing of calculation graph
WO2017166643A1 (en) Method and device for quantifying task resources
JP2022511716A (en) Decentralized deep learning
Salehi et al. Stochastic-based robust dynamic resource allocation for independent tasks in a heterogeneous computing system
WO2020082611A1 (en) Method for carrying out deep learning on basis of blockchain platform and electronic device
US10680975B2 (en) Method of dynamic resource allocation for public clouds
US20150277980A1 (en) Using predictive optimization to facilitate distributed computation in a multi-tenant system
CN111221643A (en) Task processing method and task processing device
CN111143039B (en) Scheduling method and device of virtual machine and computer storage medium
Deng et al. A data and task co-scheduling algorithm for scientific cloud workflows
EP4060496A2 (en) Method, apparatus, device and storage medium for running inference service platform
CN110781180A (en) Data screening method and data screening device
CN115586961A (en) AI platform computing resource task scheduling method, device and medium
CN116737370A (en) Multi-resource scheduling method, system, storage medium and terminal
CN115729687A (en) Task scheduling method and device, computer equipment and storage medium
JP2015108877A (en) Prediction time distribution generation device, control method, and program
CN116032928B (en) Data collaborative computing method, device, system, electronic device and storage medium
US11797353B2 (en) Method and system for performing workloads in a data cluster
WO2021128079A1 (en) Data processing method, image recognition method, processing server, system, and electronic device
Hung et al. A thin-thick client collaboration for optimizing task scheduling in mobile cloud computing

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
GR01 Patent grant
GR01 Patent grant
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20230323

Address after: No. 1268, 1f, building 12, neijian Middle Road, Xisanqi building materials City, Haidian District, Beijing 100096

Applicant after: BEIJING KUANGSHI TECHNOLOGY Co.,Ltd.

Applicant after: NANJING KUANGYUN TECHNOLOGY Co.,Ltd.

Address before: 100080 room 1018, 10th floor, 1 Zhongguancun Street, Haidian District, Beijing

Applicant before: BEIJING KUANGSHI TECHNOLOGY Co.,Ltd.