CN104699533B - A kind of dispatching method of multiple periodic duties - Google Patents

A kind of dispatching method of multiple periodic duties Download PDF

Info

Publication number
CN104699533B
CN104699533B CN201310664716.7A CN201310664716A CN104699533B CN 104699533 B CN104699533 B CN 104699533B CN 201310664716 A CN201310664716 A CN 201310664716A CN 104699533 B CN104699533 B CN 104699533B
Authority
CN
China
Prior art keywords
periodic duty
turn
periodic
task
duty
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
Application number
CN201310664716.7A
Other languages
Chinese (zh)
Other versions
CN104699533A (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.)
AVIC No 631 Research Institute
Original Assignee
AVIC No 631 Research Institute
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 AVIC No 631 Research Institute filed Critical AVIC No 631 Research Institute
Priority to CN201310664716.7A priority Critical patent/CN104699533B/en
Publication of CN104699533A publication Critical patent/CN104699533A/en
Application granted granted Critical
Publication of CN104699533B publication Critical patent/CN104699533B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Control By Computers (AREA)
  • Medicines That Contain Protein Lipid Enzymes And Other Medicines (AREA)

Abstract

The present invention provides a kind of dispatching method of multiple periodic duties, asks for the greatest common divisor pnum of one group of number by forming all dispatching cycles and scheduling occasion;The time value for setting tick interrupt is pnum;After tick interrupt triggering, each periodic duty information is inquired about, judges that the periodic duty that whether reaches of each periodic duty performs condition;If reaching periodic duty performs condition, the periodic duty entrance specified into the periodic duty;If not up to periodic duty performs condition, periodic duty is not performed, waits tick interrupt triggering next time.Periodic duty can be effectively ensured to perform and do not interfere with each other according to the scheduling occasion of oneself and correct execution dispatching cycle and each periodic duty.It is easily achieved, amount of calculation is few, and the data structure and software configuration of use are easy to modifications and extensions, and task scheduling mode is flexible, widely applicable.

Description

