CN108762903A - A kind of preemptive type method for scheduling task and system towards magnanimity working node - Google Patents

A kind of preemptive type method for scheduling task and system towards magnanimity working node Download PDF

Info

Publication number
CN108762903A
CN108762903A CN201810500086.2A CN201810500086A CN108762903A CN 108762903 A CN108762903 A CN 108762903A CN 201810500086 A CN201810500086 A CN 201810500086A CN 108762903 A CN108762903 A CN 108762903A
Authority
CN
China
Prior art keywords
task
working node
priority
allocated
busy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810500086.2A
Other languages
Chinese (zh)
Inventor
王衡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Feixun Information Technology Co Ltd
Original Assignee
Sichuan Feixun 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 Sichuan Feixun Information Technology Co Ltd filed Critical Sichuan Feixun Information Technology Co Ltd
Priority to CN201810500086.2A priority Critical patent/CN108762903A/en
Publication of CN108762903A publication Critical patent/CN108762903A/en
Pending legal-status Critical Current

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
    • 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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. 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/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a kind of preemptive type method for scheduling task towards magnanimity working node, including:A task to be allocated is obtained from current highest priority task queue to be allocated;Judge whether there is vacant working node in current idle working node pond;If so, task to be allocated to be distributed to the working node chosen from vacant working node pool;Otherwise, a busy working node of purpose is chosen from busy working node pond;In the task that the busy working node of the purpose executes, the priority of at least one task is less than the priority of task to be allocated;The being less than task priority to be allocated of task for recycling the busy working node of purpose, the busy working node of purpose is distributed to by task to be allocated;The priority of the task of recycling is increased into a grade, and puts it into corresponding priority task queue to be allocated.Through the invention, the scheduling for realizing magnanimity working node and task priority reduces the complexity of scheduling, improves the working efficiency of scheduling.

Description

