Temporal reflection and reflective scheduling for the L4 microkernel - - PowerPoint PPT Presentation

temporal reflection and reflective scheduling for the l4
SMART_READER_LITE
LIVE PREVIEW

Temporal reflection and reflective scheduling for the L4 microkernel - - PowerPoint PPT Presentation

Temporal reflection and reflective scheduling for the L4 microkernel WIRTES workshop - Pisa, 2 July 2007 Sergio Ruocco ruocco@disco.unimib.it Nomadis mobile systems Lab. Universit degli Studi di Milano-Bicocca Research overview Feb 2004


slide-1
SLIDE 1

Sergio Ruocco ruocco@disco.unimib.it Nomadis mobile systems Lab. Università degli Studi di Milano-Bicocca

Temporal reflection and reflective scheduling for the L4 microkernel

WIRTES workshop - Pisa, 2 July 2007

slide-2
SLIDE 2

2

Research overview

Feb 2004 PhD Temporal Reflection, Univ. di Milano-Bicocca Apr 2004 – Apr 07 NICTA ERTOS Researcher, Sydney, Australia L4 microkernel

  • temporal reflection and reflective scheduling [RTSS06]
  • from real-fast to real-time [OSPERT06, OSPERT07]
  • Apr. 2007 – now

Nomadis Lab. Research Fellow Università di Milano-Bicocca IMUD project: Inertial Monitoring Unit Device Research areas: – Temporal reflection and reflective real-time scheduling – non-functional / quality requirements: energy & power management – SMT/SMP real-time scheduling – L4 and Linux-based embedded real-time systems – sw engineering for device drivers, ...

slide-3
SLIDE 3

3

Schedules embed assumptions

task A

deadline WCET release

Real-time schedules embed assumptions on:

CPU speed RAM speed input data IO speed task inter-dependencies etc.

slide-4
SLIDE 4

4

Schedules embed assumptions

task A

deadline WCET release

Real-time schedules embed assumptions on:

CPU speed RAM speed input data IO speed task inter-dependencies etc.

assumptions can fail!

}

slide-5
SLIDE 5

5

...assumptions can fail !

task A

deadline violation WCET release

slide-6
SLIDE 6

6

...assumptions can fail !

task A

deadline violation WCET release

task task task A task B

slide-7
SLIDE 7

7

How to adapt ? Depends on the fault !

task A

deadline violation WCET release

task task task A task task A task C / IO

?? ??

task B

slide-8
SLIDE 8

8

Computational Reflection

Brian Cantwell Smith: A reflective system is a computer system able to reason about itself. Reflection and Semantics in a Procedural Language. TR 272, MIT LCS (1982) A reflective system embeds a suitable representation of itself. Such self-representation is causally-connected with the system itself.

slide-9
SLIDE 9

9

Reflective scheduler

Time-driven Execution Engine Strategist

now()

T

past future

actual duration planned execution interval

System temporal behaviour ↔ object of the system

  • fine-grained adaptive control of behaviour

