CN103853607B - A kind of mutual Preparation Method of task scheduling - Google Patents
A kind of mutual Preparation Method of task scheduling Download PDFInfo
- Publication number
- CN103853607B CN103853607B CN201210507556.0A CN201210507556A CN103853607B CN 103853607 B CN103853607 B CN 103853607B CN 201210507556 A CN201210507556 A CN 201210507556A CN 103853607 B CN103853607 B CN 103853607B
- Authority
- CN
- China
- Prior art keywords
- task
- task scheduling
- scheduling
- service
- applied host
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Multi Processors (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to a kind of mutual Preparation Method of task scheduling.The method be using the applied host machine of more than 2 storing in database server for task is scheduled mutually it is standby, comprise the steps:The number of tasks X of each scheduling is read in initialization step, the task scheduling service on applied host machine from the configuration file of the applied host machine;Task scheduling service steps, according to task time order, task scheduling service obtains preceding X bar task records in the way of mutual exclusion lock from the mission bit stream table of the database server;Task distributing step, task of the task scheduling service for getting on applied host machine is distributed one by one.The mutual Preparation Method of task scheduling of the invention can effectively improve the reliability of system.
Description
Technical field
The present invention relates to a kind of microcomputer data processing, relate more specifically to a kind of raising computer system security
Method.
Background technology
In active computer data processing technique, for the system of Multi-task Concurrency treatment, if it cannot be guaranteed that system
Run without interruption within 24 hours, often substantially reduce the stability of system.More especially to task real-time processing requirement
System higher, if in the case where system occurs exception, task scheduling service stopping work, even if system can be supported again
Big concurrency, it is also of no avail.
In the system that numerous Multi-task Concurrencies is processed, cold standby mechanism all typically is employed to task scheduling service.Institute
Meaning cold standby mechanism refers to that the service of only one of which task scheduling carries out task scheduling under normal circumstances, other task scheduling service centers
In not actuated or unactivated state.When the task scheduling service of normal operation is broken down or disaster occurs, then manually enable
Or the task scheduling service of activation backup, take over original task scheduling service.
The cold standby mechanism of task scheduling service although solve main task dispatch service occur it is abnormal when cannot continue to run with
The problem that task scheduling work terminates comprehensively, but cannot but ensure the absolute continuity of task scheduling.Enable backup tasks tune
Degree is typically necessary the regular hour, for the system higher to task scheduling requirement of real-time, there is the risk of task stagnation,
Scheduling deadtime can save bit by bit it is substantial amounts of treat scheduler task, when the time length to service impact is started by backup tasks dispatch service
Between and saved bit by bit treat scheduler task process time determine.
The content of the invention
In view of the above problems, run simultaneously and method mutually standby in real time the invention provides a kind of task scheduling multimachine, solution
Multi-task concurrent scheduling system of having determined may cause task to process the problem stagnated because unified task scheduling service is abnormal,
The overall continuous stability of system is ensure that simultaneously.
The mutual Preparation Method of task scheduling of the invention is the applied host machine using more than 2 to storing in database server
Task be scheduled mutually standby method, the method comprises the steps:
Number of tasks obtaining step, the task scheduling service on applied host machine is read from the configuration file of the applied host machine
The number of tasks X, X of scheduling are natural number every time;
Task scheduling service steps, according to task time order, task scheduling service is in the way of mutual exclusion lock from the number
According to X bar task records before being obtained in the mission bit stream table of storehouse server, wherein, the mission bit stream table is stored with to be scheduled
Business, the task scheduling service is independently deployed on different applied host machines;
Task distributing step, task of the task scheduling service for getting on applied host machine is distributed one by one.
Preferably, the mode of the mutual exclusion lock refers to that the service of each task scheduling only will have been adjusted each in process task
The task of degree is locked, so that other task scheduling services are scheduled to the task of non-locking.
Preferably, the applied host machine of described more than 2 is function identical applied host machine.
Preferably, in above-mentioned task scheduling service steps, if number of tasks is all taken away and is locked less than X bars;If temporarily
Without task, then dormancy waits the next round to carry out task acquisition again.
Preferably, being also equipped with arriving task scheduling delivery of services after the task distributing step of the task is appointed in scheduling
The task process step processed in applied host machine the machine of business.
Preferably, in the task scheduling service steps, once task scheduling service occur exception in the case of, then it
The record of the preceding scheduler task service lock abnormal by the generation is released, and the record for discharging turns into highest priority successively
Non-locking " preceding X bars task record ".
Preferably, in the task scheduling service steps, when new round scheduling is carried out, to " the preceding X of the non-locking
Bar task is remembered " record and preferentially call.
Preferably, in the task scheduling service steps, if each dispatch service is normal, multiple tasks scheduling
Service interaction scheduling successively.
Preferably, in the task distributing step, when all distribution is finished this all scheduler task, dormancy is carried out
Directly the carrying out next round afterwards of the task is obtained.
Preferably, the number of tasks X is the maximum number of tasks that scheduling is obtained every time.
The mutual Preparation Method of task scheduling of the invention, using the teaching of the invention it is possible to provide a kind of multimachine is mutually standby tactful, in the normal feelings of system
Under condition, can efficiently realize that task cooperation is dispatched, in the case of system exception, can realize that the mutually standby of task is adjusted high stable
Degree, therefore, effectively maintain the high-performance and high availability of system.
Brief description of the drawings
Fig. 1 is the application deployment schematic diagram of the mutual Preparation Method of task scheduling of an embodiment of the present invention.
Fig. 2 is the scheduling schematic diagram of the mutual Preparation Method of task scheduling of an embodiment of the present invention.
Fig. 3 is the flow chart of the mutual Preparation Method of task scheduling of the invention.
Specific embodiment
What is be described below is some in multiple embodiments of the invention, it is desirable to provide to basic understanding of the invention.And
It is not intended to confirm of the invention crucial or conclusive key element or limits scope of the claimed.
The present invention is specifically described below in conjunction with accompanying drawing.
In the mutual Preparation Method of task scheduling of the invention, task scheduling service is entered in the way of " seizing " task to task respectively
Row scheduling, after task scheduling service acquisition to task, is just distributed to task, that is, call follow-up work to process service.Epicycle
After task scheduling terminates, task is taken after mixing with liquid the task acquisition for re-starting a new round.
Specifically, the core of the mutual Preparation Method of task scheduling of the invention is:Task scheduling service is independently deployed in
On different main frames, the backup of each task scheduling service other task schedulings service each other.Dispatched when multiple tasks and taken
Business runs simultaneously when, they can cooperate, and work as wherein one or more task scheduling services and break down or occur calamity
When difficult, the task scheduling service of other normal operations can be taken over there is abnormal task scheduling service, if only remain one appointing
Business dispatch service is normal, and also serializable realizes the correct scheduling of all tasks.
The present invention is to be related to the invention of task scheduling mode, therefore, only task scheduling is illustrated in the present invention, and
Eliminate the description of the follow-up task treatment logic of task scheduling and task status change.
Fig. 1 is the application deployment schematic diagram of the mutual Preparation Method of task scheduling of an embodiment of the present invention.
The mutual Preparation Method of task scheduling of the invention is the applied host machine using more than 2 to storing in database server
Mission bit stream table to be scheduled be scheduled mutually it is standby.In the present invention, task scheduling service is deployed in different answering respectively
With on main frame, cooperative scheduling treatment is carried out to the task in same mission bit stream.
Specifically, in Fig. 1, it is schematically indicated 2 applied host machines, i.e. applied host machine m and applied host machine n.But,
The present invention is not only applicable to 2 situations of applied host machine, the multiple applied host machines present invention is equally capable to be applied to more than 2
Situation.The function of applied host machine m and applied host machine n in Fig. 1 is completely the same, between applied host machine m~applied host machine n each other
Backup, and be independent of each other.
After the task scheduling service m on applied host machine m gets 1~x of task from mission bit stream table to be scheduled,
Follow-up task treatment service 1~task treatment service x is carried out in applied host machine m, on the other hand, on applied host machine n
Task scheduling service n is got after 1~x of task, at task treatment 1~task of service that applied host machine n carries out follow-up
Reason service x.
That is, task scheduling service acquisition on each applied host machine is carried out subsequently to after task in the machine
Task treatment, be not in thus that a task is processed on multimachine, cause task status disorderly, final process failure
Situation.Thus, the mutual standby of task treatment service is not only realized, the mutual standby of task scheduling service can be more realized, is eliminated
Task receives and dispatches the bottleneck of flow, effectively increases the efficiency of task transmitting-receiving.
Fig. 2 is the scheduling schematic diagram of the mutual Preparation Method of task scheduling of an embodiment of the present invention.Referring to Fig. 2 for this
The mutual Preparation Method of task scheduling of invention is specifically described.In fig. 2, schematically illustrate and appointed with 2 task scheduling services
Implementation method as a example by business dispatch service m and task scheduling service n.
In fig. 2, task scheduling service m and task scheduling service n refer respectively to dispose applied host machine m in Fig. 1 and
Task scheduling service on applied host machine n.
First, as shown in the top of Fig. 2, the number of tasks X for obtaining every time is serviced when starting from configuration file by task scheduling
Middle acquisition.Here, configuration file storage is on task dispatch service m, n affiliated respectively applied host machine m, applied host machine n.Matching somebody with somebody
Put and mainly deposit the technical parameter for seldom changing for thering is the system to use in file.
Each task scheduling is serviced when process task, only will each need task to be processed to be locked, so as to
Other task scheduling service can be scheduled to the task of non-locking.
When two task scheduling services are normal, both are according to task time order interaction scheduling and distributed tasks.Example
Such as, as shown in the top half of Fig. 2, after X bar task records before task scheduling service m is obtained, this X bar task is to be adjusted by task
Degree service m locking, then, when task scheduling service n again to obtain task record when, just can only from task scheduling service m it is unlocked
X bar task records before being obtained in fixed record.Similarly, when service m carry out new round task scheduling again when, also can only never by
X bar task records before being obtained in the record of task scheduling service n lockings.So, in task dispatch service m and task scheduling service
In the case of n is normal, task scheduling service m and task scheduling service n is in the way of above-mentioned interaction locking to mission bit stream table
In task record transferred.
On the other hand, some in task scheduling services m or task scheduling service n is because there is exception in certain reason
Delay after machine or shutdown, carry out the task scheduling of following manner:Assuming that task scheduling service n is because of certain reason generation exception in Fig. 2
Delay machine or shutdown(As shown in big " X " of lower right in Fig. 2)In the case of, before by the record quilt of task scheduling service n lockings
Release, these task records, " the preceding X bars task of non-locking " for just turning into highest priority is recorded.When task scheduling service m enters
When row new round task scheduling, priority scheduling will be carried out to these tasks such that it is able to realize task scheduling service
It is mutually standby.
Then, if if task scheduling service n recovers normal(It is not shown), then task scheduling service n continuation acquisitions are unlocked
Fixed preceding X bars record.It can be seen that, whether task scheduling service n is normal, fully transparent for task scheduling service m, and not
Final task scheduling result can be influenceed.
Example from above illustrates the situation that task scheduling service is 2.It is multiple feelings below for task scheduling service
Condition is briefly described.
Assuming that in the case that task scheduling is 3, be respectively equipped with 3 applied host machines, respectively applied host machine m, using master
Machine n, applied host machine o, distinguish deployment task dispatch service m, task on applied host machine m and applied host machine n, applied host machine o
Dispatch service n and task scheduling o.
If in the case of task scheduling service m, task scheduling service n and task scheduling o are normal, three is according to appointing
Business time sequencing interaction scheduling and distributed tasks, i.e., be scheduled in the following order:Task scheduling services m->Task scheduling
Service n->Task scheduling services o->Task scheduling services m->Task scheduling services n->Task scheduling services o->Task
Dispatch service m->Task scheduling services n->Task scheduling services o ....
Assuming that after the first round dispatches, task scheduling services o because certain reason occurs abnormal delay machine or shutdown, then carry out
The task of following manner is transferred:Task scheduling services m->Task scheduling services n->Task scheduling services o->Task scheduling takes
Business m->Task scheduling services n->Task scheduling services m->Task scheduling services n->Task scheduling services m->Task is adjusted
Degree service n->…….
Assume again that another situation, it is assumed that the first round dispatch after, task scheduling service n and task scheduling service o because
All there is exception in certain reason, then hereafter the carrying out following manner of the task is transferred:Task scheduling services m->Task scheduling is serviced
N->Task scheduling services o->Task scheduling services m->Task scheduling services m->Task scheduling services m->Task scheduling
Service m ....
As described above, in the mutual Preparation Method of task scheduling of the invention, when multiple tasks dispatch service simultaneously in the presence of, it
Can cooperate, the parallel correct scheduling for mutually realizing all tasks standbyly.When asking occurs in one of task scheduling service
During topic, the service of other task schedulings can at random become the backup of abnormal task dispatch service.When multiple tasks dispatch service
It is abnormal, or even when only surplus task scheduling service is normal, it is all different that normal task scheduling service can also turn into other
The backup of normal dispatch service, during the circulation acquisition task of itself, the correct scheduling of all tasks of serial implementation.
Each step below for the mutual Preparation Method of task scheduling of the invention is specifically described.
Fig. 3 is the flow chart of the mutual Preparation Method of task scheduling of the invention.As shown in figure 3, task scheduling of the invention is mutually standby
Method mainly comprises the steps:
Step S101:Task scheduling services the maximum number of tasks X that scheduling every time is read from configuration file.Wherein, configure
File is stored on the main frame that task dispatch service is disposed, the seldom change that the main the system that is stored with is used in configuration file
Technical parameter.
Step S102:Task scheduling service is initialized according to environmental variance to service.Here " environmental variance " be
Refer to path, the log path that reports an error, environmental information of database of configuration file storage etc..The purpose for being initialized is in order to logical
Cross the connection of initialization shared drive, database connection, maximum number of tasks and every time the configuration information such as interval of scheduling so as to should
Can directly be used with running.
Step S103:Task to be distributed, suitable according to task time in task scheduling seeervice cycle inspection mission bit stream table
Sequence, obtains preceding X bars task record in the way of above-mentioned mutual exclusion lock.Wherein, if number of tasks is all taken out and locked less than X bars
It is fixed;If temporarily without task, dormancy wait next round carries out task acquisition again.In addition, on being treated in cyclic check mission bit stream table
The task of distribution refers to check whether there is task every time to issue, inspection treatment terminate after, it is necessary to dormancy once, next time enter again
Row is checked and processed, and is exactly a cycle twice between dormancy, and whether the task that has for carrying out in the cycle needs inspection to be processed
It is exactly cyclic check.
Step S104:Judge whether acquisition task, if the task of acquisition, the step of proceed follow-up distributed tasks
S105, if fruit does not obtain task, skipping to step S107 carries out dormancy.
Step S105:For getting for task, dispatch service is distributed one by one to it on same applied host machine.By
It is actually an independent job in each task, difference influences each other between each work, so needing to distribute one by one
To follow-up application, special treatment is carried out by subsequent applications.
Step S106:Judge whether task distribution terminates, after this needs scheduler task whole distribution finishes, then enter
Entering step S107 carries out dormancy, and task of next round is directly carried out after dormancy is obtained.
The mutual Preparation Method of task scheduling according to the invention described above, task scheduling service is independently deployed in different main frames
On, the backup of each task scheduling service other task schedulings service each other.When simultaneously multiple tasks dispatch service is run
When, they can cooperate, the efficient scheduling of all tasks of Parallel Implementation, be sent out when wherein one or more task schedulings are serviced
Raw failure or when there is disaster, task scheduling services of other normal operations can be taken over there are abnormal task scheduling clothes
Business.If only remaining, a task scheduling service is normal, also serializable realizes the correct scheduling of all tasks.Using task of the invention
Dispatching method, can largely reduce because main frame delay machine, system resource it is unstable produced by service disconnection risk, have
Increased to effect the stability of system.
Example above primarily illustrates the mutual Preparation Method of task scheduling of the invention and is illustrated.Although only to some of them
Specific embodiment of the invention is described, but those of ordinary skill in the art are not it is to be appreciated that the present invention can be
Deviate in its spirit and scope and implement in many other forms.Therefore, the example for being shown is considered as illustrating with implementation method
Property and it is nonrestrictive, in the case where the spirit and scope of the present invention as defined in appended claims is not departed from, this
Invention may cover various modifications and replace.
Claims (9)
1. the mutual Preparation Method of a kind of task scheduling, using the applied host machines of more than 2 to storing the task in database server
It is scheduled mutually standby, it is characterised in that comprise the steps:
Number of tasks obtaining step, the task scheduling service on applied host machine is read every time from the configuration file of the applied host machine
The number of tasks X, X of scheduling are natural number;
Task scheduling service steps, according to task time order, task scheduling service is in the way of mutual exclusion lock from the database
X bar task records before being obtained in the mission bit stream table of server, wherein, the mission bit stream table is stored with task to be scheduled,
The task scheduling service is independently deployed on different applied host machines;
Task distributing step, task of the task scheduling service for getting on applied host machine is distributed one by one,
Wherein, in the task scheduling service steps, once in the case that task scheduling service occurs exception, then before by this
The record that abnormal scheduler task service lock occurs is released, and the record for discharging is unlocked as highest priority successively
Fixed " preceding X bars task record ".
2. such as the claim 1 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
The mode of the mutual exclusion lock refers to that the service of each task scheduling only enters each scheduled task in process task
Row locking, so that other task scheduling services are scheduled to the task of non-locking.
3. such as the claim 2 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
The applied host machine of described more than 2 is function identical applied host machine.
4. such as the claim 3 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
In above-mentioned task scheduling service steps, if number of tasks is all taken away and is locked less than X bars;If temporarily without task, stopping
Wait next round of sleeping carries out task acquisition again.
5. such as the claim 4 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
Being also equipped with arriving task scheduling delivery of services after the task distributing step of the task is led in the application of scheduler task
The task process step processed in machine the machine.
6. such as the claim 1 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
In the task scheduling service steps, when new round scheduling is carried out, " the preceding X bars task note " record to the non-locking
Preferentially call.
7. such as the claim 6 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
In the task scheduling service steps, if each dispatch service is normal, multiple tasks dispatch service is handed over successively
Mutually scheduling.
8. such as the claim 7 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
In the task distributing step, when all distribution is finished this all scheduler task, directly enter after dormancy
The task of row next round is obtained.
9. such as the claim 8 mutual Preparation Method of above-mentioned task scheduling, it is characterised in that
The number of tasks X is the maximum number of tasks that scheduling is obtained every time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210507556.0A CN103853607B (en) | 2012-12-03 | 2012-12-03 | A kind of mutual Preparation Method of task scheduling |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210507556.0A CN103853607B (en) | 2012-12-03 | 2012-12-03 | A kind of mutual Preparation Method of task scheduling |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103853607A CN103853607A (en) | 2014-06-11 |
CN103853607B true CN103853607B (en) | 2017-06-23 |
Family
ID=50861294
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210507556.0A Active CN103853607B (en) | 2012-12-03 | 2012-12-03 | A kind of mutual Preparation Method of task scheduling |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103853607B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106155816B (en) * | 2015-04-22 | 2019-08-02 | Tcl集团股份有限公司 | The mutual exclusion processing method and processing device of task |
CN106406983B (en) * | 2015-07-27 | 2021-01-08 | 创新先进技术有限公司 | Task scheduling method and device in cluster |
CN107203429A (en) * | 2016-03-18 | 2017-09-26 | 阿里巴巴集团控股有限公司 | A kind of method and device that distributed task scheduling is loaded based on distributed lock |
CN107809480A (en) * | 2017-10-25 | 2018-03-16 | 上海瀚银信息技术有限公司 | One kind transaction commutation system |
CN109871273A (en) * | 2019-02-03 | 2019-06-11 | 普信恒业科技发展(北京)有限公司 | A kind of adaptive task moving method and device |
CN110750550A (en) * | 2019-10-22 | 2020-02-04 | 京东数字科技控股有限公司 | Data verification method, data verification device, storage medium and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101707543A (en) * | 2009-11-30 | 2010-05-12 | 北京中科大洋科技发展股份有限公司 | Enterprise media bus system supporting multi-task type and enterprise media bus method supporting multi-task type |
CN102394807A (en) * | 2011-08-23 | 2012-03-28 | 北京京北方信息技术有限公司 | System and method for decentralized scheduling of autonomous flow engine load balancing clusters |
-
2012
- 2012-12-03 CN CN201210507556.0A patent/CN103853607B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101707543A (en) * | 2009-11-30 | 2010-05-12 | 北京中科大洋科技发展股份有限公司 | Enterprise media bus system supporting multi-task type and enterprise media bus method supporting multi-task type |
CN102394807A (en) * | 2011-08-23 | 2012-03-28 | 北京京北方信息技术有限公司 | System and method for decentralized scheduling of autonomous flow engine load balancing clusters |
Also Published As
Publication number | Publication date |
---|---|
CN103853607A (en) | 2014-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103853607B (en) | A kind of mutual Preparation Method of task scheduling | |
CN104050029B (en) | A kind of task scheduling system | |
CN103092682B (en) | Asynchronous network applications program processing method | |
US7689863B1 (en) | Restartable database loads using parallel data streams | |
CN101464811A (en) | Multitask monitoring management system | |
US8171474B2 (en) | System and method for managing, scheduling, controlling and monitoring execution of jobs by a job scheduler utilizing a publish/subscription interface | |
WO2017128507A1 (en) | Decentralized resource scheduling method and system | |
CN1892612A (en) | Cluster availability management method and system | |
CN104239147B (en) | One kind processing deadlock round-robin method and system | |
CN103761148A (en) | Control method for cluster timing scheduling tasks | |
CN105786603B (en) | Distributed high-concurrency service processing system and method | |
CN102929585A (en) | Batch processing method and system supporting multi-master distributed data processing | |
US20090307466A1 (en) | Resource Sharing Techniques in a Parallel Processing Computing System | |
CN102394807A (en) | System and method for decentralized scheduling of autonomous flow engine load balancing clusters | |
CN101324851A (en) | Method and apparatus of thread scheduling | |
CN113448712A (en) | Task scheduling execution method and device | |
CN105389207A (en) | Adaptive data request processing method and apparatus, task scheduler and adaptive data request processing system | |
CN109062681A (en) | A kind of execution method, system, device and the storage medium of periodic cycle task | |
CN105718322B (en) | The abnormality eliminating method of more application module clients under same process | |
CN107273232B (en) | Self-healing scheduling method for enterprise information system | |
CN107656804B (en) | Process pool system and method | |
CN102508745B (en) | Triple-modular redundancy system based on two-stage loose synchronization and realization method thereof | |
CN100468342C (en) | Multiple-core multi-CPU threading dispatch execution method based on hardware resource | |
CN104484228B (en) | Distributed parallel task processing system based on Intelli DSC | |
CN101158849A (en) | Method for preventing industrial automation system from snowslip |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |