Hongzhi Li - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Hongzhi Li

Description:

Bi = S usage(k,I)CS(k) Simple Priority Inheritance. Priority: ... Check the timing sequence of the whole system. WindView. VxWorks Code -- Priority Inversion ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 21
Provided by: aceUwa
Category:

less

Transcript and Presenter's Notes

Title: Hongzhi Li


1
Schedulability on VxWorks
  • Hongzhi Li
  • Dept. of Computing Info. Science
  • Queens University

2
Outline
  • Schedulability
  • Priority Inversion
  • Deadlock
  • My Project on VxWorks
  • Conclusion

3
Schedulability
  • Whether tasks meet their deadlines
  • Methods to determine schedulability
  • Utilization Bound Theorem (Simple Tasks RMA)
  • C1/T1 CN/TN lt U(N)
  • Response Time Analysis
  • Ri Ci Ii lt Deadline
  • Lethal threatens
  • Priority Inversion
  • Deadlock
  • Transient Blocking ...

4
Priority Inversion
Priority LOW MEDIUM
HIGH
waiting...
Lock
Res
Unlock
Time
Medium Prio running !
5
Simple Priority Inheritance
  • Kill Priority Inversion
  • The priority of a task gaining access to a shared
    resource dynamically inherits the priority of the
    highest priority task sharing the resource.
  • Response Time Analysis
  • Ri Ci Bi Ii lt Deadline
  • Bi S usage(k,I)CS(k)

6
Simple Priority Inheritance
Priority LOW MEDIUM
HIGH
waiting...
Lock
Res
X
Change to HIGH!
Time
7
DeadLock
All Dead!
8
Immediate Ceiling Priority Protocol
  • Kill Deadlock, Transient Blocking, Priority
    Inversion ...
  • Each task has a static priority
  • Each resource has a static ceiling value maximum
    prio of tasks that use it
  • Each task also has a dynamic priority, equal to
    the maximum of its own static prio and the
    ceiling values of any resources it has locked.
  • Bi max usage(k,i)CS(k)

9
Immediate Ceiling Priority Protocol
Priority LOW
HIGH
Ceiling HIGH
Lock
X
S1
Dynamic HIGH
All Alive!
Lock
Lock
S2
Time
10
Project Overview
  • Similar to Lab 4 (Schedulability on mC/OS-II)
  • We are all familiar with
  • We know its schedulability Priority Inversion
  • But
  • on VxWorks
  • which RTOS is better? 17,000 or 0
  • deadlock

11
Project Overview
12
VxWorks Code
  • Create a Task
  • taskSpawn ("tctrlSW", PRIO, 0, STACK_SIZE,
  • (FUNCPTR) controlSoftware,0,0,0,0,0,0,0,0,0,
    0)
  • Create a Mutual-Exclusion Semaphore
  • inverSemId semMCreate
  • (SEM_Q_PRIORITY SEM_INVERSION_SAFE)
  • Measure the execution time of a task
  • timexN((FUNCPTR) controlSoftware, NULL,NULL,
  • NULL,NULL,NULL,NULL,NULL,NULL)
  • Check the timing sequence of the whole system
  • WindView

13
VxWorks Code -- Priority Inversion
void controlSoftware(void) //HIGH priority
FOREVER semTake(inverSemId,
WAIT_FOREVER) for (long i0 i lt
LONG_TIME i) //wait for a while
semGive(inverSemId) void accounting(void)
//LOW priority FOREVER
semTake(inverSemId, WAIT_FOREVER)
for (long i0 i lt 6 LONG_TIME i)
semGive(inverSemId)
inverSemId
Trick HIGH/LOW compete for the same semaphore
MEDIUM runs frequently
14
WindView -- Priority Inversion
Semaphore
Get
Release
Get
Pend
Priority Inversion
15
Simple Priority Inheritance
CodesemId semMCreate (SEM_Q_PRIORITY
SEM_INVERSION_SAFE)
Priority Inheritance
Semaphore Take Pend Give Give
16
VxWorks Code -- Deadlock
void productionLine(void) ..//HIGH
semTake(dlock1SemId, WAIT_FOREVER)
semTake(dlock2SemId,100) //wait 0.5s for
(long i0 i lt 4 LONG_TIME i)
semGive(dlock1SemId) semGive(dlock2SemId)
void workStation(void) //LOW
semTake(dlock2SemId, WAIT_FOREVER) for
(long i0ilt 9LONG_TIME i) //wait
semTake(dlock1SemId,100) for (long i0 i lt 2
LONG_TIME i) semGive(dlock2SemId)
semGive(dlock1SemId)
Sem1
Sem2
17
WindView -- Deadlock
Sem 1 Get Give
Get Pend Sem 2 Get
Give Get Pend
DeadLock
18
Immediate Ceiling Priority Protocol
void workStation(void) taskPrioritySet(tidWs
,MID1) / ICPP dynamic prio /
semTake(dlock2SemId, WAIT_FOREVER) ...
semTake(dlock1SemId, WAIT_FOREVER) ...
taskPrioritySet(tidWs,MID2) / ICPP dynamic prio
reset to original /
Priority Switch
19
Conclusion
VxWorks More powful and flexible
Lots of library to select Several
tools (windView) to use ICPP Can solve
priority inversion, deadlock, etc But
need to know ceiling value before runing
20
?
Write a Comment
User Comments (0)
About PowerShow.com