WO2019029721A1 - 任务的调度方法、装置、设备及存储介质 - Google Patents

任务的调度方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2019029721A1
WO2019029721A1 PCT/CN2018/100046 CN2018100046W WO2019029721A1 WO 2019029721 A1 WO2019029721 A1 WO 2019029721A1 CN 2018100046 W CN2018100046 W CN 2018100046W WO 2019029721 A1 WO2019029721 A1 WO 2019029721A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
scheduling
value
step size
attribute
Prior art date
Application number
PCT/CN2018/100046
Other languages
English (en)
French (fr)
Inventor
李蕊
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to EP18844234.7A priority Critical patent/EP3667495A1/en
Publication of WO2019029721A1 publication Critical patent/WO2019029721A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/486Scheduler internals

Definitions

  • the present disclosure relates to the field of communication technologies, for example, to a scheduling method, apparatus, device, and storage medium for tasks.
  • the present disclosure provides a scheduling method, apparatus, device, and storage medium for tasks to improve processing efficiency of at least related task scheduling.
  • the present disclosure provides a scheduling method for a task, the method comprising:
  • the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values.
  • the determining, according to the task attribute of each task, the scheduling step size of each task including:
  • the scheduling step size of each task is determined according to the priority of each task.
  • the root determines a scheduling step size of each task according to a task attribute of each task, including:
  • the scheduling value of each task is determined according to the scheduling step size of each task, including:
  • Scheduling value task creation time + scheduling step size.
  • the size of the scheduling step is determined by the number of tasks in the time period of the scheduling step and the execution time of each task.
  • the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values, including:
  • All the scheduling values in the task queue are arranged in an order, and tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values.
  • all the scheduling values in the task queue are arranged in an order, and the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values, including:
  • All the scheduling values in the task queue are arranged in ascending order
  • the tasks corresponding to each scheduling value are scheduled and executed according to the arrangement order of all the scheduling values from small to large.
  • the task queue is in the form of a single queue.
  • the method before the task attribute according to each task, the method further includes: acquiring a task attribute of the at least one task;
  • the obtaining the task attribute of the at least one task includes:
  • the present disclosure further provides a scheduling apparatus for a task, including:
  • a scheduling value calculation module configured to determine a scheduling step size of each task according to a task attribute of each task, and determine a scheduling value of each task according to a scheduling step size of each task;
  • the apparatus further includes: a task receiving module;
  • the task receiving module is configured to: receive at least one task request, extract task attributes of tasks included in each of the task requests, and send task attributes of the tasks included in each of the task requests to the Scheduling value calculation module.
  • the scheduling value calculation module is further configured to: receive a task attribute of each task sent by the task receiving module, and determine a priority of the task from the mapping table configuration module according to the task attribute of each task The scheduling step size, and determining a scheduling value of each task according to the scheduling step size of each task.
  • the present disclosure also provides a scheduling device for a task, the device comprising a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the above method.
  • the present disclosure also provides a computer readable storage medium storing a computer program that, when executed by at least one processor, implements the above method.
  • FIG. 1 is a flowchart of a scheduling method of a task in an embodiment of the present disclosure
  • 2b is a schematic structural diagram of a scheduling apparatus of another task in the embodiment of the present disclosure.
  • FIG. 3 is a schematic structural diagram of a scheduling device of a task in an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides a scheduling method for a task, where the method includes:
  • S101 Determine, according to task attributes of each task, a scheduling step size of each task.
  • the method in the embodiments of the present disclosure is for a multi-concurrent multi-tasking system.
  • the method in the embodiments of the present disclosure can be widely used in the field of scheduling tasks according to priorities, such as a ticketing system, an order processing system, and the like.
  • the determining, according to the task attribute of each task, the scheduling step size of each task including:
  • the scheduling step size of each task is determined according to the priority of each task.
  • the priority order of the priority levels from high to low corresponds to the arrangement order of the scheduling steps from small to large.
  • the determining, according to the task attribute of each task, the scheduling step size of each task including:
  • the task attribute-task scheduling step size mapping table (referred to as a mapping table) records the correspondence between the task attribute, the priority of the task, and the scheduling step size of the task.
  • the priority of the task is simplified by the mapping table, and the setting of the priority is also more flexible, so that the maintenance cost of the queue does not increase exponentially with the increase of the priority.
  • the calculation formula of the scheduling value is as follows:
  • the calculation formula of the scheduling value in the embodiment of the present disclosure includes the task creation time (current system time) and the priority information (scheduling step size) of the task, thereby ensuring that the task with the highest priority and the first creation is scheduled first.
  • the size of the scheduling step is determined by the number of tasks in the time period of the scheduling step and the execution time of each task.
  • the scheduling step size corresponding to each priority task is the key to distinguish the task priority, and the scheduling step size is set to ensure that all the tasks of the level are in the long time segment in this step. Can be executed, in order to avoid the occurrence of leapfrog scheduling.
  • the scheduling step only affects the scheduling order of the tasks, regardless of the actual scheduling time of the tasks.
  • the scheduling step size can be configured in days (internal conversion to hundreds of milliseconds).
  • All the scheduling values in the task queue are arranged in an order, and tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values.
  • the tasks corresponding to each scheduling value are scheduled in the order of the scheduling values from small to large, and the task is executed.
  • the task queue is in the form of a single queue.
  • an embodiment of the present disclosure provides a scheduling apparatus for a task, including:
  • the scheduling value calculation module 210 is configured to determine a scheduling step size of each task according to a task attribute of each task, and determine a scheduling value of each task according to the scheduling step size of each task;
  • the task scheduling execution module 220 is configured to schedule and execute the task corresponding to each scheduling value according to the order of all the scheduling values.
  • the task receiving module 230 is configured to: receive at least one task request, extract task attributes of tasks included in each of the task requests, and send task attributes of the tasks included in each of the task requests to the The scheduling value calculation module.
  • the apparatus further includes: a mapping table configuration module 240;
  • the mapping table configuration module 240 is configured to: configure a task priority and a scheduling step size corresponding to each task attribute, so that the scheduling value calculation module calculates the usage value of each task;
  • the scheduling value calculation module 210 is further configured to: receive a task attribute of each task sent by the task receiving module, and determine the task priority and the mapping table configuration module according to the task attribute of each task The scheduling step size, and determining a scheduling value of each task according to the scheduling step size of each task.
  • the task attribute-task scheduling step size mapping table is used to determine the priority of the task and the corresponding scheduling step size; after obtaining the task scheduling step size, the scheduling value of the task is calculated according to the scheduling value calculation formula.
  • the task execution is scheduled in order according to the scheduling value from small to large. The scheduling does not need to care about the priority of the task, and does not need to care about the task creation time sequence.
  • Embodiments of the present disclosure may take the form of software modules when implemented.
  • the embodiment of the present disclosure mainly includes a task receiving module, a mapping table configuration module, a scheduling value calculation module, a task queue, and a task scheduling execution module.
  • the task receiving module is configured to receive a task request, where the task request includes: a task type, a task channel (eg, a Web, a mobile application (Application), and a task parameter).
  • the task receiving module extracts the task attribute and passes it to the scheduling value calculation module to calculate the scheduling value.
  • the mapping table configuration module is configured to configure a task priority and a scheduling step size corresponding to the task attribute, and the scheduling value calculation module calculates the scheduling value to use, and supports multiple task attributes to jointly determine the task priority and the scheduling step size.
  • the scheduling step size is set to ensure that all the tasks of this level can be executed in this step for a long period of time, so as to avoid the occurrence of the off-level scheduling.
  • the scheduling step only affects the scheduling order of the task and the actual scheduling time of the task. Configured in days (internal conversion to hundreds of milliseconds).
  • Scheduling value current system time (accurate to one hundred milliseconds) + scheduling step size (accurate to one hundred milliseconds).
  • the task scheduling execution module is configured to sequentially acquire task execution from the task queue and return an execution result in descending order of the scheduling value.
  • the task scheduling process of the embodiment of the present disclosure may include the following steps:
  • the task receiving module receives the task request, parses the task attribute, and passes the task attribute to the scheduling value calculation module.
  • the scheduling value calculation module acquires the task scheduling step size according to the task attribute lookup mapping table.
  • the task scheduling value is calculated according to the scheduling value calculation formula, and the task attribute, the task priority, and the scheduling value are written into the task queue.
  • the task scheduling execution module acquires the task scheduling execution with the smallest task scheduling value from the task queue.
  • the task scheduling process involved in this application example includes the following parts:
  • Step 1 According to the classification of task attributes, configure the priority and scheduling step mapping table corresponding to the service attributes.
  • Step 2 Receive the task request, parse the task attribute, and go to step 3.
  • Step 3 According to the task attribute, obtain the priority and the scheduling step size according to the mapping table, and calculate the scheduling value according to the calculation formula of the scheduling value, and proceed to step 4.
  • Step 4 Store the task's attributes and priorities and scheduling values in the database task table.
  • Step 5 Obtain the task with the lowest scheduling value from the task table.
  • Step 6 Determine whether there is a task. If there is a task, the next step is to go to step 7. If there is no task, go to step 8.
  • Step 7 Execute the task and return to the execution result.
  • Step 8 Sleep for a while.
  • an embodiment of the present disclosure provides a scheduling device for a task, the device including a memory 20 and a processor 22, the memory 20 storing a scheduling computer program of a task, and the processor 22 executing the computer A program to implement the method described in the above embodiments.
  • the embodiment of the present disclosure determines the scheduling step size of the task according to the task attribute of the task; determines the scheduling value of the task according to the scheduling step length; and schedules the task execution according to the scheduling value, thereby effectively reducing
  • the implementation complexity of the existing task scheduling method effectively solves the problem of priority scheduling of the tasks of the multi-concurrent multi-tasking system, and improves the task processing efficiency and response speed.
  • the processor 22 executes the computer program to implement the following steps:
  • the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values.
  • the determining, according to the task attribute of each task, the scheduling step size of each task including:
  • the scheduling step size of each task is determined according to the priority of each task.
  • the order of the priority levels from high to low corresponds to the order in which the scheduling steps are small to large.
  • the determining, according to the task attribute of each task, the scheduling step size of each task including:
  • the scheduling step size of each task is matched in a preset mapping table; wherein the mapping table is a mapping relationship table of the task attribute and the task scheduling step.
  • the calculation formula of the scheduling value is as follows:
  • Scheduling value task creation time + scheduling step size.
  • the size of the scheduling step is determined by the number of tasks in the time period of the scheduling step and the execution time of each task.
  • the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values, including:
  • the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values.
  • all the scheduling values in the task queue are arranged in an order, and the tasks corresponding to each scheduling value are scheduled and executed according to the order of all the scheduling values, including:
  • All the scheduling values in the task queue are arranged in ascending order
  • the tasks corresponding to each scheduling value are scheduled and executed according to the arrangement order of all the scheduling values from small to large.
  • the task queue is in the form of a single queue.
  • the method before the task attribute according to each task, the method further includes: acquiring a task attribute of the at least one task;
  • the obtaining the task attribute of the at least one task includes:
  • the task attributes include a task type and a task channel.
  • the embodiment of the present disclosure can be referred to the first embodiment when it is implemented, and has corresponding technical effects.
  • Embodiments of the present disclosure provide a computer readable storage medium storing a scheduling computer program of a task, the computer program being executed by at least one processor to implement the method described in the foregoing embodiments.
  • the computer readable storage medium in the embodiments of the present disclosure may be a random access memory (RAM), a flash memory, a read-only memory (ROM), and an erasable programmable read only memory (Erasable Programmable Read Only). Memory, EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM) memory, registers, hard disk, mobile hard disk, compact disc read-only memory (CD-ROM) or the field Any other form of storage medium known.
  • a storage medium can be coupled to the processor to enable the processor to read information from, and write information to, the storage medium; or the storage medium can be an integral part of the processor.
  • the processor and the storage medium may be located in an application specific integrated circuit.
  • Embodiment 1 and Embodiment 2 when implemented, and have corresponding technical effects.

