CN108228240A - The treating method and apparatus of task in multitask queue - Google Patents
The treating method and apparatus of task in multitask queue Download PDFInfo
- Publication number
- CN108228240A CN108228240A CN201611155748.4A CN201611155748A CN108228240A CN 108228240 A CN108228240 A CN 108228240A CN 201611155748 A CN201611155748 A CN 201611155748A CN 108228240 A CN108228240 A CN 108228240A
- Authority
- CN
- China
- Prior art keywords
- task
- queue
- type
- title
- solicited message
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 238000012545 processing Methods 0.000 claims description 24
- 238000003672 processing method Methods 0.000 claims description 5
- 238000012360 testing method Methods 0.000 description 21
- 230000008569 process Effects 0.000 description 14
- 230000004048 modification Effects 0.000 description 8
- 238000012986 modification Methods 0.000 description 8
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004904 shortening Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3854—Instruction completion, e.g. retiring, committing or graduating
- G06F9/3856—Reordering of instructions, e.g. using queues or age tags
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multi Processors (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a kind for the treatment of method and apparatus of task in multitask queue.Wherein, this method includes:The solicited message of one or more tasks is received, wherein, solicited message includes at least:The type of task, the priority of task;One or more tasks will be stated according to solicited message to be put into corresponding queue;According to the type of task and the priority of task, queue is handled, same type of task is put into different queues.The present invention solves the technical issues of same type task causes tasks carrying inefficient the competition of same asset in same queue.
Description
Technical field
The present invention relates to Queue Algorithm field, processing method in particular to task in a kind of multitask queue and
Device.
Background technology
Queue Algorithm is broadly divided into two classes at present, and one kind is first in first out (FIFO), i.e., the task of most advanced enqueue is most
First it is removed execution;Also one kind is that first-in last-out (FILO), i.e., the task of most advanced enqueue is finally removed, and queue is always
Preferentially perform newly entered task.Above two scheme all can't go wrong under single thread mode, due to each task it
Between be not in resource competition, thus, each task can be well performed.However, under multithread mode, often
It will appear the adjacent task in queue to go to compete the situation that same resource causes mission failure.Such as thread A is taken out in queue
Task 1, task 1 will read file test.txt, and when task 1 performs completion not yet, thread 2 has taken out task 2, task 2
Data are written into file test.txt, since task 1 performs completion not yet, file test.txt is in locking shape at this time
State, such task 2 carry out failure.
In order to avoid above-mentioned under multithread mode, there is the same resource of adjacent task competition in queue and cause tasks carrying
The problem of failure, the scheme that the prior art uses is that being currently executing for task is locked, and is at lock-out state,
Being taken out after in this way for task is at wait state, until the tasks carrying being in the lock state terminates, next task just meeting
It locks and performs.Under this Queue Algorithm, the task in lockup period can block task below, it is impossible to give full play to computer
Computing capability, the stand-by period for causing system is long, inefficient.
For it is above-mentioned the problem of, currently no effective solution has been proposed.
Invention content
An embodiment of the present invention provides a kind for the treatment of method and apparatus of task in multitask queue, at least to solve same
The technical issues of same type task causes tasks carrying inefficient the competition of same asset in one queue.
One side according to embodiments of the present invention provides a kind of processing method of task in multitask queue, including:
The solicited message of one or more tasks is received, wherein, solicited message includes at least:The type of task, the priority of task;Root
One or more tasks are put into corresponding queue according to solicited message;The type and priority of task in queue are to team
Row are handled, and same type of task are put into different queues.
Further, one or more tasks are put into corresponding queue according to solicited message, including:Judge request letter
Whether the title of the task queue to be entered is contained in breath;If the name of the task queue to be entered is contained in solicited message
Claim, then task is put into queue corresponding with title;If there is no the name for including the task queue to be entered in solicited message
Claim, then task is put into default queue.
Further, if containing the title of the task queue to be entered in solicited message, task is put into and name
Claim in corresponding queue, including:Judge whether queue corresponding with title;If there is queue corresponding with title, then
Task is put into queue corresponding with title;If there is no queue corresponding with title, then new queue is created, and will appoint
Business is put into new queue.
Further, new queue is being created, and after task is put into new queue, method further includes:It will be new
Queue is named as the title of the queue included in the solicited message of task.
Further, the type of the task in queue and priority handle queue, by same type of
Business is put into different queues, including:Judge in queue with the presence or absence of the task that type is identical;If type is not present in queue
Identical task is then ranked up the task in queue according to the priority of whole tasks in queue;If it is deposited in queue
In the identical task of type, then the identical multiple tasks of type are put into different multiple queues.
Further, the identical multiple tasks of type are put into different multiple queues, including:Judge except type is identical
Multiple tasks where queue other than other queues in the presence or absence of the multiple tasks identical with type type it is identical
Task;If it does not exist, then a task in the identical multiple tasks of type is put into a queue in other queues.
Further, appoint if the type that all there are the multiple tasks identical with type in remaining other queues is identical
Business, then create at least one new queue, and the identical task of each type is put into different new queues, until each
The identical task of type is put into different queues.
Another aspect according to embodiments of the present invention additionally provides a kind of processing unit of task in multitask queue, packet
It includes:Receiving module, for receiving the solicited message of one or more tasks, wherein, solicited message includes at least:The class of task
Type, the priority of task;First processing module, for one or more tasks to be put into corresponding queue according to solicited message
In;Second processing module is handled queue for the type and priority of the task in queue, will be same type of
Task is put into different queues.
Further, first processing module includes:Whether the first judgment module appoints for judging to contain in solicited message
The title of the business queue to be entered;First execution module, if for containing the task queue to be entered in solicited message
Task is then put into queue corresponding with title by title;Second execution module, if in solicited message not comprising appoint
Task, then be put into default queue by the title of the business queue to be entered.
Further, the first implementation sub-module includes:Second judgment module, it is corresponding with title for judging whether
Queue;Third execution module, for if there is queue corresponding with title, then task being put into queue corresponding with title
In;4th execution module, for if there is no queue corresponding with title, then creating new queue, and task is put into newly
Queue in.
Further, the 4th execution module includes:Creation module, for new queue to be named as to the solicited message of task
In the title of queue that includes.
Further, Second processing module includes:Third judgment module is identical with the presence or absence of type in queue for judging
Task;The task for if the identical task of type to be not present in queue, is put into the team by the 5th execution module
The task in queue is ranked up in row and according to the priority of task;6th execution module, if for existing in queue
The identical multiple tasks of type are put into different multiple queues by the identical task of type.
Further, the 6th execution module includes:4th judgment module, for judging except the identical multiple tasks institute of type
Queue other than other queues in the presence or absence of the multiple tasks identical with type the identical task of type;7th performs
Module, if for the task identical with type to be not present in queue, by a task in the identical multiple tasks of type
A queue being put into other queues.
Further, the 7th execution module includes:8th execution module, if in remaining other queues all
In the presence of the identical task of the type of the multiple tasks identical with the type, then at least one new queue is created, and will be each
The identical task of the type is put into the different new queues, until each identical task of the type is put into not
Same queue.
In embodiments of the present invention, using the solicited message for receiving one or more tasks, according to solicited message by one
Or multiple tasks are put into corresponding queue, and queue is handled according to the type of the task in queue and priority,
Same type of task is put into the mode of different queues, it will be into the title of enqueue by judging whether to contain in task
With with the presence or absence of queue corresponding with title;Both exist then judge in queue with the presence or absence of the identical task of type and according to
Task priority is ranked up, and has achieved the purpose that the identical task of task type is put into different queue, it is achieved thereby that shortening
Task waiting time, the technique effect for improving execution efficiency, and then solve in same queue same type task to identical
The technical issues of competition of resource causes tasks carrying inefficient.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and forms the part of the application, this hair
Bright illustrative embodiments and their description do not constitute improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is the process flow figure of task in a kind of multitask queue according to embodiments of the present invention;
Fig. 2 is the process flow figure of task in a kind of optional multitask queue according to embodiments of the present invention;
Fig. 3 is the process flow figure of task in a kind of optional multitask queue according to embodiments of the present invention;
Fig. 4 is the process flow figure of task in a kind of optional multitask queue according to embodiments of the present invention;
Fig. 5 is the process flow figure of task in a kind of optional multitask queue according to embodiments of the present invention;
Fig. 6 is the process flow figure of task in a kind of optional multitask queue according to embodiments of the present invention;With
And
Fig. 7 is the processing unit structural representation of task in a kind of optional multitask queue according to embodiments of the present invention
Figure.
Specific embodiment
In order to which those skilled in the art is made to more fully understand the present invention program, below in conjunction in the embodiment of the present invention
The technical solution in the embodiment of the present invention is clearly and completely described in attached drawing, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
Member's all other embodiments obtained without making creative work should all belong to the model that the present invention protects
It encloses.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, "
Two " etc. be the object for distinguishing similar, and specific sequence or precedence are described without being used for.It should be appreciated that it uses in this way
Data can be interchanged in the appropriate case, so as to the embodiment of the present invention described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover
Cover it is non-exclusive include, be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment
Those steps or unit clearly listed, but may include not listing clearly or for these processes, method, product
Or the intrinsic other steps of equipment or unit.
Embodiment 1
According to embodiments of the present invention, a kind of processing method embodiment of task in multitask queue is provided, needs to illustrate
, step shown in the flowchart of the accompanying drawings can hold in the computer system of such as a group of computer-executable instructions
Row, although also, show logical order in flow charts, it in some cases, can be to be different from sequence herein
Perform shown or described step.
Fig. 1 is the process flow figure of task in a kind of multitask queue according to embodiments of the present invention, such as Fig. 1 institutes
Show, this method comprises the following steps:
Step S102 receives the solicited message of one or more tasks, wherein, solicited message includes at least:The class of task
Type, the priority of task.
Specifically, in above-mentioned steps S102, above-mentioned task can be to reach in implementation procedure under multithread mode
A certain purpose sequence of operations can be a thread or a process.For example, can be different threads to same
File is read out write operation;Above-mentioned solicited message can be to perform in task process to the solicited message of resource, the request
Information includes the type of task, the priority of task, request task sequence number;Task includes:Be put into the title of queue with
And task definition;Request task sequence number and the task sequence synchronized update in server.
In a kind of optional embodiment, under multithread mode, multiple threads take out task from queue and perform task,
Such as:Task 1 is to read data file test.txt, and task 2 is write-in data file test.txt, and task 3 is modification data
File test.txt, thread A, which are performed, reads data file test.txt, and thread B performs write-in data file test.txt, thread
C performs modification data file test.txt, wherein, task 1 includes:The entitled queue a of queue is put into, task definition is reads
Data file test.txt is taken, task 2 includes:The entitled queue b of queue is put into, task definition is write-in data file
Test.txt, task 3 include:The title of queue is not put into, task definition is modification data file test.txt.
One or more tasks are put into corresponding queue by step S104 according to solicited message.
Specifically, in above-mentioned steps S104, the request task sequence number in solicited message finds corresponding task,
One or more tasks are put into the queue of the corresponding queue of title, default queue or establishment.
In a kind of optional embodiment, request task Serial No. task 1, task 2 and task 3 in solicited message, from
Task 1, task 2 and task 3 are found in server, task 1 will be put into the entitled queue a of queue, judge whether and put
The corresponding queue a of title of enqueue, if in the presence of, task 1 into enqueue a;Task 2 will be put into the entitled team of queue
Arrange the queue of b, if judge to be not present with the corresponding queue b of title into enqueue, create queue b, task 2 is into enqueue
In b, task 3 will not be put into the title of queue, then task 3 enters in default queue.
Step S106 is handled queue according to the type of the task in queue and priority, by same type
Task be put into different queues.
Specifically, in above-mentioned steps S106, the already existing task in queue is refreshed, it will be same type of
Task is put into different queues;Wherein, the type of task includes:Synchrodata, update report;The priority of task according to appoint
The sequence of business important level from big to small is evaluated.
In a kind of optional embodiment, to queue a, already existing task refresh process in b and default queue, request letter
The priority of task 1 is 3 in breath, the type of task 1 is synchrodata;The priority of task 2 is 2, and the type of task 2 is synchronous
Data;The priority of task 3 is 4, and the type of task 3 is update report;Judge whether to have task type in queue a for same step number
According to task, task 1 is put into queue a if not and carries out task ranking according to the priority of task, if queue a
Middle there are the tasks that task type is synchrodata, then judge the task with the presence or absence of task type for synchrodata in queue b,
If there is no then task 1 is put into queue b and carries out task ranking according to the priority of task, if there are tasks by queue b
Type is the task of synchrodata, then judges the task whether default queue has task type for synchrodata, if acquiescence team
Task 1, then be put into default queue and according to the preferential grading of task by task of not having task type to be synchrodata in row
Row task ranking;If there is the task that task type is synchrodata in default queue, a queue is created;Task 2 and appoint
Business 3 uses identical Queue Algorithm, same type of task is put into different queues.
In scheme disclosed in above-mentioned steps S102 to step S106 of the present invention, in embodiments of the present invention, one is received
Or the solicited message of multiple tasks, one or more tasks are put into corresponding queue according to solicited message, according in queue
The type and priority of task handle queue, same type of task are put into different queues;Therefore, judge to appoint
Whether contained in business will be into the title of enqueue and with the presence or absence of queue corresponding with title;Both exist and then judge queue
In be ranked up with the presence or absence of the identical task of type and according to task priority, therefore to have reached task type identical for this programme
Task be put into the purpose of different queue, so as to reach the technique effect for shortening task waiting time, improving execution efficiency, into
And solve due to same type of task the resource contention caused by same queue, the technical issues of Mission Success rate is low.
In a kind of optional embodiment, as shown in Fig. 2, one or more tasks are put into accordingly according to solicited message
In queue, it can be implemented by the following steps:
Step S202:Request task sequence number in solicited message finds corresponding task, judge in task whether
Containing will be into the title of enqueue;
Step S204:If team corresponding with title will be put into the title of enqueue by task by being contained in task
In row;
Step S206:If not having the title for including the queue to be entered in task, task is put into default queue.
Specifically, in scheme disclosed in above-mentioned steps S202 to step S206, default queue is preset queue;
Herein it should be noted that if task 1 will be put into the entitled queue a of queue, and judge to exist with being put into queue
The corresponding queue a of title, then task 1 is into enqueue a;Task 3 will not be put into the title of queue, then task 3 enters
In default queue.
By above-described embodiment step S202 to step S206, realize the task for the title for having had queue to be put into
Corresponding queue is put into, and the task for the title that be not put into queue is put into default queue.
In a kind of optional embodiment, if as shown in figure 3, containing the task queue to be entered in solicited message
Task is then put into queue corresponding with title, can be implemented by the following steps by title:
Step S302:Judge whether queue corresponding with title;
Step S304:If there is queue corresponding with title, then task is put into queue corresponding with title;
Step S306:If there is no queue corresponding with title, then new queue is created, and task is put into new team
In row.
Herein it should be noted that if task 2 will be put into the entitled queue b of queue, and judge to be not present with into joining the team
The corresponding queue b of column name, then create new queue b, task 2 is put into new queue b.
By above-described embodiment step S302 to step S306, realize and be put into the task for the title for having queue to be put into
Into existing queue, then need that task is put into new queue after creating without existing queue.
In a kind of optional embodiment, new queue is named as the title of the queue included in the solicited message of task.
Specifically, the entitled data of above-mentioned queue b synchronize.
In a kind of optional embodiment, as shown in figure 4, according to the type of task in queue and the priority of task, it is right
Queue is handled, and same type of task is put into different queues, can be implemented by the following steps:
Step S402:Judge in queue with the presence or absence of the task that type is identical;
Step S404:If there is no the task that type is identical in queue, according to the priority of tasks whole in queue
Task in queue is ranked up;
Step S406:If the identical task of present pattern in queue, the identical multiple tasks of type are put into difference
Multiple queues in.
Specifically, judge whether there be task of the type for synchrodata in queue a, task 1 is put into team if not
It arranges in a and carries out task ranking according to the priority of task;If present pattern is the task of synchrodata in queue a, sentence
With the presence or absence of the task that type is synchrodata in disconnected queue b.
It is realized by above-described embodiment step S402 to step S406 and same type of task is put into different teams
It resequences in row and by the queue after adjustment according to the priority of task.
In a kind of optional embodiment, as shown in figure 5, the identical multiple tasks of type to be put into different multiple queues
In, it can be implemented by the following steps:
Step S502:Judge in other queues in addition to the queue where the identical multiple tasks of type whether there is with
The identical task of the types of the identical multiple tasks of type;
Step S504:If it does not exist, then a task in the identical multiple tasks of type is put into other queues
A queue.
Specifically, the task with the presence or absence of type for synchrodata in queue b is judged, if there is no then putting task 1
Task ranking is carried out in enqueue b and according to the priority of task, if queue b present patterns are the task of synchrodata,
The task whether default queue has type for synchrodata is judged, if there is no type appointing for synchrodata in default queue
Task 1 is then put into default queue and carries out task ranking according to the priority of task by business;
By above-described embodiment step S502 to step S504, realize and same type of task is put into different teams
It resequences in row and by the queue after adjustment according to the priority of task.
In a kind of optional embodiment, if all there is the class of the multiple tasks identical with type in remaining other queues
The identical task of type then creates at least one new queue, and the identical task of each type is put into different new queues
In, until the identical task of each type is put into different queues.
Specifically, if all present pattern is the task of synchrodata in other queues, a queue c is created, and will
The task of synchronization data types is put into queue c.
As a preferred embodiment, illustrate the above embodiments of the present application with reference to Fig. 6, as shown in fig. 6, packet
Include following steps:
Step S602:Receive one or more tasks to be placed into queue;
Step S604:Judge whether there is specified queue title to be placed into the task of queue;If to be placed into the task of queue
There is specified queue title, then perform step S606.
Step S604b:If the task to be placed into queue does not have specified queue title, specified queue is set for acquiescence team
Row, and the task to be placed into queue is put into default queue and performs step S608;
Step S606:Judge that specified queue whether there is;
Step S606a:If specified queue exists, the task to be placed into queue is put into specified queue and performs step
Rapid S608;
Step S606b:If specified queue is not present, creates new queue according to already existing queued name and hold
Row step S608;
Step S608:Task in queue is subjected to hash rearrangement according to the type of task and the priority of task,
If there are the tasks of same task type in queue, queue is restored to original state;
Step S610:Again by be placed into task be put into next queue.
Task of same task type is realized by above-mentioned steps S602 to step S610 is put into different queues,
The task of same task type in same queue is avoided to improve the effect of execution efficiency to the competition of resource.
Specifically, above-mentioned Queue Interface design is as follows:
Herein it should be noted that the interface Xia You queued names of queue, to be placed into the method for joining the team of the task of queue
Queue (), reference parameter are the number for being put into queue of the task;In batches to be placed into the method Queue that joins the team of the task of queue
(), reference parameter are put into the number of the task of queue for batch;Task goes out group method QueueItem Unqueue (), task
Batch goes out group method QueueItem [] Unqueue (), reference parameter is to appoint the number of team;Queue priority aligning method
Prior (), reference parameter are the type of task and the priority of task;The method Discrete () of sequencing queue, reference parameter
For QueueItem [] items.
Embodiment 2
According to embodiments of the present invention, a kind of processing unit embodiment of task in multitask queue is additionally provided.The present invention
The processing method of task can perform in the processing unit of the embodiment of the present invention 2 in multitask queue in embodiment 1.
Fig. 7 is the structure diagram of the processing unit of task in a kind of multitask queue according to embodiments of the present invention, should
Device includes:Receiving module 201, first processing module 203, Second processing module 205.
Wherein, receiving module 201, for receiving the solicited message of one or more tasks;First processing module 203 is used
In one or more tasks are put into corresponding queue according to solicited message;Second processing module 205, for according in queue
The type and priority of task handle queue, same type of task are put into different queues.
In above-mentioned receiving module 201, task can be to reach a certain purpose in implementation procedure under multithread mode
Sequence of operations, can be a thread or a process.For example, can be different threads to same file into
Row reads write operation;Above-mentioned solicited message can be to perform in task process to the solicited message of resource, in the solicited message
The priority of type, task including task, request task sequence number;Task includes:It is put into the title and task of queue
Content;Request task sequence number and the task sequence synchronized update in server.
Herein it should be noted that above-mentioned receiving module 201 corresponds to step S102 in embodiment 1.In multithread mode
Under, multiple threads take out task from queue and perform task, such as:Task 1 is to read data file test.txt, task 2
It is write-in data file test.txt, task 3 is modification data file test.txt, and thread A, which is performed, reads data file
Test.txt, thread B perform write-in data file test.txt, thread C and perform modification data file test.txt, wherein, appoint
Business 1 includes:The entitled queue a of queue is put into, task definition is included to read data file test.txt, task 2:It puts
The entitled queue b of enqueue, task definition are write-in data file test.txt, and task 3 includes:Not to be put into queue
Title, task definition are modification data file test.txt.
In above-mentioned first processing module 203, the request task sequence number in solicited message finds corresponding task,
One or more tasks are put into the queue of the corresponding queue of queued name, default queue or establishment.
Herein it should be noted that above-mentioned first processing module 203 corresponds to step S104 in embodiment 1, solicited message
In request task Serial No. task 1, task 2 and task 3, task 1, task 2 and task 3, task 1 are found from server
Queued name is put into as queue a, judges to exist with being put into the corresponding queue a of queued name, then task 1 is into enqueue a;
Task 2 will be put into queued name as queue b, judge to be not present and enter the corresponding queue b of queued name, then create queue b,
For task 2 into enqueue b, task 3 will not be put into the title of queue, then task 3 enters in default queue.
In above-mentioned Second processing module 205, the already existing task in queue is refreshed, it will be same type of
Task is put into different queues;Wherein, the type of task includes:Synchrodata, update report;The priority of task according to appoint
The sequence of business important level from big to small is evaluated.
Herein it should be noted that above-mentioned first processing module 203 corresponds to step S106 in embodiment 1.To queue a, b
Refreshed with task already existing in default queue, the priority of task 1 is 3 in solicited message, the type of task 1 is same
Step data;The priority of task 2 is 2, and the type of task 2 is synchrodata;The priority of task 3 is 4, and the type of task 3 is
Update report;Judge whether there be task of the task type for synchrodata in queue a, task 1 is put into queue a if not
In and according to task priority carry out task ranking, if in queue a there are task type be synchrodata task, sentence
With the presence or absence of the task that task type is synchrodata in disconnected queue b, if there is no then by task 1 be put into queue b and by
Task ranking is carried out according to the priority of task, queue b then judges that default queue is there are the task that task type is synchrodata
No task of having task type to be synchrodata will appoint if not having the task that task type is synchrodata in default queue
Business 1 is put into default queue and carries out task ranking according to the priority of task;If it is same to have task type in default queue
The task of step data then creates a queue;Task 2 and task 3 use identical Queue Algorithm, and same type of task is put
Enter in different queues.
Optionally, above-mentioned first processing module 203 further includes:First judgment module, for judge in solicited message whether
The title of the task of the containing queue to be entered;First execution module, if to enter for containing task in solicited message
Queue title, then task is put into queue corresponding with title;Second execution module, if for not having in solicited message
There is the title for including the task queue to be entered, then task is put into default queue.
Optionally, above-mentioned first execution module further includes:Second judgment module, it is corresponding with title for judging whether
Queue;Third execution module, for if there is queue corresponding with title, then task being put into queue corresponding with title
In;4th execution module, for if there is no queue corresponding with title, then creating new queue, and task is put into newly
Queue in.
Optionally, above-mentioned 4th execution module further includes:Creation module, for new queue to be named as to the request of task
The title of the queue included in information.
Optionally, above-mentioned Second processing module 205 further includes:Third judgment module, for judging to whether there is in queue
The identical task of type;5th execution module, if for the identical task of type to be not present in queue, according in queue
The priority of whole tasks is ranked up the task in queue;6th execution module, if for present pattern phase in queue
The identical multiple tasks of type, then be put into different multiple queues by same task.
Optionally, above-mentioned 6th execution module further includes:4th judgment module removes identical multiple of type for judgement
With the presence or absence of the identical task of the type of the multiple tasks identical with type in other queues other than queue where being engaged in;7th
Execution module, if for the task identical with type to be not present in queue, by then will be in the identical multiple tasks of type
One task is put into a queue in other queues.
Optionally, above-mentioned 7th execution module further includes:8th execution module, if in remaining other queues all
In the presence of the identical task of the type of the multiple tasks identical with type, then at least one new queue is created, and by each type
Identical task is put into different new queues, until the identical task of each type is put into different queues.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
In the above embodiment of the present invention, all emphasize particularly on different fields to the description of each embodiment, do not have in some embodiment
The part of detailed description may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others
Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of unit, can be one kind
Division of logic function, can there is an other dividing mode in actual implementation, such as multiple units or component can combine or can
To be integrated into another system or some features can be ignored or does not perform.Another point, shown or discussed is mutual
Coupling, direct-coupling or communication connection can be by some interfaces, the INDIRECT COUPLING or communication connection of unit or module,
Can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separate, be shown as unit
The component shown may or may not be physical unit, you can be located at a place or can also be distributed to multiple
On unit.Some or all of unit therein can be selected according to the actual needs to realize the purpose of this embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
That each unit is individually physically present, can also two or more units integrate in a unit.Above-mentioned integrated list
The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and is independent product sale or uses
When, it can be stored in a computer read/write memory medium.Based on such understanding, technical scheme of the present invention is substantially
The part to contribute in other words to the prior art or all or part of the technical solution can be in the form of software products
It embodies, which is stored in a storage medium, is used including some instructions so that a computer
Equipment (can be personal computer, server or network equipment etc.) perform each embodiment the method for the present invention whole or
Part steps.And aforementioned storage medium includes:USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. are various can to store program code
Medium.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should
It is considered as protection scope of the present invention.
Claims (10)
1. a kind of processing method of task in multitask queue, which is characterized in that including:
The solicited message of one or more tasks is received, wherein, the solicited message includes at least:The type of the task, institute
State the priority of task;
One or more of tasks are put into corresponding queue according to the solicited message;
The type and priority of task in the queue handle the queue, and same type of task is put into
In different queues.
2. according to the method described in claim 1, it is characterized in that, according to the solicited message by one or more of tasks
It is put into corresponding queue, including:
Judge whether to contain the title of the task queue to be entered in the solicited message;
If containing the title of the task queue to be entered in the solicited message, by the task be put into it is described
In the corresponding queue of title;
If not having the title for including the task queue to be entered in the solicited message, the task is put into acquiescence
In queue.
If 3. according to the method described in claim 2, it is characterized in that, the task is contained in the solicited message will be into
The task is then put into queue corresponding with the title by the title of the queue entered, including:
Judge whether queue corresponding with the title;
If there is queue corresponding with the title, then the task is put into queue corresponding with the title;
If there is no queue corresponding with the title, then new queue is created, and the task is put into the new team
In row.
4. according to the method described in claim 3, it is characterized in that, creating new queue, and the task is put into described
After in new queue, the method further includes:The new queue is named as what is included in the solicited message of the task
The title of queue.
5. method as claimed in any of claims 1 to 4, which is characterized in that task in the queue
Type and priority handle the queue, same type of task are put into different queues, including:
Judge in the queue with the presence or absence of the task that type is identical;
If there is no the task that type is identical in the queue, according to the priority of whole tasks in the queue to institute
Stating in queue for task is ranked up;
If the identical multiple tasks of type, are put into different multiple queues by the identical task of present pattern in the queue
In.
6. according to the method described in claim 5, it is characterized in that, the identical multiple tasks of type are put into different multiple teams
In row, including:
Judge to whether there is and the type in other queues in addition to the queue where the identical multiple tasks of the type
The identical task of the types of identical multiple tasks;
If it does not exist, then a task in the identical multiple tasks of the type is put into one in other queues
Queue.
If 7. according to the method described in claim 6, it is characterized in that, in remaining other queues all exist with it is described
The identical task of the types of the identical multiple tasks of type then creates at least one new queue, and will each type phase
Same task is put into the different new queues, until each identical task of the type is put into different queues.
8. a kind of processing unit of task in multitask queue, which is characterized in that including:
Receiving module, for receiving the solicited message of one or more tasks, wherein, the solicited message includes at least:It is described
The priority of the type of task, the task;
First processing module, for one or more of tasks to be put into corresponding queue according to the solicited message;
Second processing module, the type and priority of the task in the queue handle the queue, will be same
The task of type is put into different queues.
9. device according to claim 8, which is characterized in that the first processing module includes:
First judgment module, for judging the title of the task queue to be entered whether is contained in the solicited message;
First execution module, if for containing the title of the task queue to be entered in the solicited message, it will
The task is put into queue corresponding with the title;
Second execution module, if for there is no the title for including the task queue to be entered in the solicited message,
The task is put into default queue.
10. device according to claim 9, which is characterized in that first implementation sub-module includes:
Second judgment module, for judging whether queue corresponding with the title;
Third execution module, for if there is queue corresponding with the title, being then put into the task and the title
In corresponding queue;
4th execution module, for if there is no queue corresponding with the title, then creating new queue, and described will appoint
Business is put into the new queue.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611155748.4A CN108228240B (en) | 2016-12-14 | 2016-12-14 | Method and device for processing tasks in multi-task queue |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611155748.4A CN108228240B (en) | 2016-12-14 | 2016-12-14 | Method and device for processing tasks in multi-task queue |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108228240A true CN108228240A (en) | 2018-06-29 |
CN108228240B CN108228240B (en) | 2021-02-26 |
Family
ID=62650118
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611155748.4A Active CN108228240B (en) | 2016-12-14 | 2016-12-14 | Method and device for processing tasks in multi-task queue |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108228240B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108985629A (en) * | 2018-07-17 | 2018-12-11 | 阿里巴巴集团控股有限公司 | The execution method, apparatus and server of service node in business chain |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU6094494A (en) * | 1993-03-03 | 1994-09-26 | Siemens Rolm Communications Inc. | Queue managing system and method |
US20100153957A1 (en) * | 2008-12-16 | 2010-06-17 | Sensormatic Electronics Corporation | System and method for managing thread use in a thread pool |
CN101807159A (en) * | 2010-03-18 | 2010-08-18 | 西北工业大学 | Self-adapting task scheduling method |
US8185897B2 (en) * | 2008-09-30 | 2012-05-22 | Verizon Patent And Licensing Inc. | Task management system |
CN102567086A (en) * | 2010-12-30 | 2012-07-11 | 中国移动通信集团公司 | Task scheduling method, equipment and system |
US20140137128A1 (en) * | 2012-11-12 | 2014-05-15 | Skymedi Corporation | Method of Scheduling Tasks for Memories and Memory System Thereof |
CN104407921A (en) * | 2014-12-25 | 2015-03-11 | 浪潮电子信息产业股份有限公司 | Time-based method for dynamically scheduling yarn task resources |
CN104657214A (en) * | 2015-03-13 | 2015-05-27 | 华存数据信息技术有限公司 | Multi-queue multi-priority big data task management system and method for achieving big data task management by utilizing system |
CN104731651A (en) * | 2013-12-20 | 2015-06-24 | 南京南瑞继保电气有限公司 | Power automation task scheduling and triggering method, system and processor |
CN105204933A (en) * | 2015-09-18 | 2015-12-30 | 上海斐讯数据通信技术有限公司 | Multitask switching execution method based on single process, multitask switching execution system based on single process and processor |
CN105893126A (en) * | 2016-03-29 | 2016-08-24 | 华为技术有限公司 | Task scheduling method and device |
CN106020954A (en) * | 2016-05-13 | 2016-10-12 | 深圳市永兴元科技有限公司 | Thread management method and device |
-
2016
- 2016-12-14 CN CN201611155748.4A patent/CN108228240B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU6094494A (en) * | 1993-03-03 | 1994-09-26 | Siemens Rolm Communications Inc. | Queue managing system and method |
US8185897B2 (en) * | 2008-09-30 | 2012-05-22 | Verizon Patent And Licensing Inc. | Task management system |
US20100153957A1 (en) * | 2008-12-16 | 2010-06-17 | Sensormatic Electronics Corporation | System and method for managing thread use in a thread pool |
CN101807159A (en) * | 2010-03-18 | 2010-08-18 | 西北工业大学 | Self-adapting task scheduling method |
CN102567086A (en) * | 2010-12-30 | 2012-07-11 | 中国移动通信集团公司 | Task scheduling method, equipment and system |
US20140137128A1 (en) * | 2012-11-12 | 2014-05-15 | Skymedi Corporation | Method of Scheduling Tasks for Memories and Memory System Thereof |
CN104731651A (en) * | 2013-12-20 | 2015-06-24 | 南京南瑞继保电气有限公司 | Power automation task scheduling and triggering method, system and processor |
CN104407921A (en) * | 2014-12-25 | 2015-03-11 | 浪潮电子信息产业股份有限公司 | Time-based method for dynamically scheduling yarn task resources |
CN104657214A (en) * | 2015-03-13 | 2015-05-27 | 华存数据信息技术有限公司 | Multi-queue multi-priority big data task management system and method for achieving big data task management by utilizing system |
CN105204933A (en) * | 2015-09-18 | 2015-12-30 | 上海斐讯数据通信技术有限公司 | Multitask switching execution method based on single process, multitask switching execution system based on single process and processor |
CN105893126A (en) * | 2016-03-29 | 2016-08-24 | 华为技术有限公司 | Task scheduling method and device |
CN106020954A (en) * | 2016-05-13 | 2016-10-12 | 深圳市永兴元科技有限公司 | Thread management method and device |
Non-Patent Citations (1)
Title |
---|
郑焕鑫: "基于多机多卡的卷积神经网络性能优化", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108985629A (en) * | 2018-07-17 | 2018-12-11 | 阿里巴巴集团控股有限公司 | The execution method, apparatus and server of service node in business chain |
CN108985629B (en) * | 2018-07-17 | 2022-04-08 | 创新先进技术有限公司 | Method and device for executing service node in service chain and server |
Also Published As
Publication number | Publication date |
---|---|
CN108228240B (en) | 2021-02-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109274754A (en) | For the method for synchrodata, equipment and storage medium in block chain network | |
CN105701159B (en) | A kind of data synchronization unit and method | |
CN108182108A (en) | A kind of timed task cluster and its execution method | |
CN106803790A (en) | The upgrade control method and device of a kind of group system | |
CN109961364B (en) | Transaction method and system based on directed acyclic graph | |
CN110363663A (en) | Batch data processing method, device, equipment and storage medium based on block chain | |
CN106412088B (en) | A kind of method of data synchronization and terminal | |
CN107250984A (en) | For stealing the technology for supporting to carry out effective synchronization barrier using work | |
CN105847560A (en) | Mobile terminal lock screen message pushing method and mobile terminal lock screen message pushing device | |
CN107066292A (en) | Server environment dispositions method and device | |
US10768974B2 (en) | Specifying an order of a plurality of resources in a transaction according to distance | |
CN114048265A (en) | Task processing method and device, electronic equipment and computer readable storage medium | |
CN108875853A (en) | The processing method and processing device of data label printing | |
CN108228240A (en) | The treating method and apparatus of task in multitask queue | |
CN107203420A (en) | The master-slave switching method and device of task scheduling example | |
CN108733477A (en) | The method, apparatus and equipment of data clusterization processing | |
CN106598726A (en) | Multi-task management system and distributed deployment method thereof | |
CN107122675B (en) | A kind of db transaction operating method and system based on block chain | |
CN109067864A (en) | Notification message method for pushing, device and electronic equipment | |
CN114860266A (en) | Deployment method and system of multi-party security computing model | |
CN108306926A (en) | A kind of method for pushing and device of car networking device gateway business datum | |
JP5229223B2 (en) | Workflow definition change program and workflow definition change method | |
CN106776076A (en) | A kind of method and system for realizing MongoDB transaction managements | |
CN110046199A (en) | Synchronous method, device and the electronic equipment of transaction data | |
CN107247621B (en) | Scheduling method and device for batch processing tasks |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |