CN113760488A - Method, device, equipment and computer readable medium for scheduling task - Google Patents
Method, device, equipment and computer readable medium for scheduling task Download PDFInfo
- Publication number
- CN113760488A CN113760488A CN202010884944.5A CN202010884944A CN113760488A CN 113760488 A CN113760488 A CN 113760488A CN 202010884944 A CN202010884944 A CN 202010884944A CN 113760488 A CN113760488 A CN 113760488A
- Authority
- CN
- China
- Prior art keywords
- tasks
- task
- depended
- dependent
- execution list
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000001419 dependent effect Effects 0.000 claims abstract description 97
- 238000004590 computer program Methods 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 15
- 230000008569 process Effects 0.000 description 11
- 238000012545 processing Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method, a device, equipment and a computer readable medium for scheduling tasks, and relates to the technical field of computers. One embodiment of the method comprises: analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the depended tasks; and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed. The embodiment can improve the efficiency of scheduling tasks.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable medium for scheduling tasks.
Background
A Directed Acyclic Graph (DAG) is adopted, the scheduling purpose is to divide a job into different stages, enter the stages, divide the stages into tasks capable of being calculated in parallel, and finally deliver all the tasks in one stage to a task scheduler for ending.
The starting point of the task is always a root node, and if the task comprises a plurality of starting points, the task needs to be split into a plurality of DAG graph arrangement schedules.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: in the process of executing tasks by using DAG, the efficiency of scheduling the tasks is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a computer readable medium for scheduling a task, which can improve efficiency of scheduling the task.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of scheduling a task, including:
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks;
selecting tasks for execution from the task execution list according to the number of the depended tasks;
and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed.
The analyzing the dependency relationship between the tasks according to the adjacent tasks in the directed acyclic graph, and establishing the task execution list comprises the following steps:
acquiring a task, a dependent task of the task and a depended task of the task according to adjacent tasks in a directed acyclic graph;
and establishing the task execution list according to the task, the dependent task of the task and the depended task of the task.
The learning of the task and the dependent task of the task according to the adjacent tasks in the directed acyclic graph comprises the following steps:
establishing a dependent task set and a depended task set according to adjacent tasks in the directed acyclic graph,
the dependent task set includes dependent task key-value pairs, the dependent task keys including tasks, the dependent task values including dependent tasks of the tasks,
the depended task set comprises depended task key value pairs, the depended task keys comprise tasks, and the depended task values comprise depended tasks of the tasks;
the establishing of the task execution list according to the task, the dependent task of the task and the depended task of the task comprises the following steps:
and establishing the task execution list according to the dependent task key-value pairs and the depended task key-value pairs.
The task execution list comprises key-value pairs;
a key of the key-value pair comprises the task, and a value of the key-value pair comprises the number of depended tasks of the task and dependent tasks of the task.
Selecting a task for execution from the task execution list according to the number of depended tasks, comprising:
and selecting the task with the number of the depended tasks being zero from the task execution list as the task for execution.
After selecting the task with the number of depended tasks being zero from the task execution list, the method further includes:
in the task execution list, selecting the tasks of which the number of the depended tasks is less than a task threshold value, and taking the tasks less than the task threshold value as alternative tasks;
the selecting, from the task execution list, the task whose number of depended tasks is zero as the task for execution includes:
and selecting the tasks with the number of the depended tasks being zero from the alternative tasks as the tasks for execution.
The analyzing the dependency relationship between the tasks according to the adjacent tasks in the directed acyclic graph, and establishing the task execution list comprises the following steps:
dividing data in a display page into a plurality of tasks, and establishing the directed acyclic graph according to the tasks;
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list;
after the execution of all tasks in the task execution list is finished, the method further includes:
and displaying all data in the page.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for scheduling tasks, including:
the list module is used for analyzing the dependency relationship among tasks according to adjacent tasks in the directed acyclic graph and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks;
the selection module is used for selecting tasks for execution from the task execution list according to the number of the depended tasks;
and the updating module is used for determining the number of depended tasks of the dependent tasks to update the task execution list after the selected tasks are executed in parallel until all the tasks in the task execution list are executed.
According to a third aspect of the embodiments of the present invention, there is provided an electronic device for scheduling tasks, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method as described above.
One embodiment of the above invention has the following advantages or benefits: analyzing the dependency relationship among tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the depended tasks; and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed. Since the selected tasks can be executed in parallel, the efficiency of scheduling tasks can be improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of task relationships according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a main flow of a method of scheduling tasks according to an embodiment of the invention;
FIG. 3 is a diagram of tasks in a directed acyclic graph according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating the process of creating a task execution list according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating updating a task execution list according to an embodiment of the invention;
fig. 6 is a schematic diagram of a main structure of an apparatus for scheduling tasks according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Referring to fig. 1, fig. 1 is a schematic diagram of task relationships according to an embodiment of the invention. In fig. 1, one job is divided into a plurality of tasks, and the starting point of a task can be only one root node.
In fig. 1, one job is divided into the following tasks: task 1, task 2, task 3, and task 4. The execution sequence of the tasks is as follows: after the task 1 is executed, executing a task 2; after the execution of task 3 is completed, task 4 is executed. Among them, task 2 and task 3 can be executed in parallel.
A job may be defined representing a schedule of a transaction. The above-described job maintains the relationship between task 1 to task 4.
The specific process of executing the job is briefly described below.
First, a task 1, which is a root node of a job, is determined, and the task 1 is executed first. Because it is the root node, there is no parent and therefore no prerequisite and task 1 can be executed when scheduled.
Then, after the task 1 is completed, whether the task 1 has a child node is checked. If the task 1 has no child node, stopping; and if the task 1 has the child nodes, executing the tasks of the child nodes.
The child nodes of task 1 are task 2 and task 3. Task 2 and task 3 are invoked in parallel. Assuming that the call first arrives at task 2, task 2 finds 1 parent node, and the call indicates that the parent node has completed execution, the scheduling of task 2 is started, and similarly, task 3 is the same logic.
Finally, after the tasks 2 and 3 are completed, the tasks 4 are called sequentially or simultaneously. To avoid the trouble of simultaneous concurrency, task 4 is set to be a synchronous call.
Then, suppose that task 2 calls task 4 first, at this time, it is recorded in the memory that task 2 is completed, and task 4 finds that task 3 has not been received in its 2 father nodes, so this time of scheduling skips and waits for task 3 instruction.
When receiving the instruction of task 3, finding the suspended task according to the task identifier, and finding that both task 2 and task 3 are completed, then starting to execute task 4 and completing the service scheduling. The above process is called context switching.
The starting point of the task in the above scheme is always a root node. If the task has a plurality of starting points, the task needs to be split into a plurality of DAG graphs for scheduling, and the scheduled task may need to be suspended in the execution process, which causes context switching of processing and is not efficient.
In order to solve the problem that the processing efficiency of the scheduling task is not high, the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 2, fig. 2 is a schematic diagram of a main flow of a method for scheduling tasks according to an embodiment of the present invention, which analyzes dependency relationships among tasks, establishes a task execution list, and executes the tasks according to the task execution list. As shown in fig. 2, the method specifically includes the following steps:
s201, analyzing the dependency relationship among tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks.
The DAG graph comprises a plurality of tasks, and the dependency relationship between the tasks can be analyzed according to the adjacent tasks, so that a task execution list is established. The adjacent tasks are tasks which are executed adjacently and successively in the execution sequence.
Referring to fig. 3, fig. 3 is a schematic diagram of tasks in a directed acyclic graph according to an embodiment of the present invention. Fig. 3 includes task a, task B, task C, task D, and task E, for a total of five tasks.
Task a and task B may be executed in parallel. Task D is executed after task A and task B are completed. And after the task C and the task D are executed, executing the task E.
Referring to fig. 4, fig. 4 is a schematic flowchart of establishing a task execution list according to an embodiment of the present invention, and the task execution list may be established according to a dependency relationship between the tasks. The method specifically comprises the following steps:
s401, acquiring tasks, dependent tasks of the tasks and dependent tasks of the tasks according to adjacent tasks in the directed acyclic graph.
The DAG graph comprises a plurality of tasks, adjacent tasks can be analyzed, dependent tasks of the tasks and dependent tasks of the tasks can be obtained, and dependent tasks of the tasks can be obtained.
The task dependent task refers to a task which is adjacent to the task and needs to be executed after the task is executed. The depended task of the task refers to the task which is adjacent to the task and needs to be executed before the task is executed.
As an example, with continued reference to FIG. 3, for task D, the dependent task of task D is task E; the depended tasks of task D are task A and task B.
And analyzing according to adjacent tasks in the directed acyclic graph. Illustratively, the following analysis results may be obtained:
task a, task B, and task C may be executed in parallel, begin (C, a, B).
Task D needs to be executed after task A and task B have completed execution, after (A, B).
Task E needs to be executed after task D and task C have completed execution, after (D, C).
In one embodiment of the invention, a dependent task set and a depended task set are established according to adjacent tasks in the directed acyclic graph. The dependent task set comprises dependent task key value pairs, the dependent task keys comprise tasks, and the dependent task values comprise dependent tasks of the tasks. The set of depended tasks includes depended task key-value pairs, the depended task keys include tasks, and the depended task values include depended tasks of the tasks.
According to the analysis result, two sets, namely a dependent task set and a depended task set, can be established, and the dependent tasks of the tasks and the depended tasks of the tasks are respectively stored.
In one embodiment of the invention, the dependent task set may be a dependedpandhandler map. The dependedpandhandler map saves tasks and dependent tasks of the tasks. Tasks and task dependent tasks of the tasks may be saved in a key-value pair fashion. And the Key in the Key value pair is a task, and the value is a task dependent task.
Illustratively, Key: Chandler, value: EHandler;
Key:EHandler,value:ScriptEndEventHandler;
Key:ScriptEndEventHandler,value:null;
Key:DHandler,value:EHandler;
Key:AHandle,value:DHandler;
Key:BHandler,value:DHandler。
in one embodiment of the invention, the set of depended tasks may be dependending handler map. Tasks and dependent tasks of the tasks are saved in the dependendsandlemap. Tasks and dependent tasks of a task may be saved in a key-value pair fashion. And the Key in the Key value pair is a task, and the value is a task depended on.
Key:Chandler,value:null;
Key:AHandler,value:null;
Key:ScriptEndEventHandler,value:EHandler;
Key:BHandler,value:null;
Key:EHandler,value:DHandler,Chandler;
Key:DHandler,value:AHandler,BHandler。
S402, establishing a task execution list according to the tasks, the dependent tasks of the tasks and the depended tasks of the tasks.
After determining the dependent tasks of the tasks and the depended tasks of the tasks, a task execution list can be established according to the tasks, the dependent tasks of the tasks and the depended tasks of the tasks.
In one embodiment of the invention, the speed of establishing the task execution list can be increased by utilizing the key value pair. The task execution list can be established according to the dependent task key value pairs and the depended task key value pairs.
As an example, according to a key in the dependent task key value pair, that is, a dependent task key, values in the depended task key value pair, that is, depended task values, are traversed, and then a task execution list is established.
Referring to table 1, table 1 is a task execution list. The task execution list comprises tasks, the number of depended tasks and dependent tasks. Table 1 is a task execution list built according to the tasks of fig. 3.
TABLE 1
In one embodiment of the invention, tasks, the number of depended tasks, and dependent tasks may be stored in key-value pairs. That is, the task execution list includes key value pairs, the keys in the key value pairs include tasks, and the values in the key value pairs include the number of depended tasks of a task and the dependent tasks of the task.
As one example, key-value pairs in the task execution list are stored in a processPrototypeMap.
In the embodiment of fig. 4, the task execution list is built according to the task, the dependent task of the task, and the dependent task of the task. When asynchronous events are processed, task execution lists can be established completely according to the dependency relationship among tasks, and the multi-entry DAG does not need to be split.
S202, selecting tasks for execution from the task execution list according to the number of the depended tasks.
A plurality of tasks are included in the task execution list from which the task to be executed can be determined according to the number of tasks relied upon.
In one embodiment of the invention, the number of depended tasks is zero, which means that the task is available for execution. Then, from the task execution list, a task whose number of depended tasks is zero is selected as a task for execution.
In addition, considering that there are tasks whose depended task number is not zero, in order to increase the speed of executing the tasks, the tasks whose depended task number is less than the task threshold may be selected from the task execution list, and the tasks whose depended task number is less than the task threshold may be used as the candidate tasks. In this way, among the alternative tasks, the task whose number of depended tasks is zero can be selected as the task for execution. The task threshold is a preset parameter, and can be set empirically.
In the alternative tasks, the tasks for execution are selected, and the number of the alternative tasks is far smaller than that of the tasks in the task execution list, so that the task execution speed can be improved.
S203, after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed.
And executing the selected tasks in parallel, and then updating the task execution list until all tasks in the task execution list are executed.
Referring to fig. 5, fig. 5 is a schematic flowchart of a process of updating a task execution list according to an embodiment of the present invention, which specifically includes:
and S501, executing the selected tasks in parallel.
One or more tasks are selected and the selected tasks may be executed in parallel in order to increase the speed of executing the tasks. That is, as long as the number of depended tasks is zero, the task can be executed.
And S502, after the selected tasks are executed in parallel, determining the number of depended tasks of the dependent tasks according to the selected tasks.
After the selected tasks are executed in parallel, the number of the depended tasks is changed. In order to select the task again, the number of depended tasks of the dependent task is determined according to the selected task.
And S503, updating the task execution list according to the determined number of the depended tasks of the dependent tasks.
And if the number of the depended tasks changes, updating the task execution list according to the determined number of the depended tasks of the dependent tasks. After updating the task execution list, a task whose number of depended tasks is zero may be selected as a task for execution.
In the embodiment of the present invention, with continued reference to table 1, the tasks whose number of dependent tasks in table 1 is zero, i.e., task a, task B, and task C, may be taken as the tasks for execution. Illustratively, task A, task B, and task C are delivered to the scheduler for execution in a thread. And the thread execution task updates the data in the processPrototypeMap.
As an example, task a is executed, and it is known from the task execution list that task D depends on task a. After task A execution is complete, the number of depended tasks of task D is reduced by 1. After task B execution is complete, the number of depended tasks of task D is reduced by 1. At this time, the number of depended tasks of task D in the task execution list is updated to 0. Then task D may be considered a task for execution. And circulating the steps until all the tasks in the task execution list are executed.
In the process of scheduling the task, a countdown latch.
In the embodiment, the dependency relationship between tasks is analyzed according to adjacent tasks in the directed acyclic graph, and a task execution list is established, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the depended tasks; and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed.
And analyzing the dependency relationship among the tasks, and finding out the tasks which can be executed in parallel without splitting the DAG of the multiple entries. The tasks are processed in parallel, the dependency relationship among the tasks is met, the context switching times of the processor are reduced, and therefore the task scheduling efficiency can be improved.
In an embodiment of the present invention, during the process of displaying the page, the page may be displayed on a computer screen or displayed on a mobile terminal. The display page needs to be loaded with a plurality of data.
In order to improve the speed of displaying the page, the data in the displayed page can be divided into a plurality of tasks, and a directed acyclic graph is established according to the plurality of tasks; and analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list.
As an example, the data in the display page is divided into: commodity basic data, commodity price data, commodity sales data, commodity inventory data, commodity evaluation data and commodity advertisement data.
The commodity base data may be used as data for the root node, and the other data may be used as other data in the DAG. And analyzing the dependency relationship between tasks based on adjacent tasks in the DAG, and establishing a task execution list.
After all tasks in the task execution list have been executed, all data in the page may be displayed.
The task execution list is built based on adjacent tasks in the DAG. According to the task execution list, the efficiency of scheduling tasks can be improved, and the speed of displaying the page is further improved.
Referring to fig. 6, fig. 6 is a schematic diagram of a main structure of a device for scheduling a task according to an embodiment of the present invention, where the device for scheduling a task may implement a method for scheduling a task, as shown in fig. 6, the device for scheduling a task specifically includes:
the list module 601 is configured to analyze a dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establish a task execution list, where the task execution list includes a corresponding relationship between the tasks, the number of depended tasks, and the dependent tasks.
A selecting module 602, configured to select a task for execution from the task execution list according to the number of depended tasks.
The updating module 603 is configured to determine the number of depended tasks of the dependent task to update the task execution list after the selected tasks are executed in parallel, until all tasks in the task execution list are executed.
In an embodiment of the present invention, the list module 601 is specifically configured to obtain a task, a dependent task of the task, and a depended task of the task according to adjacent tasks in a directed acyclic graph;
and establishing the task execution list according to the task, the dependent task of the task and the depended task of the task.
In an embodiment of the present invention, the list module 601 is specifically configured to establish a dependent task set and a dependent task set according to adjacent tasks in the directed acyclic graph,
the dependent task set includes dependent task key-value pairs, the dependent task keys including tasks, the dependent task values including dependent tasks of the tasks,
the depended task set comprises depended task key value pairs, the depended task keys comprise tasks, and the depended task values comprise depended tasks of the tasks;
and establishing the task execution list according to the dependent task key-value pairs and the depended task key-value pairs.
In one embodiment of the invention, the task execution list comprises key-value pairs;
a key of the key-value pair comprises the task, and a value of the key-value pair comprises the number of depended tasks of the task and dependent tasks of the task.
In an embodiment of the present invention, the selecting module 602 is specifically configured to select, from the task execution list, the task whose number of depended tasks is zero as the task for execution.
In an embodiment of the present invention, the selecting module 602 is further configured to select, from the task execution list, the task whose number of depended tasks is smaller than a task threshold, and use the task smaller than the task threshold as an alternative task;
and selecting the tasks with the number of the depended tasks being zero from the alternative tasks as the tasks for execution.
In an embodiment of the present invention, the list module 601 is specifically configured to divide data in a display page into a plurality of tasks, and establish the directed acyclic graph according to the plurality of tasks;
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list;
the updating module 603 is specifically configured to display all data in the page.
Fig. 7 illustrates an exemplary system architecture 700 of a method of scheduling tasks or an apparatus for scheduling tasks to which embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. The terminal devices 701, 702, 703 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for scheduling tasks provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the device for scheduling tasks is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a transmitting unit, an obtaining unit, a determining unit, and a first processing unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, the sending unit may also be described as a "unit sending a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks;
selecting tasks for execution from the task execution list according to the number of the depended tasks;
and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed.
According to the technical scheme of the embodiment of the invention, the dependency relationship between tasks is analyzed according to the adjacent tasks in the directed acyclic graph, and a task execution list is established, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the depended tasks; and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed. Since the selected tasks can be executed in parallel, the efficiency of scheduling tasks can be improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (11)
1. A method of scheduling tasks, comprising:
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks;
selecting tasks for execution from the task execution list according to the number of the depended tasks;
and after the selected tasks are executed in parallel, determining the number of the depended tasks of the dependent tasks to update the task execution list until all the tasks in the task execution list are executed.
2. The method for scheduling tasks according to claim 1, wherein the analyzing the dependency relationship between tasks according to the adjacent tasks in the directed acyclic graph to establish the task execution list comprises:
acquiring a task, a dependent task of the task and a depended task of the task according to adjacent tasks in a directed acyclic graph;
and establishing the task execution list according to the task, the dependent task of the task and the depended task of the task.
3. The method for scheduling task according to claim 2, wherein the learning of the task and the dependent task of the task according to the adjacent tasks in the directed acyclic graph comprises:
establishing a dependent task set and a depended task set according to adjacent tasks in the directed acyclic graph,
the dependent task set includes dependent task key-value pairs, the dependent task keys including tasks, the dependent task values including dependent tasks of the tasks,
the depended task set comprises depended task key value pairs, the depended task keys comprise tasks, and the depended task values comprise depended tasks of the tasks;
the establishing of the task execution list according to the task, the dependent task of the task and the depended task of the task comprises the following steps:
and establishing the task execution list according to the dependent task key-value pairs and the depended task key-value pairs.
4. A method of scheduling tasks according to claim 1 or 2 wherein the task execution list comprises key-value pairs;
a key of the key-value pair comprises the task, and a value of the key-value pair comprises the number of depended tasks of the task and dependent tasks of the task.
5. A method for scheduling tasks according to claim 1, wherein said selecting tasks for execution from said task execution list according to said number of depended tasks comprises:
and selecting the task with the number of the depended tasks being zero from the task execution list as the task for execution.
6. The method for scheduling tasks according to claim 5, wherein the selecting the task with zero number of depended tasks from the task execution list further comprises:
in the task execution list, selecting the tasks of which the number of the depended tasks is less than a task threshold value, and taking the tasks less than the task threshold value as alternative tasks;
the selecting, from the task execution list, the task whose number of depended tasks is zero as the task for execution includes:
and selecting the tasks with the number of the depended tasks being zero from the alternative tasks as the tasks for execution.
7. The method for scheduling tasks according to claim 1, wherein the analyzing the dependency relationship between tasks according to the adjacent tasks in the directed acyclic graph to establish the task execution list comprises:
dividing data in a display page into a plurality of tasks, and establishing the directed acyclic graph according to the tasks;
analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list;
after the execution of all tasks in the task execution list is finished, the method further includes:
and displaying all data in the page.
8. An apparatus for scheduling tasks, comprising:
the list module is used for analyzing the dependency relationship among tasks according to adjacent tasks in the directed acyclic graph and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of depended tasks and the dependent tasks;
the selection module is used for selecting tasks for execution from the task execution list according to the number of the depended tasks;
and the updating module is used for determining the number of depended tasks of the dependent tasks to update the task execution list after the selected tasks are executed in parallel until all the tasks in the task execution list are executed.
9. The apparatus for scheduling a task according to claim 8, wherein the list module is specifically configured to learn, according to adjacent tasks in the directed acyclic graph, a task and dependent tasks of the task, and dependent tasks of the task;
and establishing the task execution list according to the task, the dependent task of the task and the depended task of the task.
10. An electronic device that schedules tasks, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
11. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010884944.5A CN113760488B (en) | 2020-08-28 | 2020-08-28 | Method, apparatus, device and computer readable medium for scheduling tasks |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010884944.5A CN113760488B (en) | 2020-08-28 | 2020-08-28 | Method, apparatus, device and computer readable medium for scheduling tasks |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113760488A true CN113760488A (en) | 2021-12-07 |
CN113760488B CN113760488B (en) | 2024-05-17 |
Family
ID=78785761
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010884944.5A Active CN113760488B (en) | 2020-08-28 | 2020-08-28 | Method, apparatus, device and computer readable medium for scheduling tasks |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760488B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114625507A (en) * | 2022-03-14 | 2022-06-14 | 广州经传多赢投资咨询有限公司 | Task scheduling method, system, equipment and storage medium based on directed acyclic graph |
CN115098254A (en) * | 2022-06-17 | 2022-09-23 | 特赞(上海)信息科技有限公司 | Method and system for triggering execution of subtask sequence and electronic equipment |
CN116340436A (en) * | 2023-03-14 | 2023-06-27 | 山东浪潮数字商业科技有限公司 | Data packet processing scheduling method and device, medium and equipment |
WO2023202006A1 (en) * | 2022-04-20 | 2023-10-26 | Zhejiang Dahua Technology Co., Ltd. | Systems and methods for task execution |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117286A (en) * | 2015-09-22 | 2015-12-02 | 北京大学 | Task scheduling and pipelining executing method in MapReduce |
US20180341516A1 (en) * | 2017-05-25 | 2018-11-29 | International Business Machines Corporation | Processing jobs using task dependencies |
CN108920618A (en) * | 2018-06-28 | 2018-11-30 | 泰康保险集团股份有限公司 | A kind of store method, device, medium and the electronic equipment of object reference relationship |
CN109523187A (en) * | 2018-11-27 | 2019-03-26 | 北京字节跳动网络技术有限公司 | Method for scheduling task, device and equipment |
CN109788043A (en) * | 2018-12-28 | 2019-05-21 | 亚信科技(中国)有限公司 | Task processing method, device, computer equipment and storage medium |
CN110554909A (en) * | 2019-09-06 | 2019-12-10 | 腾讯科技(深圳)有限公司 | task scheduling processing method and device and computer equipment |
-
2020
- 2020-08-28 CN CN202010884944.5A patent/CN113760488B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117286A (en) * | 2015-09-22 | 2015-12-02 | 北京大学 | Task scheduling and pipelining executing method in MapReduce |
US20180341516A1 (en) * | 2017-05-25 | 2018-11-29 | International Business Machines Corporation | Processing jobs using task dependencies |
CN108920618A (en) * | 2018-06-28 | 2018-11-30 | 泰康保险集团股份有限公司 | A kind of store method, device, medium and the electronic equipment of object reference relationship |
CN109523187A (en) * | 2018-11-27 | 2019-03-26 | 北京字节跳动网络技术有限公司 | Method for scheduling task, device and equipment |
CN109788043A (en) * | 2018-12-28 | 2019-05-21 | 亚信科技(中国)有限公司 | Task processing method, device, computer equipment and storage medium |
CN110554909A (en) * | 2019-09-06 | 2019-12-10 | 腾讯科技(深圳)有限公司 | task scheduling processing method and device and computer equipment |
Non-Patent Citations (3)
Title |
---|
JOHNSON, JAY等: "A Computational Method for Task Allocation and Coordination in a Distributed Design Environment", 《 DETC 2008: PROCEEDINGS OF THE ASME INTERNATIONAL DESIGN ENGINEERING TECHNICAL CONFERENCES AND COMPUTERS AND INFORMATIONAL IN ENGINEERING CONFERENCE》, vol. 3, 1 January 2009 (2009-01-01) * |
曹镇山: "基于数据访问依赖的分布式机器学习编程模型的优化", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, no. 1, 15 January 2018 (2018-01-15) * |
王学成;马金全;李建军;: "多Stream并行DAG任务映射策略", 太赫兹科学与电子信息学报, no. 02, 25 April 2019 (2019-04-25) * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114625507A (en) * | 2022-03-14 | 2022-06-14 | 广州经传多赢投资咨询有限公司 | Task scheduling method, system, equipment and storage medium based on directed acyclic graph |
CN114625507B (en) * | 2022-03-14 | 2023-01-03 | 广州经传多赢投资咨询有限公司 | Task scheduling method, system, equipment and storage medium based on directed acyclic graph |
WO2023202006A1 (en) * | 2022-04-20 | 2023-10-26 | Zhejiang Dahua Technology Co., Ltd. | Systems and methods for task execution |
CN115098254A (en) * | 2022-06-17 | 2022-09-23 | 特赞(上海)信息科技有限公司 | Method and system for triggering execution of subtask sequence and electronic equipment |
CN116340436A (en) * | 2023-03-14 | 2023-06-27 | 山东浪潮数字商业科技有限公司 | Data packet processing scheduling method and device, medium and equipment |
CN116340436B (en) * | 2023-03-14 | 2024-05-24 | 山东浪潮数字商业科技有限公司 | Data packet processing scheduling method and device, medium and equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113760488B (en) | 2024-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11762697B2 (en) | Method and apparatus for scheduling resource for deep learning framework | |
CN113760488B (en) | Method, apparatus, device and computer readable medium for scheduling tasks | |
CN110321252B (en) | Skill service resource scheduling method and device | |
CN110619078A (en) | Method and device for pushing information | |
WO2023040612A1 (en) | Order processing method and apparatus | |
CN114297278A (en) | Method, system and device for quickly writing batch data | |
CN111478781A (en) | Message broadcasting method and device | |
CN110795328A (en) | Interface testing method and device | |
CN115357350A (en) | Task configuration method and device, electronic equipment and computer readable medium | |
CN113076186B (en) | Task processing method, device, electronic equipment and storage medium | |
CN108985805B (en) | Method and device for selectively executing push task | |
CN113190558A (en) | Data processing method and system | |
CN111062682B (en) | Work order processing method and device | |
CN110362297B (en) | Element ordering method and device | |
CN111324470A (en) | Method and device for generating information | |
CN111143408A (en) | Event processing method and device based on business rules | |
CN113283991B (en) | Processing method and device for transaction data on blockchain | |
CN111026629A (en) | Method and device for automatically generating test script | |
CN112925623B (en) | Task processing method, device, electronic equipment and medium | |
CN115629853A (en) | Task scheduling method and device | |
CN115170026A (en) | Task processing method and device | |
CN114896244A (en) | Method, device and equipment for configuring database table and computer readable medium | |
CN111143740B (en) | Information processing method and device and electronic equipment | |
CN109299223B (en) | Method and device for inquiring instruction | |
CN113176937A (en) | Task processing method and device and electronic equipment |
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 |