CN113760488B - Method, apparatus, device and computer readable medium for scheduling tasks - Google Patents

Method, apparatus, device and computer readable medium for scheduling tasks Download PDF

Info

Publication number
CN113760488B
CN113760488B CN202010884944.5A CN202010884944A CN113760488B CN 113760488 B CN113760488 B CN 113760488B CN 202010884944 A CN202010884944 A CN 202010884944A CN 113760488 B CN113760488 B CN 113760488B
Authority
CN
China
Prior art keywords
task
tasks
dependent
execution list
execution
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
CN202010884944.5A
Other languages
Chinese (zh)
Other versions
CN113760488A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010884944.5A priority Critical patent/CN113760488B/en
Publication of CN113760488A publication Critical patent/CN113760488A/en
Application granted granted Critical
Publication of CN113760488B publication Critical patent/CN113760488B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

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 the following steps: according to adjacent tasks in the directed acyclic graph, analyzing the dependency relationship between the tasks, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of the dependent tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the dependent tasks; and after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished. The embodiment can improve the efficiency of task scheduling.

Description

Method, apparatus, device and computer readable medium for scheduling tasks
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
The method adopts a directed acyclic graph (DIRECTED ACYCLIC GRAPH, DAG), and the scheduling purpose is to divide a job into different stages, enter the stage, divide the stage into tasks which can be calculated in parallel, and finally deliver all the tasks in one stage to a task scheduler for ending.
The starting point of a 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 graphs to schedule.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art: in the process of executing tasks by adopting the DAG, the task scheduling efficiency is lower.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, apparatus, device, and computer readable medium for scheduling tasks, which can improve the efficiency of task scheduling.
To achieve the above object, according to one aspect of the embodiments of the present invention, there is provided a method of scheduling tasks, including:
according to adjacent tasks in the directed acyclic graph, analyzing the dependency relationship between the tasks, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of the dependent tasks and the dependent tasks;
selecting tasks for execution from the task execution list according to the number of the dependent tasks;
And after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished.
Analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the method comprises the following steps:
Acquiring a task, a dependent task of the task and a dependent task of the task according to adjacent tasks in the directed acyclic graph;
And establishing the task execution list according to the task, the dependent task of the task and the dependent task of the task.
The learning task and the dependent task of the task according to the adjacent tasks in the directed acyclic graph comprise:
Based on adjacent tasks in the directed acyclic graph, a set of dependent tasks and a set of dependent tasks are established,
The set of dependent tasks includes a pair of dependent task key values, the dependent task key includes a task, the dependent task value includes a dependent task of the task,
The depended task set comprises a depended task key value pair, the depended task key comprises a task, and the depended task value comprises a depended task of the task;
The task execution list is established according to the task, the dependent task of the task and the dependent task of the task, and the task execution list comprises the following steps:
And establishing the task execution list according to the dependent task key value pair and the dependent task key value pair.
The task execution list comprises key value pairs;
the keys in the key-value pair include the task, and the values in the key-value pair include the number of dependent tasks of the task and dependent tasks of the task.
The selecting tasks for execution from the task execution list according to the number of the dependent tasks comprises:
and selecting the task with zero number of the dependent tasks from the task execution list as the task for execution.
And after selecting the task with zero number of the dependent tasks from the task execution list, the method further comprises the following steps:
selecting tasks with the number of the dependent tasks smaller than a task threshold from the task execution list, and taking the tasks smaller than the task threshold as candidate tasks;
The selecting, from the task execution list, the task with zero number of dependent tasks as the task for execution includes:
and selecting the task with zero number of the dependent tasks from the candidate tasks as the task for executing.
Analyzing the dependency relationship between tasks according to adjacent tasks in the directed acyclic graph, and establishing a task execution list, wherein the method comprises the following steps:
dividing data in a display page into a plurality of tasks, and establishing 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 method comprises the following steps of:
and displaying all data in the page.
According to a second aspect of an embodiment of the present invention, there is provided an apparatus for scheduling tasks, including:
The list module is used for analyzing the dependency relationship among the tasks according to the 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 the dependent 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 dependent tasks;
And the updating module is used for determining the number of the dependent tasks after the parallel execution of the selected tasks is finished so as to update the task execution list until all the tasks in the task execution list are finished.
According to a third aspect of an embodiment of the present invention, there is provided an electronic device that schedules tasks, including:
one or more processors;
Storage means for storing one or more programs,
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program which when executed by a processor implements a method as described above.
One embodiment of the above invention has the following advantages or benefits: according to adjacent tasks in the directed acyclic graph, analyzing the dependency relationship between the tasks, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of the dependent tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the dependent tasks; after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished. Since the selected tasks can be executed in parallel, the efficiency of scheduling the tasks can be improved.
Further effects of the above-described non-conventional alternatives are 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 a task relationship according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a method of scheduling tasks according to an embodiment of the invention;
FIG. 3 is a schematic diagram of tasks in a directed acyclic graph according to an embodiment of the invention;
FIG. 4 is a flow diagram of creating a task execution list according to an embodiment of the present invention;
FIG. 5 is a flow diagram of updating a task execution list according to an embodiment of the invention;
FIG. 6 is a schematic diagram of the main structure of an apparatus for scheduling tasks according to an embodiment of the invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
Fig. 8 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered 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 a task relationship according to an embodiment of the present invention. In fig. 1, a job is divided into a plurality of tasks, and the start point of a task can only be 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 task 3 is completed, the task 4 is executed. Wherein task 2 and task 3 may be performed in parallel.
A job may be defined representing the scheduling of a service. The above-described job maintains the relationship between task 1 to task 4.
The specific procedure of executing the job is briefly described below.
First, the root node task 1 of the job is determined, and task 1 is executed first. Because of the root node, there is no parent class, so there is no precondition, and task 1 can be executed when scheduled.
Then, after task 1 completes execution, it is checked whether task 1 has child nodes. If the task 1 has no child node, stopping; if the task 1 has the child node, executing the task of the child node.
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 instruction firstly starts to task 2, task 2 finds 1 father node, and the call instruction indicates that the father node has been executed, then the scheduling of task 2 is started, and similarly task 3 is the same logic.
Finally, task 2 and task 3 may call task 4 either sequentially or simultaneously after completion of execution. To avoid the trouble caused by the concurrent, task 4 is set to be a synchronous call.
Then, assume that task 2 invokes task 4 first, at this time, task 2 is recorded in the memory to be completed, and task 4 finds that no instruction of task 3 is received in its own 2 parent nodes, so this scheduling skips and waits for a task 3 instruction.
When the instruction of the task 3 is received, finding out the previously paused task according to the task identifier, and then finding out that the task 2 and the task 3 are completed to be executed, and starting to execute the task 4, wherein the service scheduling is completed. The above procedure is called context switch.
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 process of execution, so that the processing context is switched, and the processing efficiency is low.
In order to solve the problem of low scheduling task processing efficiency, 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, analyzes dependency relationships between tasks, establishes a task execution list, and executes tasks according to the task execution list. As shown in fig. 2, the method specifically comprises 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 the dependent tasks and the dependent tasks.
The DAG graph comprises a plurality of tasks, and the dependency relationship among the tasks can be analyzed according to the adjacent tasks, so that a task execution list is established. Wherein, adjacent tasks are tasks which are adjacent and executed 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 invention. The figure 3 comprises a task A, a task B, a task C, a task D and a task E, and the total of five tasks are five.
Task a and task B may be performed in parallel. Task D is performed after task A and task B are performed. And after the task C and the task D are executed, executing the task E.
Referring to fig. 4, fig. 4 is a schematic flow chart of establishing a task execution list according to an embodiment of the present invention, where the task execution list may be established according to the dependency relationship between the tasks. The method specifically comprises the following steps:
s401, acquiring tasks and task dependent tasks of the tasks and task dependent tasks according to adjacent tasks in the directed acyclic graph.
The DAG graph comprises a plurality of tasks, and can analyze adjacent tasks, acquire the tasks and the dependent tasks of the tasks.
The dependent task of the task is a task which is adjacent to the task and needs to be executed after the task is executed. The dependent task of the task refers to a task which is adjacent to the task and needs to be executed before the task is executed.
As one example, with continued reference to fig. 3, for task D, the dependent task of task D is task E; the dependent 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, task C may be performed in parallel, begin (C, a, B).
Task D needs to be performed after task a and task B are performed, after (a, B). Then (D).
Task E needs to be performed after task D and task C are performed, after (D, C). Then (E).
In one embodiment of the invention, a set of dependent tasks and a set of dependent tasks are established based on adjacent tasks in the directed acyclic graph. The dependency task set comprises a dependency task key value pair, the dependency task key comprises a task, and the dependency task value comprises a dependency task of the task. The set of dependent tasks includes a pair of dependent task key values, the dependent task key includes a task, and the dependent task value includes a dependent task of the task.
According to the analysis result, two sets, namely a dependent task set and a dependent task set, can be established, and the dependent tasks of the task are respectively stored.
In one embodiment of the invention, the set of dependent tasks may be DEPENDEDHANDLERMAP. DEPENDEDHANDLERMAP store tasks and task dependent tasks for the tasks. Tasks and task dependent tasks may be saved in key-value pairs. Wherein, key in the Key value pair is task, value is the dependent task of 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 dependent tasks may be DEPENDINGHANDLERMAP. Tasks and task-dependent tasks of the tasks are saved at DEPENDINGHANDLERMAP. Tasks and task-dependent tasks of a task may be saved in key-value pairs. Wherein, key in the Key value pair is the task, and value is the dependent task of the task.
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, a task execution list is established according to the task, the dependent task of the task and the dependent task of the task.
After determining the dependent tasks of the task and the dependent tasks of the task, a task execution list can be established according to the task, the dependent tasks of the task and the dependent tasks of the task.
In one embodiment of the present invention, it is contemplated that the speed of creating a task execution list can be increased by utilizing key-value pairs. The task execution list may be established according to the dependent task key value pair and the dependent task key value pair.
As one example, the values in the depended task key value pair, i.e., the depended task values, are traversed according to the keys in the depended task key value pair, i.e., the depended task keys, and a task execution list is built.
Referring to table 1, table 1 is a task execution list. Wherein the task execution list includes tasks, the number of dependent tasks, and dependent tasks. Table 1 is a task execution list established according to the tasks of fig. 3.
TABLE 1
In one embodiment of the invention, the tasks, the number of dependent tasks, and the dependent tasks may be stored in key value pairs. That is, the task execution list includes a key value pair, the key in the key value pair includes a task, and the value in the key value pair includes the number of dependent tasks of the task and the dependent tasks of the task.
As one example, key-value pairs in the task execution list are stored in processPrototypeMap.
In the embodiment of FIG. 4, a task execution list is built according to tasks, task dependent tasks, and task dependent tasks. When asynchronous events are processed, a task execution list can be established completely according to the dependency relationship among tasks, and the DAG with multiple entries is not required to be split.
S202, selecting tasks for execution from the task execution list according to the number of the dependent tasks.
The task execution list includes a plurality of tasks, and the executed tasks can be determined according to the number of the dependent tasks.
In one embodiment of the invention, the number of dependent tasks is zero, representing that the task is available for execution. Then, from the task execution list, a task whose number of dependent tasks is zero is selected as a task for execution.
In addition, considering that there are tasks whose number of dependent tasks is not zero, in order to increase the speed of executing tasks, tasks whose number of dependent tasks is smaller than the task threshold may be selected from the task execution list, and tasks smaller than the task threshold may be selected as candidate tasks. Thus, among the alternative tasks, a task with zero number of dependent tasks may be selected as a task for execution. The task threshold is a preset parameter, and can be set empirically.
Among the candidate tasks, the task for execution is selected, and the number of the candidate tasks is far smaller than the number of the tasks in the task execution list, so that the task execution speed can be improved.
And S203, after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished.
And executing the selected tasks in parallel, and updating the task execution list until all the tasks in the task execution list are finished.
Referring to fig. 5, fig. 5 is a schematic flow chart of updating a task execution list according to an embodiment of the present invention, which specifically includes:
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, the dependent task may be executed as long as the number of tasks is zero.
S502, after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks according to the selected tasks.
After the selected tasks are executed in parallel, the number of the dependent tasks is changed. In order to select the task again, the number of dependent tasks of the dependent task is determined according to the selected task.
S503, updating a task execution list according to the determined number of the dependent tasks.
And if the number of the dependent tasks changes, updating the task execution list according to the determined number of the dependent tasks. After updating the task execution list, a task with zero number of dependent tasks may be selected as a task for execution.
In the embodiment of the present invention, with continued reference to table 1, tasks with zero number of dependent tasks in table 1, i.e., task a, task B, and task C, may be regarded as tasks for execution. Illustratively, task A, task B, and task C are delivered to the scheduler for execution in the thread. The thread execution task updates the data in processPrototypeMap.
As one example, task a is executed, and task D is known to depend on task a from the task execution list. After task A is completed, the number of dependent tasks for task D is reduced by 1. After task B execution is completed, the number of dependent tasks for task D is reduced by 1. At this time, the number of dependent 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 in this way until all tasks in the task execution list are finished.
In the process of scheduling tasks, a countdown latch. Countdown method can be adopted to cancel the blockage of the scheduling thread.
In the above embodiment, according to the adjacent tasks in the directed acyclic graph, the dependency relationship between the tasks is analyzed, and a task execution list is established, where the task execution list includes the corresponding relationship of the tasks, the number of the dependent tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the dependent tasks; after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished.
And analyzing the dependency relationship among the tasks to find out tasks which can be executed in parallel, and splitting the DAG with multiple inlets is not needed. The multiple tasks are processed in parallel, the dependency relationship among the tasks is met, and the context switching times of the processor are reduced, so that the task scheduling efficiency can be improved.
In one embodiment of the invention, the page may be displayed on a computer screen or a mobile terminal during the process of displaying the page. Displaying a page requires loading 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 the tasks according to the adjacent tasks in the directed acyclic graph, and establishing a task execution list.
As one 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.
Commodity base data may be used as the root node's data, with other data being used as other data in the DAG. Based on adjacent tasks in the DAG, the dependency relationship between the tasks is analyzed, and a task execution list is established.
After all tasks in the task execution list have ended, all data in the page may be displayed.
Because the task execution list is built based on adjacent tasks in the DAG. According to the task execution list, the task scheduling efficiency can be improved, and the page displaying speed is further improved.
Referring to fig. 6, fig. 6 is a schematic diagram of a main structure of an apparatus for scheduling tasks according to an embodiment of the present invention, where the apparatus for scheduling tasks may implement a method for scheduling tasks, and as shown in fig. 6, the apparatus for scheduling tasks specifically includes:
The list module 601 is configured to analyze dependency relationships between tasks according to adjacent tasks in the directed acyclic graph, and establish a task execution list, where the task execution list includes a correspondence relationship between tasks, the number of dependent tasks, and dependent tasks.
A selecting module 602, configured to select a task for execution from the task execution list according to the number of dependent tasks.
And an updating module 603, configured to determine, after the selected task parallel execution ends, the number of dependent tasks of the dependent task to update the task execution list until all task execution ends in the task execution list.
In one embodiment of the present invention, the list module 601 is specifically configured to learn, according to adjacent tasks in the directed acyclic graph, a task and a dependent task of the task, and a dependent task of the task;
And establishing the task execution list according to the task, the dependent task of the task and the dependent task of the task.
In one embodiment of the invention, the list module 601 is specifically configured to establish a set of dependent tasks and a set of dependent tasks based on adjacent tasks in the directed acyclic graph,
The set of dependent tasks includes a pair of dependent task key values, the dependent task key includes a task, the dependent task value includes a dependent task of the task,
The depended task set comprises a depended task key value pair, the depended task key comprises a task, and the depended task value comprises a depended task of the task;
And establishing the task execution list according to the dependent task key value pair and the dependent task key value pair.
In one embodiment of the invention, the task execution list includes key-value pairs;
the keys in the key-value pair include the task, and the values in the key-value pair include the number of dependent tasks of the task and dependent tasks of the task.
In one embodiment of the present invention, the selecting module 602 is specifically configured to select, from the task execution list, a task with zero number of dependent tasks as the task for executing.
In one embodiment of the present invention, the selecting module 602 is further configured to select, from the task execution list, a task whose number of dependent tasks is less than a task threshold, and take the task less than the task threshold as an candidate task;
and selecting the task with zero number of the dependent tasks from the candidate tasks as the task for executing.
In one 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 build 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 of scheduling tasks to which embodiments of the invention may be applied.
As shown in fig. 7, a system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 is the medium used to provide communication links between the terminal devices 701, 702, 703 and the server 705. The network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 705 via the network 704 using the terminal devices 701, 702, 703 to receive or send messages or the like. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 701, 702, 703. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for scheduling tasks provided in 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, there is illustrated a schematic diagram of a computer system 800 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment 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 according to 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 required for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 808 including a hard disk or 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. The drive 810 is also connected to the I/O interface 805 as needed. 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 needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to 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 shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 801.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 context of this document, 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, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 flowcharts 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 involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a transmitting unit, an acquiring unit, a determining unit, and a first processing unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the transmitting unit may also be described as "a unit that transmits 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 present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
according to adjacent tasks in the directed acyclic graph, analyzing the dependency relationship between the tasks, and establishing a task execution list, wherein the task execution list comprises the corresponding relationship among the tasks, the number of the dependent tasks and the dependent tasks;
selecting tasks for execution from the task execution list according to the number of the dependent tasks;
And after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished.
According to the technical scheme of the embodiment of the invention, according to adjacent tasks in the directed acyclic graph, the dependency relationship among the tasks is analyzed, a task execution list is established, and the task execution list comprises the corresponding relationship among the tasks, the number of the dependent tasks and the dependent tasks; selecting tasks for execution from the task execution list according to the number of the dependent tasks; after the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished. Since the selected tasks can be executed in parallel, the efficiency of scheduling the tasks can be improved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. A method of scheduling tasks, comprising:
Acquiring a task, a dependent task of the task and a dependent task of the task according to adjacent tasks in the directed acyclic graph;
According to the task, the dependent task of the task and the dependent task of the task, the task execution list is established, and the task execution list comprises the corresponding relation of the task, the number of the dependent tasks and the dependent task; the task execution list comprises key value pairs; the keys in the key value pair comprise the tasks, and the values in the key value pair comprise the number of the dependent tasks of the tasks and the dependent tasks of the tasks;
selecting tasks for execution from the task execution list according to the number of the dependent tasks;
After the parallel execution of the selected tasks is finished, determining the number of the dependent tasks to update the task execution list until all the tasks in the task execution list are finished, wherein the dependent tasks are adjacent to the tasks and the tasks to be executed after the task execution is finished; the dependent task is a task which is adjacent to the task and needs to be executed before the task is executed.
2. A method of scheduling tasks according to claim 1, wherein the learning of tasks and dependent tasks of the tasks, and the tasks' dependent tasks, from adjacent tasks in a directed acyclic graph, comprises:
Based on adjacent tasks in the directed acyclic graph, a set of dependent tasks and a set of dependent tasks are established,
The set of dependent tasks includes a pair of dependent task key values, the dependent task key includes a task, the dependent task value includes a dependent task of the task,
The depended task set comprises a depended task key value pair, the depended task key comprises a task, and the depended task value comprises a depended task of the task;
The task execution list is established according to the task, the dependent task of the task and the dependent task of the task, and the task execution list comprises the following steps:
And establishing the task execution list according to the dependent task key value pair and the dependent task key value pair.
3. A method of scheduling tasks according to claim 1, wherein said selecting tasks for execution from said task execution list in accordance with said number of dependent tasks comprises:
and selecting the task with zero number of the dependent tasks from the task execution list as the task for execution.
4. A method of scheduling tasks according to claim 3, wherein after selecting the zero number of dependent tasks from the task execution list, further comprising:
selecting tasks with the number of the dependent tasks smaller than a task threshold from the task execution list, and taking the tasks smaller than the task threshold as candidate tasks;
The selecting, from the task execution list, the task with zero number of dependent tasks as the task for execution includes:
and selecting the task with zero number of the dependent tasks from the candidate tasks as the task for executing.
5. 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 and establishing the task execution list comprise:
dividing data in a display page into a plurality of tasks, and establishing 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 method comprises the following steps of:
and displaying all data in the page.
6. An apparatus for scheduling tasks, comprising:
The list module is used for acquiring the task, the dependent task of the task and the dependent task of the task according to the adjacent tasks in the directed acyclic graph; establishing the task execution list according to the task, the dependent task of the task and the dependent task of the task; the task execution list comprises the corresponding relation among tasks, the number of the dependent tasks and the dependent tasks; the task execution list comprises key value pairs; the keys in the key value pair comprise the tasks, and the values in the key value pair comprise the number of the dependent tasks of the tasks and the dependent tasks of the tasks;
the selection module is used for selecting tasks for execution from the task execution list according to the number of the dependent tasks;
The updating module is used for determining the number of the dependent tasks after the parallel execution of the selected tasks is finished so as to update the task execution list until all the tasks in the task execution list are finished, wherein the dependent tasks are adjacent to the tasks and the tasks to be executed after the task execution is finished; the dependent task is a task which is adjacent to the task and needs to be executed before the task is executed.
7. An electronic device for scheduling tasks, comprising:
one or more processors;
Storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
CN202010884944.5A 2020-08-28 2020-08-28 Method, apparatus, device and computer readable medium for scheduling tasks Active CN113760488B (en)

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 CN113760488A (en) 2021-12-07
CN113760488B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625507B (en) * 2022-03-14 2023-01-03 广州经传多赢投资咨询有限公司 Task scheduling method, system, equipment and storage medium based on directed acyclic graph
CN114518917B (en) * 2022-04-20 2022-08-09 浙江大华技术股份有限公司 Algorithm module scheduling method, algorithm module scheduling device and readable storage medium
CN116340436B (en) * 2023-03-14 2024-05-24 山东浪潮数字商业科技有限公司 Data packet processing scheduling method and device, medium and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117286A (en) * 2015-09-22 2015-12-02 北京大学 Task scheduling and pipelining executing method in MapReduce
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10423442B2 (en) * 2017-05-25 2019-09-24 International Business Machines Corporation Processing jobs using task dependencies

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105117286A (en) * 2015-09-22 2015-12-02 北京大学 Task scheduling and pipelining executing method in MapReduce
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)