(...and many other things we don't have time to talk about...)

actions

slide-10
SLIDE 10

10

Temporal reflection

CPU / Hardware

Reflective sched. + TDE

Application + strategist

executes observes & manipulates OS Kernel Causal-connection

Temporal reflection – observe & control the system temporal behavior as an object of the system itself. – i.e., – – The real-time system becomes aware of real-time and its own behaviour. –

Sergio Ruocco, Temporal Reflection (PhD Thesis), 2004

slide-11
SLIDE 11

11

Nice, but...

Pragmatic application (one of many...): Adaptive real-time scheduling in resource-constrained systems – fine-grained adaptation exploiting application-specific information – feedback control loop detects faults and corrects future behaviour – difficult to do with ordinary schedulers — no accurate data on faults Case study: – real-time adaptive video analysis Experimental results: – user-level implementation – ...on unmodified L4 microkernel on ARM XScale 400 MHz – microsecond-level precision & accuracy – – ... (much more in the paper, RTSS'06)

slide-12
SLIDE 12

12

Adaptive video analysis

Problem: decode MPEG stream & search for a lightning before the next frame is due.

slide-13
SLIDE 13

13

Application actions

CPU / Hardware

Reflective sch. + TDE

Application strategist

executes observes & manipulates OS Kernel

/* C functions implement the application functional requirements */ void mpeg2_read_action () { size = fread (buffer, 1, BUFFER_SIZE, mpgfile); mpeg2_buffer (decoder, buffer, buffer + size); } void mpeg2_parse_action () { mpeg2_parse_state = mpeg2_parse (decoder); } void analyze_action () { rectangle_rgb (info->sequence->width, info->sequence- >height, video_buffer, BRIGHTNESS_TRESHOLD, dx, dy); } void display_action () { video_buffer.display() // display the frame }

slide-14
SLIDE 14

14

Read() from stream...

phase1: decoding

Application read_action()

slide-15
SLIDE 15

15

Strategist actions

phase1: decoding

Strategist: handle_read()

slide-16
SLIDE 16

16

Strategist actions

CPU / Hardware

Reflective sch. + TDE

Application + strategist

executes observes & manipulates OS Kernel /* C functions implement * temporal requirements * i.e., observe and compute * the system's temporal behaviour */ int handle_read() { if (size != 0) { now = lltimer_now_usec(clock); plan_parse (now, now + PARSE_LEN); } }

slide-17
SLIDE 17

17

Adaptive video analysis plan

phase1: decoding

Application parse_action()

slide-18
SLIDE 18

18

Strategist actions

phase1: decoding

Strategist: handle_parse()

slide-19
SLIDE 19

19

Strategist actions

CPU / Hardware

Reflective sch. + TDE

Application + strategist

executes observes & manipulates OS Kernel

/* C functions implement temporal requirements * i.e., compute the system's temporal behaviour */ int handle_parse() { switch ( mpeg2_parse_state ) { case STATE_FRAME_READY: { framenum++; // compute frame display time when = first_frame_time + (framenum-1) * frame_interval[framerate]; // plan display even if 'when' is past 'now' // (i.e., missed deadline!) newa = plan_display (when,when + DISPLAY_LEN)) ... /* ... plan_analysis() ... */ }

slide-20
SLIDE 20

20

Display is planned, but analysis ?

phase 2: analysis

Strategist: handle_parse()

slide-21
SLIDE 21

21

Adaptive analysis planning

phase 2: analysis

time available for analysis unknown until frame ready Strategist: handle_parse()

slide-22
SLIDE 22

22

Adaptive real-time video analysis

Subsampling graduates frame analysis duration

slide-23
SLIDE 23

23

Table for adaptive scheduling

Frame Analysis length Dy 16 15211 1 1 1 18 7373 1 2 1 / 2 (no data) 1 3 1 / 3 (no data) 2 2 1 / 4 (no data) 2 3 1 / 6 Dx Quality (1/dxdy)

display accuracy / jitter (controlled variable)

slide-24
SLIDE 24

24

Strategist: adaptation tactic

CPU / Hardware

Reflective sched. + TDE

Application strategist

executes observes & manipulates OS Kernel

handle_parse() { .... newa = plan_display (when, when + DISPLAY_LEN))) now = lltimer_now_usec(clock); // refresh 'now' avail_time = when - now; // avail.time for analysis if ((avail_time > 0) && ( lookup (adapt_table,ADAPT_TABLE_SIZE,avail_time,&dx,&dy)) ) { // sets analysis quality in dx/dy, // based on the available time newa = plan_analyze (now, now + ANALYZE_LEN); } handle_analyse() { update_adaptive_table (adaptive_table, a->actual.end.usec - a->actual.start.usec, dx, dy, a->frameno); }

adapt_table 10 15211 12 7373 35 n/a

slide-25
SLIDE 25

25

Experimental results

  • [ Feedback calibration: source code + graph ]
slide-26
SLIDE 26

26

Adaptive tuning of display instant

CPU / Hardware

Reflective sched. + TDE

Application strategist

executes observes & manipulates OS Kernel

handle_display (struct Action * a) { error = a->actual.start.raw.raw32 – a- >planned.start.raw.raw32; newcal = - (error) / 2 + oldcal; // feedback correction lltimer_set_calibration (clock, newcal); }

slide-27
SLIDE 27

27

Experimental results

slide-28
SLIDE 28

28

Thanks

slide-29
SLIDE 29

29

References

[OSPERT07] Kevin Elphinstone, David Greenaway and Sergio Ruocco, Lazy Scheduling and Direct Process Switch - Merit or Myths?, Proc. of the 2007 Workshop on Operating Systems Platforms for Embedded Real-Time applications, Pisa, Italy, July 2007. [RTSS06] Sergio Ruocco, User-Level Fine-Grained Adaptive Real-Time Scheduling via Temporal Reflection, Proceedings of 27th IEEE Real-time Systems Symposium, Rio de Janeiro, Brazil, Dec 2006. [OSPERT06] Sergio Ruocco, Real-time Programming and L4 Microkernels, Proc.

  • f 2006 Workshop on Operating Systems Platforms for Embedded Real-

Time applications, Dresden, Germany, July 2006 [ISORC04] Micucci, D. and Ruocco, S. and Tisato, F. and Trentini, A., Time Sensitive Architectures: a Reflective Approach, Proc. of 7th International Symposium on Object-oriented Real-time distributed Computing, Wien, Austria, May 2004. [Ruo04] Sergio Ruocco, Temporal Reflection (PhD Thesis), Università degli Studi di Milano, Milano, Italy, February 2004

slide-30
SLIDE 30

30

Thanks