Abstract

本文公开了一种任务的调度方法,包括:根据每个任务的任务属性确定所述每个任务的调度步长;根据所述每个任务的调度步长确定所述每个任务的调度值;按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。本文还公开了一种任务的调度装置、一种任务的调度设备以及一种存储介质。

Description

任务的调度方法、装置、设备及存储介质
本申请要求在2017年8月11日提交中国专利局、申请号为201710685266.8的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开涉及通讯技术领域,例如涉及一种任务的调度方法、装置、设备及存储介质。
背景技术
智能网是为了更灵活、方便、经济、有效地提供增值业务(即一种或多种新业务),在传统的移动交换网中引入的一种叠加网络,整个移动网络便形成了由原有的交换层和叠加的智能层构成的网络结构,其中,交换层负责完成基本业务呼叫连接功能,而复杂的一些增值业务则由智能层控制实现。常见的智能网业务有预付费业务、动感地带业务、以及充值业务等。
随着互联网应用的迅猛发展,智能网业务的管理界面接入方式发生了翻天覆地的变化,不再限于传统的电脑接入方式(例如万维网Web门户),手机、便携式设备(Portable Android Device,PAD)等多种终端接入方式越来越被大家认可。后台应用也在适应这种变化,将每种功能独立化、模块化,避免模块间的强耦合,避免相同功能的重复开发和测试。通常会为用户通过不同渠道提交的请求建立一个或多个任务,生成任务标识写入任务表,同时将任务标识返回给渠道,由任务调度处理程序处理任务,处理结束后发消息给渠道通知处理结果或由渠道根据任务标识主动查询执行结果。
相关任务处理机制虽然解决了不同渠道相同功能的代码重用问题,但是在复杂的多并发多任务系统中,任务处理效率、响应速度、系统处理能力、系统开销、维护开销等方面仍需改进。
发明内容
本公开提供一种任务的调度方法、装置、设备及存储介质,用以至少提高相关任务调度的处理效率。
在一实施例中,本公开提供一种任务的调度方法,所述方法包括:
根据每个任务的任务属性确定所述每个任务的调度步长;
根据所述每个任务的调度步长确定所述每个任务的调度值;
按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,所述根据每个任务的任务属性,确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,确定所述每个任务的优先级;
根据所述每个任务的优先级,确定所述每个任务的调度步长。
在一实施例中,所述优先级由高到低的等级顺序与所述调度步长由小到大的排列顺序对应。
在一实施例中,所述根根据每个任务的任务属性确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,在预设的映射表中匹配出所述每个任务的调度步长;其中,所述映射表为任务属性和任务调度步长的映射关系表。
在一实施例中,根据所述每个任务的调度步长确定所述每个任务的调度值,包括:
按照如下计算公式计算每个任务的调度值:
调度值=任务创建时间+调度步长。
在一实施例中,所述调度步长的大小由所述调度步长的时间段内的任务数量和每个任务的执行时间确定。
在一实施例中,所述按照所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
将所述每个任务和所述每个任务对应的调度值写入任务队列;
对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
将所述任务队列中的所有调度值按照由小到大的顺序排列;
根据所有调度值由小到大的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,所述任务队列为单队列形式。
在一实施例中,在根据每个任务的任务属性之前,还包括:获取至少一个任务的任务属性;
其中,所述获取至少一个任务的任务属性,包括:
接收至少一个任务请求;
解析并获取每个所述任务请求中包含的任务的任务属性;
其中,所述任务属性包括任务类型和任务渠道。
在一实施例中,本公开还提供一种任务的调度装置,包括:
调度值计算模块,设置为根据每个任务的任务属性确定所述每个任务的调度步长,以及根据所述每个任务的调度步长确定所述每个任务的调度值;
任务调度执行模块,设置为按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,所述装置还包括:任务接收模块;
所述任务接收模块设置为:接收至少一个任务请求,提取每个所述任务请求中包含的任务的任务属性,并将所述每个所述任务请求中包含的任务的任务属性发送给所述调度值计算模块。
在一实施例中,所述装置还包括:映射表配置模块;
所述映射表配置模块设置为:配置每个任务属性对应的任务优先级和调度步长,以供所述调度值计算模块计算每个任务的调度值使用;
所述调度值计算模块还设置为:接收所述任务接收模块发送的每个任务的 任务属性,并根据所述每个任务的任务属性从所述映射表配置模块确定所述任务的优先级和所述调度步长,并根据所述每个任务的调度步长确定所述每个任务的调度值。
在一实施例中,本公开还提供一种任务的调度设备,所述设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序以实现上述方法。
在一实施例中,本公开还提供一种计算机可读存储介质,所述介质存储有计算机程序,所述计算机程序被至少一个处理器执行时实现上述方法。
附图说明
图1是本公开实施例中的一种任务的调度方法流程图;
图2a是本公开实施例中的一种任务的调度装置的结构示意图;
图2b是本公开实施例中的另一种任务的调度装置的结构示意图;
图3是本公开实施例中的一种任务的调度设备的结构示意图。
具体实施方式
实施例一
如图1所示,本公开实施例提供一种任务的调度方法,所述方法包括:
S101,根据每个任务的任务属性确定所述每个任务的调度步长;
S102,根据所述每个任务的调度步长确定所述每个任务的调度值;
S103,按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
本公开实施例中的方法用于多并发多任务系统。
本公开实施例中的方法可以广泛用于按照优先级调度任务的领域,例如:票务系统、订单处理系统等。
本公开实施例通过根据任务的任务属性,确定所述任务的调度步长;根据所述调度步长,确定所述任务的调度值;根据所述调度值,调度所述任务执行, 从而有效降低了相关任务调度方法的实现复杂度,有效解决多并发多任务系统的任务按优先级调度存在的问题,有效提高任务处理效率和响应速度。
在上述实施例的基础上,提出上述实施例的变型。
在本公开实施例中,所述根据每个任务的任务属性确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,确定所述每个任务的优先级;
根据所述每个任务的优先级,确定所述每个任务的调度步长。
在一实施例中,所述优先级由高到低的等级顺序与所述调度步长由小到大的排列顺序对应。
在一实施例中,所述根据每个任务的任务属性,确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,在预设的映射表中匹配出所述每个任务的调度步长;其中,所述映射表为任务属性和任务调度步长的映射关系表。
也就是说,如表1所示,任务属性-任务调度步长映射表(简称为映射表)记录了任务属性、任务的优先级和任务的调度步长的对应关系。本公开实施例中,通过映射表简化了任务优先级的判断,使优先级的设置也更加灵活,从而使队列的维护开销不会随优先级增多而指数级的增长。
表1
Figure PCTCN2018100046-appb-000001
在本公开实施例中,所述调度值的计算公式如下:
调度值=当前系统时间(精确到百毫秒)+调度步长(精确到百毫秒)。
本公开实施例中调度值的计算公式中包含了任务创建时间(当前系统时间)和任务的优先级信息(调度步长),从而确保了优先级最高且最先创建的任务被最先调度。
在本公开实施例中,所述调度步长的大小由所述调度步长的时间段内的任务数量和每个任务的执行时间确定。
也就是说,本公开实施例中,每个优先级任务对应的调度步长,是区分任务优先级的关键,调度步长的设定要确保在此步长时间段内所有该等级的任务都能执行完,这样才能避免发生越级调度。调度步长只影响任务的调度顺序,与任务的实际调度时间无关。其中,调度步长可以以天为单位配置(内部转换为百毫秒)。
在一实施例中,所述按照所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
将所述每个任务和所述每个任务对应的调度值写入任务队列;
对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行。
也就是说,按照调度值从小到大的顺序,调度每个调度值对应的任务,并执行该任务。
在一实施例中,所述任务队列为单队列形式。
如图2a所示,本公开实施例提供一种任务的调度装置,包括:
调度值计算模块210,设置为根据每个任务的任务属性确定所述每个任务的调度步长,以及根据所述每个任务的调度步长确定所述每个任务的调度值;
任务调度执行模块220,设置为按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
如图2b所示,在一实施例中,所述装置还包括:任务接收模块230;
所述任务接收模块230设置为:接收至少一个任务请求,提取每个所述任 务请求中包含的任务的任务属性,并将所述每个所述任务请求中包含的任务的任务属性发送给所述调度值计算模块。
在一实施例中,所述装置还包括:映射表配置模块240;
所述映射表配置模块240设置为:配置每个任务属性对应的任务优先级和调度步长,以供所述调度值计算模块计算每个任务的调度值使用;
所述调度值计算模块210还设置为:接收所述任务接收模块发送的每个任务的任务属性,并根据所述每个任务的任务属性从所述映射表配置模块确定所述任务优先级和所述调度步长,并根据所述每个任务的调度步长确定所述每个任务的调度值。
以下详细说明本公开实施例。
本公开实施例中采用单队列替代相关技术中的多队列,引入了调度步长,根据任务的多个属性来确定任务的优先级和调度步长,只要调度步长足够大,就能确保任务严格按照优先级来调度,同时当高优先级的任务都被执行完成后低优先级任务能被及时调度。
在一实施例中,通过任务属性-任务调度步长映射表,来确定任务的优先级及对应的调度步长;获取任务调度步长后,根据调度值计算公式计算出此任务的调度值,按照调度值从小到大的顺序依次调度任务执行,调度时不需要关心任务的优先级,也不需要关心任务的创建时间顺序。
本公开实施例在实现时,可以采用软件模块的形式。例如本公开实施例中主要包括任务接收模块、映射表配置模块、调度值计算模块、任务队列、以及任务调度执行模块。
所述任务接收模块,设置为接收任务请求,任务请求中包含:任务类型、任务渠道(例如;Web,手机应用程序(Application,App))、以及任务参数等任务属性。任务接收模块提取任务属性,传递给调度值计算模块计算调度值。
所述映射表配置模块,设置为配置任务属性对应的任务优先级和调度步长,供调度值计算模块计算调度值使用,支持多个任务属性联合确定任务优先级和 调度步长。调度步长的设定要确保在此步长时间段内所有该等级的任务都能执行完,这样才能避免发生越级调度,调度步长只影响任务的调度顺序和任务的实际调度时间无关,建议以天为单位配置(内部转换为百毫秒)。
所述调度值计算模块,设置为根据任务的属性查映射表确定任务优先级及调度步长,根据调度值计算公式计算出任务的调度值。调度值的计算公式为:
调度值=当前系统时间(精确到百毫秒)+调度步长(精确到百毫秒)。
所述任务队列存储所有未执行完的任务,按调度值为任务排序,调度值越小优先级越高调度越优先。
所述任务调度执行模块,设置为按调度值从小到大的顺序依次从任务队列中获取任务执行并返回执行结果。
基于以上软件模块,本公开实施例的任务调度过程可以包括以下步骤:
(1)根据任务的业务需求确定任务属性对应的任务优先级和调度步长,通过映射表配置模块配置任务属性和任务优先级及任务调度步长映射关系。
(2)任务接收模块接收任务请求,解析任务属性,将任务属性传递给调度值计算模块。
(3)调度值计算模块根据任务属性查映射表获取任务调度步长。根据调度值计算公式计算出任务调度值,并将任务属性、任务优先级以及调度值写入任务队列。
(4)任务调度执行模块从任务队列中获取任务调度值最小的任务调度执行。
本公开实施例中提供的方法,与相关技术相比,可以解决复杂的多优先级多任务实时系统中任务调度优先级问题,映射表的引入简化了任务优先级的判断,使优先级的设置也更加灵活,任务队列的维护开销不会随优先级增多而指数级的增长;任务调度值的计算方法确保了任务严格按照优先级调度;任务的调度值只在任务进入调度队列前生成,不需要动态调整和修正,保证了任务调度的高效,提高了任务响应时间和处理效率。
举一应用实例说明本公开实施例。
本应用例涉及的任务调度处理过程包括以下部分:
步骤1:根据任务属性的分类,配置业务属性对应的优先级和调度步长映射表。
步骤2:接收任务请求,解析任务属性,转入步骤3。
步骤3:根据任务属性,对照映射表获取优先级和调度步长,并根据调度值计算公式计算出调度值,转入步骤4。
步骤4:将任务的属性和优先级及调度值存储在数据库任务表中。
步骤5:从任务表中获取调度值最小的任务。
步骤6:判断是否存在任务,如果存在任务,则下一步转入步骤7,如果不存在任务,则转入步骤8。
步骤7:执行任务并返回执行结果。
步骤8:休眠一段时间。
实施例二
如图3所示,本公开实施例提供一种任务的调度设备,所述设备包括存储器20和处理器22,所述存储器20存储有任务的调度计算机程序,所述处理器22执行所述计算机程序,以实现上述实施例所述的方法。
本公开实施例通过根据任务的任务属性,确定所述任务的调度步长;根据所述调度步长,确定所述任务的调度值;根据所述调度值,调度所述任务执行,从而有效降低了现有任务调度方法的实现复杂度,有效解决多并发多任务系统的任务按优先级调度问题,提高任务处理效率和响应速度。
在一实施例中,所述处理器22执行所述计算机程序,以实现如下步骤:
根据每个任务的任务属性确定所述每个任务的调度步长;
根据所述每个任务的调度步长确定所述每个任务的调度值;
按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,所述根据每个任务的任务属性确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,确定所述每个任务的优先级;
根据所述每个任务的优先级,确定所述每个任务的调度步长。
其中,所述优先级由高到低的等级顺序与所述调度步长由小到大的排列顺序对应。
在一实施例中,所述根据每个任务的任务属性确定所述每个任务的调度步长,包括:
根据所述每个任务的任务属性,在预设的映射表中匹配出所述每个任务的调度步长;其中,所述映射表为任务属性和任务调度步长的映射关系表。
在一实施例中,所述调度值的计算公式如下:
调度值=任务创建时间+调度步长。
在一实施例中,所述调度步长的大小由所述调度步长的时间段内的任务数量和每个任务的执行时间确定。
在一实施例中,所述按照所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
将所述每个任务和所述每个任务对应的调度值写入任务队列;
对在所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
将所述任务队列中的所有调度值按照由小到大的顺序排列;
根据所有调度值由小到大的排列顺序,调度每个调度值对应的任务并执行。
在一实施例中,所述任务队列为单队列形式。
在一实施例中,在根据每个任务的任务属性之前,还包括:获取至少一个任务的任务属性;
其中,所述获取至少一个任务的任务属性,包括:
接收至少一个任务请求;
解析并获取每个所述任务请求中包含的任务的任务属性;
其中,所述任务属性包括任务类型和任务渠道。
本公开实施例在实现时可以参阅实施例一,也具有相应的技术效果。
实施例三
本公开实施例提供一种计算机可读存储介质,所述介质存储有任务的调度计算机程序,所述计算机程序被至少一个处理器执行时,以实现上述实施例所述的方法。
本公开实施例中计算机可读存储介质可以是随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read-Only Memory,ROM)、可擦可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、电可擦可编程只读存储器(Electrically Erasable Programmable Read Only Memory,EEPROM)存储器、寄存器、硬盘、移动硬盘、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或者本领域已知的任何其他形式的存储介质。可以将一种存储介质藕接至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息;或者该存储介质可以是处理器的组成部分。处理器和存储介质可以位于专用集成电路中。
本公开实施例在实现时可以参阅实施例一和实施例二,也具有相应的技术效果。

