Presentation is loading. Please wait.

Presentation is loading. Please wait.

From HRT-HOOD to C Real-Time Systems Lecture 6

Similar presentations


Presentation on theme: "From HRT-HOOD to C Real-Time Systems Lecture 6"— Presentation transcript:

1 From HRT-HOOD to C Real-Time Systems Lecture 6
Copyright, 2001 © Adam Czajka

2 Copyright, 2001 © Adam Czajka
Contents Introduction Mapping to C Static Scheduling Summary Copyright, 2001 © Adam Czajka

3 Copyright, 2001 © Adam Czajka
Introduction HRT-HOOD design C source code Execution time estimation Static schedule Real-time system RTL library Copyright, 2001 © Adam Czajka

4 Copyright, 2001 © Adam Czajka
Introduction Timetable (TMT) Tasks’ description: • period • max. Exec. time Design time Timetable (TMT) T2 start! Run-time 0 : 05 Copyright, 2001 © Adam Czajka

5 Copyright, 2001 © Adam Czajka
Mapping to C HRT-HOOD object types : Cyclic Sporadic Protected Passive Copyright, 2001 © Adam Czajka

6 Copyright, 2001 © Adam Czajka
Mapping to C HRT-HOOD object types : Cyclic Sporadic Protected Passive Copyright, 2001 © Adam Czajka

7 Copyright, 2001 © Adam Czajka
Mapping to C Cyclic object mapping : void Task_J() { while (1) rt_switch(); } Copyright, 2001 © Adam Czajka

8 Copyright, 2001 © Adam Czajka
Mapping to C HRT-HOOD object types : Cyclic Sporadic Protected Passive Copyright, 2001 © Adam Czajka

9 Copyright, 2001 © Adam Czajka
Mapping to C Sporadic object mapping : void Task_J() { while (1) if ( rt_signaled( J ) ) } rt_switch(); Copyright, 2001 © Adam Czajka

10 Copyright, 2001 © Adam Czajka
Mapping to C HRT-HOOD object types : Cyclic Sporadic Protected Passive Copyright, 2001 © Adam Czajka

11 Copyright, 2001 © Adam Czajka
Mapping to C Protected object mapping : We have non-preemtable tasks Static scheduling Protected == Passive Copyright, 2001 © Adam Czajka

12 Copyright, 2001 © Adam Czajka
Mapping to C Protected object mapping – operation activation constraints : void Buffer_Get(int *elem) { if (counter == 0) wait(Empty); ..... counter--; if (counter == MAX – 1) signal(Full); } void Buffer_Put(int elem) if (counter == MAX) wait(Full); counter++; if (counter == 1) signal(Empty); Copyright, 2001 © Adam Czajka

13 Copyright, 2001 © Adam Czajka
Mapping to C Protected object mapping – operation activation constraints : int Buffer_Get(int *elem) { if (counter == 0) return FALSE; ..... counter--; return TRUE; } int Buffer_Put(int elem) { if (counter == MAX) return FALSE; ..... counter++; return TRUE; } Copyright, 2001 © Adam Czajka

14 Copyright, 2001 © Adam Czajka
Mapping to C Protected object mapping – operation activation constraints : Such objects are called: Non- blocking Protected Objects (nPr) Cyclic objects using nPr objects are called: Non-blocking Cyclic Objects (nC) Copyright, 2001 © Adam Czajka

15 Copyright, 2001 © Adam Czajka
Mapping to C Non-blocking cyclic objects : void Task_Producer() { int success=1; while (1) { if (success) { success = 0; } if (Buffer_Put(elem)) success=1; rt_switch(); void Task_Consumer() { while (1) if (Buffer_Get(&elem)) ..... } rt_switch(); Copyright, 2001 © Adam Czajka

16 Copyright, 2001 © Adam Czajka
Mapping to C Exceptions mapping : Exceptions are mapped into sporadic objects executed after the given object. Task Exception handler Task set with precedence constraints !!! Copyright, 2001 © Adam Czajka

17 Copyright, 2001 © Adam Czajka
Mapping to C Implementation steps : Write the code Transform the blocking objects into non-blocking ones Calculate the maximum task execution times Build the stacic schedule Copyright, 2001 © Adam Czajka

18 Copyright, 2001 © Adam Czajka
Static scheduling We have the following scheduling problem : How can we schedule nonpreemtable cyclic tasks (with precedence constraints) on 1 CPU ? Copyright, 2001 © Adam Czajka

19 Copyright, 2001 © Adam Czajka
Static scheduling Simple answer : ! We can use well-known (i.e. dynamic) scheduling algorithms !!! Copyright, 2001 © Adam Czajka

20 Copyright, 2001 © Adam Czajka
Static scheduling Problem : ! Not always dynamic scheduling algorithms give the feasible static schedule !!! Copyright, 2001 © Adam Czajka

21 Copyright, 2001 © Adam Czajka
Static scheduling Problem - example : Tasks = [ T1, T2, T3 ] Periods = [ 10, 40, 40 ] Exec. Times = [ 1, 17, 16 ] Copyright, 2001 © Adam Czajka

22 Copyright, 2001 © Adam Czajka
Static scheduling Problem - example : EDF algorithm T1 T2 T1 T3 T1 T1 Copyright, 2001 © Adam Czajka

23 Copyright, 2001 © Adam Czajka
Static scheduling Problem - example : EDF algorithm T1 T2 T1 T3 T1 T1 Dynamic EDF scheduling –> non-feasible schedule Copyright, 2001 © Adam Czajka

24 Copyright, 2001 © Adam Czajka
Static scheduling Problem - example : VG algorithm T1 T2 T1 T1 T3 T1 Copyright, 2001 © Adam Czajka

25 Copyright, 2001 © Adam Czajka
Static scheduling Problem - example : VG algorithm T1 T2 T1 T1 T3 T1 Static scheduling –> feasible schedule Copyright, 2001 © Adam Czajka

26 Copyright, 2001 © Adam Czajka
Static scheduling Advantages: More powerful scheduling algorithms We can check the system before the run- time phase (we don’t need additional data) Debug & test phase is easier The system is fully predictable Copyright, 2001 © Adam Czajka

27 Copyright, 2001 © Adam Czajka
Static scheduling Disadvantages : Horizon H = LCM(1, 2, .., n) H TMT Copyright, 2001 © Adam Czajka

28 Copyright, 2001 © Adam Czajka
Static scheduling Disadvantages (example) : H = LCM (17, 37, 131, 271) = 4 tasks  H = 22 mln Hundreds of tasks  H = ??? Copyright, 2001 © Adam Czajka

29 Copyright, 2001 © Adam Czajka
Summary Introduction Mapping to C Static Scheduling Summary Copyright, 2001 © Adam Czajka


Download ppt "From HRT-HOOD to C Real-Time Systems Lecture 6"

Similar presentations


Ads by Google