CN101751289B - Mixed scheduling method of embedded real-time operating system - Google Patents

Mixed scheduling method of embedded real-time operating system Download PDF

Info

Publication number
CN101751289B
CN101751289B CN 200810241349 CN200810241349A CN101751289B CN 101751289 B CN101751289 B CN 101751289B CN 200810241349 CN200810241349 CN 200810241349 CN 200810241349 A CN200810241349 A CN 200810241349A CN 101751289 B CN101751289 B CN 101751289B
Authority
CN
China
Prior art keywords
task
ready
priority
time
scheduling
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
CN 200810241349
Other languages
Chinese (zh)
Other versions
CN101751289A (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.)
Mores Electronics Technology Inc Co Of Shenzhen
Original Assignee
SHENZHEN MINDE ELECTRONICS TECHNOLOGY Ltd
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 SHENZHEN MINDE ELECTRONICS TECHNOLOGY Ltd filed Critical SHENZHEN MINDE ELECTRONICS TECHNOLOGY Ltd
Priority to CN 200810241349 priority Critical patent/CN101751289B/en
Publication of CN101751289A publication Critical patent/CN101751289A/en
Application granted granted Critical
Publication of CN101751289B publication Critical patent/CN101751289B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a mixed scheduling method of an embedded real-time operating system. The method comprises the steps of pre-task scheduling resource allocation and task scheduling, wherein the task scheduling comprises the following steps: enabling a task to be ready in an event-trigger or time-trigger mode; looking for a priority decision table based on a ready list and a ready group to obtain the current ready highest task priority; and when the ready task of the highest priority is a collaborative task, directly running the collaborative task, removing the positions of the collaborative task in the ready list and the ready group after the completion of the collaborative task, and executing the previous step again. By treating ISR as the task, allocating priority along with other tasks, simultaneously combining the time-trigger and event-trigger framework and adopting the mixed scheduling mode of preemptive and collaborative tasks, the invention obtains a scheduling method which has the advantages of high predictability and reliability and high real-time response capability. The scheduling method can make full use of the system resources and effectively control the system overhead.

Description