Claims (15)

  1. 一种任务的调度方法,包括:
    根据每个任务的任务属性确定所述每个任务的调度步长;
    根据所述每个任务的调度步长确定所述每个任务的调度值;
    按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
  2. 如权利要求1所述的方法,其中,所述根据每个任务的任务属性确定所述每个任务的调度步长,包括:
    根据所述每个任务的任务属性,确定所述每个任务的优先级;
    根据所述每个任务的优先级,确定所述每个任务的调度步长。
  3. 如权利要求2所述的方法,其中,所述优先级由高到低的等级顺序与所述调度步长由小到大的排列顺序对应。
  4. 如权利要求1所述的方法,其中,所述根据每个任务的任务属性确定所述每个任务的调度步长,包括:
    根据所述每个任务的任务属性,在预设的映射表中匹配出所述每个任务的调度步长;
    其中,所述映射表为任务属性和任务调度步长的映射关系表。
  5. 如权利要求1所述的方法,其中,根据所述每个任务的调度步长确定所述每个任务的调度值,包括:
    按照如下计算公式计算所述每个任务的调度值:
    调度值=任务创建时间+调度步长。
  6. 如权利要求1所述的方法,其中,所述调度步长的大小由所述调度步长的时间段内的任务数量和每个任务的执行时间确定。
  7. 如权利要求1-4中任一项所述的方法,其中,所述按照所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:
    将所述每个任务和所述每个任务对应的调度值写入任务队列;
    对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序, 调度每个调度值对应的任务并执行。
  8. 如权利要求7所述的方法,其中,对所述任务队列中的所有调度值排列顺序,根据所有调度值的排列顺序,调度每个调度值对应的任务并执行,包括:将所述任务队列中的所有调度值按照由小到大的顺序排列;
    根据所有调度值由小到大的排列顺序,调度每个调度值对应的任务并执行。
  9. 如权利要求7或8所述的方法,其中,所述任务队列为单队列形式。
  10. 如权利要求1所述的方法,在根据每个任务的任务属性之前,还包括:获取至少一个任务的任务属性;
    其中,所述获取至少一个任务的任务属性,包括:
    接收至少一个任务请求;
    解析并获取每个所述任务请求中包含的任务的任务属性;
    其中,所述任务属性包括任务类型和任务渠道。
  11. 一种任务的调度装置,包括:
    调度值计算模块,设置为根据每个任务的任务属性确定所述每个任务的调度步长,以及根据所述每个任务的调度步长确定所述每个任务的调度值;
    任务调度执行模块,设置为按照所有调度值的排列顺序,调度每个调度值对应的任务并执行。
  12. 如权利要求11所述的装置,还包括:任务接收模块;
    所述任务接收模块设置为:接收至少一个任务请求,提取每个所述任务请求中包含的任务的任务属性,并将所述每个所述任务请求中包含的任务的任务属性发送给所述调度值计算模块。
  13. 如权利要求12所述的装置,还包括:映射表配置模块;
    所述映射表配置模块设置为:配置每个任务属性对应的任务优先级和调度步长,以供所述调度值计算模块计算每个任务的调度值使用;
    所述调度值计算模块还设置为:接收所述任务接收模块发送的每个任务的任务属性,并根据所述每个任务的任务属性从所述映射表配置模块确定所述任 务优先级和所述调度步长,并根据所述每个任务的调度步长确定所述每个任务的调度值。
  14. 一种任务的调度设备,其中,所述设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序,以实现如权利要求1-10中任一项所述的方法。
  15. 一种计算机可读存储介质,其中,所述存储介质存储有计算机程序,所述计算机程序被至少一个处理器执行时,实现如权利要求1-10中任一项所述的方法。