A kind of dispatching method of multiple periodic duties
Technical field
The invention belongs to computer control field, and in particular to a kind of dispatching method of multiple periodic duties.
Background technology
In embedded real time system, the scheduling of periodic duty is always the focus of research, and the scheduling of periodic duty is fine or not It is an important factor for influenceing running efficiency of system.Research on period task scheduling method emerges in an endless stream, and generates many realities When dispatching method:Such as classical FCFS algorithms, RM algorithms, priority inheritance, reversion, static rate-monotonic method RMS and Monotonic dispatching method DMS and driving algorithm DD of dynamic deadline date and minimum processing time finite algorithm SPTF etc., also many innovatory algorithms.Conventional dispatching method stresses the selection gist and such as of main research scheduler task What is scheduled the determination of duty cycle, does not consider in the case of multiple periodic duties, how according to cycle of task It is scheduled with scheduling occasion.
The content of the invention
The purpose of the present invention is:Design is realized a kind of for multiple periodic duties of different dispatching cycles and scheduling occasion tune Degree method, the scheduling of multiple periodic duties in embedded real time system is realized, in the situation that occupancy CPU time and resource are less The lower correct scheduling for ensureing periodic duty.
The technical scheme is that:
A kind of dispatching method of multiple periodic duties, it is characterized in that:Comprise the following steps:
1) according to the dispatching cycle of multiple periodic duties and scheduling occasion, ask for by all dispatching cycles and scheduling occasion The greatest common divisor pnum of one group of number of composition;
2) ask for the dispatching cycle of each periodic duty and scheduling occasion is respectively relative to pnum multiple, and will each week * function, At_period, At_turn of phase task form a field and are sequentially stored in buffering area;* fuction is represented Periodic duty entrance;At_period represents periodic duty and performs the cycle, and computational methods are:Dispatching cycle/pnum;At_turn generations Table periodic duty performs opportunity for the first time, and computational methods are:(scheduling occasion/pnum)+1;
3) time value for setting tick interrupt is pnum;
4) after tick interrupt triggering, each periodic duty information in buffering area is looked into according to storage order Ask, judge whether each periodic duty reaches execution condition, first subtract 1 to At_turn values, represent to work as when At_turn values are 0 The preceding periodic duty execution time arrives, and can trigger execution.Specified if periodic duty reaches trigger condition into the periodic duty Periodic duty entrance, perform periodic duty, otherwise, do not perform periodic duty, At_turn values are updated, in clock next time Periodic duty, which is rejudged, after disconnected triggering performs whether condition meets.
Above-mentioned steps 4) be specially:At_turn values are updated, i.e. At_turn values subtract 1, judge the At_ of current period task Whether turn value is 0, if the At_turn of current period task value is 0, the cycle specified into current period task Task entrance * function, periodic duty is performed, and At_period value is assigned to At_turn;Otherwise, do not perform current Periodic duty, wait tick interrupt triggering next time.
It is an advantage of the invention that:The greatest common divisor of all periodic duties respective cycle time is arranged to tick interrupt Triggered time spacing value, period time value multiple proportion substantially be greatest common divisor value it is bigger in the case of, CPU can Single treatment is carried out to periodic duty with the interval long period, operating efficiency greatly improves;The dispatching cycle of periodic duty and tune Multiple proportion is more obvious between spending opportunity each data, then method efficiency is higher, and periodic duty is inquired about in tick interrupt Processing, periodic duty can be effectively ensured according to the scheduling occasion of oneself and correctly execution and the execution of each periodic duty dispatching cycle It does not interfere with each other.This method is easily achieved, and amount of calculation is few, and the data structure and software configuration of use are easy to modifications and extensions, task Scheduling mode is flexible, widely applicable.
Embodiment
The present invention stresses research in the case of known periods duty cycle and scheduling occasion, how according to periodic duty The method that dispatching cycle and scheduling occasion carry out multiple periodic duty Real-Time Schedulings.I.e. in once dispatching, all cycles are arrived Reaching for task is scheduled, and the scheduling between periodic duty does not interfere with each other while is not take up CPU too many times and resource.
Period task scheduling of the present invention is primarily upon scheduling occasion and dispatching cycle, and different periodic duties typically can all be adopted With different scheduling occasions and dispatching cycle.Present invention design is a kind of using tick interrupt and the period task scheduling of inquiry mode Method so that each periodic duty can be scheduled according to the scheduling occasion of task in itself and dispatching cycle, without by other The interference of periodic duty.
The present invention specific method step be:
1) according to the dispatching cycle of multiple periodic duties and scheduling occasion, ask for by all dispatching cycles and scheduling occasion The greatest common divisor pnum of one group of number of composition;When each periodic duty can correspond to a dispatching cycle and a scheduling Machine, then n periodic duty just have n dispatching cycle and n scheduling occasion, for n dispatching cycle and n scheduling occasion group Into one group of number, ask for greatest common divisor pnum;
2) ask for the dispatching cycle of each periodic duty and scheduling occasion is respectively relative to pnum multiple, and will each week * function, At_period, At_turn of phase task form a field and are sequentially stored in buffering area;* fuction is represented Periodic duty entrance;At_period represents periodic duty and performs the cycle, and computational methods are:Dispatching cycle/pnum;At_turn generations Table periodic duty performs opportunity for the first time, and computational methods are:(scheduling occasion/pnum)+1;
3) time value for setting tick interrupt is pnum;
4) after tick interrupt triggering, each periodic duty information in buffering area is looked into according to storage order Ask, judge whether each periodic duty reaches execution condition, first subtract 1 to At_turn values, represent to work as when At_turn values are 0 The preceding periodic duty execution time arrives, and can trigger execution.Specified if periodic duty reaches trigger condition into the periodic duty Periodic duty entrance, perform periodic duty, otherwise, do not perform periodic duty, At_turn values are updated, in clock next time Periodic duty, which is rejudged, after disconnected triggering performs whether condition meets.
Step 4) specifically can be in the following ways:At_turn values are updated, i.e. At_turn values subtract 1, judge current period Whether the At_turn of task value is 0, if the At_turn of current period task value is 0, into current period task The periodic duty entrance * function specified, periodic duty is performed, and At_period value is assigned to At_turn;Otherwise, Current period task is not performed, waits tick interrupt triggering next time.
False code is as follows:
Illustrated below by way of an instantiation:
Assuming that in controller system, there are 4 data transfer cycle tasks, the scheduling occasion of each periodic duty and scheduling Cycle is as shown in table 1:
The periodic duty information of table 1
Periodic duty Scheduling occasion Dispatching cycle
Task 1 0ms 20ms
Task 2 5ms 30ms
Task 3 10ms 10ms
Task 4 15ms 20ms
According to the scheduling occasion of four tasks and time dispatching cycle, i.e. 0ms, 20ms, 5ms, 30ms, 10ms, 10ms, 15ms, 20ms greatest common divisor pnum are 5ms, and the time value for setting tick interrupt is 5ms, by the * of each periodic duty Function, At_period, At_turn form a field and are sequentially stored in buffering area, then the mission bit stream storage in buffering It is as follows:
{
The entrance of periodic duty 1,4,1;
The entrance of periodic duty 2,6,2;
The entrance of periodic duty 3,2,3;
The entrance of periodic duty 4,4,4;
}
Tick interrupt triggers once every 5ms, and after tick interrupt triggering, above periodic transfer task portion performs feelings Condition is as shown in table 2.
When the triggering of the 0th tick interrupt is (during 0ms), the At_turn values of each periodic duty are updated according to storage order, That is At_turn values subtract 1, inquire about the At_turn values of four periodic duties.For periodic duty 1, its At_turn value is 1, renewal It is afterwards 0, meets execution condition, the periodic duty entrance specified into periodic duty 1, performs periodic duty 1, and by periodic duty 1 At_period value 4 is assigned to At_turn, obtains At_turn updated value 4.For periodic duty 2, its At_turn value is 2, At_turn is subtracted 1, obtains At_turn updated value 1, is unsatisfactory for execution condition, does not perform periodic duty 2, when waiting next time Clock down trigger.For periodic duty 3, its At_turn value is 3, and At_turn values are 2 after renewal, are unsatisfactory for execution condition, no Periodic duty 3 is performed, waits tick interrupt triggering next time.For periodic duty 4, its At_turn value is 4, At_ after renewal Turn values are 3, are unsatisfactory for execution condition, do not perform periodic duty 4, wait tick interrupt triggering next time.
When the triggering of the 1st tick interrupt is (during 5ms), the At_turn values of four periodic duties are inquired about with storage order.For Periodic duty 1, its At_turn value are 4, and At_turn values are updated into 3, do not perform periodic duty 1., will for periodic duty 2 At_turn values are updated to 0, the periodic duty entrance specified into periodic duty 2, perform periodic duty 2, and by periodic duty 2 At_period value 6 be assigned to At_turn, obtain At_turn updated value 6.For periodic duty 3, by At_turn values more New is 1, does not perform periodic duty 3.For periodic duty 4, At_turn values are updated to 2, do not perform periodic duty 4.
……
When the 4th tick interrupt triggering (during 20ms), with storage order inquire about four periodic duties At_turn values.It is right In periodic duty 1, At_turn values are updated to 0, the periodic duty entrance specified into periodic duty 1, perform periodic duty 1, And the At_period of periodic duty 1 value 4 is assigned to At_turn, obtain At_turn updated value 4.For periodic duty 2, At_turn values are updated to 3, wait tick interrupt triggering next time.For periodic duty 3, At_turn values are updated to 0, held Row periodic duty 3, and the At_period of periodic duty 3 value 2 is assigned to At_turn, obtain At_turn updated value 2.It is right In periodic duty 4, At_turn values are updated to 3, then do not perform periodic duty 4, wait tick interrupt triggering next time.Therefore When the 4th tick interrupt triggers, one, which shares two periodic duties, is performing, i.e. periodic duty 1 and periodic duty 3.
The periodic transfer task scheduling of table 2 performs table
Step 4 can also use other principle identical methods.
The present invention period time value multiple proportion be substantially greatest common divisor value it is bigger in the case of, CPU can be with The interval long period carries out single treatment to periodic duty, and operating efficiency greatly improves;Periodic duty is entered in tick interrupt Row query processing, periodic duty can be effectively ensured according to the scheduling occasion of oneself and dispatching cycle correctly performs and each cycle times Business execution is not interfere with each other.