A kind of preemptive type method for scheduling task and system towards magnanimity working node
Technical field
The present invention relates to task scheduling field more particularly to a kind of preemptive type task scheduling sides towards magnanimity working node Method and system.
Background technology
With the continuous development of shared economy and cloud computing, following task scheduling is no longer towards the limited work in enterprise Make the task scheduling of node but on object platform magnanimity (million grades of millions) working node task scheduling.Mission requirements By can plan or tuneable scheduler task, the rigid priority requirements for the driving that becomes bidding.
Existing method for scheduling task includes mainly following two aspects:
Magnanimity working node is scheduled:Currently generally LFU algorithms is used to carry out load balancing and preemption scheduling.
The implementation of task based access control priority scheduling:It generally uses complete fairness policy (CFS) or is arranged using priority Sequence structure, such as red black tree carry out priority scheduling.
Following three points are often based upon for current task scheduling (such as load-balancing algorithm) to assume
1, assume that all task priorities are consistent;
2, the working efficiency of all working node is consistent, and all task workloads are consistent.
3, limited operation node.
Based on above 3 points it is assumed that generally using wheel disc algorithm (round robin) in node selection, algorithm is multiple at this time Miscellaneous degree is O (1).
When Article 2 assumes invalid, the prior art generally uses LFU algorithms, it is assumed that working node is c, then Single working node selects complexity for O (ln (c)).
When assuming invalid for first, there are following two problems for existing implementation method:
When working node task is saturated, the low priority task arrived first at is distributed first, and then high priority Task reaches, and low priority task can be replaced out again, cause work efficiency drop.
When high-priority task reaches, it is O (ln (w)) that task, which seizes selection algorithm complexity, and w is ongoing Business quantity.
When one, two, three is all invalid, then total algorithm complexity is m* (ln (w)+ln (c)+ln (q)) at this time, Middle m is that task issues number in the unit time, and q is the number of tasks of waiting task distribution, w and c meanings are same as above.This dispatching algorithm is complicated Though degree is still difficult to realize with existing computing resource in practical applications to O (Nlog (N)) grade.
It is low currently without discovery algorithm complexity, and disclosed combination magnanimity working node equity dispatching and task priority The scheduling scheme of preemption scheduling.
Invention content
The object of the present invention is to provide a kind of preemptive type method for scheduling task and system towards magnanimity working node so that The equity dispatching of magnanimity working node and the preemption scheduling of task priority are achieved simultaneously, and the complexity of dispatching algorithm It is low, real-time is high.
On the one hand, the invention discloses a kind of preemptive type method for scheduling task towards magnanimity working node, including:From working as A task to be allocated is obtained in preceding highest priority task queue to be allocated;Judge whether deposited in current idle working node pond Available free working node;When there are when vacant working node, the task to be allocated is distributed in current idle working node pond To the working node chosen from the vacant working node pool;When there is no vacant working sections in current idle working node pond When point, a busy working node of purpose is chosen from busy working node pond;What the busy working node of purpose executed appoints In business, the priority of at least one task is less than the priority of the task to be allocated;Recycle the busy work section of the purpose One of point is less than the task of the task priority to be allocated, and the task to be allocated is distributed to the busy work of the purpose Node;The priority of the task of the recycling is increased into a grade, and puts it into corresponding priority task team to be allocated Row.
Preferably, it is also wrapped before obtaining a task to be allocated in current highest priority task queue to be allocated It includes:A task queue is created for each priority, when there is task to need scheduling, according to the needing to dispatch of the task Priority, by the task queue for needing dispatching for task to place corresponding priority.
Preferably, when vacant working node is not present in current idle working node pond, from busy working node pond Choosing a busy working node of purpose includes:When vacant working node is not present in current idle working node pond, from numerous N number of working node is randomly selected in busy working node pond;From all tasks that N number of working node of extraction executes, one is chosen The minimum task of a priority task as a purpose;Compare the priority height of the purpose task and the task to be allocated; When the priority of the purpose task is less than the priority of the task to be allocated, determine busy where the purpose task Busy working node for the purpose of working node;When the priority of the purpose task is higher than the priority of the task to be allocated When, N number of working node is randomly selected from the busy working node pond again, to get the busy work section of the purpose Point continues to randomly select again, until the number randomly selected reaches preset times if not getting yet;When random The number of extraction does not get the busy working node of the purpose yet after reaching preset number, then puts the task to be allocated The task queue to be allocated for returning corresponding priority, wait for new scheduler task arrival or the vacant working node pool in occur it is empty Allocation processing is scheduled when not busy working node again.
Preferably, described from all tasks that N number of working node of selection executes, choose minimum times of a priority Task includes as a purpose for business:Judge the number of the minimum task of priority in all tasks that the N number of working node chosen executes Amount whether more than one;When the minimum task of priority in all tasks that the N number of working node executes only there are one when, choosing Task of taking the priority minimum task as a purpose;When priority is most in all tasks that the N number of working node executes When low task has multiple, the performance level of the multiple task is obtained, and it is minimum to choose performance level in the multiple task Task as the purpose task.
Preferably, several idle class queues are divided in the vacant working node pool, and by the vacant working section Vacant working node in point pond is distributed by idle degree to corresponding idle class queue.
Preferably, it is described when in current idle working node pond there are when vacant working node, by the task to be allocated Distributing to the working node chosen from the vacant working node pool includes:It is idle when existing in current idle working node pond When working node, a vacant working node is chosen from the highest idle queues of current idle grade as target vacant working Node;The task to be allocated is distributed into the target free time working node.
On the other hand, the invention also discloses a kind of preemptive type task scheduling systems towards magnanimity working node, including: Task acquiring unit, for obtaining a task to be allocated from current highest priority task queue to be allocated;Judging unit, For judging whether there is vacant working node in current idle working node pond;First task processing unit, for when current There are when vacant working node in vacant working node pool, the task to be allocated is distributed to from the vacant working node pool The working node of middle selection;Second task processing unit, for when there is no vacant working sections in current idle working node pond When point, task scheduling processing is carried out to the task to be allocated;It specifically includes:Working node chooses module, for when current empty When vacant working node being not present in not busy working node pond, the busy work section of a purpose is chosen from busy working node pond Point;In the task that the busy working node of purpose executes, the priority of at least one task is less than the task to be allocated Priority;Task recycling module, one for recycling the busy working node of the purpose are excellent less than the task to be allocated The task of first grade;Processing module is seized, for distributing to the task to be allocated from the busy working node of the purpose;By institute The priority for stating the task of task recycling module recycling increases a grade, and puts it into corresponding priority task to be allocated Queue.
Preferably, the working node selection module includes:Sampling submodule, is used in current idle working node pond not There are when vacant working node, N number of working node is randomly selected from busy working node pond;Purpose task chooses submodule, For from all tasks that N number of working node of extraction executes, choosing the minimum task of priority task as a purpose; Priority comparison sub-module, for the priority of the purpose task and the task to be allocated height;First node is true Stator modules are used to, when the priority of the purpose task is less than the priority of the task to be allocated, determine the purpose Busy working node for the purpose of busy working node where task;Second node determination sub-module, for appointing when the purpose When the priority of business is higher than the priority of the task to be allocated, by the sampling submodule again from the busy work section Point randomly selects N number of working node in pond, to get the busy working node of the purpose, if not getting yet, continues Again it randomly selects, until the number randomly selected reaches preset times;It is described to seize processing module, it is additionally operable to when described After the number that sampling submodule is randomly selected reaches preset number, the second node determination sub-module does not get described yet When the busy working node of purpose, the task to be allocated is put back to the task queue of corresponding priority, waits for new scheduler task Occur being scheduled allocation processing again when vacant working node in arrival or the vacant working node pool.
Preferably, the judging unit is additionally operable to priority in the N number of working node for judging the sampling submodule extraction The quantity of minimum task whether more than one;When priority in N number of working node minimum task only there are one when, institute It states purpose task selection submodule and chooses the minimum task of priority task as a purpose;When in N number of working node When the minimum task of priority has multiple, the purpose task chooses the performance level that submodule obtains the multiple task, and Performance level is minimum in the multiple task task is chosen as the purpose task.
Preferably, the preemptive type task scheduling system towards magnanimity working node further includes:Idle queues divide single Member, for dividing several idle class queues in the vacant working node pool, and will be in the vacant working node pool Vacant working node is distributed by idle degree to corresponding idle class queue;The first task processing unit includes:Mesh Mark node determining module, for when in current idle working node pond there are when vacant working node, it is highest from idle grade A vacant working node is chosen in idle queues as target free time working node;First task distribution module is used for institute It states task to be allocated and distributes to the target free time working node.
The present invention is included at least with the next item down advantageous effect:
(1) the magnanimity working node in the present invention, different work sections has been divided into according to respective working condition Point pond, and dispatching for task, have been placed on the task queue to be allocated of corresponding priority, every time to be allocated also according to its priority All it is preferentially to obtain task to be allocated in the high task queue of priority to be allocated when task is scheduled processing, meets The demand of user, and equity dispatching is realized for magnanimity working node, the system performance of scheduling is optimized, scheduling is improved Efficiency.
(2) present invention passes through the improvement to integrated scheduling each section, such as the queue assignment of task priority, different operating The setting of node pool and in the case of no vacant working node, preemption scheduling processing of task based access control priority etc., from And by magnanimity task requests magnanimity working node (magnanimity:Million grades) the control of dispatching algorithm complexity in O (1), comparison is existing There are dispatching algorithm complexity O ((ln (w)+ln (c)+ln (q)), the work for improving scheduling system of decades of times of the present invention of technology Make efficiency.
(3) it in the case that the present invention is for no vacant working node, uses sampling and chooses N number of working node, then Priority ratio is carried out compared with obtaining the low task of priority ratio task priority to be allocated, then carry out recycling replacement, tune is seized in realization Degree.In view of the magnanimity rank of working node, by the way of sample process, the efficiency of dispatch deal is greatly improved.
(4) present invention is also provided with the number of sampling, in the case where sampling does not get target operation node, can weigh Multiple sampling, until reaching preset number.The setting of preset times substantially increases the possibility that sampling obtains destination node.
(5) present invention has divided the idle queues of different idle grades for the idle degrees of vacant working node, to Vacant working node in vacant working node pool is distributed to the idle queues of corresponding grade, convenient for follow-up work scheduling point Match, promotes dispatch deal efficiency.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these attached drawings His attached drawing.
Fig. 1 is the flow chart of the preemptive type method for scheduling task embodiment of the invention towards magnanimity working node;
Fig. 2 is the flow chart of preemptive type method for scheduling task another embodiment of the invention towards magnanimity working node;
Fig. 3 is the flow chart of preemptive type method for scheduling task another embodiment of the invention towards magnanimity working node;
Fig. 4 is the block diagram of the preemptive type task scheduling system embodiment of the invention towards magnanimity working node;
Fig. 5 is the block diagram of the preemptive type task scheduling system FIELD Embodiments of the invention towards magnanimity working node;
Fig. 6 is the block diagram of preemptive type task scheduling system another embodiment of the invention towards magnanimity working node.
Reference numeral:
100-- task acquiring units;200-- judging units;300-- first task processing units;At the second tasks of 400-- Manage unit;500-- idle queues division units;310-- destination node determining modules;320-- first task distribution modules; 410-- working nodes choose module;420-- task recycling modules;430-- seizes processing module;411-- sampling submodules; The task of 412-- mesh chooses submodule;412-- priority comparison sub-modules;414-- first node determination sub-modules;415-- Two node determination sub-modules.
Specific implementation mode
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into It is described in detail to one step, it is clear that the described embodiments are only some of the embodiments of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts All other embodiment, shall fall within the protection scope of the present invention.
The invention discloses a kind of preemptive type method for scheduling task towards magnanimity working node, embodiment as shown in Figure 1, Including:
S101 obtains a task to be allocated from current highest priority task queue to be allocated;
S102 judges whether there is vacant working node in current idle working node pond;
S103 when in current idle working node pond there are when vacant working node, by the task to be allocated distribute to from The working node chosen in the vacant working node pool;
S104 chooses when vacant working node is not present in current idle working node pond from busy working node pond One busy working node of purpose;In the task that the busy working node of purpose executes, the priority of at least one task Less than the priority of the task to be allocated;
S105 recycles the being less than the task priority to be allocated of task of the busy working node of the purpose, by institute It states task to be allocated and distributes to the busy working node of the purpose;
The priority of the task of the recycling is increased a grade by S106, and it is to be allocated to put it into corresponding priority Task queue.
In the present embodiment, magnanimity working node is allocated in two ponds, one is vacant working node pool, the inside storage The working node of task can also be performed, the other is busy working node pond, the work that the work that the inside is stored is saturated Node.One working node often may be performed simultaneously multiple tasks, if a working node reaches when executing 3 task amounts Saturation state, if that when certain working node has only carried out 1 task, then the working node can be placed on vacant working Node pool, because it can also receive 1-2 task.Certainly, each working node can also update certainly with the execution of task Once there is task execution complete in some busy working node in working node pond residing for oneself, such as busy working node pond At then vacant working node pool will be released into, likewise, if certain vacant working node in vacant working node pool Reach saturation state after the task of being assigned, then will be updated in busy working node pond.Moreover, for each of scheduling Task has a corresponding priority, according to the priority of each task, each task is placed into corresponding priority and is waited for In distribution queue.
That is in the above-described embodiments, obtained from current highest priority task queue to be allocated in step S100 Further include before one task to be allocated:A task queue is created for each priority, when there is task to need scheduling, root According to the priority of the needing to dispatch of the task, by the task queue for needing dispatching for task to place corresponding priority.
When practical execution task scheduling distribution, one to be allocated is first obtained from current highest priority queue to be allocated Business, the priority of task to be allocated is higher, then more can preferentially be scheduled distribution.Get the high task to be allocated of priority Afterwards, first look in vacant working node pool either with or without vacant working node, if any, then selected from vacant working node pool A vacant working node is taken to execute the task to be allocated, task scheduling to be allocated in this way is completed.And if the vacant working When there is no vacant working node in node pool, then with regard to needing to go to carry out preemptive type task tune from busy working node pond It spends.Specifically, a busy working node of purpose is chosen from busy working node pond, and the busy working node of this purpose The priority of at least one task in all tasks of its execution is then needed to be less than the priority of task to be allocated.Find this After the busy working node of purpose, then one priority of recycling in task that the busy working node of the purpose is carrying out is less than Then the task to be allocated is distributed to the busy working node by the task of task priority to be allocated, by recycling appointing back The priority of business increases a grade, is then placed in the task queue to be allocated of corresponding priority, waits for subsequent scheduling Distribution.
Another embodiment of the method for the present invention, as shown in Fig. 2, including:
S201 obtains a task to be allocated from current highest priority task queue to be allocated;
S202 judges whether there is vacant working node in current idle working node pond;
S203 when in current idle working node pond there are when vacant working node, by the task to be allocated distribute to from The working node chosen in the vacant working node pool;
S204 is random from busy working node pond when vacant working node is not present in current idle working node pond Extract N number of working node;
S205 chooses the minimum task conduct of a priority from all tasks that N number of working node of extraction executes Purpose task;
S206 judges whether the priority of the purpose task is higher than the priority of the task to be allocated;
S207 determines that the purpose is appointed when the priority of the purpose task is less than the priority of the task to be allocated Busy working node for the purpose of busy working node where being engaged in, enters step S210;
S208 judges to randomly select when the priority of the purpose task is higher than the priority of the task to be allocated Whether number reaches preset number, if so, entering step S209, otherwise, return to step S204 is again from the busy work N number of working node is randomly selected in node pool;
The task to be allocated is put back to the task queue to be allocated of corresponding priority by S209, waits for arriving for new scheduler task Come or the vacant working node pool in occur being scheduled allocation processing again when vacant working node;
S210 recycles the purpose task in the busy working node of the purpose, and the task to be allocated is distributed to the mesh Busy working node;
The priority of the purpose task of the recycling is increased a grade by S211, and is put it into corresponding priority and waited for Distribute task queue.
In the present embodiment, specifically describe when vacant working node being not present in vacant working node pool, how from busy The busy working node of purpose is chosen in working node pond.Specifically, N number of work section is first extracted from busy working node pond at random Point chooses the minimum task of priority task as a purpose then from this N number of working node.Then omparison purpose The priority height of business and task to be allocated, if the priority of purpose task is less than the priority of the task to be allocated, It determines that busy working node for the purpose of the busy working node where the purpose task, is then returned from the busy working node The purpose task is received, and task to be allocated is distributed into the busy working node.And that the purpose task recycled is then first by it Priority increases a grade, is then placed into again in corresponding priority task queue to be allocated.
Another embodiment of the method for the present invention, as shown in figure 3, including:
S301 obtains a task to be allocated from current highest priority task queue to be allocated;
S302 judges whether there is vacant working node in current idle working node pond;
S303 when in current idle working node pond there are when vacant working node, by the task to be allocated distribute to from The working node chosen in the vacant working node pool;
S304 is random from busy working node pond when vacant working node is not present in current idle working node pond Extract N number of working node;
Whether not S305 judges the quantity of the minimum task of priority in all tasks that the N number of working node chosen executes Only one, if so, entering step S307, otherwise enter step S306;
S306 chooses the minimum task of priority task as a purpose;
S307 obtains the performance level of the multiple task, and chooses the task that performance level is minimum in the multiple task As the purpose task;
S308 judges whether the priority of the purpose task is higher than the priority of the task to be allocated;
S309 determines that the purpose is appointed when the priority of the purpose task is less than the priority of the task to be allocated Busy working node for the purpose of busy working node where being engaged in;Enter step S312;
S310 judges to randomly select when the priority of the purpose task is higher than the priority of the task to be allocated Whether number reaches preset number, if so, entering step S311, otherwise, return to step S304 is again from the busy work N number of working node is randomly selected in node pool;
The task to be allocated is put back to the task queue to be allocated of corresponding priority by S311, waits for arriving for new scheduler task Come or the vacant working node pool in occur being scheduled allocation processing again when vacant working node;
S312 recycles the purpose task in the busy working node of the purpose, and the task to be allocated is distributed to the mesh Busy working node;
The priority of the purpose task of the recycling is increased a grade by S313, and is put it into corresponding priority and waited for Distribute task queue.
In above-described embodiment, a task queue is created for each priority first, when a task needs scheduling, is appointed Business is placed into the queue to be allocated of corresponding priority.It then, can be from current highest priority when asking working node resource every time Queue obtains task to be allocated.
If the task to be allocated got is task (a), when being allocated to task a, from vacant working node pool It chooses a working node and distributes to task execution, and update the pond where working node.
If not having vacant working node in vacant working node pool, s work section is randomly selected from busy queue Point chooses the wherein minimum task (x) of priority, if this task (x) priority is less than task (a) to be allocated, it is low to recycle this Priority tasks (x) promote level-one its (x) priority, are put into corresponding queue to be allocated, and task (a) to be allocated is distributed to Relevant work node;If there is multiple tasks (x1, x2) to possess equal priority and selected less than task (a) to be allocated wherein complete It is recycled at the spending minimum of task;S working node weight is randomly selected again if not finding the task less than task (a) Multiple above step, until randomly selecting number and reaching r times.Such as all fail to choose by r times and can seize task (x), then will Task (a) puts back to queue to be allocated, and new task is waited for reach or occur being dispatched again when vacant working node.
Another embodiment of the present invention will be drawn in the vacant working node pool based on any of the above embodiments Divide several idle class queues, and the vacant working node in the vacant working node pool is distributed by idle degree to right The idle class queue answered.Step S300 in so any of the above-described embodiment is idle when existing in current idle working node pond When working node, the task to be allocated, which is distributed to the working node chosen from the vacant working node pool, includes:When There are when vacant working node in current idle working node pond, one is chosen from the highest idle queues of current idle grade Vacant working node is as target free time working node;The task to be allocated is distributed into the target free time working node. When that is carrying out task scheduling processing every time, vacant working node is preferentially chosen from most idle task queue and is appointed Business distribution.Certainly, each working node can also be distributed according to the task of itself and performance oneself will be updated to corresponding work Make in node work pool and corresponding working node queue.
Specifically, such as a working node may be performed simultaneously 5 task amounts, then according to the idle journey of working node Vacant working node division can be that (the completely idle state of working node can receive 5 tasks for completely idle queue by degree Amount), (working node in the queue is executing a task, also 4 task amount skies to level-one idle queues It is not busy), (working node in the queue is executing a task, also 3 task amount skies to two level idle queues It is not busy), (working node in the queue is executing a task, also 2 task amount skies to three-level idle queues It is not busy), (working node in the queue is executing a task, also 1 task amount sky to level Four idle queues It is not busy).When carrying out task scheduling processing, completely idle working node can be preferentially chosen from completely idle queue to distribute Task, and the completely idle working node can automatically update after having received a task in level-one idle queues.Such as There is no working node in the completely idle queue of fruit, then just choosing vacant working node, successively class from level-one idle queues It pushes away.Certainly, for the busy working node in busy working node pond, once there is task execution to finish, the busy working node Task amount can be then vacated, then will be released in vacant working node pool in corresponding idle queues.
In addition, for task to be allocated, the task team to be allocated of different priorities can be also established according to different priority Row, and in the task queue to be allocated of same level-one, can according to the sequencing of time to the task to be allocated of same level-one into Row arrangement, also can be combined with the performance level of task to optimize the sequence of same level-one task queue to be allocated, specifically, such as Being recycled from busy working node for task, some possibility complete 30%, 50% or 80% etc., that is to say, that recycling Task is typically all to have been completed the task of a part, and corresponding task team to be allocated is being placed for this partial task When in row, the high task of completeness can be come queue forefront, and for the identical brother task of completeness then according to the time Sequencing is ranked up.In this way, the task queue to be allocated progress time for same level-one combines the mode of completeness to sort, Convenient for being as early as possible assigned task of part is completed as early as possible, the length of queue is reduced, sequence is optimized.
Based on the same technical idea, the invention also discloses a kind of preemptive type task schedulings towards magnanimity working node The dispatching method in any of the above-described dispatching method embodiment can be used to carry out task scheduling processing for system, the scheduling system, specifically , as shown in figure 4, the preemptive type task scheduling system towards magnanimity working node of the present invention includes:Task acquiring unit 100, for obtaining a task to be allocated from current highest priority task queue to be allocated;Judging unit 200, for sentencing Whether there is vacant working node in disconnected current idle working node pond;First task processing unit 300, for working as current idle There are when vacant working node in working node pond, the task to be allocated is distributed to and is selected from the vacant working node pool The working node taken;Second task processing unit 400, for when there is no vacant working nodes in current idle working node pond When, task scheduling processing is carried out to the task to be allocated;It specifically includes:Working node chooses module 410, for when current empty When vacant working node being not present in not busy working node pond, the busy work section of a purpose is chosen from busy working node pond Point;In the task that the busy working node of purpose executes, the priority of at least one task is less than the task to be allocated Priority;Task recycling module 420, one for recycling the busy working node of the purpose is less than the task to be allocated The task of priority;Processing module 430 is seized, for distributing to the task to be allocated from the busy work section of the purpose Point;The priority for the task that the task recycling module 420 is recycled increases a grade, and puts it into corresponding priority Task queue to be allocated.
The scheduling system of the present embodiment carries out mission dispatching with priority ranking, and working node is carried out in conjunction with equity dispatching Selection;In working node selection:Equity dispatching under the enough non-preemptive patterns of vacant working node resource, Yi Ji The selection of the busy working node of carry out purpose in the case of vacant working node resource deficiency and seize scheduling.
Another embodiment of present system, on the basis of the embodiment of above-mentioned scheduling system, as shown in figure 5, the work Making node selection module 410 includes:Sampling submodule 411, for vacant working section to be not present in current idle working node pond When point, N number of working node is randomly selected from busy working node pond;Purpose task chooses submodule 412, is used for from extraction In all tasks that N number of working node executes, the minimum task of priority task as a purpose is chosen;Priority ratio is more sub Module 413, for the priority of the purpose task and the task to be allocated height;First node determination sub-module 414, it is used to, when the priority of the purpose task is less than the priority of the task to be allocated, determine the purpose task institute Busy working node for the purpose of busy working node;Second node determination sub-module 415, for when the purpose task When priority is higher than the priority of the task to be allocated, by the sampling submodule 411 again from the busy work section Point randomly selects N number of working node in pond, to get the busy working node of the purpose, if not getting yet, continues Again it randomly selects, until the number randomly selected reaches preset times;It is described to seize processing module 430, it is additionally operable to work as After the number that the sampling submodule 411 is randomly selected reaches preset number, the second node determination sub-module 415 is not yet When getting the busy working node of the purpose, the task to be allocated is put back to the task queue of corresponding priority, is waited for new Occur being scheduled allocation processing again when vacant working node in the arrival of scheduler task or the vacant working node pool.
In the present embodiment, in the case of there is no vacant working node in vacant working node pool, the side for the sampling taken Formula relatively carries out preemption scheduling in conjunction with priority ratio.Specifically, since working node amount is big, therefore magnanimity rank is not having In the case of available free working node, the mode of sampling is taken to choose N number of busy working node from busy working node pond, so The minimum task of a priority is chosen from N number of busy working node of extraction afterwards, then this by selection is preferential again The minimum task of grade carries out priority ratio compared with if the priority of task to be allocated is higher than the priority chosen with task to be allocated Minimum task, then just directly recycling the minimum task of the priority, it is minimum that task to be allocated is distributed to the priority Working node where task, and the minimum task of this priority recycled can then increase a priority level, then place Into the task queue to be allocated of respective priority.And if the priority for the minimum task of this priority chosen is higher than The priority of task to be allocated, then just need N number of busy working node is extracted from busy working node pond again, then after The continuous working node for therefrom choosing lowest priority is compared, and so on, until finding the priority than task to be allocated Low task, and repeat the number extracted and be no more than preset number, once the number extracted again has reached preset number, Also again without choosing to the task lower than the priority of task to be allocated, then just still the task to be allocated is put back to In the queue to be allocated of corresponding priority, waits in new task arrival or vacant working node pool and vacant working node occur It is scheduled processing again afterwards.
Preferably, on the basis of above-mentioned scheduling system embodiment, the judging unit 200 is additionally operable to judge the sampling Submodule 411 extract N number of working node in the minimum task of priority quantity whether more than one;When N number of work When in node there are one the minimum tasks of priority, it is minimum that the purpose task selection submodule 412 chooses the priority Task task as a purpose;When the minimum task of priority in N number of working node has multiple, the purpose task choosing It takes submodule 412 to obtain the performance level of the multiple task, and chooses the task that performance level is minimum in the multiple task As the purpose task.
It, therefore, can be according to task in view of the minimum task of multiple priority is likely to occur in N number of working node of extraction Performance level further screened, choose that minimum task of completeness and recycled, after increasing priority level Corresponding queue to be allocated is put back to again, and the task institute that the minimum completeness of priority that task to be allocated is distributed to selection is minimum Working node.
The present invention dispatches another embodiment of system, based on any of the above embodiments, as shown in fig. 6, the face Further include to the preemptive type task scheduling system of magnanimity working node:Idle queues division unit 500, in the idle work Make to divide several idle class queues in node pool, and by the vacant working node in the vacant working node pool by the free time Degree is distributed to corresponding idle class queue;The first task processing unit 300 includes:Destination node determining module 310, For when, there are when vacant working node, one being chosen from the highest idle queues of idle grade in current idle working node pond A vacant working node is as target free time working node;First task distribution module 320, for dividing the task to be allocated Target free time working node described in dispensing.
The scheduling system embodiment of the present invention is corresponding with the dispatching method embodiment of the present invention, and dispatching method of the present invention is real The technical detail for applying example can equally be well applied to the scheduling system embodiment of the present invention, repeats, repeats no more to reduce.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art God and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (10)

1. a kind of preemptive type method for scheduling task towards magnanimity working node, which is characterized in that including:
A task to be allocated is obtained from current highest priority task queue to be allocated;
Judge whether there is vacant working node in current idle working node pond;
When, there are when vacant working node, the task to be allocated being distributed to from the free time in current idle working node pond The working node chosen in working node pond;
When vacant working node is not present in current idle working node pond, a purpose is chosen from busy working node pond Busy working node;In the task that the busy working node of purpose executes, the priority of at least one task is less than described The priority of task to be allocated;
The being less than the task priority to be allocated of task for recycling the busy working node of the purpose, will be described to be allocated Task distributes to the busy working node of the purpose;
The priority of the task of the recycling is increased into a grade, and puts it into corresponding priority task team to be allocated Row.
2. a kind of preemptive type method for scheduling task towards magnanimity working node according to claim 1, which is characterized in that Further including before obtaining a task to be allocated in current highest priority task queue to be allocated:
A task queue is created for each priority, when there is task to need scheduling, according to the needing to dispatch of the task Priority, by the task queue for needing the dispatching of the task to place corresponding priority.
3. a kind of preemptive type method for scheduling task towards magnanimity working node according to claim 1, which is characterized in that When vacant working node is not present in current idle working node pond, it is busy that a purpose is chosen from busy working node pond Working node includes:
When vacant working node is not present in current idle working node pond, randomly selected from busy working node pond N number of Working node;
From all tasks that N number of working node of extraction executes, the minimum task of priority task as a purpose is chosen;
Compare the priority height of the purpose task and the task to be allocated;
When the priority of the purpose task is less than the priority of the task to be allocated, where determining the purpose task Busy working node for the purpose of busy working node;
When the priority of the purpose task is higher than the priority of the task to be allocated, again from the busy working node N number of working node is randomly selected in pond, to get the busy working node of the purpose, if not getting yet, continues weight It newly randomly selects, until the number randomly selected reaches preset times;
It does not get the busy working node of the purpose yet after the number randomly selected reaches preset number, is then waited for described Distribution task puts back to the task queue to be allocated of corresponding priority, waits for the arrival of new scheduler task or the vacant working node Occur being scheduled allocation processing again when vacant working node in pond.
4. a kind of preemptive type method for scheduling task towards magnanimity working node according to claim 3, which is characterized in that It is described from all tasks that N number of working node of selection executes, choose the minimum task of priority task as a purpose Including:
Judge choose N number of working node execute all tasks in the minimum task of priority quantity whether more than one;
When the minimum task of priority in all tasks that the N number of working node executes only there are one when, choose described preferential The minimum task of grade task as a purpose;
When the minimum task of priority in all tasks that N number of working node executes has multiple, the multiple is obtained The performance level of business, and performance level is minimum in the multiple task task is chosen as the purpose task.
5. according to a kind of preemptive type method for scheduling task towards magnanimity working node of claim 1-4 any one of them, It is characterized in that, several idle class queues is divided in the vacant working node pool, and will be in the vacant working node pool Vacant working node distributed to corresponding idle class queue by idle degree.
6. a kind of preemptive type method for scheduling task towards magnanimity working node according to claim 5, which is characterized in that It is described when, there are when vacant working node, the task to be allocated being distributed to from the free time in current idle working node pond The working node chosen in working node pond includes:
When, there are when vacant working node, being selected from the highest idle queues of current idle grade in current idle working node pond Take a vacant working node as target free time working node;
The task to be allocated is distributed into the target free time working node.
7. a kind of preemptive type task scheduling system towards magnanimity working node, which is characterized in that including:
Task acquiring unit, for obtaining a task to be allocated from current highest priority task queue to be allocated;
Judging unit, for judging whether there is vacant working node in current idle working node pond;
First task processing unit, for when there are when vacant working node, being waited for described point in current idle working node pond The working node chosen from the vacant working node pool is distributed to task;
Second task processing unit, for when vacant working node is not present in current idle working node pond, waiting for described Distribution task carries out task scheduling processing, specifically includes:
Working node chooses module, is used for when vacant working node is not present in current idle working node pond, from busy work Make to choose a busy working node of purpose in node pool;In the task that the busy working node of purpose executes, at least one The priority of a task is less than the priority of the task to be allocated;
Task recycling module, one for recycling the busy working node of the purpose is less than the task priority to be allocated Task;
Processing module is seized, for distributing to the task to be allocated from the busy working node of the purpose;By the task The priority of the task of recycling module recycling increases a grade, and puts it into corresponding priority task queue to be allocated.
8. a kind of preemptive type task scheduling system towards magnanimity working node according to claim 7, which is characterized in that The working node chooses module:
Sampling submodule, when for vacant working node to be not present in current idle working node pond, from busy working node pond In randomly select N number of working node;
Purpose task chooses submodule, for from all tasks that N number of working node of extraction executes, choosing a priority Minimum task task as a purpose;
Priority comparison sub-module, for the priority of the purpose task and the task to be allocated height;
First node determination sub-module, the priority for being less than the task to be allocated when the priority of the purpose task When, determine busy working node for the purpose of the busy working node where the purpose task;
Second node determination sub-module, the priority for being higher than the task to be allocated when the priority of the purpose task When, N number of working node is randomly selected from the busy working node pond by the sampling submodule again, to get The busy working node of purpose continues to randomly select again if not getting yet, until the number randomly selected reaches pre- If until number;
It is described to seize processing module, it is additionally operable to after the number that the sampling submodule is randomly selected reaches preset number, institute When stating second node determination sub-module and not getting the busy working node of the purpose yet, the task to be allocated is put back into correspondence The task queue of priority, wait for new scheduler task arrival or the vacant working node pool in when there is vacant working node It is scheduled allocation processing again.
9. a kind of preemptive type task scheduling system towards magnanimity working node according to claim 8, which is characterized in that
The judging unit is additionally operable to the task that priority is minimum in the N number of working node for judging the sampling submodule extraction Quantity whether more than one;
When priority in N number of working node minimum task only there are one when, the purpose task is chosen submodule and is chosen The minimum task of priority task as a purpose;When the minimum task of priority in N number of working node has multiple, The purpose task chooses submodule and obtains the performance level of the multiple task, and chooses performance level in the multiple task Minimum task is as the purpose task.
10. according to a kind of preemptive type task scheduling system towards magnanimity working node of claim 7-9 any one of them, It is characterized in that, further includes:
Idle queues division unit, for dividing several idle class queues in the vacant working node pool, and will be described Vacant working node in vacant working node pool is distributed by idle degree to corresponding idle class queue;
The first task processing unit includes:
Destination node determining module, for when in current idle working node pond there are when vacant working node, from idle grade A vacant working node is chosen in highest idle queues as target free time working node;
First task distribution module, for the task to be allocated to be distributed to the target free time working node.
CN201810500086.2A 2018-05-23 2018-05-23 A kind of preemptive type method for scheduling task and system towards magnanimity working node Pending CN108762903A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810500086.2A CN108762903A (en) 2018-05-23 2018-05-23 A kind of preemptive type method for scheduling task and system towards magnanimity working node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810500086.2A CN108762903A (en) 2018-05-23 2018-05-23 A kind of preemptive type method for scheduling task and system towards magnanimity working node

Publications (1)

Publication Number Publication Date
CN108762903A true CN108762903A (en) 2018-11-06

Family

ID=64005080

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810500086.2A Pending CN108762903A (en) 2018-05-23 2018-05-23 A kind of preemptive type method for scheduling task and system towards magnanimity working node

Country Status (1)

Country Link
CN (1) CN108762903A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109492149A (en) * 2018-11-29 2019-03-19 深圳墨世科技有限公司 Crawler task processing method and device
CN110716809A (en) * 2019-10-21 2020-01-21 北京百度网讯科技有限公司 Method and device for scheduling cloud resources
CN110990142A (en) * 2019-12-13 2020-04-10 上海智臻智能网络科技股份有限公司 Concurrent task processing method and device, computer equipment and storage medium
CN111612396A (en) * 2020-05-19 2020-09-01 上海海事大学 Real-time monitoring method for logistics network flow
WO2022151668A1 (en) * 2021-01-15 2022-07-21 长鑫存储技术有限公司 Data task scheduling method and apparatus, storage medium, and scheduling tool
CN114971594A (en) * 2022-07-28 2022-08-30 北京有生深境技术有限公司 Workflow engine based on preemptive office mode

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567086A (en) * 2010-12-30 2012-07-11 中国移动通信集团公司 Task scheduling method, equipment and system
US20130117756A1 (en) * 2011-11-08 2013-05-09 Electronics And Telecommunications Research Institute Task scheduling method for real time operating system
CN103699445A (en) * 2013-12-19 2014-04-02 北京奇艺世纪科技有限公司 Task scheduling method, device and system
CN104021044A (en) * 2013-02-28 2014-09-03 中国移动通信集团浙江有限公司 Job scheduling method and device
US9135581B1 (en) * 2011-08-31 2015-09-15 Amazon Technologies, Inc. Resource constrained task scheduling
CN105893157A (en) * 2016-04-29 2016-08-24 国家计算机网络与信息安全管理中心 Open and distributed system resource management and task scheduling system and method
CN106713396A (en) * 2015-11-17 2017-05-24 阿里巴巴集团控股有限公司 Server scheduling method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567086A (en) * 2010-12-30 2012-07-11 中国移动通信集团公司 Task scheduling method, equipment and system
US9135581B1 (en) * 2011-08-31 2015-09-15 Amazon Technologies, Inc. Resource constrained task scheduling
US20130117756A1 (en) * 2011-11-08 2013-05-09 Electronics And Telecommunications Research Institute Task scheduling method for real time operating system
CN104021044A (en) * 2013-02-28 2014-09-03 中国移动通信集团浙江有限公司 Job scheduling method and device
CN103699445A (en) * 2013-12-19 2014-04-02 北京奇艺世纪科技有限公司 Task scheduling method, device and system
CN106713396A (en) * 2015-11-17 2017-05-24 阿里巴巴集团控股有限公司 Server scheduling method and system
CN105893157A (en) * 2016-04-29 2016-08-24 国家计算机网络与信息安全管理中心 Open and distributed system resource management and task scheduling system and method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109492149A (en) * 2018-11-29 2019-03-19 深圳墨世科技有限公司 Crawler task processing method and device
CN110716809A (en) * 2019-10-21 2020-01-21 北京百度网讯科技有限公司 Method and device for scheduling cloud resources
CN110716809B (en) * 2019-10-21 2022-06-21 北京百度网讯科技有限公司 Method and device for scheduling cloud resources
CN110990142A (en) * 2019-12-13 2020-04-10 上海智臻智能网络科技股份有限公司 Concurrent task processing method and device, computer equipment and storage medium
CN111612396A (en) * 2020-05-19 2020-09-01 上海海事大学 Real-time monitoring method for logistics network flow
CN111612396B (en) * 2020-05-19 2023-09-22 上海海事大学 Real-time monitoring method for flow of logistics network
WO2022151668A1 (en) * 2021-01-15 2022-07-21 长鑫存储技术有限公司 Data task scheduling method and apparatus, storage medium, and scheduling tool
CN114971594A (en) * 2022-07-28 2022-08-30 北京有生深境技术有限公司 Workflow engine based on preemptive office mode

Similar Documents

Publication Publication Date Title
CN108762903A (en) A kind of preemptive type method for scheduling task and system towards magnanimity working node
CN111427679B (en) Computing task scheduling method, system and device for edge computing
CN107329815A (en) A kind of cloud task load equalization scheduling method searched for based on BP Tabu
CN104657221B (en) The more queue flood peak staggered regulation models and method of task based access control classification in a kind of cloud computing
JP3585755B2 (en) Load sharing based on priority among non-communication processes in time sharing system
CN108345501A (en) A kind of distributed resource scheduling method and system
Chen et al. A multiobjective evaluation of flexible manufacturing system loading heuristics
CN103617472B (en) Equilibrium of stock self-adapting dispatching method in entry multiple task management
CN110689262B (en) Space-based information system task scheduling method and device and electronic equipment
CN109408215A (en) A kind of method for scheduling task and device of calculate node
CN110888407B (en) Task allocation method and device in AGV (automatic guided vehicle) scheduling system
CN110231986A (en) Dynamic based on more FPGA reconfigurable multi-task scheduling and laying method
CN104239154A (en) Job scheduling method in Hadoop cluster and job scheduler
Biswas et al. Multi-level queue for task scheduling in heterogeneous distributed computing system
CN104917839A (en) Load balancing method used in cloud computing environment
JP3541212B2 (en) Processor assignment device
CN106998340B (en) Load balancing method and device for board resources
CN116010051A (en) Federal learning multitasking scheduling method and device
CN107741878A (en) Method for scheduling task, apparatus and system
CN111628943B (en) Intelligent Internet of things method based on communication and perception technology
Grasso AGV-served assembly lines: Influence of sequencing and launch policies on system performances
CN113448705B (en) Unbalanced job scheduling algorithm
CN114816720B (en) Scheduling method and device of multi-task shared physical processor and terminal equipment
CN109857539A (en) Resource regulating method and terminal
Luh et al. Stochastic task selection and renewable resource allocation

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20181106