CN100485625C - Real-time system task scheduling method - Google Patents

Real-time system task scheduling method Download PDF

Info

Publication number
CN100485625C
CN100485625C CNB2007101767044A CN200710176704A CN100485625C CN 100485625 C CN100485625 C CN 100485625C CN B2007101767044 A CNB2007101767044 A CN B2007101767044A CN 200710176704 A CN200710176704 A CN 200710176704A CN 100485625 C CN100485625 C CN 100485625C
Authority
CN
China
Prior art keywords
task
resource
scheduling
current
tasks
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.)
Expired - Fee Related
Application number
CNB2007101767044A
Other languages
Chinese (zh)
Other versions
CN101145112A (en
Inventor
侯亚荣
张书杰
李健
熊璋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Technology
Original Assignee
Beijing University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing University of Technology filed Critical Beijing University of Technology
Priority to CNB2007101767044A priority Critical patent/CN100485625C/en
Publication of CN101145112A publication Critical patent/CN101145112A/en
Application granted granted Critical
Publication of CN100485625C publication Critical patent/CN100485625C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a task scheduling method in a real-time system, and the method includes the steps as follows: A, the scheduling tasks can be ordered according to the time limit and computing load; B, if free resource is available, the resource can be allocated by the arrangement order which can be one or more-than-one to-be-scheduled tasks, wherein, if the arrangement order is more-than-one to-be-scheduled tasks, the max delay time between multi-tasks of allocated resource is least; the invention can realize optimal scheduling for multi-resource and multi-tasks, and thereby can improve the resource utilization, as well as the ratio of tasks which reach within time limit.

Description

A kind of real-time system task scheduling method
Technical field
The present invention relates to task scheduling, particularly relate to the method for scheduling task in a kind of real-time system.
Background technology
Real-time system along with computer utility in real-time control and real-time information process field and grow up, it requires computing machine can handle with enough fast speed for external information, and in the time range that the Be Controlled object allows, make quick response, its response time requirement is in second level, Millisecond even microsecond level or littler.One of principal character of real-time system is the instantaneity of response, and the instantaneity of so-called response is meant will finish computing within time-constrain.Wherein, time-constrain is meant closing time or claims the time limit, is the time of acceptable at the latest that real-time system provides result.
In real-time system, method for scheduling task is the key factor that directly influences real-time system response instantaneity, thereby the research of method for scheduling task is had crucial meaning.At present, use time limit priority algorithm (EDF, Earliest Deadline First) the most the earliest in the real-time system, the EDF algorithm is the most representative widely used a kind of real-time scheduling.
Specifically, the basic functional principle of EDF scheduling is: the urgent task of priority processing, when having resource space leisure, scheduler program just selects to have the task in time limit the earliest, and composes the resource of giving selected required by task, makes selected task obtain operation power.It is optimum that the EDF scheduling has been proved to be the single resources allocation based on the time limit standard, and still, at the assignment problem of a plurality of same asset, the EDF scheduling but can't realize total optimization.For example, CPU multiple tasks dispatching system more than, the dominant frequency difference of each CPU, the operand difference of each task, if it is adopt the EDF dispatching algorithm, then very possible for having the earliest the time limit but the big idle at first low dominant frequency CPU who gets off of Task Distribution of operand; And the next one has the task in time limit the earliest, although operand is little, is assigned with a high primary frequency CPU.Therefore, the EDF scheduling can not realize the optimal scheduling of many resources multitask real-time system.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of real-time system task scheduling method, can realize the optimal scheduling to the multitask of many resources, improves arrival task ratio in resource utilization and time limit.
For achieving the above object, technical scheme of the present invention is achieved in that
Method for scheduling task in a kind of real-time system comprises:
A, according to time limit and operand, treat scheduler task and carry out series arrangement, concrete operations are:
According to the time limit priority for the treatment of scheduler task, time limit task is early come task scheduling formation front earlier; To the identical task of a plurality of time limits that exists, by task operand size, the task that operand is big comes task scheduling formation front again; To the task all identical of a plurality of time limits, with described task random alignment with operand;
B, when idling-resource is arranged, by putting in order to treating the scheduler task Resources allocation, wherein, for a plurality of when treating the scheduler task Resources allocation, maximum delay minimum between a plurality of tasks of institute's Resources allocation.
Wherein, step B is described for treating that the scheduler task Resources allocation specifically comprises:
B1, initialization task scheduling queue Q i, use U jRepresent a task, wherein, 1≤i≤n, Q iDistribute to resource C in the scheduling process for real-time system iThe formation that forms of task .j is a task number;
B2, determine the current quantity n ' that wants scheduler task, promptly determine min (| M 0|, | N 0|) value, n '=min (| M 0|, | N 0|), wherein, M 0Be task dispatching queue not as yet, | M 0| be the contained element number of task dispatching queue not as yet, N 0Be the set of current time idling-resource, | N 0| for the current time idling-resource is gathered contained element number;
B3, be the determined current scheduler task Resources allocation of wanting of step B2, and satisfy the maximum delay minimum between a plurality of tasks of institute's Resources allocation, promptly
Figure C200710176704D00051
Wherein, U kBe the task of current scheduling,
Figure C200710176704D00052
Be the resource of determining to distribute, Be U kTake
Figure C200710176704D00054
Time delay;
B4, according to current resource allocation conditions and resource recovery idle condition, upgrade the idling-resource set;
B5, according to current task scheduling situation, updating task scheduling queue;
B6, judge whether to have dispatched all tasks,, then finish the current task scheduling flow if dispatched; If do not dispatched, then return step B2.
Wherein, described each task scheduling formation is corresponding one by one with each allowable resource.
Wherein, upgrade the idling-resource set described in the step B4 and be specially: the current occupied resource of deletion from the idling-resource set, and the resource that current recovery is idle adds in the idling-resource set.The described updating task scheduling queue of step B5 is: with current distributing of task U kAdd in the task scheduling formation.Judging whether to have dispatched all tasks described in the step B6 is: judge whether task dispatching queue is not empty, if be empty, has then dispatched all tasks; Otherwise, do not dispatched.
Real-time system task scheduling method provided by the present invention needs scheduler tasks to arrange by the time limit sequencing all, and simultaneously, to identical task of a plurality of time limits, by the big minispread of task operand, operand is big comes task scheduling formation front; Like this, when idling-resource is arranged,, and when a plurality of tasks are carried out resources allocation, adopt the minimum strategy of cluster time delay, so, can not only guarantee that a plurality of maximum delay of the task of scheduling simultaneously minimize by the ordering Resources allocation of task scheduling formation; And broken the limitation of single resources allocation optimum, and then improved in resource utilization and time limit performance index such as arrival task ratio, for real-time system task scheduling provides a kind of method that realizes total optimization.
Embodiment
Method for scheduling task of the present invention is at first ranked to the task in the real-time system, afterwards again to dispatching through the task of queuing.Concrete, described task in the real-time system is ranked generally adopted following strategy: according to the time limit priority for the treatment of scheduler task, time limit task early comes task scheduling formation front; If exist a plurality of task time limits identical, then according to task operand size, the task that operand is big comes task scheduling formation front; If the time limit of a plurality of tasks is all identical with operand, then with these task random alignment.
Among the present invention, use U jRepresent some tasks, wherein j is a task number; M represents whole set of tasks, or claims whole task queues; M 0The set of tasks that expression is not dispatched as yet claims as yet not task dispatching queue again; Whole tasks all are in and treat dispatch state under the original state, i.e. M 0=M=(U 1, U 2... U j).And, use C iRepresent a certain resource, wherein i is a resource number; N represents whole resource collections; N 0Represent certain idling-resource set constantly; Whole resources are in idle condition under the original state, i.e. N 0=N={C i| 1≤i≤n}.So, method for scheduling task of the present invention specifically may further comprise the steps:
Step 1: initialization task scheduling queue;
Each resource C iIn the scheduling process of real-time system, may successively distribute to a plurality of tasks, these tasks form a task scheduling formation, claim the task scheduling set again, use Q iExpression, Q iWith resource C iCorresponding one by one.Under the original state, all unallocated any one task of all resources is in idle condition, and therefore any one task scheduling formation corresponding with resource all is initialized as empty set Φ, i.e. Q i=Φ, (1≤i≤n).
Step 2: determine current one or more tasks that will dispatch;
Work as M 0≠ Φ and N 0During ≠ Φ, calculate M respectively 0And N 0Size, i.e. M 0And N 0What of contained element respectively, wherein, less represents with n ', promptly n '=min (| M 0|, | N 0|), task dispatching queue M not as yet then 0=(U j. ..., U m), among 1≤j≤m, the individual task U of preceding n ' j..., U J+n '-1Be confirmed as current being scheduled of task.So task dispatching queue does not become M as yet 0=(U J+n '..., U m), n '<j+n '≤m, perhaps M 0Be sky.
Step 3: be the current scheduler task U that wants that determines j. ..., U J+n '-1Resources allocation, and adopt the minimum strategy of cluster time delay to carry out resources allocation;
The minimum strategy of so-called cluster time delay is meant maximum delay minimum between a plurality of tasks of institute's Resources allocation, is exactly to be each U specifically k(j≤k≤j+n '-1) determines a resource respectively C i k , C i k ∈ N 0 , Target is to make the individual current scheduling task of n ' U j..., U J+n '-1The maximum delay minimum, promptly
Figure C200710176704D00072
Wherein, U kBe exactly the task of current scheduling, The definite exactly resource that will distribute, Be U kTake
Figure C200710176704D00075
Time delay.
At any time, real-time system number of having idling-resource can have three kinds of situations: do not have idling-resource, an idling-resource is arranged, a plurality of idling-resources are arranged.Corresponding resources allocation principle is:
First kind of situation when not having idling-resource, is not the Task Distribution resource, do not dispatch;
Second kind of situation when an idling-resource is arranged, if do not have task in the task scheduling formation, then do not dispatched; If one or more tasks are arranged in the task scheduling formation, then do not calculate, directly be first Task Distribution resource in the task scheduling formation;
The third situation when n (n〉1) idling-resource is arranged, if do not have task in the task scheduling formation, is not then dispatched; If one or more tasks are arranged in the task scheduling formation, the scheduling of then specifically executing the task according to the following steps:
A. what tasks set the tasks earlier has in the scheduling queue wait for scheduling, supposes to have m task;
B. judge again that whether idling-resource count n greater than treating scheduler task m, if n〉m, illustrate and treat in the task scheduling formation that scheduler task is less than the number of idling-resource, then select whole m tasks in the task scheduling formation, according to the minimum formula of the maximum delay in the step 3, be the idling-resource of each Task Distribution in the selected m task;
If n≤m c., illustrate treat in the task scheduling formation scheduler task more than or equal the number of idling-resource, n task before then selecting in the task scheduling formation according to the minimum formula of the maximum delay in the step 3, is the idling-resource of each Task Distribution in the selected n task.
For reducing resource free time, improve resource utilization, if M 0Not being empty, as long as then there is idling-resource, is M just 0The individual current scheduling Task Distribution of n ' in front resource.
Step 4:, upgrade the idling-resource set according to current resource allocation conditions and resource recovery idle condition;
After the resources allocation of finishing the current scheduling task, on the one hand, should be with current occupied resource deletion, promptly from the idling-resource set N 0 = N 0 - { C i k | j ≤ k ≤ j + n ′ - 1 } ; On the other hand, should be according to the U that executes the task kTake
Figure C200710176704D00082
Time delay Whether current occupied resource is recovered the free time judge, cover idling-resource set N so that will recover idle resource 0In utilize again.At this moment, the idling-resource set becomes N 0 = N 0 ∪ { C i k } .
Step 5: according to current task scheduling situation, updating task scheduling queue;
Pairing task scheduling formation is upgraded to each current occupied resource, that is: with current distributing of task U kAdd the task scheduling formation to
Figure C200710176704D00085
In, at this moment Q i k = Q i k ∪ { U k } .
Step 6: judge whether to have dispatched all tasks,, then finish the current task scheduling flow if dispatched; If do not dispatched, then return step 2.
In this step, judge whether to have dispatched all tasks exactly: judge not task dispatching queue M 0Whether be empty,, then dispatched all tasks if be empty; Otherwise, do not dispatched.
Below by the data of concrete application example,, the performance of method for scheduling task of the present invention and the performance of EDF scheduling are compared, estimate as the number of tasks ratio (upnr) that arrives in network utilization (nuf) and time limit.
Suppose that based on the matlab platform method for scheduling task of the present invention and EDF scheduling are carried out emulation testing, the task of real-time system and resource distribution situation are shown in table one and table two, wherein, table one is the task configuring condition, and the time limit of each task is 0.25s, and table two is the resource distribution situation; Evaluation result data such as table three are to table six, and wherein, table three is the nuf data of method for scheduling task of the present invention, and table four is the nuf data of EDF dispatching method, and table five is the upnr data of method for scheduling task of the present invention, and table six is the upnr data of EDF dispatching method.
Table one
Table two
Figure C200710176704D00101
Table three
Figure C200710176704D00102
Table four
Table five
Figure C200710176704D00104
Table six
By table three to the data of table six as can be seen, real-time system task scheduling method of the present invention is compared with the EDF scheduling, all is significantly improved on network utilization and the number of tasks ratio that arrives in the time limit.When the system task amount further increases, the advantage of method for scheduling task of the present invention will be more obvious.
Above-mentioned example mainly is under the multimedia application environment, and at the scheduling of Voice ﹠ Video task, in the practical application, method of the present invention goes for various applied environments.The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (6)

1, the method for scheduling task in a kind of real-time system is characterized in that, this method comprises:
A, according to time limit and operand, treat scheduler task and carry out series arrangement, concrete operations are:
According to the time limit priority for the treatment of scheduler task, time limit task is early come task scheduling formation front earlier; To the identical task of a plurality of time limits that exists, by task operand size, the task that operand is big comes task scheduling formation front again; To the task all identical of a plurality of time limits, with described task random alignment with operand;
B, when idling-resource is arranged, by putting in order to treating the scheduler task Resources allocation more than a plurality of, wherein, for a plurality of when treating the scheduler task Resources allocation, maximum delay minimum between a plurality of tasks of institute's Resources allocation.
2, method according to claim 1 is characterized in that, step B is described for treating that the scheduler task Resources allocation specifically comprises:
B1, initialization task scheduling queue Q i, (1≤i≤n), use U jRepresent task, wherein a Q iDistribute to resource C in the scheduling process for real-time system iThe formation that forms of task, j is a task number;
B2, determine the current quantity n ' that wants scheduler task, promptly determine min (| M 0|, | N 0|) value, n '=min (| M 0|, | N 0|), wherein, M 0Be task dispatching queue not as yet, | M 0| be the contained element number of task dispatching queue not as yet, N 0Be the set of current time idling-resource, | N 0| for the current time idling-resource is gathered contained element number;
B3, for the determined current Task Distribution resource that will dispatch of step B2, and satisfy maximum delay between a plurality of tasks of institute's Resources allocation and reach minimum value, promptly
Figure C200710176704C00031
Wherein, U kBe the task of current scheduling,
Figure C200710176704C00032
Be the resource of determining to distribute, Be U kTake Time delay;
B4, according to current resource allocation conditions and resource recovery idle condition, upgrade the idling-resource set;
B5, according to current task scheduling situation, updating task scheduling queue;
B6, judge whether to have dispatched all tasks,, then finish the current task scheduling flow if dispatched; If do not dispatched, then return step B2.
3, method according to claim 2 is characterized in that, described each task scheduling formation is corresponding one by one with each allowable resource.
4, method according to claim 2 is characterized in that, upgrades the idling-resource set described in the step B4 and is specially: the current occupied resource of deletion from the idling-resource set, and the resource that current recovery is idle adds in the idling-resource set.
5, method according to claim 2 is characterized in that, the described updating task scheduling queue of step B5 is: with current distributing of task U kAdd in the task scheduling formation.
6, method according to claim 2 is characterized in that, judges whether to have dispatched all tasks described in the step B6 to be: judge whether task dispatching queue is not empty, if be empty, has then dispatched all tasks; Otherwise, do not dispatched.
CNB2007101767044A 2007-11-01 2007-11-01 Real-time system task scheduling method Expired - Fee Related CN100485625C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007101767044A CN100485625C (en) 2007-11-01 2007-11-01 Real-time system task scheduling method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007101767044A CN100485625C (en) 2007-11-01 2007-11-01 Real-time system task scheduling method

Publications (2)

Publication Number Publication Date
CN101145112A CN101145112A (en) 2008-03-19
CN100485625C true CN100485625C (en) 2009-05-06

Family

ID=39207650

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007101767044A Expired - Fee Related CN100485625C (en) 2007-11-01 2007-11-01 Real-time system task scheduling method

Country Status (1)

Country Link
CN (1) CN100485625C (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101968750B (en) * 2010-10-15 2012-12-26 珠海举天软件科技有限公司 Computer system and working method thereof
CN102654843A (en) * 2011-03-04 2012-09-05 北京国科环宇空间技术有限公司 Non-preemptive type fault-tolerant scheduling method in embedded processor and embedded processor
CN102158906B (en) * 2011-05-19 2014-02-26 北京工业大学 Service quality sensory system and task scheduling method thereof
CN103207807B (en) * 2012-01-12 2017-06-27 阿里巴巴集团控股有限公司 Method for scheduling task and device
CN104035818A (en) * 2013-03-04 2014-09-10 腾讯科技(深圳)有限公司 Multiple-task scheduling method and device
CN103163870A (en) * 2013-04-07 2013-06-19 沈阳化工大学 Method for scheduling wireless networked control system with maximal tolerant time delay
CN103324525B (en) * 2013-07-03 2016-01-13 东南大学 Method for scheduling task under a kind of cloud computing environment
CN103309750B (en) * 2013-07-10 2016-09-14 国睿集团有限公司 Host resource satisfiability detection method towards hard real time service
CN104636200B (en) * 2013-11-14 2019-03-29 上海计算机软件技术开发中心 A kind of method of computer multi-process equity dispatching
CN106156115B (en) * 2015-04-07 2019-09-27 中国移动通信集团云南有限公司 A kind of resource regulating method and device
CN107229519B (en) * 2016-03-25 2021-04-23 阿里巴巴集团控股有限公司 Task scheduling method and device
CN106709628A (en) * 2016-11-24 2017-05-24 广州赛意信息科技股份有限公司 Production scheduling method and production scheduling system
CN109992382B (en) * 2017-12-29 2021-06-01 浙江宇视科技有限公司 Task scheduling method and device and task scheduler
CN112019453B (en) * 2019-05-29 2024-06-21 潘仲光 Resource reallocation method, equipment and storage medium
CN111445213A (en) * 2020-03-31 2020-07-24 乌鲁木齐众维汇联信息科技有限公司 Network management system for incubation service of park enterprise
CN111614377B (en) * 2020-04-24 2021-09-14 江苏方天电力技术有限公司 Acquisition multi-task scheduling method and system based on HPLC concurrent channel

Also Published As

Publication number Publication date
CN101145112A (en) 2008-03-19

Similar Documents

Publication Publication Date Title
CN100485625C (en) Real-time system task scheduling method
CN103324525B (en) Method for scheduling task under a kind of cloud computing environment
Sprunt et al. Aperiodic task scheduling for hard-real-time systems
Lehoczky et al. The rate monotonic scheduling algorithm: Exact characterization and average case behavior
CN102902587B (en) Distributed task dispatching mthods, systems and devices
CN109408215A (en) A kind of method for scheduling task and device of calculate node
CN102096599A (en) Multi-queue task scheduling method and related system and equipment
CN108762896A (en) One kind being based on Hadoop cluster tasks dispatching method and computer equipment
CN101923487A (en) Comprehensive embedded type real-time period task scheduling method
CN102158906B (en) Service quality sensory system and task scheduling method thereof
CN103455375A (en) Load-monitoring-based hybrid scheduling method under Hadoop cloud platform
CN116820784B (en) GPU real-time scheduling method and system for reasoning task QoS
CN113672391A (en) Parallel computing task scheduling method and system based on Kubernetes
Stavrinides et al. Orchestrating bag-of-tasks applications with dynamically spawned tasks in a distributed environment
CN102184124B (en) Task scheduling method and system
Racu et al. Improved response time analysis of tasks scheduled under preemptive round-robin
CN108845870B (en) Probabilistic real-time task scheduling method based on pWCET shaping
CN107797870A (en) A kind of cloud computing data resource dispatching method
CN114138453B (en) Resource optimization allocation method and system suitable for edge computing environment
CN115858169A (en) Operation resource allocation method and device, electronic equipment and storage medium
CN112506640B (en) Multiprocessor architecture for encryption operation chip and allocation method
Papazachos et al. Gang scheduling in a two-cluster system implementing migrations and periodic feedback
Zouaoui et al. CPU scheduling algorithms: Case & comparative study
CN108304257A (en) Hard real time hybrid tasks scheduling method based on Delay Service device
KR20150012071A (en) Apparatus and method for allocating computing resource to multiple users

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090506

Termination date: 20121101