CN107589993A - A kind of dynamic priority scheduling algorithm based on linux real time operating systems - Google Patents
A kind of dynamic priority scheduling algorithm based on linux real time operating systems Download PDFInfo
- Publication number
- CN107589993A CN107589993A CN201710694888.7A CN201710694888A CN107589993A CN 107589993 A CN107589993 A CN 107589993A CN 201710694888 A CN201710694888 A CN 201710694888A CN 107589993 A CN107589993 A CN 107589993A
- Authority
- CN
- China
- Prior art keywords
- task
- time
- real
- algorithms
- memory module
- 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.)
- Pending
Links
Abstract
The present invention relates to a kind of dynamic priority scheduling algorithm based on linux real time operating systems, it is characterised in that comprises the following steps:When real-time task adds task queue, update current recovery time and obtain the state of current task, real-time task enters caching memory module;When real-time task transfinites, SLAD or BACKSLASH algorithms are called, and counted in memory module is cached;Otherwise EDF algorithms are called, and are counted in memory module is cached;Caching memory module calculates the frequency that real-time task transfinites in setting time section;The frequency to be transfinited according to real-time task determines directly scheduling SLAD or BACKSLASH algorithms, or scheduling EDF algorithms, updates task priority and next recovery time.The advantage of EDF algorithms is thus effectively make use of when handling normal tasks and loading, it is easy to accomplish and the resource of less occupancy processor.
Description
Technical field
The invention belongs to real time operating system technical field, and in particular to a kind of dynamic based on linux real time operating systems
State priority scheduling algorithm.
Background technology
In numerous real time operating systems, the real time operating system based on Linux, due to open source code, and
The stability of linux system, it is increasingly subject to the welcome of people.But Linux is not real real time operating system in itself, it is necessary to
By being correspondingly improved to (SuSE) Linux OS, improve its real-time, with meet real-time system requirement it is real-time
Property and reliability.
The behavior correctness of real-time system depends not only on the correctness of checkout result, additionally depends on to obtain this result institute
The time of cost.The fundamental characteristics of real-time system is the certainty of task response-time and the high-throughput of system processing task.
The application field of real-time system is quite varied, and requirement of the different applications to time determinability is also different.Except that must possess sound
Answer beyond time determinability, real-time system others key property includes concurrency, predictability and reliability.Concurrency refers to
Real-time system allows for handling multiple outside inputs in specified time period.Predictability is substantially to response time certainty
Guarantee.The essence of outside input is concurrent and random distribution, and each input triggering real-time system produces corresponding action, and
The flow of these actions, required processor time are predictable.The response time is only just can guarantee that in this case
Certainty.
Real-time scheduling is the basic means that real-time system solved concurrently and ensured predictability.Real-time scheduling's root
It is that concurrent outside input determines processing sequence according to scheduling strategy, and is sequentially each processing operation distribution system money according to this
Source.Another major function of real-time scheduling is to determine whether system existing resource meets processing behaviour according to Schedulable conditions
The time determinability of work.Different from general-purpose scheduler algorithm, real-time scheduling ensures that all ready processing operations can be first
Regulation terminated before the time limit, and next is only handles external event to improve the resource utilization of system as much as possible.How to protect
The hot issue that resource utilization ratio is real-time scheduling's research is improved on the premise of card time determinability.
Classical EDF (Earliest Deadline First) algorithm is a kind of dynamic dispatching algorithm based on priority,
Although this algorithm can ensure before the final term for some task occur can not meet, in the absence of processor free time when
Between, so as to ensure the real-time of task scheduling as far as possible, schedulable can be loaded optimize in theory, but it can not be solved
Overload problem.Once overloading, may result in CPU will spend in scheduling the plenty of time, cause performance to be degenerated rapidly.
In addition, scheduling strategy of the EDF dispatching algorithms using non-preemptive, the time of real-time task is distributed in kernel
In piece, real-time task upon execution between arrive before with regard to task can be completed.So, other task is in vacant timeslice
Kernel cannot be seized, CPU is likely to be idle within the free time of this section, and this will result in prolonging for real-time task
By mistake.On the other hand after a real-time task exceeds task execution time, task is not completed, then with current within next cycle
Limit priority continue to seize kernel, follow-up real-time task can be caused and perform postponing for time, " more meters be consequently formed
Domino " effect can make multiple processes exceed the task final coutoff time, and cause the collapse of task system.
For the appearance of problem above, Lin and Brandt are based on ISM thoughts, it is proposed that SLAD (SLACK Donation)
Algorithm and BACKSLASH (BACK SLACK Donation) algorithm.ISM thinking be real-time task is separately dispensed into it is several
Same level seeervice level, each service distribute CPU according to a certain percentage, are continued to run with if the real-time task in some service transfinites
Go down, then take the CPU of the service, and the other real-time tasks in the service that postpone.This strategy does not consider the shadow between task
Ring, have certain effect to reducing missed deadline percentage DMR (deadline miss ratio).
Although SLAD and BACKSLASH algorithms can allow the task of an excess budget more preferable dynamically distributes remaining time and
Timeslice is borrowed from next cycle in processing, the real-time task that can thus solve the problems, such as system (transfinites) overrun.But
Due to there is an advance judgement to time limit task, to decide whether using dynamically distributes remaining time and to handle from next
The individual cycle borrows timeslice.The resource of processor can be thus taken, when not being to frequently occur situation that real-time task transfinites;
This scheduling is inefficient.
As known from the above, when above two type algorithm is applied individually to any in Linux real time operating systems, can not meet
The requirement of the real-time and reliability of real-time system requirement.This is weak point of the prior art.
The content of the invention
It is an object of the present invention in view of the above-mentioned problems of the prior art, propose that one kind is based on linux real-time operations
The dynamic priority scheduling algorithm of system, to solve above-mentioned technical problem.
In order to achieve the above object, the technical scheme is that:
A kind of dynamic priority scheduling algorithm based on linux real time operating systems, comprises the following steps:
When real-time task adds task queue, update current release time and obtain the state of current task, appoint in real time
Business enters caching memory module;
When real-time task transfinites, SLAD or BACKSLASH algorithms are called, and counted in memory module is cached;Otherwise
EDF algorithms are called, and are counted in memory module is cached;
Caching memory module calculates the frequency that real-time task transfinites in setting time section;The frequency to be transfinited according to real-time task
Determine directly to dispatch SLAD or BACKSLASH algorithms, or scheduling EDF algorithms, update task priority and next recovery time.
The setting time section is some work periods.
Further, the algorithm is further comprising the steps of:
The task of a highest priority is chosen in all state tasks as task is seized, in the task of effective status
Middle the choosing highest priority of the task is as may switching for task;
If judging, may the switching of the task is identical with task is seized, next time the job scheduling time be arranged to possibility switching
The release time of task, the release time that otherwise will likely switch task and the release time for seizing task compare, and smaller value is made
For the job scheduling time next time;
Carry out operation switching.
Further, caching memory module sets task it is expected e, for that to remaining timeslice and may borrow
The situation of timeslice do advance judgement, when the expectation of task is higher, dispatch SLAD algorithms or BACKSLASH algorithms rank just
It is higher;To it is expected that e is provided with KCCoefficient, for it is expected that e makes regulation.
Further, 0≤KC≤ 1, distribution remaining time is occurred according to setting time and borrows the general of the task of timeslice
Rate is dynamically distributed;If above-mentioned this task, this COEFFICIENT K does not occur in setting time completelyCValue will take 0, directly adjust
With EDF algorithms.
Further, SLAD algorithms priority calculation formula is:
Vdeadline=[t/p] * p+d formulas (1)
BACKSLASH algorithm priority calculation formula are:
Vdeadline=ds,k-[(ds,k- t)/p] * p formulas (2)
Wherein, t is current time, and p is the duty cycle, and d is deadline in the duty cycle, and vdeadline is minimum
Task priority highest.
Further, the condition of EDF algorithms task-set schedulable is:
Task-set τ={ T1,T2... Tn }, wherein Ti=(ei,di,pi,ri),eiRepresent the execution time in the cycle, diTable
Show that completion is realized, piRepresent cycle size, riThe initial release moment of the task is represented, i.e., at the time of task puts into operation;
Wherein ei,di,piFor arithmetic number, riFor nonnegative real number;Duty cycle realizes identical, i.e. d with cut-offi=riWhen,
The beneficial effects of the present invention are the frequency that caching memory module transfinites according to the real-time task occurred in a period of time
Rate determines directly to dispatch SLAD or BACKSLASH algorithms, otherwise calls EDF dispatching algorithms.Thus born in processing normal tasks
The advantage of EDF algorithms is effectively make use of during load, it is easy to accomplish and the resource of less occupancy processor.Directly dispatching
It can efficiently handle the overrun issues of real-time task during SLAD or BACKSLASH algorithms.Cache memory module and the task phase is set
E is hoped, it is used for making an advance judgement to the situation of remaining timeslice and the timeslice that may be borrowed.When this
The expectation of business (distribution remaining time and borrowing timeslice) is higher, and it gives scheduling SLAD or BACKSLASH algorithms rank just
It is higher.Perhaps this task can't frequently occur under common situation.Then to it is expected that e is provided with a KCSystem
Number, it is used for it is expected that e makes a regulation, and it is dynamically distributed according to the probability that this task occurs for a period of time.When
This task does not occur completely for a period of time, this COEFFICIENT KCValue will take 0.EDF algorithms are directly invoked so as to be transferred to.Very
The good overload problem that solves traditional algorithm and cann't be solved, and the correctness and real-time of system call are ensure that, significantly
Improve the dispatching efficiency of system.
In addition, design principle of the present invention is reliable, and it is simple in construction, there is very extensive application prospect.
As can be seen here, the present invention compared with prior art, has prominent substantive distinguishing features and significantly improved, it is implemented
Beneficial effect be also obvious.
Brief description of the drawings
Fig. 1 is a kind of algorithm of the dynamic priority scheduling algorithm based on linux real time operating systems provided by the invention
Flow chart.
Embodiment
Below in conjunction with the accompanying drawings and the present invention will be described in detail by specific embodiment, and following examples are to the present invention
Explanation, and the invention is not limited in implementation below.
As shown in figure 1, a kind of dynamic priority scheduling based on linux real time operating systems that the present embodiment provides is calculated
Method, comprise the following steps:
When real-time task adds task queue, update current release time and obtain the state of current task, appoint in real time
Business enters caching memory module;
When real-time task transfinites, SLAD or BACKSLASH algorithms are called, and counted in memory module is cached;Otherwise
EDF algorithms are called, and are counted in memory module is cached;
Caching memory module calculates the frequency that real-time task transfinites in setting time section;The frequency to be transfinited according to real-time task
Determine directly to dispatch SLAD or BACKSLASH algorithms, or scheduling EDF algorithms, update task priority and next recovery time.
The setting time section is some work periods.
Task scheduling algorithm comprises the following steps that:
Step 31:Real-time task adds the shape that current release time time acquisition current task is updated during task queue
State, real-time task enter caching memory module link KC*e;
Step 32:According to the number of the task of caching record overload and normal consistency, judge whether real-time task transfinites choosing
The method for selecting renewal task priority;
Step 33:After updating task priority, task is classified according to the working condition in this cycle of task, for one
The individual cycle does not complete the task of work, and state is set to active, and the task status that work is completed for a cycle is set to
inactive;
Step 34:The task conduct of a highest priority is chosen in the task of all active states to be switched
Task, and be saved in next variables, the task of a highest priority chosen in all state tasks as seizing and is appointed
Business, and be saved in preemptor variables, judge, if variable next and variable preemptor are equal, next subjob is adjusted
The release time resume-time that variable preempt_time is arranged to variable next by the time is spent, otherwise by variable
Preempt_time is arranged to next release time resume-time and preemptor release time resume-time ratios
Compared with smaller value is as the job scheduling time next time;Carry out operation switching.
The method of selection renewal task priority includes:
SLAD algorithms renewal task priority is called when if real-time task transfinites, and to remembering link accumulated counts;It is if real
When task EDF algorithms renewal task priority is called when not transfiniting, while to remembering link accumulated counts.
Caching memory module sets a task it is expected e, for remaining timeslice and the timeslice that may be borrowed
Situation do advance judgement, when the expectation of task is higher, scheduling SLAD ranks are higher;To it is expected that e is provided with a KCSystem
Number, for it is expected that e makes a regulation.
0≤KC≤ 1, the probability that distribution remaining time occurs according to setting time and borrows the task of timeslice dynamically divides
Match somebody with somebody;If above-mentioned this task, this COEFFICIENT K does not occur in setting time completelyCValue will take 0, directly invoke EDF algorithms.
SLAD algorithm priority calculation formula are:
Vdeadline=[t/p] * p+d
Wherein, t is current time, and p is the duty cycle, and d is deadline in the duty cycle, and vdeadline is minimum
Task priority highest.
The condition of EDF algorithm task-set schedulable is:
Task-set τ={ T1,T2... Tn }, wherein Ti=(ei,di,pi,ri), eiRepresent the execution time in the cycle, diTable
Show that completion is realized, piRepresent cycle size, riThe initial release moment of the task is represented, i.e., at the time of task puts into operation;
Wherein ei,di,piFor arithmetic number, riFor nonnegative real number;Duty cycle realizes identical, i.e. d with cut-offi=riWhen,
Disclosed above is only the preferred embodiment of the present invention, but the present invention is not limited to this, any this area
What technical staff can think does not have creative change, and some improvement made without departing from the principles of the present invention and
Retouching, should all be within the scope of the present invention.
Claims (6)
1. a kind of dynamic priority scheduling algorithm based on linux real time operating systems, it is characterised in that comprise the following steps:
When real-time task adds task queue, update current release time and obtain the state of current task, real-time task is entered
Enter to cache memory module;
When real-time task transfinites, SLAD or BACKSLASH algorithms are called, and counted in memory module is cached;Otherwise call
EDF algorithms, and counted in memory module is cached;
Caching memory module calculates the frequency that real-time task transfinites in setting time section;The frequency to be transfinited according to real-time task determines
SLAD or BACKSLASH algorithms, or scheduling EDF algorithms are directly dispatched, updates task priority and next recovery time.
2. a kind of dynamic priority scheduling algorithm based on linux real time operating systems according to claim 1, its feature
It is, the algorithm is further comprising the steps of:
The task of a highest priority is chosen in all state tasks as task is seized, is selected in the task of effective status
The task of highest priority is taken as may switching for task;
If judging, may the switching of the task is identical with task is seized, next time the job scheduling time be arranged to that task may be switched
Release time, the release time that otherwise will likely switch task and the release time for seizing task compare, under smaller value is used as
One-stop operation scheduling time;Carry out operation switching.
3. a kind of dynamic priority scheduling algorithm based on linux real time operating systems according to claim 2, its feature
It is, caching memory module sets a task it is expected e, for the feelings to remaining timeslice and the timeslice that may be borrowed
Condition does advance judgement, and when the expectation of task is higher, scheduling SLAD algorithms or BACKSLASH algorithm ranks are higher;To it is expected e
There is provided KCCoefficient, for it is expected that e makes regulation.
4. a kind of dynamic priority scheduling algorithm based on linux real time operating systems according to claim 3, its feature
It is, 0≤KC≤ 1, the probability that distribution remaining time occurs according to setting time and borrows the task of timeslice dynamically distributes;
If above-mentioned this task, this COEFFICIENT K does not occur in setting time completelyCValue will take 0, directly invoke EDF algorithms.
5. a kind of dynamic priority scheduling algorithm based on linux real time operating systems according to claim 1, its feature
It is,
SLAD algorithm priority calculation formula are:
Vdeadline=[t/p] * p+d formulas (1)
BACKSLASH algorithm priority calculation formula are:
Vdeadline=ds,k-[(ds,k- t)/p] * p formulas (2)
Wherein, t is current time, and p is the duty cycle, and d is deadline in the duty cycle, and vdeadline is minimum to be appointed
Business highest priority.
6. a kind of dynamic priority scheduling algorithm based on linux real time operating systems according to claim 1, its feature
It is,
The condition of EDF algorithm task-set schedulable is:
Task-set τ={ T1,T2... Tn }, wherein Ti=(ei,di,pi,ri), eiRepresent the execution time in the cycle, diRepresent
Into realization, piRepresent cycle size, riThe initial release moment of the task is represented, i.e., at the time of task puts into operation;
Wherein ei,di,piFor arithmetic number, riFor nonnegative real number;Duty cycle realizes identical, i.e. d with cut-offi=riWhen,
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710694888.7A CN107589993A (en) | 2017-08-15 | 2017-08-15 | A kind of dynamic priority scheduling algorithm based on linux real time operating systems |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710694888.7A CN107589993A (en) | 2017-08-15 | 2017-08-15 | A kind of dynamic priority scheduling algorithm based on linux real time operating systems |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107589993A true CN107589993A (en) | 2018-01-16 |
Family
ID=61043146
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710694888.7A Pending CN107589993A (en) | 2017-08-15 | 2017-08-15 | A kind of dynamic priority scheduling algorithm based on linux real time operating systems |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107589993A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109165089A (en) * | 2018-09-21 | 2019-01-08 | 成都理工大学 | A kind of overload real-time system based on MaxSAT optimal solution can not preemption scheduling method |
CN111176637A (en) * | 2019-12-11 | 2020-05-19 | 西北工业大学 | Schedulability analysis method of AADL model based on cache preemption delay constraint |
CN113010273A (en) * | 2021-03-23 | 2021-06-22 | 河北冀联人力资源服务集团有限公司 | Human resource data distributed task processing method and system |
CN113296874A (en) * | 2020-05-29 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Task scheduling method, computing device and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5995745A (en) * | 1996-12-23 | 1999-11-30 | Yodaiken; Victor J. | Adding real-time support to general purpose operating systems |
CN101339521A (en) * | 2008-07-28 | 2009-01-07 | 华中科技大学 | Tasks priority dynamic dispatching algorithm |
CN102779047A (en) * | 2012-07-09 | 2012-11-14 | 哈尔滨工程大学 | Embedded software support platform |
-
2017
- 2017-08-15 CN CN201710694888.7A patent/CN107589993A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5995745A (en) * | 1996-12-23 | 1999-11-30 | Yodaiken; Victor J. | Adding real-time support to general purpose operating systems |
CN101339521A (en) * | 2008-07-28 | 2009-01-07 | 华中科技大学 | Tasks priority dynamic dispatching algorithm |
CN102779047A (en) * | 2012-07-09 | 2012-11-14 | 哈尔滨工程大学 | Embedded software support platform |
Non-Patent Citations (3)
Title |
---|
余祖峰 等: ""EDF调度算法的实时性改进"", 《广西工学院学报》 * |
余祖峰: ""嵌入式Lunux操作系统调度算法研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
余祖峰等: ""基于ISM的动态优先级调度算法"", 《计算机工程》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109165089A (en) * | 2018-09-21 | 2019-01-08 | 成都理工大学 | A kind of overload real-time system based on MaxSAT optimal solution can not preemption scheduling method |
CN109165089B (en) * | 2018-09-21 | 2021-10-29 | 成都理工大学 | Non-preemptible scheduling method of overload real-time system based on MaxSAT optimal solution |
CN111176637A (en) * | 2019-12-11 | 2020-05-19 | 西北工业大学 | Schedulability analysis method of AADL model based on cache preemption delay constraint |
CN111176637B (en) * | 2019-12-11 | 2023-01-13 | 西北工业大学 | Schedulability analysis method of AADL model based on cache preemption delay constraint |
CN113296874A (en) * | 2020-05-29 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Task scheduling method, computing device and storage medium |
CN113296874B (en) * | 2020-05-29 | 2022-06-21 | 阿里巴巴集团控股有限公司 | Task scheduling method, computing device and storage medium |
CN113010273A (en) * | 2021-03-23 | 2021-06-22 | 河北冀联人力资源服务集团有限公司 | Human resource data distributed task processing method and system |
CN113010273B (en) * | 2021-03-23 | 2022-07-19 | 河北冀联人力资源服务集团有限公司 | Human resource data distributed task processing method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Vijayakumar et al. | Dynamic resource provisioning for data streaming applications in a cloud environment | |
US9798830B2 (en) | Stream data multiprocessing method | |
CN107589993A (en) | A kind of dynamic priority scheduling algorithm based on linux real time operating systems | |
CN105045658B (en) | A method of realizing that dynamic task scheduling is distributed using multinuclear DSP embedded | |
EP1730628B1 (en) | Resource management in a multicore architecture | |
US10176014B2 (en) | System and method for multithreaded processing | |
US20120297216A1 (en) | Dynamically selecting active polling or timed waits | |
CN110795254A (en) | Method for processing high-concurrency IO based on PHP | |
CN109992385A (en) | A kind of inside GPU energy consumption optimization method of task based access control balance dispatching | |
CN104331331A (en) | Resource distribution method for reconfigurable chip multiprocessor with task number and performance sensing functions | |
US7827282B2 (en) | System and method for processing hardware or service usage data | |
CN108446180A (en) | A kind of data center dynamic method for scheduling task based on Data Migration | |
CN103685492B (en) | Dispatching method, dispatching device and application of Hadoop trunking system | |
CN111597044A (en) | Task scheduling method and device, storage medium and electronic equipment | |
Alhussian et al. | An unfair semi-greedy real-time multiprocessor scheduling algorithm | |
CN103645941A (en) | Novel wireless sensor network operation system | |
Zhang et al. | An energy-efficient scheduling algorithm for sporadic real-time tasks in multiprocessor systems | |
CN101349975B (en) | Method for implementing interrupt bottom semi-section mechanism in embedded operation system | |
CN116795503A (en) | Task scheduling method, task scheduling device, graphic processor and electronic equipment | |
Tang et al. | A network load perception based task scheduler for parallel distributed data processing systems | |
CN111176847B (en) | Method and device for optimizing performance of big data cluster on physical core ultra-multithreading server | |
Manickam et al. | A fair and efficient gang scheduling algorithm for multicore processors | |
Kalogeraki et al. | Dynamic migration algorithms for distributed object systems | |
CN102339223A (en) | Digital data processing system | |
RU2239228C2 (en) | Method for distributing time of central processor between tasks in automatized system for controlling technological processes |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180116 |