Claims (2)

  1. A kind of 1. dispatching method of multiple periodic duties, it is characterised in that:Comprise the following steps:
    1) according to the dispatching cycle of multiple periodic duties and scheduling occasion, ask for being made up of all dispatching cycles and scheduling occasion One group of number greatest common divisor pnum;
    2) ask for the dispatching cycle of each periodic duty and scheduling occasion is respectively relative to pnum multiple, and each cycle is appointed * function, At_period, At_turn of business form a field and are sequentially stored in buffering area;* fuction represents the cycle Task entrance;At_period represents periodic duty and performs the cycle, and computational methods are:Dispatching cycle/pnum;At_turn represents week Phase task performs opportunity for the first time, and computational methods are:(scheduling occasion/pnum)+1;
    3) time value for setting tick interrupt is pnum;
    4) after tick interrupt triggering, each periodic duty information in buffering area is inquired about according to storage order, sentenced Whether each disconnected periodic duty reaches execution condition, first subtracts 1 to At_turn values, and current week is represented when At_turn values are 0 Phase task execution time is arrived, and can trigger execution, and the week that the periodic duty is specified is entered if periodic duty reaches trigger condition Phase task entrance, periodic duty is performed, otherwise, do not perform periodic duty, update At_turn values, touched in tick interrupt next time Periodic duty is rejudged after hair and performs whether condition meets.
  2. 2. the dispatching method of multiple periodic duties according to claim 1, it is characterised in that:Step 4) is specially:Renewal At_turn values, i.e. At_turn values subtract 1, and whether the value for judging the At_turn of current period task is 0, if current period is appointed The At_turn of business value is 0, then the periodic duty entrance * function specified into current period task, performs the cycle times Business, and At_period value is assigned to At_turn;Otherwise, current period task is not performed, waits tick interrupt next time Triggering.