PCT/CN2018/100046 2017-08-11 2018-08-10 任务的调度方法、装置、设备及存储介质 WO2019029721A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP18844234.7A EP3667495A1 (en) 2017-08-11 2018-08-10 Task scheduling method, apparatus and device, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710685266.8 2017-08-11
CN201710685266.8A CN109388482A (zh) 2017-08-11 2017-08-11 任务的调度方法、装置及存储介质

Publications (1)

Publication Number Publication Date
WO2019029721A1 true WO2019029721A1 (zh) 2019-02-14

Family

ID=65272794

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/100046 WO2019029721A1 (zh) 2017-08-11 2018-08-10 任务的调度方法、装置、设备及存储介质

Country Status (3)

Country Link
EP (1) EP3667495A1 (zh)
CN (1) CN109388482A (zh)
WO (1) WO2019029721A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112035237A (zh) * 2020-09-11 2020-12-04 中国银行股份有限公司 审核次序的优化调度方法及装置
US11704744B2 (en) 2018-09-13 2023-07-18 FinancialForce.com, Inc. Server-based architecture for automated generation of suggestive data for report input through algorithmic analysis of historical and geographical profile data
US11778089B2 (en) 2017-12-22 2023-10-03 Certinia Inc. Method and apparatus for generating records from communication data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035818A (zh) * 2013-03-04 2014-09-10 腾讯科技(深圳)有限公司 多任务调度的方法及装置
CN104346215A (zh) * 2013-08-07 2015-02-11 中兴通讯股份有限公司 一种任务调度服务系统及方法
US9612874B1 (en) * 2010-03-26 2017-04-04 Open Invention Network Llc Systems and methods for managing the execution of processing jobs

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104915253B (zh) * 2014-03-12 2019-05-10 中国移动通信集团河北有限公司 一种作业调度的方法及作业处理器
CN105069250A (zh) * 2015-08-24 2015-11-18 哈尔滨工程大学 一种基于调度粒度的任务优先级计算方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9612874B1 (en) * 2010-03-26 2017-04-04 Open Invention Network Llc Systems and methods for managing the execution of processing jobs
CN104035818A (zh) * 2013-03-04 2014-09-10 腾讯科技(深圳)有限公司 多任务调度的方法及装置
CN104346215A (zh) * 2013-08-07 2015-02-11 中兴通讯股份有限公司 一种任务调度服务系统及方法

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11778089B2 (en) 2017-12-22 2023-10-03 Certinia Inc. Method and apparatus for generating records from communication data
US11704744B2 (en) 2018-09-13 2023-07-18 FinancialForce.com, Inc. Server-based architecture for automated generation of suggestive data for report input through algorithmic analysis of historical and geographical profile data
CN112035237A (zh) * 2020-09-11 2020-12-04 中国银行股份有限公司 审核次序的优化调度方法及装置
CN112035237B (zh) * 2020-09-11 2023-10-24 中国银行股份有限公司 审核次序的优化调度方法及装置

