evolving real-time systems using hierarchical scheduling and concurrency analysis

23
Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis John Regehr Alastair Reid Kirk Webb Michael Parker Jay Lepreau School of Computing, University of Utah

Upload: dezso

Post on 08-Jan-2016

24 views

Category:

Documents


2 download

DESCRIPTION

Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis. John Regehr Alastair Reid Kirk Webb Michael Parker Jay Lepreau School of Computing, University of Utah. Problem: Evolving real-time and embedded software is hard - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

Evolving Real-Time Systemsusing Hierarchical Scheduling

and Concurrency Analysis

John Regehr Alastair Reid

Kirk Webb Michael Parker Jay Lepreau

School of Computing, University of Utah

Page 2: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

2

Problem: Evolving real-time and embedded software is hard

Problem: Concurrent software is hard to write and debug

Problem: Traditional task models ignore some important details about real systems

Page 3: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

3

A Task Set

t1

t2

FIFOt3

t4

thread t7

IRQ

hi

loCPU

hi

lo FIFOt5t6

Key:preemptivenon-preemptive

hi

lo t8

Page 4: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

4

This Talk Introduces hierarchical

execution environments to support analysis of: Concurrency Response times Blocking terms Dispatch overheads

Results in solving real-time problems on sensor network nodes

Page 5: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

5

Execution Environments

A real-time or embedded system usually supports multiple execution environments Interrupts Bottom-half handlers

a.k.a. DPCs, tasklets, deferred handlers

Event handlers Kernel threads User threads

Page 6: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

6

An Execution Environment…

Occupies a place in the scheduling hierarchy

Has particular performance characteristics

Has rules: About actions code running in it

may take About how to synchronize with

code in other environments

Page 7: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

7

Related Work Hierarchical scheduling

Lots of work: Deng et al., Feng & Mok, Lipari et al., Regehr & Stankovic, Saewong et al., Shin & Lee, …

Multiple execution environments Limited related work here

Concurrency analysis Lots of work in PL and formal methods

communities – but none supporting multiple execution environments

Page 8: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

8

Goal: Evolving Systems Often desirable to move code

between environments “Promote” code to a higher priority

environment “Demote” code to a lower priority

environment Problem: How do we know when to

promote / demote code? Problem: Very easy to introduce

concurrency errors this way May be lots of code per environment

Page 9: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

9

Example System: Motes

Sensor network nodes Software based on

TinyOS Very simple “OS” No threads!

Motes are resource constrained 4 MHz 8-bit RISC 4 KB SRAM, 128 KB

flash

Page 10: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

10

CPU

IRQ

FIFO

int1

int2

sentcalc_crc

received

hi

hi lo

lo

int3

encrypt

Problem 1:Long-runningtasks causenetworkerrors

decryptKey:preemptivenon-preemptive

Page 11: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

11

Fixed TinyOS 1

CPU

IRQ

FIFO2

int1

int2

encryptdecrypt

hi

hi lo

lo

int3

AvrX

FIFO1

calc_crcsent

hi

lo

received

Key:preemptivenon-preemptive

Page 12: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

12

Results

Page 13: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

13

CPU

IRQ

FIFO

timer

SPI

t2t1

t3

hi

hi lo

lo

UART

t4

Problem 2:Missed SPIdeadlines cause packetloss

Key:preemptivenon-preemptive

Page 14: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

14

Fixed TinyOS 2

CPU

IRQ

FIFO

SPI

t2t1

t3

hi

hi lo

lo

t4

vIRQ

timer

soft_SPIhi

lo UART

Key:preemptivenon-preemptive

Page 15: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

15

Results

Page 16: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

16

Problem: How do we know when to promote / demote code?

Solution: Response time analysis

Problem: Very easy to introduce concurrency errors this way

Solution: Concurrency analysis

Page 17: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

17

Real-Time Analysis Problem: How to analyze

response times for hierarchies? Solution: Map to a problem that

we know how to solve Static priority scheduling Preemption threshold scheduling

Hierarchies restricted to: Preemptive priority schedulers Leaf schedulers can be non-

preemptive FIFO or priority

Page 18: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

18

Real-Time Analysis

CPU

IRQ

thread

FIFO

clockdisk

disk_bh

eth_bh

eventt1

t3

hi

hi lo

lo

e2e3

e1

Key:preemptivenon-preemptive

(0,0)(1,1)

(2,2)

(2,2)

(3,3)

(7,7)

(4,4)(5,4)(6,4)

2 us10 us

2 us

5 us

Page 19: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

19

Concurrency Analysis

Problem: How to check for race conditions?

Solution: Task scheduler logic Static analysis of concurrency

across a hierarchy of execution environments

Page 20: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

20

Task Scheduler Logic Schedulers specify:

Preemption relations among things they schedule

Locks they provide Axioms propagate effects around

the hierarchy TSL allows us to derive (potential)

preemption relations for each pair of tasks in a system

Details in paper…

Page 21: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

21

Concurrency Analysis

CPU

IRQ

thread

FIFO

clockdisk

disk_bh

eth_bh

eventt1

t3

hi

hi lo

lo

e2e3

e1

Key:preemptivenon-preemptive

Page 22: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

22

Contributions

New notation for describing structure of systems software

Heuristics for evolving systems Algorithms for hierarchical priority

and FIFO schedulers: Whole-program concurrency analysis Response time analysis

Experimental validation

Page 23: Evolving Real-Time Systems using Hierarchical Scheduling and Concurrency Analysis

Evolving Real-Time Systemsusing Hierarchical Scheduling

and Concurrency Analysis

John Regehr Alastair Reid

Kirk Webb Michael Parker Jay Lepreau

School of Computing, University of Utah