* Cited by examiner, † Cited by third party
Title
A Computational Method for Task Allocation and Coordination in a Distributed Design Environment;Johnson, Jay等;《 DETC 2008: PROCEEDINGS OF THE ASME INTERNATIONAL DESIGN ENGINEERING TECHNICAL CONFERENCES AND COMPUTERS AND INFORMATIONAL IN ENGINEERING CONFERENCE》;20090101;第3卷;全文 *
基于数据访问依赖的分布式机器学习编程模型的优化;曹镇山;《中国优秀硕士学位论文全文数据库(信息科技辑)》;20180115(第1期);全文 *
多Stream并行DAG任务映射策略;王学成;马金全;李建军;;太赫兹科学与电子信息学报;20190425(第02期);全文 *

Also Published As

Publication number Publication date
CN113760488A (en) 2021-12-07

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
WO2018019139A1 (en) Information pushing method and device
US11706172B2 (en) Method and device for sending information
CN111177433B (en) Method and apparatus for parallel processing of information
CN110619078A (en) Method and device for pushing information
CN115357350A (en) Task configuration method and device, electronic equipment and computer readable medium
CN111461583B (en) Inventory checking method and device
CN113076186B (en) Task processing method, device, electronic equipment and storage medium
CN111813685B (en) Automatic test method and device
CN116909539A (en) Visual programming method, device, equipment and storage medium
CN108804442B (en) Serial number generation method and device
CN112799797B (en) Task management method and device
CN112925623B (en) Task processing method, device, electronic equipment and medium
CN115170026A (en) Task processing method and device
CN110309403B (en) Method and device for capturing data
CN113095060A (en) Method, device, equipment and computer readable medium for processing data
CN109840073B (en) Method and device for realizing business process
CN112308074A (en) Method and device for generating thumbnail
CN112784187A (en) Page display method and device
CN113806033B (en) Task execution method, device, server and medium for task system
CN111596941B (en) Application updating method, device, electronic equipment and medium
CN111786801A (en) Method and device for charging based on data flow
CN112559001A (en) Method and device for updating application
CN113762570B (en) Method and device for sorting task group list

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