A kind of mixed scheduling method of embedded real-time operating system
Technical field
The present invention relates to the embedded OS design and realize technical field, more particularly, relate to a kind of mixed scheduling method of embedded real-time operating system.
Background technology
Widespread use along with rapid development of computer technology and Internet technology, embedded system (Embedded System) is being brought into play more and more important effect, and it is widely used in aspects such as process industry, process control, communication, instrument, instrument, automobile, boats and ships, Aero-Space, military equipment, consumer product.Embedded system is defined as, and is application-centered, and based on computer technology, hardware and software can be reduced, and adapts to application system to function, reliability, cost, volume, the dedicated computer system that power consumption etc. are strict with.
Just because of the application of embedded system enlarges day by day, functional requirement also increases gradually, impels people to introduce embedded OS in embedded system.Embedded OS with real-time be exactly embedded real-time operating system (Embedded Real Time Operating System, ERTOS).The correctness of its operation not only depends on the correct degree of logical design, and the time of following these operations to carry out is relevant.That is to say that real time operating system be the more important thing is also will satisfy and used the real-time requirement that proposes except the functional requirement that will satisfy application.Its top priority is under the certain hour restriction, transfers all available resources and finishes real-time control task.Embedded real-time operating system is because the needs used and the restriction of hardware condition, but has characteristics such as solid state, volume are little, efficient, high reliability, high real-time.
The real-time of embedded real-time operating system and multiple task ability depend on its task scheduling algorithm to a great extent.From scheduling mode, but can be divided into preemption scheduling and can not dispatch by preemptive type (i.e. cooperation formula).
In preemptive type (Preemptive) scheduling, moving at present of task can be by other more urgent and prior tasks interrupt.Simultaneously, being seized of task can be resumed operation in future, and can not have influence on the whole time limit constraint of task.The advantage of preemption scheduling is more flexible, and the response time of its task level is able to optimization, and the utilization factor of resource is than higher, but because the context that often occurs switching (CPntextSwitch) makes that its system overhead is bigger, predictability is lower.
Fig. 1 has shown the implementation status of the preemption scheduling of two different priorities tasks and an interrupt service routine (ISR, InterruptService Routine).At first, when the task of low priority is being moved, ISR seizes low priority task and enters run mode, it makes the task of a higher priority enter ready attitude, so after ISR is complete, scheduler selects this high-priority task to enter operation, has so just postponed the operation that recovers to carry out low priority task.
MicroC/OS II and most of commercial real-time kernel all adopt preemption scheduling, MicroC/OS II is the embedded OS of the current free and open source code of being used widely, but it is based on priority preemptive type multiprocess system, supporting 64 priority, is an embedded real-time operating system that very typically adopts preemption scheduling.
And non-preemptive scheduling, i.e. cooperation formula (Cooperative) scheduling, the task of not allowing moving is by other tasks interrupt, and in a single day task has been occupied processor and just can have been moved until finishing always.Relatively be suitable for task run time relatively short system all.Its advantage is to have saved to carry out the expense that context switches, it is movable having only a task at any time, and this task run is up to finishing, has better predictability, reliability, be easier to test, but scheduling there is not preemption scheduling flexible like that, also relatively low to the utilization factor of resource.
Fig. 2 has shown the implementation status of the cooperation formula scheduling of two different priorities tasks and an ISR.At first, when low priority task is moved, ISR seizes low priority task and enters run mode, it makes the task of a higher priority enter ready attitude, the low priority task that ISR complete back recovery is seized, after this task was finished, scheduler just moved the high-priority task that is in ready attitude.
Michael J.Pont proposes a kind of cooperation formula (TTC, Time-TriggeredCooperative) scheduler of time triggering.In this scheduler, the order of magnitude in the time interval of a timeticks is generally millisecond (ms), and the task of embedded OS all can be moved in the time interval of a timeticks and finish.It is produced by the CPU timer conter, and in every time interval through a timeticks of system, just producing a time overflows interruption, and whether interrupt service routine detects has task to be in ready state this moment, then calls this task if detect.This cooperation formula scheduler is realized simple, has more reliability and security.But this scheduling mode is more weak to the real-time response ability of external event, and scheduling mode do not have preemption scheduling flexible like that, and is also relatively low to the utilization factor of resource.
In the embedded system, have two kinds of different task triggering modes in essence: Event triggered and time trigger.The Event triggered mode often uses multistage interruption to realize that its time of origin has randomness; Time triggering mode is then different, and it drives by a global clock, and owing to it is all determined in time with on the function, so its predictability is than higher.Two kinds of different task scheduling modes add two kinds of different task triggering modes, so embedded system, there is 4 types task, be respectively: the cooperation formula task that the time triggers, the preemptive type task that time triggers, Event triggered cooperation formula task and Event triggered the preemptive type task.
Though the TTC scheduler that Michael J.Pont proposes (the cooperation formula scheduling that the time triggers) can reduce the task jitter phenomenon in the embedded system effectively, the predictability height, realize simple, but this scheduling mode is more weak to the real-time response ability of external event, and scheduling mode do not have preemption scheduling flexible like that, and is relatively low to the utilization factor of resource yet.
The real-time response ability of the MicroC/OS II of employing preemption scheduling mode is more satisfactory, but can not in certain special time, accurately carry out specific task, the time determinacy is relatively poor, the context switching that often occurs makes system overhead bigger, and predictability is lower, dispatches not as the cooperation formula of time triggering based on the preemption scheduling device reliability of Event triggered.
Summary of the invention
The technical problem to be solved in the present invention is, above-mentioned defective at prior art, provide a kind of and have the time and trigger high predictability and the reliability of cooperation formula dispatching system, also have the mixed scheduling method of embedded real-time operating system of the high real-time response ability of Event triggered preemption scheduling system.
For realizing above purpose, the invention provides a kind of mixed scheduling method of embedded real-time operating system, comprise the preceding resource distribution of task scheduling and task scheduling, wherein, described task scheduling may further comprise the steps:
The mode that triggers by Event triggered or time makes task ready;
Search the priority decision table according to ready list and ready group, obtain current ready super objective priority;
According to described current ready super objective priority, obtain the task control block (TCB) structure of described ready limit priority task, and judge the classification of this task;
When described ready limit priority task is cooperation formula task, carry out this cooperation formula task, after described cooperation formula task is finished, remove its position in ready list and ready group, search the priority decision table according to ready list and ready group again, obtain current ready super objective priority.
Mixed scheduling method of the present invention, wherein, resource distribution specifically comprises the steps: before the described task scheduling
Creation task; Set up the task control block (TCB) structure; Set up task control block (TCB) address array; Set up and initialization ready list and ready group; Set up and the initialization bit mask table; Set up and initialization priority decision table; Set up and initialization interrupt priority level table; The installation timeticks interrupts.
Mixed scheduling method of the present invention, wherein, described method is treated interrupt routine with task, and distributes priority with other tasks.
Mixed scheduling method of the present invention wherein, describedly makes that task is ready specifically to be comprised:
By communication and synchronization mechanism or because interrupting making the task of Event triggered ready, or subtract 1 the time delay in the task control block (TCB) of the task correspondence that will trigger the time, when be kept to 0 time delay, make the task that the described time triggers ready.
Mixed scheduling method of the present invention wherein, describedly makes that task is ready specifically to be referred to:
To be 1 to position that should task priority in the ready list, and the position of corresponding task place group be 1 in ready group.
Mixed scheduling method of the present invention, wherein, described method also comprises:
When carrying out the timeticks interrupt routine, check whether the cooperation formula task of moving is interrupted by the timeticks interruption, be then to select Treatment Options according to user's request, described Treatment Options arranges when creation task, it comprises the uncompleted task of continuation execution, abandons carrying out uncompleted task or re-executes uncompleted task.
Mixed scheduling method of the present invention, wherein, described method is further comprising the steps of:
After described cooperation formula task is finished, check that the task requests that whether has interrupt event to trigger carries out the term of execution of described cooperation formula task, when the task requests that has interrupt event to trigger is carried out, make the task of the Event triggered of asking ready.
Mixed scheduling method of the present invention, wherein, whether described inspection has interrupt event request generation concrete steps to be:
Software is searched the interruption that takes place in cooperation formula task run process, utilize resulting interrupt source numbering, searches corresponding task priority in described interrupt priority level table, utilizes resulting priority to make corresponding task ready.
Mixed scheduling method of the present invention, wherein, described method is further comprising the steps of:
The time of described inspection interrupt event is set to the set time, and after cooperation formula task was finished, relatively set time and timeticks residue if the former is smaller, was then carried out this audit function, otherwise abandoned carrying out audit function at interval;
When carrying out this audit function, if described audit function surpasses described set time, the scheduling of executing the task immediately working time.
Mixed scheduling method of the present invention, wherein, described method is further comprising the steps of: when ready limit priority task is the preemptive type task, the preemptive type task of operation limit priority.
The invention has the beneficial effects as follows, by ISR is treated with task, and distribute priority with other tasks, and simultaneously compoundly utilize the time to trigger with the Event triggered framework and adopt the mode of preemptive type and cooperation formula task mixed scheduling, obtain a kind of mixed scheduling method.This mixed scheduling method had both had high predictability and the reliability of cooperation formula dispatching system, the advantage that also has the high real-time response ability of preemption scheduling system, by controlling the task number of two kinds of different scheduling modes, take full advantage of system resource, effectively the control system expense.
Description of drawings
Fig. 1 is the implementation status synoptic diagram of preemption scheduling in the prior art;
Fig. 2 is the implementation status synoptic diagram of cooperation formula scheduling in the prior art;
Fig. 3 is the synoptic diagram that concerns of the TCB doubly linked list that provides of the embodiment of the invention and TCB address;
Fig. 4 is ready group of providing of the embodiment of the invention and the synoptic diagram that concerns of ready list;
Fig. 5 is that the timeticks that the embodiment of the invention provides interrupts process flow diagram.
Embodiment
Below in conjunction with description of drawings, the present invention is explained in further detail.
To carry out the virtual mixed scheduling device that is called of program of described mixed scheduling method in the embodiment of the invention.
The embodiment of the invention mainly comprises two big steps, and namely the early-stage preparations of task scheduling and task scheduling are described in detail respectively below.
The early-stage preparations of task scheduling.At first, creation task, for each task creation task control block (TCB) (TaskControl Block, TCB) structure, and all TCB are connected into the TCB doubly linked list simultaneously, are set up TCB address array TCBPrioTbl[LowestPrio+1].As shown in Figure 3, introduced relation between TCB address array and the TCB doubly linked list among the figure.TCB address array is to deposit the array of all TCB addresses, the priority of the corresponding task of the subscript of array, and the size of array depends on minimum task priority LowestPrio, the task priority scope is generally: 0~63, i.e. 64 tasks.So the size of TCB address array is LowestPrio+1, its each element all points to the entry address of corresponding TCB structure, and task stack pointer just is with the operation of convenient rudimentary programming language to TCB.
The corresponding task of each TCB structure, behind a task creation, the corresponding TCB of this task determines thereupon.Each variable among the TCB determines that thereupon scheduler can only be realized by the operation to TCB the operation of task.Comprise time delay, performance period, task type and priority in the TCB structure of task, these variablees are absolutely necessary in the task scheduling process.Time delay and performance period are generally 0 in the TCB structure of Event triggered task; Represent that this task postpones to carry out behind what timeticks again the time delay in the TCB structure of time triggering task, the performance period represents the task of time triggering every what timeticks is carried out once.Task type generally is divided into 4 types task as described in the background art, and they are respectively: the cooperation formula task that the time triggers, the preemptive type task that the time triggers, Event triggered cooperation formula task and Event triggered the preemptive type task.The priority of task is one 8 unsigned variant, and it is the important sign whether task exists, the corresponding priority of each task, and this value scope generally is 0~63, namely always has 64 tasks that priority is different.Usually, priority 0 is super objective priority, and priority 63 is minimum task priorities, and other task priority height by that analogy.Each TCB structure is connected together with * Next and * Prev pointer chain, constitutes a doubly linked list, to improve search efficiency.
Then, set up and initialization ready list and ready group, can be expressed as respectively as them:
Ready list: unsigned char OSRdyTbl[LowestPrio/8+1];
Ready group: unsigned char OSRdyGrp.
Wherein the size of ready list is decided by task priority minimum in all tasks, and each element is one 8 variable, and ready list is one group with 8 priority, is an element of ready list, the corresponding task of one of them priority, as shown in Figure 4.The size of this ready list is 64, and 8 elements are arranged, and namely is divided into 8 groups, and every group is exactly 8 bit variables.The priority of the corresponding task of numeral in the grid increases progressively arrangement according to from right to left order.The priority of task is one 8 unsigned variant, and its low 3 are used for setting the tasks at the horizontal level of ready list, i.e. directions X, and its high 3 are used for setting the tasks in the upright position of ready list, i.e. Y-direction.For example, the priority of certain task is 35, and the binary value of its correspondence is 100011 so, and then its X coordinate is that 3, Y coordinate is 4, so several the 5th row from top to bottom in the corresponding ready list, from the position of several the 4th row in a right left side, i.e. the 35th grid is just to should task.If any position 1 in the ready list, the task of then representing this correspondence is in ready attitude, namely this task device that can be scheduled at any time calls, directly carry out, if should show any position 0, the task of then representing this correspondence is not in ready attitude, but is in pending state, and the device that then temporarily can not be scheduled calls.
Ready group is one 8 variable, each group in the ready list of the numeral correspondence in the grid, if group corresponding in the ready list is then represented in any position 1 in ready group, namely the group on the Y-direction has task to be in ready attitude; If put 0 for any one group in ready group, represent that then the task of corresponding group in the ready list is in pending state, wouldn't carry out.As shown in Figure 2, if ready group the 0th put 1, represent then in the 0th group of ready list that priority is that 0 to 7 any one or a plurality of task are in ready attitude; If the 2nd of ready group is put 0, represent then in the 2nd group of ready list that priority is that 10 to 23 task all is in pending state.
Then, set up also initialization bit mask table and priority decision table.The size of bitmask table is 8, and definition bitmask table is:
unsigned?char?const?OSMapTbl[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}。
The size of priority decision table is 256, and definition priority decision table is:
unsigned?char?const?OSUnMapTbl[]={
0,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
}。
Set up and initialization interrupt priority level Table I SR_IDPrio[], be used for identifying the priority height of the corresponding ISR of various interrupt sources, be designated as interrupt source number it under, each element then is the ISR of the corresponding interruption priority during as task.
The installation timeticks interrupts, the performance period that the definition timeticks interrupts, interrupt type etc., system is produced once at set intervals interrupts, this timeticks interrupts being equivalent to a global clock, produce with the form of interrupting, can move corresponding timeticks interrupt routine automatically at set intervals, in order to carry out task scheduling.
More than introduce the details of the early-stage preparations of task scheduling, created task, the task control block (TCB) chained list, ready list, ready group, mask table and priority decision table, and the timeticks interruption has been installed, will introduce the method for task scheduling below.
As previously described, we can be divided into the task in the embedded system cooperation formula task that the time triggers, the preemptive type task that the time triggers, Event triggered cooperation formula task and Event triggered the preemptive type task.The task that time triggers need as time delay and performance period, be carried out respective handling according to the time response of this task.And the task of Event triggered mainly is interruption or intertask communication mechanism by embedded system, wait for or obtain a semaphore as task and trigger, most of form by interrupt event occurs, and is irrelevant with the time response of task, so separately handle in the task scheduling process.
Behind the task creation, the type of task among the task control block (TCB) TCB, priority also has determine time delay thereupon.
Task scheduling mainly is to be undertaken by the timeticks interrupt routine, and the operation of each timeticks interrupt routine all is the opportunity of carrying out task scheduling again, as shown in Figure 5, has introduced the process flow diagram that timeticks interrupts among the figure, may further comprise the steps:
Step S501 judges whether it is triggering time of task, if then jump to step S502, otherwise jumps to step S505.
Step S502, the time that subtracts is certainly triggered the task delay time;
Step S503 judges that the time after subtracting is triggered the task delay time, if be 0, and execution in step S504 then, otherwise jump to step S505;
Step S504 makes the task of time triggering ready;
Step S505 looks into ready list and obtains current ready super objective priority;
Step S506 judges that ready limit priority task is cooperation formula task or preemptive type task, if cooperation formula task, and execution in step S507 then, otherwise execution in step S508;
Step S507, the cooperation formula task of operation limit priority after operation is finished, makes this task be in pending state, then execution in step S505;
Step S508, the preemptive type task of operation limit priority.
Introduce this flow process below in detail.After entering the timeticks interrupt routine, the task that we at first trigger the time is handled, certainly subtracted the time delay among the task control block (TCB) TCB of correspondence, even subtract 1 time delay, when be kept to 0 time delay, then make this task ready, namely at ready list OSRdyTbl[] in position that should task priority is put 1, and the position of corresponding task place group puts 1 in ready group of OSRdyGrp.If the task of Event triggered is not then done any processing.
Wherein, 1 the method for in ready list and ready group the position of corresponding certain task being put is: as shown in Figure 4, at ready list OSRdyTbl[] in, because low 3 corresponding OSRdyTbl[of this task priority] the X coordinate, high 3 corresponding Y coordinates, so utilize bitmask table OSMapTbl[] search the bitmask of X coordinate and Y coordinate correspondence, to determine which element X, Y coordinate are in 8 bit variables, at last two bit-wise mask value are composed respectively to ready group of OSRdyGrp and ready list OSRdyTbl[] in the class value at this task place.
For example, making priority is that the detailed process that 33 task is set to ready attitude is: 33 binary value is 100001, low 3 of X table priority is 1, the bitmask of its correspondence is OSMapTbl[X], high 3 of priority of Y table is 4, the bitmask of its correspondence is OSMapTbl[Y], be OSRdyGrp=OSMapTbl[Y to ready group of set then], be OSRdyTbl[OSMapTbl[Y to ready list set]]=OSMapTbl[X].
Checking whether the cooperation formula task of moving is interrupted by the timeticks interruption, is then to deal with according to user's request.Because the time interval of each timeticks is limited, cooperation formula task might be interrupted by the timeticks interruption, so in order further to improve the rationality of cooperation formula scheduling, need be when the timeticks interrupt routine begins, check whether have the cooperation formula task moved by timeticks interrupt interrupt, can whether be that 0 method realizes by checking a zone bit.For example: have cooperation formula task to be interrupted when zone bit is 1, then carry out respective handling, not cooperation formula task is interrupted when zone bit is 0.The user is according to the actual demand of oneself, and Treatment Options can be selected when creation task, determines concrete which kind of disposal route that adopts, for example: continue to carry out uncompleted task, abandon carrying out uncompleted task, re-execute uncompleted task dispatching.
Usually, can be set a closing time for cooperation formula task during creation task, in general, equal its cycle of operation this closing time, when beginning, the timeticks interrupt routine carries out from subtracting, when be 0 closing time, to deal with according to user's request, Treatment Options can be selected when creation task.
Then, search the priority decision table according to ready list and ready group, obtain current ready super objective priority.When task was set to ready attitude, the position of the corresponding task of ready list and ready group will put 1, found out the highest task priority according to ready group and ready list.Detailed process is: search priority decision table OSUnMapTbl[with ready group of OSRdyGrp earlier], draw the high 3 of limit priority, namely be that the limit priority task is at ready list OSRdyTbl[] under the group bitmask, search priority decision table OSUnMapTbl[with this group again], what draw limit priority hangs down 3, at last, 3 of front and back being combined is exactly current ready super objective priority.For example, if the value of ready group of OSRdyGrp is 01010100, be 0x54, search priority decision table OSUnMapTbl[OSRdyGrp] value be 2, namely high 3 of super objective priority is 2, if OSRdyTbl[2] value be 01100010, be 0x62, search priority decision table OSUnMapTbl[OSRdyTbl[2]] value be 1, then the binary value of super objective priority is exactly 010001, namely 11.
Moreover, if ready limit priority task is cooperation formula task, then directly move this cooperation formula task.Detailed process is: search task control block (TCB) TCB according to super objective priority, and judge whether the task type of TCB is cooperation formula task, is then directly to move this task up to end, do not need to carry out context and switch.After this cooperation formula task is finished, remove it in the position of ready list and ready group, remove the ready attitude of this task, its method to put 1 very similar at ready list with ready group, be 0 with this task in the position of ready group and ready list just, rather than be set to 1, detailed step is no longer carefully stated.
Usually, after a cooperation formula task is finished, allow to check the task requests execution whether Event triggered is arranged the term of execution of this cooperation formula task, have then to make it ready.Because cooperation formula task the term of execution generally do not allow to interrupt, if there is interrupt event to take place, can not respond immediately, whether we can have the interrupt event request to take place the cooperation formula task term of execution by checking, be set to ready attitude in the Event triggered task of carrying out the request of in time will sending after cooperation formula task finishes, improve scheduler to the real-time response ability of external event as far as possible.
Whether have detailed process that interrupt event request take place be: search interrupt source from hardware if checking, utilize resulting interrupt source numbering, at interrupt priority level Table II SR_IDPrio[] search corresponding task priority, utilize resulting task priority, make this Event triggered task ready.In addition, because this audit function needs certain execution time, and the execution time has uncertainty, supervision time when not having interrupt request is than there being a lot of interruptions request of sending the time to lack, this produces uncertainty to the beginning execution time of the cooperation formula task of back with by the execution time, thereby the task jitter phenomenon takes place.Therefore we are set to a set time ChkIntrDuration supervision time, after a cooperation formula task is finished, then relatively set time and timeticks remain (the timeticks time interval and ChkIntrDuration's is poor) at interval, if the former is smaller, then carry out this audit function, otherwise abandon checking.When carrying out this audit function, if when surpassing ChkIntrDuration its working time, no matter scheduler checking whether is abandoned carrying out immediately, enters task scheduling,
Then, again jump to the step of searching current ready super objective priority, find out the task of current limit priority, if this task is cooperation formula task, carry out it, jump to after the inspection and search super objective priority step, if this task is the preemptive type task, then carrying out context switches, be about to all register holds of current processor in corresponding stack, and the content (depositing the content of corresponding all registers of this task) that will be kept at this preemptive type task stack is taken out the preemptive type task of execution limit priority.
The present invention is by treating ISR with task, and distribute priority with other tasks, simultaneously compound time triggering and Event triggered framework and the mode that adopts preemptive type and cooperation formula task mixed scheduling utilized, the advantage of comprehensive two kinds of scheduling modes, overcome shortcoming separately, obtain a kind of mixed scheduling method.This mixed scheduling method had both had high predictability and the reliability of cooperation formula dispatching system, the advantage that also has the high real-time response ability of preemption scheduling system, it passes through four kinds of different tasks of rational management, has reached to take full advantage of system resource, effectively the purpose of control system expense.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.

Claims (9)

1. the mixed scheduling method of an embedded real-time operating system comprises the preceding resource distribution of task scheduling and task scheduling, it is characterized in that described task scheduling may further comprise the steps:
The mode that triggers by Event triggered or time makes task ready;
Search the priority decision table according to ready list and ready group, obtain current ready super objective priority;
According to described current ready super objective priority, obtain the task control block (TCB) structure of described ready limit priority task, and judge the classification of this task;
When described ready limit priority task is cooperation formula task, carry out this cooperation formula task, after described cooperation formula task is finished, remove its position in ready list and ready group, search the priority decision table according to ready list and ready group again, obtain current ready super objective priority;
Resource distribution specifically comprises the steps: before the described task scheduling
Creation task; Set up the task control block (TCB) structure; Set up task control block (TCB) address array; Set up and initialization ready list and ready group; Set up and the initialization bit mask table; Set up and initialization priority decision table; Set up and initialization interrupt priority level table; The installation timeticks interrupts.
2. mixed scheduling method as claimed in claim 1 is characterized in that, described method is treated interrupt routine with task, and distributes priority with other tasks.
3. mixed scheduling method as claimed in claim 1 or 2 is characterized in that, describedly makes that task is ready specifically to be comprised:
Because communication and synchronization mechanism or interruption make the task of Event triggered ready, or subtract 1 the time delay in the task control block (TCB) of the task correspondence that will trigger the time, when be kept to 0 time delay, make the task that the described time triggers ready.
4. mixed scheduling method as claimed in claim 3 is characterized in that, describedly makes that task is ready specifically to be referred to:
To be 1 to position that should task priority in the ready list, and the position of corresponding task place group be 1 in ready group.
5. mixed scheduling method as claimed in claim 1 is characterized in that, described method also comprises:
When carrying out the timeticks interrupt routine, check whether the cooperation formula task of moving is interrupted by the timeticks interruption, be then to select Treatment Options according to user's request, described Treatment Options arranges when creation task, it comprises the uncompleted task of continuation execution, abandons carrying out uncompleted task or re-executes uncompleted task.
6. mixed scheduling method as claimed in claim 1 is characterized in that, and is further comprising the steps of:
After described cooperation formula task is finished, check that the task requests that whether has interrupt event to trigger carries out the term of execution of described cooperation formula task, when the task requests that has interrupt event to trigger is carried out, make the task of the Event triggered of asking ready.
7. mixed scheduling method as claimed in claim 6 is characterized in that, whether described inspection has interrupt event request generation concrete steps to be:
Software is searched the interruption that takes place in cooperation formula task run process, utilize resulting interrupt source numbering, searches corresponding task priority in described interrupt priority level table, utilizes resulting priority to make corresponding task ready.
8. mixed scheduling method as claimed in claim 6 is characterized in that, and is further comprising the steps of:
The time of described inspection interrupt event is set to the set time, and after cooperation formula task was finished, relatively set time and timeticks residue if the former is smaller, was then carried out this audit function, otherwise abandoned carrying out audit function at interval;
When carrying out this audit function, if described audit function surpasses described set time, the scheduling of executing the task immediately working time.
9. as claim 1 or 8 described mixed scheduling methods, it is characterized in that, further comprising the steps of: when ready limit priority task is the preemptive type task, the preemptive type task of operation limit priority.
CN 200810241349 2008-12-19 2008-12-19 Mixed scheduling method of embedded real-time operating system Expired - Fee Related CN101751289B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200810241349 CN101751289B (en) 2008-12-19 2008-12-19 Mixed scheduling method of embedded real-time operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200810241349 CN101751289B (en) 2008-12-19 2008-12-19 Mixed scheduling method of embedded real-time operating system

Publications (2)

Publication Number Publication Date
CN101751289A CN101751289A (en) 2010-06-23
CN101751289B true CN101751289B (en) 2013-07-17

Family

ID=42478301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200810241349 Expired - Fee Related CN101751289B (en) 2008-12-19 2008-12-19 Mixed scheduling method of embedded real-time operating system

Country Status (1)

Country Link
CN (1) CN101751289B (en)

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923493A (en) * 2010-09-21 2010-12-22 深圳市华力特电气股份有限公司 Task scheduling method and task scheduling equipment
CN102012837B (en) * 2010-10-18 2012-12-19 西南交通大学 Space optimization method for priority bitmap algorithm
CN102495758A (en) * 2011-12-05 2012-06-13 中南大学 Scheduling method of real-time tasks in distributing type high performance calculation environment
CN103577267A (en) * 2012-08-03 2014-02-12 上海博泰悦臻电子设备制造有限公司 Resource distribution method and resource distribution device of vehicle-mounted device
CN103149993A (en) * 2012-12-28 2013-06-12 联宝(合肥)电子科技有限公司 Multi-heat-pipe and multi-path cooling method and cooling device
CN103559045B (en) * 2013-11-21 2017-05-10 青岛大学 Hardware real-time operation system
CN103593244B (en) * 2013-11-28 2017-02-15 中国船舶重工集团公司第七二四研究所 Resource scheduling method of wide beam frequency conversion time-difference locating system
CN103984596B (en) * 2014-05-19 2017-06-20 上海微小卫星工程中心 The dispatching method and device of a kind of On-board software
CN104915254A (en) * 2014-12-31 2015-09-16 杰瑞石油天然气工程有限公司 Embedded system multi-task scheduling method and system
CN106293919B (en) * 2016-08-12 2019-06-11 中国航空工业集团公司西安飞行自动控制研究所 A kind of the built-in tasks dispatching device and method of time trigger
CN106775964A (en) * 2016-11-11 2017-05-31 西北工业大学 The operating system framework and method for scheduling task of time/event mixing triggering
CN106655284B (en) * 2016-12-27 2020-04-14 广州供电局有限公司 Power generation dispatching control method and system
CN108009015B (en) * 2018-01-10 2021-03-12 烟台大学文经学院 Event processing method of real-time embedded operating system
CN109101313A (en) * 2018-03-15 2018-12-28 山东超越数控电子股份有限公司 A kind of realization and test method of real-time kernel
CN110231993A (en) * 2019-06-19 2019-09-13 爱驰汽车有限公司 Battery management method, device, electronic equipment, storage medium
CN110737522B (en) * 2019-10-16 2023-03-03 福州物联网开放实验室有限公司 Standby task scheduling method of embedded operating system
CN111258733B (en) * 2020-01-14 2023-06-27 明见(厦门)技术有限公司 Embedded OS task scheduling method and device, terminal equipment and storage medium
CN113467901A (en) * 2020-03-31 2021-10-01 北京华为数字技术有限公司 Task scheduling method and related equipment
CN113900787A (en) * 2021-10-14 2022-01-07 中国电子科技集团公司第五十四研究所 Method for realizing preemptive multi-task real-time operating system for micro single-chip microcomputer
CN116974728B (en) * 2023-09-20 2024-01-02 深圳市德兰明海新能源股份有限公司 Singlechip task scheduling method, singlechip product and storage medium
CN118025049B (en) * 2024-04-15 2024-07-09 成都创科升电子科技有限责任公司 Control method and system for vehicle electric control based on scheduler and vehicle

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1825288A (en) * 2006-03-31 2006-08-30 浙江大学 Method for implementing process multi-queue dispatching of embedded SRAM operating system
CN101178664A (en) * 2007-12-12 2008-05-14 北京中星微电子有限公司 Task scheduling method and system in real-time operating system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1825288A (en) * 2006-03-31 2006-08-30 浙江大学 Method for implementing process multi-queue dispatching of embedded SRAM operating system
CN101178664A (en) * 2007-12-12 2008-05-14 北京中星微电子有限公司 Task scheduling method and system in real-time operating system

Also Published As

Publication number Publication date
CN101751289A (en) 2010-06-23

Similar Documents

Publication Publication Date Title
CN101751289B (en) Mixed scheduling method of embedded real-time operating system
Phillips et al. Adapting a message-driven parallel application to GPU-accelerated clusters
CN101160565B (en) Mechanism to schedule threads on os-sequestered without operating system intervention
CN101556545B (en) Method for realizing process support, device and multithreading system
CN103294544B (en) Embedded system and interruption processing method thereof and device
CN103809936A (en) System and method for allocating memory of differing properties to shared data objects
Menon et al. Automated load balancing invocation based on application characteristics
CN102779075A (en) Method, device and system for scheduling in multiprocessor nuclear system
CN104035818A (en) Multiple-task scheduling method and device
CN104536827A (en) Data dispatching method and device
CN105183698A (en) Control processing system and method based on multi-kernel DSP
CN108710536A (en) A kind of multi-level fine-grained virtualization GPU method for optimizing scheduling
CN104915254A (en) Embedded system multi-task scheduling method and system
CN109445939A (en) A kind of dispatching method based on the soft real-time scheduling kernel for actively selling mechanism
CN104090826A (en) Task optimization deployment method based on correlation
CN100440153C (en) Processor
Talmale et al. Cluster formation techniques for hierarchical real time tasks allocation on multiprocessor system
CN106708618A (en) Process scheduling method and device
Agung et al. Preemptive parallel job scheduling for heterogeneous systems supporting urgent computing
CN110837415B (en) Thread scheduling method and device based on RISC-V multi-core processor
CN101349975B (en) Method for implementing interrupt bottom semi-section mechanism in embedded operation system
Lamie Real-time embedded multithreading: using ThreadX and ARM
Niknam et al. Resource optimization for real-time streaming applications using task replication
CN103870313A (en) Virtual machine task scheduling method and system
CN104699520B (en) A kind of power-economizing method based on virtual machine (vm) migration scheduling

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: SHENZHEN MINDE ELECTRONICS TECHNOLOGY LTD.

Free format text: FORMER OWNER: HUANG QIANG

Effective date: 20120618

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 518060 SHENZHEN, GUANGDONG PROVINCE TO: 518057 SHENZHEN, GUANGDONG PROVINCE

TA01 Transfer of patent application right

Effective date of registration: 20120618

Address after: 23, building 04, room 518057, overseas student Pioneer Building, Shenzhen hi tech Zone, Guangdong, China

Applicant after: Shenzhen Minde Electronics Technology Co., Ltd.

Address before: 518060 science and technology building, Shenzhen University, Guangdong, Shenzhen 1410

Applicant before: Huang Qiang

C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: SHENZHEN MINDE ELECTRONIC TECHNOLOGY CO., LTD.

Free format text: FORMER NAME: SHENZHEN MINDE ELECTRONICS TECHNOLOGY LTD.

CP01 Change in the name or title of a patent holder

Address after: 23, building 04, room 518057, overseas student Pioneer Building, Shenzhen hi tech Zone, Guangdong, China

Patentee after: Mores electronics technology incorporated company of Shenzhen

Address before: 23, building 04, room 518057, overseas student Pioneer Building, Shenzhen hi tech Zone, Guangdong, China

Patentee before: Shenzhen Minde Electronics Technology Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20130717

Termination date: 20201219