CN201310664716.7A 2013-12-09 2013-12-09 A kind of dispatching method of multiple periodic duties Active CN104699533B (en)

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 CN104699533A (en) 2015-06-10
CN104699533B true 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)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI584667B (en) 2015-11-27 2017-05-21 財團法人工業技術研究院 Method for request scheduling and scheduling device
CN107577528B (en) * 2017-09-01 2020-09-08 长沙小卡机器人科技有限公司 Method for parallel running of multitask sequences
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

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3920818B2 (en) * 2003-07-22 2007-05-30 株式会社東芝 Scheduling method and information processing system
JP4673408B2 (en) * 2005-06-03 2011-04-20 エヌエックスピー ビー ヴィ Data processing system and method for scheduling utilization of at least one exclusive resource
KR100953099B1 (en) * 2007-12-26 2010-04-19 전자부품연구원 Small Low-Power Embedded System and Preemption Avoidance Method Thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN104699533A (en) 2015-06-10

Similar Documents

Publication Publication Date Title
CN104699533B (en) A kind of dispatching method of multiple periodic duties
Fattahi et al. A branch and bound algorithm for hybrid flow shop scheduling problem with setup time and assembly operations
Bouazza et al. A distributed approach solving partially flexible job-shop scheduling problem with a Q-learning effect
Balharith et al. Round robin scheduling algorithm in CPU and cloud computing: a review
Zhu et al. Scheduling stochastic multi-stage jobs to elastic hybrid cloud resources
US20150347186A1 (en) Method and system for scheduling repetitive tasks in o(1)
WO2014041673A1 (en) Stream data multiprocessing method
CN104281495B (en) Method for task scheduling of shared cache of multi-core processor
Akhshabi et al. Solving flow shop scheduling problem using a parallel genetic algorithm
Navaei et al. Two-stage flow-shop scheduling problem with non-identical second stage assembly machines
Behera et al. A new dynamic round robin and SRTN algorithm with variable original time slice and intelligent time slice for soft real time systems
Begam et al. Preference-oriented fixed-priority scheduling for periodic real-time tasks
Tariq et al. Energy-aware scheduling of conditional task graphs with deadlines on mpsocs
Sarkar et al. Cannot avoid penalty? Let’s minimize
CN104375883B (en) A kind of CFS schedulers
CN104461471B (en) Unified instruction scheduling and register allocation method on sub-clustering vliw processor
Saranya et al. Dynamic partitioning based scheduling of real-time tasks in multicore processors
Chernigovskiy et al. Scheduling algorithms for automatic control systems for technological processes
CN106055862A (en) Novel efficient heuristic-type two-stage parallel branch-and-bound method
DE602005002533D1 (en) DMAC OUTPUT MECHANISM USING A STEAMING ID PROCESS
Netjinda et al. Cloud Provisioning for Work ow Application with Deadline using Discrete PSO
Maia et al. Response-time analysis of fork/join tasks in multiprocessor systems
Liu et al. List scheduling strategies for task graphs with data parallelism
Jeong et al. Heuristics for assembly operation scheduling problem in flexible assembly systems
Kamal et al. Enhanced user preference based intelligent scheduling algorithm (E-UPISA)

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