The Wizard of OS: a Heartbeat for Legacy Multimedia Applications

Post on 11-Jun-2015

276 views 0 download

Tags:

description

This presentation describes a technique for automagic provisioning of real-time scheduling guarantees for legacy multimedia applications, that does not require any modification to the application source-code.

Transcript of The Wizard of OS: a Heartbeat for Legacy Multimedia Applications

© 2008 Scuola Superiore Sant’Anna

“The Wizard of OS: a Heartbeat for Legacy        Multimedia Applications”

Real-Time Systems Laboratory

RETIS Lab

Tommaso Cucinotta, Fabio ChecconiReal­Time Systems Laboratory

Scuola Superiore Sant'Anna

7th IEEE Workshop onEmbedded Systems for Real-Time Multimedia

Grenoble, FranceOctober, 15th – 16th, 2009

Luca Abeni, Luigi Palopoli University of Trento

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

MotivationsMotivations

General­Purpose Operating SystemsGeneral­Purpose Operating Systems

Very effective for storing & managing multimedia contents

Designed for

• average­case performance

• serving applications on a best­effort basis

They are not the best candidate for serving real­time 

applications with tight timing constraints

• nor for real­time multimedia

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

MotivationsMotivations

Overcoming limitations of a GPOS for multimediaOvercoming limitations of a GPOS for multimedia

Large buffers used to compensate unpredictability

• ==> no real­time interaction nor low­latency multimedia

One­application one­system paradigm

• For example, for low­latency real­time audio processing (jack), 

gaming, CD/DVD burning, etc...

POSIX real­time extensions

• Priority­based, no temporal isolation

• Not appropriate for deploying the multitude of (soft) real­time 

applications populating the systems of tomorrow

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

MotivationsMotivations

Recent developments in GPOS schedulingRecent developments in GPOS scheduling

EDF­based real­time scheduling with temporal isolation

• Better utilization of resources

• Independent applications are isolated from the temporal perspective

Various APIs for accessing the enhanced functionality

• For example, the FRSH API from

• For example, the API from 

They require modifications of the applications

• at the source­code level

What about legacy multimedia applications ?

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Research objectivesResearch objectives

This research aims toThis research aims to

Allow legacy real­time applications to benefit of real­time 

scheduling facilities available on a GPOS

Without any change in the application source­code

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Proposed approachProposed approach

Proposed approachProposed approach

An appropriate tracing mechanism observes the 

application, inferring main parameters affecting a (periodic) 

multimedia application temporal behaviour:

• job execution time

• period

Scheduling guarantees are automagically provisioned by 

the OS, according to proper scheduling parameters

• Based on sound arguments from real­time theory

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Proposed approachProposed approach

Comprehensive viewComprehensive view

Application tracing

Period estimation (events analysis)

On­line WCET estimation

Automagic provisioning of 

scheduling guarantees

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Real­time theoryReal­time theory

Reservation­based scheduling: (Q, P)Reservation­based scheduling: (Q, P)Known results from the real­time theoryKnown results from the real­time theory

Not all (Q, P) with

a given Q/P are

equal

Highlighted by the

supply­bound

function shown

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Real­time theoryReal­time theory

What are the reservation What are the reservation parameters needed for parameters needed for correctly scheduling a real­correctly scheduling a real­time periodic task with time periodic task with assigned WCET and period ?assigned WCET and period ?

The The minimumminimum reservation  reservation utilization is achievedutilization is achieved

when the reservation period 

equals the task period

• or any integer sub­

multiple

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Core problemCore problem

How to detect the application period ?How to detect the application period ?

Of a legacy real­time application (no source­code 

availability, no modifications)

Proposed approachProposed approach

Tracing the application behaviour at run­time

For the purpose of identifying “periodicity patterns”

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Legacy application tracingLegacy application tracing

Tracing legacy multimedia applicationTracing legacy multimedia application

Tracing what the application does

• What system calls it periodically calls

– Waiting, reading time information, posting timers, disk 

operations, network operations, etc...

Tracing how the application behaves temporally

• When it suspends and resumes

Results obtained with Results obtained with system­call tracingsystem­call tracing

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Legacy application tracingLegacy application tracing

Available mechanismsAvailable mechanisms

strace Linux utility

• Designed as debugging helper, too much overhead due to the 

generation of unneeded data

ptrace() system call

• Allows an external process to trace the execution of a target 

process, forcing it to stop at each entry and exit of a system call

We developed We developed qostraceqostrace

A low­overhead system­call tracer based on ptrace()

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Period detectionPeriod detection

The tracer produces a sequence of The tracer produces a sequence of time­stampstime­stamps

Time­stamps used to compute a Time­stamps used to compute a Fourier­transformFourier­transform

A A heuristicheuristic catches the  catches the first harmonicfirst harmonic

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

HeuristicHeuristic

Identification of local peaksIdentification of local peaks

Selection of candidate peaksSelection of candidate peaks(sensibly higher than average)(sensibly higher than average)

Perform a weighted linear regression Perform a weighted linear regression among the candidate peaksamong the candidate peaks

The peak closest to the regression The peak closest to the regression line inclination coefficient winsline inclination coefficient wins

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Experimental resultsExperimental results

Set­upSet­up

Linux OS, with an implementation of the CBS scheduler

Feedback­scheduling by means of LFS (prior paper)

Custom video player, using libavformat/libavcodec

• modified to monitor the Inter­Frame time

Application tracing by using qostrace

Validation metricsValidation metrics

Inter­Frame time

Allocated bandwidth

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Experimental resultsExperimental results

Inter­Frame times Cumulative Distribution FunctionInter­Frame times Cumulative Distribution Function

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Experimental resultsExperimental results

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

The billThe bill

What it costs (tracing overhead)What it costs (tracing overhead)

When using strace: +4,8%

When using qostrace: +2,75%

42% overhead reduction with the custom tracer

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Future workFuture work

Reducing further the tracing overheadReducing further the tracing overhead

Kernel­level tracer

Period detection heuristicPeriod detection heuristic

More comprehensive evaluation

Precision with respect to available parameters

Improvements for enhanced precision and reduced 

overhead

Facing with multi­thread applications

© 2007 Scuola Superiore Sant’Anna Tommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'AnnaTommaso Cucinotta – Real Time Systems Laboratory (ReTiS) – Scuola Superiore Sant'Anna

Thanks for your attentionThanks for your attention

Questions ?Questions ?