Also Published As

Publication number Publication date
CN109388482A (zh) 2019-02-26
EP3667495A1 (en) 2020-06-17

Similar Documents

Publication Publication Date Title
CN108776934B (zh) 分布式数据计算方法、装置、计算机设备及可读存储介质
CN107977268B (zh) 人工智能的异构硬件的任务调度方法、装置及可读介质
WO2019128535A1 (zh) 消息管理方法、设备及存储介质
US10754706B1 (en) Task scheduling for multiprocessor systems
WO2017127976A1 (zh) 一种用于增量式学习云系统的训练、调度方法及相关设备
US11436050B2 (en) Method, apparatus and computer program product for resource scheduling
CN112162865A (zh) 服务器的调度方法、装置和服务器
CN110569252B (zh) 一种数据处理系统及方法
CN111338791A (zh) 集群队列资源的调度方法、装置、设备及存储介质
CN106557369A (zh) 一种多线程的管理方法及系统
WO2019029721A1 (zh) 任务的调度方法、装置、设备及存储介质
CN105022668B (zh) 一种作业调度方法及系统
CN114579285B (zh) 一种任务运行系统、方法及计算设备
CN110830964B (zh) 信息调度方法、物联网平台和计算机可读存储介质
CN111240864A (zh) 异步任务处理方法、装置、设备及计算机可读存储介质
CN113296874A (zh) 一种任务的调度方法、计算设备及存储介质
CN113391911B (zh) 一种大数据资源动态调度方法、装置和设备
EP4123449A1 (en) Resource scheduling method and related device
CN109739634A (zh) 一种原子任务执行方法及装置
JP5987987B2 (ja) リソース管理システム、リソース管理方法、およびプログラム
CN109189581B (zh) 一种作业调度方法和装置
CN110109986B (zh) 任务处理方法、系统、服务器及任务调度系统
CN106648874B (zh) 一种批量任务的处理方法及装置
US9659041B2 (en) Model for capturing audit trail data with reduced probability of loss of critical data
CN115168040A (zh) 一种作业抢占调度方法、装置、设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18844234

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2018844234

Country of ref document: EP

Effective date: 20200311