CN104699533A - Scheduling method of multiple periodic tasks - Google Patents
Scheduling method of multiple periodic tasks Download PDFInfo
- Publication number
- CN104699533A CN104699533A CN201310664716.7A CN201310664716A CN104699533A CN 104699533 A CN104699533 A CN 104699533A CN 201310664716 A CN201310664716 A CN 201310664716A CN 104699533 A CN104699533 A CN 104699533A
- Authority
- CN
- China
- Prior art keywords
- periodic duty
- turn
- periodic
- value
- task
- 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
Abstract
The invention provides a scheduling method of multiple periodic tasks, which comprises the steps of obtaining a greatest common divisor pnum of a set of numbers consisting of all scheduling periods and scheduling occasions, setting a time value of clock interrupt as pnum, enquiring information of each periodic task after triggering the clock interrupt, judging whether each periodic task achieves periodic task execution conditions, entering a periodic task entry designated by each periodic task if so, undoing execution of each periodic task if not, and waiting for the triggering of the next clock interrupt. The method can effectively ensure that the periodic tasks are executed correctly according to the self scheduling occasions and the scheduling periods, and the periodic tasks do not interfere with each other during the execution. The method is easy to realize and has low calculation load, an adopted data structure and a software structure are easy to modify and expand, a task scheduling manner is flexible, and an application range is wide.
Description
Technical field
The invention belongs to computing machine control field, be specifically related to a kind of dispatching method of multiple periodic duty.
Background technology
In embedded real time system, the scheduling of periodic duty is the focus of research always, and the scheduling quality of periodic duty is the key factor of influential system operational efficiency.Research about period task scheduling method emerges in an endless stream, create many real-time scheduling methods: such as classical FCFS algorithm, RM algorithm, priority inheritance, reversion, static rate-monotonic method RMS and Monotonic dispatching method DMS and dynamic deadline date drive algorithm DD and SPT finite algorithm SPTF etc., also have a lot of innovatory algorithm.Dispatching method in the past stresses mainly study the selection gist of scheduler task and how to carry out the determination in scheduler task cycle, does not consider when existing multiple periodic duty, how dispatches according to cycle of task and scheduling occasion.
Summary of the invention
The object of the invention is: design realizes a kind of multiple period task scheduling methods for different dispatching cycle and scheduling occasion, realizing the scheduling of multiple periodic duty in embedded real time system, ensureing the correct scheduling of periodic duty when taking CPU time and resource is less.
Technical scheme of the present invention is:
A dispatching method for multiple periodic duty, its special character is: comprise the following steps:
1] according to dispatching cycle and the scheduling occasion of multiple periodic duty, ask for by the highest common factor pnum of the one group of number formed all dispatching cycles and scheduling occasion;
2] ask for the dispatching cycle of each periodic duty and scheduling occasion respectively relative to the multiple of pnum, and * function, At_period, At_turn of each periodic duty are formed a field be sequentially stored in buffer zone; * fuction represents periodic duty entrance, and At_period representative (dispatching cycle/pnum), At_turn represent (scheduling occasion/pnum+1);
3] time value arranging tick interrupt is pnum;
4] after tick interrupt triggers, according to storage order, each the periodic duty information in buffer zone is inquired about, judge whether the value of the At_turn of each periodic duty reaches periodic duty executive condition; If the value of the At_turn of some periodic duties reaches periodic duty executive condition, then enter the periodic duty entrance that this periodic duty is specified, performance period task; If the value of the At_turn of some periodic duties does not reach periodic duty executive condition, then not performance period task, waits for that tick interrupt triggers next time.
Above-mentioned steps 4] be specially: whether the value judging the At_turn of current period task is 1, if the value of the At_turn of current period task is 1, then enter the periodic duty entrance * function that current period task is specified, performance period task, and by the value assignment of At_period to At_tum; If the value of the At_turn of current period task is not 1, then At_turn subtracts 1, does not perform current period task, waits for that tick interrupt triggers next time.
Advantage of the present invention is: the triggering intervals value highest common factor of all periodic duties cycle length being separately set to tick interrupt, when obviously namely the value of highest common factor is larger for period time value multiple proportion, CPU can carry out single treatment to periodic duty the interval long period, and work efficiency improves greatly; Between the dispatching cycle of periodic duty and each data of scheduling occasion, multiple proportion is more obvious, then method efficiency is higher, in tick interrupt, query processing is carried out to periodic duty, can effectively ensure periodic duty according to the scheduling occasion of oneself and correctly perform dispatching cycle and each periodic duty perform do not interfere with each other.This method is easy to realize, and calculated amount is few, and the data structure of employing and software configuration are easy to amendment and expansion, and task scheduling mode is flexible, widely applicable.
Embodiment
The present invention stresses research when known periods duty cycle and scheduling occasion, how carries out the method for multiple periodic duty Real-Time Scheduling according to the dispatching cycle of periodic duty and scheduling occasion.Namely in once dispatching, dispatch the task that all cycles arrive, the scheduling between periodic duty does not interfere with each other and does not take CPU too many time and resource simultaneously.
Period task scheduling of the present invention mainly pays close attention to scheduling occasion and dispatching cycle, and different periodic duties generally all can adopt different scheduling occasions and dispatching cycle.The present invention designs a kind of period task scheduling method adopting tick interrupt and inquiry mode, and each periodic duty can be dispatched according to the scheduling occasion of task itself and dispatching cycle, and not by the interference of other periodic duty.
Concrete grammar step of the present invention is:
1] according to dispatching cycle and the scheduling occasion of multiple periodic duty, ask for by the highest common factor pnum of the one group of number formed all dispatching cycles and scheduling occasion; Each periodic duty can a corresponding dispatching cycle and a scheduling occasion, then n periodic duty just has n dispatching cycle and n scheduling occasion, for one group of number that n dispatching cycle and n scheduling occasion form, asks for highest common factor pnum;
2] ask for the dispatching cycle of each periodic duty and scheduling occasion respectively relative to the multiple of pnum, and * function, At_period, At_turn of each periodic duty are formed a field be sequentially stored in buffer zone; * fuction represents periodic duty entrance, and At_period representative (dispatching cycle/pnum), At_turn represent (scheduling occasion/pnum+1);
3] time value arranging tick interrupt is pnum;
4] after tick interrupt triggers, according to storage order, each the periodic duty information in buffer zone is inquired about, judge whether the value of the At_turn of each periodic duty reaches periodic duty executive condition; If the value of the At_turn of some periodic duties reaches periodic duty executive condition, then enter the periodic duty entrance that this periodic duty is specified, performance period task; If the value of the At_turn of some periodic duties does not reach periodic duty executive condition, then not performance period task, waits for that tick interrupt triggers next time.
Step 4] specifically can in the following ways: whether the value judging the At_turn of current period task is 1, if the value of the At_turn of current period task is 1, then enter the periodic duty entrance * function that current period task is specified, performance period task, and by the value assignment of At_period to At_tum; If the value of the At_turn of current period task is not 1, then At_turn subtracts 1, does not perform current period task, waits for that tick interrupt triggers next time.
False code is as follows:
Be described below by way of an instantiation:
Suppose in certain automobile controller system, have 4 numbers reportedly defeated periodic duty, scheduling occasion and the dispatching cycle of each periodic duty are as shown in table 1.
Table 1 periodic duty information
Periodic duty | Scheduling occasion | Dispatching cycle |
Task 1 | 0ms | 20ms |
Task 2 | 5ms | 30ms |
Task 3 | 10ms | 10ms |
Task 4 | 15ms | 20ms |
According to scheduling occasion and time dispatching cycle of four tasks, namely the highest common factor pnum of 0ms, 20ms, 5ms, 30ms, 10ms, 10ms, 15ms, 20ms is 5ms, the time value arranging tick interrupt is 5ms, * function, At_period, At_turn of each periodic duty are formed a field and is sequentially stored in buffer zone, then the mission bit stream in buffering stores as follows:
{
Periodic duty 1 entrance, 4,1;
Periodic duty 2 entrance, 6,2;
Periodic duty 3 entrance, 2,3;
Periodic duty 4 entrance, 4,4;
}
Tick interrupt triggers once every 5ms, and after tick interrupt triggers, above periodic transfer task portion implementation status is as shown in table 2.
When the 0th tick interrupt triggers (during 0ms), inquire about the At_turn value of four periodic duties with storage order.For periodic duty 1, its At_turn value is 1, then enter the periodic duty entrance that periodic duty 1 is specified, performance period task 1, and by value 4 assignment of the At_period of periodic duty 1 to At_tum, obtains At_turn updated value 4.For periodic duty 2, its At_turn value is 2, then not performance period task 2, and At_turn is subtracted 1, obtains At_turn updated value 1, waits for that tick interrupt triggers next time.For periodic duty 3, its At_turn value is 3, then not performance period task 3, and At_turn is subtracted 1, obtains At_turn updated value 2, waits for that tick interrupt triggers next time.For periodic duty 4, its At_turn value is 4, then not performance period task 4, and At_turn is subtracted 1, obtains At_turn updated value 3, waits for that tick interrupt triggers next time.
When the 1st tick interrupt triggers (during 5ms), inquire about the At_turn value of four periodic duties with storage order.For periodic duty 1, its At_turn value becomes 4, then not performance period task 1, and after the At_turn of periodic duty 1 being subtracted 1, assignment, to At_tum, obtains At_turn updated value 3.For periodic duty 2, its At_turn value becomes 1, then enter the periodic duty entrance that periodic duty 2 is specified, performance period task 2, and by value 6 assignment of the At_period of periodic duty 2 to At_tum, obtains At_turn updated value 6.For periodic duty 3, its At_turn value becomes 2, then not performance period task 3, and At_turn is subtracted 1, obtains At_turn updated value 1, waits for that tick interrupt triggers next time.For periodic duty 4, its At_turn value becomes 3, then not performance period task 4, and At_turn is subtracted 1, obtains At_turn updated value 2, waits for that tick interrupt triggers next time.
……
When the 4th tick interrupt triggers (during 20ms), inquire about the At_turn value of four periodic duties with storage order.For periodic duty 1, its At_turn value becomes 1, then enter the periodic duty entrance that periodic duty 1 is specified, performance period task 1, and by value 4 assignment of the At_period of periodic duty 1 to At_tum, obtains At_turn updated value 4.For periodic duty 2, its At_turn value is 4, then not performance period task 2, and At_turn is subtracted 1, obtains At_turn updated value 3, waits for that tick interrupt triggers next time.For periodic duty 3, its At_turn value is 1, then enter the periodic duty entrance that periodic duty 3 is specified, performance period task 3, and by value 2 assignment of the At_period of periodic duty 3 to At_tum, obtains At_turn updated value 2.For periodic duty 4, its At_turn value is 4, then not performance period task 4, and At_turn is subtracted 1, obtains At_turn updated value 3, waits for that tick interrupt triggers next time.Therefore, when the 4th tick interrupt triggers, one has two periodic duties in execution, i.e. periodic duty 1 and periodic duty 3.
Table 2 periodic transfer task scheduling performs table
Step 4 also can adopt the method that other principles are identical.
The present invention is when obviously namely the value of highest common factor is larger for period time value multiple proportion, and CPU can carry out single treatment to periodic duty the interval long period, and work efficiency improves greatly; In tick interrupt, query processing is carried out to periodic duty, can effectively ensure periodic duty according to the scheduling occasion of oneself and correctly perform dispatching cycle and each periodic duty perform do not interfere with each other.
Claims (2)
1. a dispatching method for multiple periodic duty, is characterized in that: comprise the following steps:
1] according to dispatching cycle and the scheduling occasion of multiple periodic duty, ask for by the highest common factor pnum of the one group of number formed all dispatching cycles and scheduling occasion;
2] ask for the dispatching cycle of each periodic duty and scheduling occasion respectively relative to the multiple of pnum, and * function, At_period, At_turn of each periodic duty are formed a field be sequentially stored in buffer zone; * fuction represents periodic duty entrance, and At_period representative (dispatching cycle/pnum), At_turn represent (scheduling occasion/pnum+1);
3] time value arranging tick interrupt is pnum;
4] after tick interrupt triggers, according to storage order, each the periodic duty information in buffer zone is inquired about, judge whether the value of the At_turn of each periodic duty reaches periodic duty executive condition; If the value of the At_turn of some periodic duties reaches periodic duty executive condition, then enter the periodic duty entrance that this periodic duty is specified, performance period task; If the value of the At_turn of some periodic duties does not reach periodic duty executive condition, then not performance period task, waits for that tick interrupt triggers next time.
2. the dispatching method of multiple periodic duty according to claim 1, it is characterized in that: step 4] be specially: whether the value judging the At_turn of current period task is 1, if the value of the At_turn of current period task is 1, then enter the periodic duty entrance * function that current period task is specified, performance period task, and by the value assignment of At_period to At_tum; If the value of the At_turn of current period task is not 1, then At_turn subtracts 1, does not perform current period task, waits for that tick interrupt triggers next time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310664716.7A CN104699533B (en) | 2013-12-09 | 2013-12-09 | A kind of dispatching method of multiple periodic duties |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310664716.7A CN104699533B (en) | 2013-12-09 | 2013-12-09 | A kind of dispatching method of multiple periodic duties |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104699533A true CN104699533A (en) | 2015-06-10 |
CN104699533B CN104699533B (en) | 2017-11-28 |
Family
ID=53346696
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310664716.7A Active CN104699533B (en) | 2013-12-09 | 2013-12-09 | A kind of dispatching method of multiple periodic duties |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104699533B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107577528A (en) * | 2017-09-01 | 2018-01-12 | 长沙小卡机器人科技有限公司 | The method of multitask sequential parallel operation |
US10089149B2 (en) | 2015-11-27 | 2018-10-02 | Industrial Technology Research Institute | Method for scheduling multiple periodic requests and scheduling device |
CN109298925A (en) * | 2018-09-27 | 2019-02-01 | 郑州云海信息技术有限公司 | A kind of start by set date method, system and the relevant apparatus of periodic duty |
CN112799821A (en) * | 2021-02-06 | 2021-05-14 | 读书郎教育科技有限公司 | Method for scheduling multiple periodic tasks with variable execution time |
DE102020214144A1 (en) | 2020-11-11 | 2022-05-12 | Robert Bosch Gesellschaft mit beschränkter Haftung | Method and device for monitoring cyclic tasks in machine control |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050060709A1 (en) * | 2003-07-22 | 2005-03-17 | Tatsunori Kanai | Method and system for performing real-time operation |
US20090172684A1 (en) * | 2007-12-26 | 2009-07-02 | Hwang Tae Ho | Small low power embedded system and preemption avoidance method thereof |
CN101620550A (en) * | 2009-05-27 | 2010-01-06 | 西华师范大学 | Embedded real-time scheduling method based on fuzzy multiple features of task |
US20100262969A1 (en) * | 2005-06-03 | 2010-10-14 | Nxp B.V. | Data processing system and method for scheduling the use of at least one exclusive resource |
CN101923487A (en) * | 2010-08-06 | 2010-12-22 | 西华师范大学 | Comprehensive embedded type real-time period task scheduling method |
CN102222022A (en) * | 2011-07-15 | 2011-10-19 | 范示德汽车技术(上海)有限公司 | Real-time task scheduling method based on multicore processor |
-
2013
- 2013-12-09 CN CN201310664716.7A patent/CN104699533B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050060709A1 (en) * | 2003-07-22 | 2005-03-17 | Tatsunori Kanai | Method and system for performing real-time operation |
US20100262969A1 (en) * | 2005-06-03 | 2010-10-14 | Nxp B.V. | Data processing system and method for scheduling the use of at least one exclusive resource |
US20090172684A1 (en) * | 2007-12-26 | 2009-07-02 | Hwang Tae Ho | Small low power embedded system and preemption avoidance method thereof |
CN101620550A (en) * | 2009-05-27 | 2010-01-06 | 西华师范大学 | Embedded real-time scheduling method based on fuzzy multiple features of task |
CN101923487A (en) * | 2010-08-06 | 2010-12-22 | 西华师范大学 | Comprehensive embedded type real-time period task scheduling method |
CN102222022A (en) * | 2011-07-15 | 2011-10-19 | 范示德汽车技术(上海)有限公司 | Real-time task scheduling method based on multicore processor |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10089149B2 (en) | 2015-11-27 | 2018-10-02 | Industrial Technology Research Institute | Method for scheduling multiple periodic requests and scheduling device |
CN107577528A (en) * | 2017-09-01 | 2018-01-12 | 长沙小卡机器人科技有限公司 | The method of multitask sequential parallel operation |
CN107577528B (en) * | 2017-09-01 | 2020-09-08 | 长沙小卡机器人科技有限公司 | Method for parallel running of multitask sequences |
CN109298925A (en) * | 2018-09-27 | 2019-02-01 | 郑州云海信息技术有限公司 | A kind of start by set date method, system and the relevant apparatus of periodic duty |
CN109298925B (en) * | 2018-09-27 | 2021-10-15 | 郑州云海信息技术有限公司 | Periodic task timing starting method, system and related device |
DE102020214144A1 (en) | 2020-11-11 | 2022-05-12 | Robert Bosch Gesellschaft mit beschränkter Haftung | Method and device for monitoring cyclic tasks in machine control |
CN112799821A (en) * | 2021-02-06 | 2021-05-14 | 读书郎教育科技有限公司 | Method for scheduling multiple periodic tasks with variable execution time |
Also Published As
Publication number | Publication date |
---|---|
CN104699533B (en) | 2017-11-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104699533A (en) | Scheduling method of multiple periodic tasks | |
Li et al. | A heuristic rescheduling algorithm for computer-based production scheduling systems | |
WO2011080055A3 (en) | Dynamically distributing a multi-dimensional work set across a multi-core system | |
CN102364447B (en) | Operation scheduling method for optimizing communication energy consumption among multiple tasks | |
WO2002097562A3 (en) | Method and system for scheduling in an adaptable computing engine | |
EP1501013A3 (en) | Method and system for scheduling real-time periodic tasks | |
CN101923487A (en) | Comprehensive embedded type real-time period task scheduling method | |
WO2001082075A3 (en) | System and method for scheduling execution of cross-platform computer processes | |
CN102073547B (en) | Performance optimizing method for multipath server multi-buffer-zone parallel packet receiving | |
MY156590A (en) | Method for the real-time ordering of a set of noncyclical multi-frame tasks | |
CN103491174A (en) | Periodic/aperiodic mixed real-time task scheduling method based on delay servers | |
CN101968749B (en) | Method for receiving message passing interface (MPI) information under circumstance of over-allocation of virtual machine | |
CN103744726A (en) | Two-stage scheduling method of real-time extension of Windows system | |
CN111176806A (en) | Service processing method, device and computer readable storage medium | |
DE602005009398D1 (en) | EFFICIENT SWITCHING BETWEEN PRIORIZED TASKS | |
CN109739332A (en) | A kind of general energy consumption optimization method of multitask | |
CN106055862A (en) | Novel efficient heuristic-type two-stage parallel branch-and-bound method | |
CN1710543A (en) | Two-stage timing method for inlaid real-time operation system timer | |
CN101996105A (en) | Static software/hardware task dividing and dispatching method for reconfigurable computing platform | |
CN105117281A (en) | Task scheduling method based on task application signal and execution cost value of processor core | |
Pachchigar et al. | Design and Implementation of Deadline based EDF Algorithm on ARM LPC2148 | |
Maia et al. | Response-time analysis of fork/join tasks in multiprocessor systems | |
CN102279731A (en) | Method for realizing single step execution | |
EP2781977A1 (en) | Method and system for managing distributed computing in automation systems | |
CN104484160A (en) | Instruction scheduling and register allocation method on optimized clustered VLIW (Very Long Instruction Word) processor |
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 |