- To implement periodic tasks
- To observe the scheduling behaviors
- Fixed priority scheduling
Two sets of periodic tasks
- Task set 1 = { t1(1, 3), t2(3, 6) }
- Task set 2 = { t1(1, 3), t2(3, 6), t3(4, 9) }
- Tasks all arrive at the same time
- Show context switch behaviors
- Show deadline violations if there is any
-
Add message at 3 place
OSStart
:preempt
(fromidle
totask1
)OSInitExit
:preempt
OS_Sched
:complete
-
The deadline violation message should show its deadline rather than the time we know it
- For example, in the set1, the task3 should violate at 9 tick, but we can only know it at 2x tick. In this case, we need to print
9
rather than2x
- For example, in the set1, the task3 should violate at 9 tick, but we can only know it at 2x tick. In this case, we need to print
- To implement an EDF scheduler in uC/OS-II
Two sets of periodic tasks
- Task set 1 = { t1(1, 3), t2(3, 5) }
- Task set 2 = { t1(1, 4), t2(2, 5), t3(2, 10) }
- Use EDF scheduling at
OSStart
,OSInitExit
,OS_Sched
- The following loop can iterate through the TCB list
OS_TCB *ptcb; for (ptcb = OSTCBList; ptcb != (OS_TCB*)0; ptcb = ptcb->OSTCBNext) { // do something }
- To implement Ceiling Priority Protocol (CPP) for ucOS’s mutex locks
Two scenario
- For the pointers pointing to error message, the memory should be allocated before passing it as parameter (
OSMutexCreate
,OSMutexPend
)INT8U R1_error; R1 = OSMutexCreate(1, &R1_error); ... INT8U error; OSMutexPend(R1, 5, &error);