7. multimedia operating system – classification of real

52
7. Multimedia Operating System Multimedia Kommunikation SS‘99 1 / 52 Contents 7.1 Overview 7.2 Real Time Systems 7.3 Resource Management Dimensions in Resource Design Reservation Strategies 7.4 Process Management Classification of Real-Time Scheduling Strategies Schedulability Tests and Optimal Schedulers Preemptive vs. Non-Preemptive Task Scheduling 7.5 Prototype Systems Real-Time Mach YARTOS (Yet Another Real-Time Operating System)

Upload: others

Post on 22-Apr-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

1 / 5

2C

onte

nts

7.1

Ove

rvie

w

7.2

Rea

l Tim

e Sy

stem

s

7.3

Res

ourc

e M

anag

emen

t–

Dim

ensi

ons

in R

esou

rce

Des

ign

–R

eser

vatio

n S

trat

egie

s

7.4

Proc

ess

Man

agem

ent

–C

lass

ifica

tion

of R

eal-T

ime

Sch

edul

ing

Str

ateg

ies

–S

ched

ulab

ility

Tes

ts a

nd O

ptim

al S

ched

uler

s

–P

reem

ptiv

e vs

. Non

-Pre

empt

ive

Tas

k S

ched

ulin

g

7.5

Prot

otyp

e Sy

stem

s–

Rea

l-Tim

e M

ach

–Y

AR

TO

S (

Yet

Ano

ther

Rea

l-Tim

e O

pera

ting

Sys

tem

)

Page 2: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

2 / 5

27.

1 O

verv

iew

Ope

ratin

g Sy

stem

Asp

ects

for

Mul

timed

ia P

roce

ssin

g:–

Mos

t con

vent

iona

l ope

ratin

g sy

stem

s do

offe

r on

ly li

ttle

or n

o su

ppor

t for

intim

epr

oces

sing

of c

ontin

uous

med

ia. T

his

conc

erns

all

func

tions

of a

n op

erat

ing

syst

em li

ke p

roce

ss, m

emor

y, fi

le o

r de

vice

man

agem

ent.

Res

ourc

e M

anag

emen

t:–

How

to a

chie

ve a

coo

rdin

ated

pro

cess

ing

of a

ll op

erat

ing

syst

em fu

nctio

ns in

orde

r to

ach

ieve

an

end-

to-e

nd Q

ualit

y of

Ser

vice

(de

lay,

cap

acity

, los

s ra

te,

jitte

r, ..

.)?

·A

n ab

stra

ct c

ontin

uous

res

ourc

e m

odel

·A

com

mon

res

ourc

e m

anag

emen

t pro

cedu

re

Proc

ess

Man

agem

ent:

–H

ow to

sch

edul

e pr

oces

ses

perm

ittin

g ea

ch to

term

inat

e ac

cord

ing

to is

tde

adlin

e?·

Rat

e-M

onot

onic

Sch

edul

ing

·E

arlie

st D

eadl

ine

Firs

t

Page 3: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

3 / 5

27.

1 O

verv

iew

/ R

esou

rce

Man

agem

ent T

asks

1. A

dmis

sion

con

trol

–Is

ther

e en

ough

rem

aini

ng c

apac

ity to

han

dle

the

addi

tiona

l dat

a st

ream

?

2. Q

oS c

alcu

lati

on

–W

hich

cha

ract

eris

tics

(e.g

. in

term

s of

thro

ughp

ut a

nd d

elay

) ar

e av

aila

ble

for

the

new

str

eam

?

3. R

esou

rce

rese

rvat

ion

–R

eser

ves

the

reso

urce

s w

hich

are

req

uire

d to

mee

t the

dea

dlin

es.

4. Q

oS e

nfor

cem

ent

–P

rovi

sion

of s

ervi

ce gu

aran

ted

by a

ppro

pria

te s

ched

ulin

g, e

.g. b

y re

orde

ring

(ser

ving

task

s w

ith s

hort

dea

dlin

e ea

rlier

to a

task

with

less

str

ict b

ound

s).

Page 4: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

4 / 5

27.

2 R

eal T

ime

Syst

ems

Rea

l Tim

e:

–A

rea

l-tim

e ta

sk is

a p

roce

ss w

hich

del

iver

s is

t pro

cess

ing

resu

lt in

a g

iven

tim

eor

acc

ordi

ng to

a g

iven

dea

dlin

e. A

dea

dlin

e is

giv

en e

.g. i

n th

e or

der

of

ms

for

inte

ract

ive

voic

e or

vid

eo d

ata

or

days

for

text

doc

umen

ts.

Dea

dlin

e:

–A

dea

dlin

e re

pres

ents

the

late

st a

ccep

tabl

e tim

e fo

r th

e pr

esen

tatio

n of

the

proc

essi

ng r

esul

t of a

task

. Dea

dlin

e ar

e ca

lled

hard

if fa

ilure

s ar

e m

issi

on-c

ritic

alor

thre

aten

ing

hum

an b

eing

s. T

hey

are

calle

d so

ft de

adlin

es if

they

can

not

exac

tly b

e de

term

ined

or

a vi

olat

ion

is le

ss c

ritic

al.

Fiel

ds o

f ap

plic

atio

n:

–C

ontr

ol s

yste

ms

for

man

ufac

turin

g pr

oces

ses,

mili

tary

sys

tem

s,te

leco

mm

unic

atio

n sy

stem

s, a

ircra

fts, a

utom

obile

s, n

ucle

ar p

ower

pla

nts

orin

tera

ctiv

e m

ultim

edia

sys

tem

s.

Page 5: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

5 / 5

27.

2 R

eal T

ime

Syst

ems

Proc

essi

ng R

equi

rem

ents

:–

Pre

dict

able

fast

res

pons

e to

tim

e-cr

itica

l eve

nts,

–ac

cura

te ti

min

g in

form

atio

n,–

high

deg

ree

of s

ched

ulab

ility

, i.e

. res

ourc

e ca

paci

ty is

not

was

ted

(

clev

er s

ched

ulin

g; b

ut fi

ndin

g op

timal

sch

edul

es is

ofte

n a

NP

-com

plet

e ta

sk),

and

–st

abili

ty u

nder

tran

sien

t ove

rload

, i.e

. usi

ng b

uffe

ring

to c

ope

with

bur

sty

syst

ems.

Asp

ects

spe

cifi

c to

Mul

timed

ia S

yste

ms:

–In

-tim

e pr

oces

sing

, tra

nsm

issi

on a

nd p

rese

ntat

ion

of c

ontin

uous

med

ia d

ata

like

audi

o or

vid

eo.

Req

uire

men

ts a

re k

now

n as

Qua

lity

of S

ervi

ce (

QoS

) pa

ram

eter

s, e

.g.:

–th

roug

hput

–lo

cal o

r gl

obal

(i.e

. end

-to-

end)

del

ay,

–(d

elay

) jit

ter,

or

–re

liabi

lity.

The

se v

alue

s ar

e us

ually

spe

cifi

ed b

y gi

ving

an

aver

age

valu

e, a

wor

st c

ase

valu

e,pe

ak r

ates

, dis

trib

utio

n fu

nctio

n or

mom

ents

of

its d

istr

ibut

ion

func

tion.

Page 6: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

6 / 5

27.

2 R

eal T

ime

Syst

ems

real

-tim

e sy

stem

s

soft

rea

l-tim

e sy

stem

sha

rd r

eal-

time

syst

ems

high

ava

ilabi

lty

high

inte

grity

fail

safe

fail

opea

rtio

n

tele

phon

esw

itchi

ngon

-lin

eba

nkin

gra

ilway

sign

alin

gfl

ight

cont

rol

soft

rea

l-tim

e sy

stem

- co

nseq

uenc

es o

f a

syst

em f

ailu

rear

e of

the

sam

e m

agni

tude

as

utili

tyhi

gh a

vaila

bilit

y-

dow

n-tim

e is

min

imal

high

inte

grity

- co

nsite

ncy

of d

ata

mus

t sur

vive

any

syst

em f

ailu

re a

nd m

alic

ious

atte

mpt

to a

lter

the

data

hard

rea

l-tim

e sy

stem

- co

nseq

uenc

es o

f fa

ilure

are

cata

stro

phic

fail-

safe

sys

tem

- pr

obab

ility

to d

etec

t any

fai

lure

is

clos

e to

1-

syst

em c

an b

e st

oppe

dfa

il-op

erat

iona

l sys

tem

- m

inim

al s

ervi

ce e

ven

in c

ase

of

failu

re-

syst

em c

anno

t be

stop

ped

Page 7: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

7 / 5

27.

3 R

esou

rce

Man

agem

ent

Eve

n so

phis

ticat

ed c

ompr

essi

on te

chni

ques

can

not c

ompe

nsat

e fo

r th

e re

sour

ce

capa

city

nec

essa

ry f

or a

udio

and

vid

eo tr

ansm

issi

on a

s w

ell a

s pr

oces

sing

in c

urre

nt(i

nter

activ

e) m

ultim

edia

sys

tem

s.

Har

dwar

e R

esou

rces

in Y

ear

x

Res

ourc

e R

equi

rem

ents 19

8019

9020

00

Net

wor

k Fi

le A

cces

s

“Kill

er A

pplic

atio

n“

Inte

ract

ive

Vid

eo

Hig

h-Q

ualit

y A

udio

insu

ffic

ient

scar

ce

abun

dant

Page 8: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

8 / 5

27.

3 R

esou

rce

Man

agem

ent /

Dim

ensi

ons

in R

esou

rce

Des

ign

Act

ive

vs. p

assi

ve r

esou

rces

dep

endi

ng o

n its

aut

onom

ous

proc

essi

ng

capa

bili

ties

–ac

tive

reso

urce

s: C

PU

, net

wor

k ad

apte

r ca

rd, e

tc.

–pa

ssiv

e re

sour

ces:

file

sys

tem

, mai

n m

emor

y, e

tc.

Shar

ed v

s. e

xclu

sive

res

ourc

e us

age

activ

e re

sour

ce a

re u

sual

ly a

lloca

ted

excl

usiv

ely

whe

reas

pas

sive

one

s ca

n be

sha

red

by m

ultip

le ta

sks

Sing

le v

s. m

ulti

ple

reso

urce

occ

uren

ces

PCs

usua

lly c

onta

in o

nly

a si

ngle

CPU

whe

reas

e.g

. a S

PA

RC

20

wor

ksta

tion

cont

ains

two

CPU

s

Page 9: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

9 / 5

27.

3 R

esou

rce

Man

agem

ent /

Pro

cedu

re

2. S

ched

ulab

ility

3. Q

oS C

alcu

latio

n

Res

ourc

e M

anag

er1.

Req

uest

by

a ne

w ta

sk

CPU

Res

ourc

es

. . I/O

6. A

dd T

ask

Que

ue

5. C

alcu

late

Sch

edul

e

7. S

ched

ule

Tas

k

4. R

eser

vatio

n

4.

Dis

patc

her

8. A

ssig

nR

esou

rces

Ste

ps 1

to 5

: pre

pari

ng ta

sk p

roce

ssin

gSt

eps

6 to

8: t

ask

proc

essi

ng

Page 10: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

10 /

527.

3 R

esou

rce

Man

agem

ent /

Res

erva

tion

Stra

tegi

es

prin

cipl

e

timel

ines

of

proc

essi

ngno

gua

rant

ee

reso

urce

util

izat

ion

over

book

ing

poss

ible

pote

ntia

lly h

igh

base

for

sch

edul

abili

ty te

st

aver

age

test

dete

ct a

nd s

olve

con

flic

ts

optim

istic

pess

imis

tic

avoi

d co

nflic

ts

max

imum

for

pea

k ra

te lo

ad

no o

verb

ooki

ng

“gua

rant

ee“

The

air

line

exam

ple:

Nor

thw

est

risky

, lot

s of

ove

rboo

king

,so

lve

conf

licts

by

findi

ng a

cust

omer

s w

ho le

aves

the

airc

raft

( by

pay

ing

som

ethi

ngin

cas

h or

-be

tter-

in v

ouch

er)

Luf

than

save

ry c

autio

us a

irlin

e(n

o ov

erbo

okin

g, n

o-sh

ows)

,lo

w a

ctua

l loa

d,hi

gh p

rices

Page 11: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

11 /

527.

3 R

esou

rce

Man

agem

ent /

Abs

trac

t Con

tinuo

us M

edia

Mod

ellin

g: W

orkl

oad

Dat

a st

ream

s co

nsis

t of

peri

odic

ally

arr

ivin

g L

ogic

al D

ata

Uni

ts (

calle

d M

essa

ges)

and

are

desc

ribe

d by

the

“Lin

ear

Bou

nded

Arr

ival

Pro

cess

(L

BA

P)

Mod

el“.

A d

ata

stre

am is

a tr

ipel

(M

, R, B

), w

here

–M

is th

e m

axim

um m

essa

ge s

ize,

–R

is th

e m

axim

um m

essa

ge r

ate

(i.e.

the

num

ber

of m

essa

ge p

er ti

me

unit)

, and

–B

is th

e m

axim

um b

urst

ines

s or

allo

wed

wor

kahe

ad.

The

mod

el is

nam

ed li

near

bou

nd a

rriv

al p

roce

ss b

ecau

se it

ass

umes

that

the

num

ber

of m

essa

ge a

rriv

als

N in

a g

iven

tim

e in

terv

al

is b

ound

ed b

yN

()

= R

⋅ +

B

(R

mes

sage

arr

ival

s in

ti

me

units

)

Res

ourc

e

Mes

sage

s M

essa

ges

Inte

rfac

es

Page 12: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

12 /

527.

3 R

esou

rce

Man

agem

ent /

Abs

trac

t Con

tinuo

us M

edia

Mod

ellin

g: E

xam

ple

Aud

io s

ampl

ing:

44.

1 kH

z

1

6 bi

t per

sam

ple

(

i.e. 1

6 x

4410

0 =

705

.600

bit/

sec)

R =

75

fram

es/s

ec

Ía

fram

e co

ntai

ns 7

05.6

00/7

5 =

9.4

08 b

it

ÍM

= 9

.408

(he

re: “

fram

e“

“m

essa

ge“)

Num

ber

N M o

f m

essa

ges

(of s

ize

M)

in t

time

units

is g

iven

by:

=

+

⋅⋅=

B)

is

size

burs

t

max

imum

(i

f

burs

ts)

tu

due

s v

aria

tion

no (i

f

)(

BM

R

MR

tN

Page 13: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

13 /

527.

3 R

esou

rce

Man

agem

ent /

Abs

trac

t Con

tinuo

us M

edia

Mod

ellin

g: W

orka

head

The

wor

kahe

ad w

(t)

of a

n L

BA

P at

tim

e t d

escr

ibes

how

man

y m

essa

ges

have

arri

ved

that

are

not

pro

cess

ed y

et. I

t is

defi

ned

by

w(t

) =

max

{0,

N(

[t0,

t] )

- R

⋅ |t

- t 0

|}.

The

logi

cal a

rriv

e tim

e l(

mi)

of m

essa

ge m

i is

the

time

at w

hich

a m

essa

ge is

effe

ctiv

ely

bein

g sc

hedu

led.

It i

s de

fine

d by

l(m

i)

= a

i + w

(ai)

/ R

(= a

ctua

l arr

ival

tim

e +

del

ay d

ue to

wor

kahe

ad)

l(m

i+1)

= m

ax {

a i+

1, l(

mi)

+ 1

/ R

}

whe

re a

i is

the

actu

al a

rriv

ing

time

of m

essa

ge m

i.

t

w(t

)

12

34

56

78

910

123

a 1l(

m1)

a 2l(

m2)a 3

a 4 l(m

3)l(

m4)

a i =

act

ual a

rriv

al ti

me

Page 14: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

14 /

52

Res

ourc

e

Mes

sage

s M

essa

ges

Inte

rfac

es

Que

ue

Serv

er

min

im. l

og. d

elay

= U

max

im. l

og. d

elay

= D

7.3

Res

ourc

e M

anag

emen

t / A

bstr

act C

ontin

uous

Med

ia M

odel

ling:

Res

ourc

es

The

logi

cal d

elay

d(m

) of

mes

sage

s m

bet

wee

n tw

o in

terf

aces

I1

and

I2 is

defi

ned

by d

(m)

= l2

(m

) -

l1(m

).

The

buf

fer

requ

irem

ents

of

reso

urce

for

a g

iven

dat

a st

ream

are

def

ined

by

buf

= B

+ R

(D-U

) w

here

:

B

= n

umbe

r of

mes

sage

s w

hich

arr

ive

unex

pect

edly

due

to b

urst

ines

s,

D

= m

axim

um lo

gica

l del

ay b

etw

een

inpu

t and

out

put i

nter

face

s,

U

= m

inim

um (

unbu

ffer

ed)

actu

al d

elay

bet

wee

n th

e sa

me

inte

rfac

es, a

nd

R(D

-U)

= n

umbe

r of

msg

. whi

ch m

ay b

e bu

ild u

p du

e to

the

vari

atio

n pr

oces

sing

tim

e

Page 15: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

15 /

527.

4 Pr

oces

s M

anag

emen

t / B

asic

s

Proc

ess

Man

agem

ent d

eals

wit

h th

e as

sign

men

t of

the

CPU

to p

roce

sses

/task

s.

A p

roce

ss m

ay b

e in

one

of

five

bas

ic s

tate

s:–

initi

al, i

.e. i

t is

crea

ted,

but

not

in s

ched

ule;

pro

cess

is id

le

–re

ady,

i.e.

it is

wai

ting

for

CP

U a

ssig

nmen

t,

–ru

nnin

g, i.

e. it

is r

unni

ng o

n th

e C

PU

,

–w

aitin

g, i.

e. it

is w

aitin

g fo

r an

ext

erna

l eve

nt, o

r

–fin

ishe

d.

The

sch

edul

er c

hoos

es th

e ne

xt p

roce

ss to

bec

ome

runn

ing

acco

rdin

g to

a g

iven

sche

dule

. The

sch

edul

e de

term

ines

the

orde

r of

CPU

ass

ignm

ent t

o pr

oces

ses.

Goa

ls o

f tr

adit

iona

l sch

edul

ing

–op

timal

thro

ughp

ut, o

ptim

al r

esou

rce

utili

zatio

n, o

r fa

ir qu

euei

ng

Goa

ls o

f re

al-t

ime

sche

dulin

g–

exec

ute

max

imum

num

ber

of p

roce

sses

in ti

me,

i.e.

acc

ordi

ng

to th

eir

dead

lines

–m

inim

ize

dead

line

viol

atio

ns

inru

fire in

Page 16: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

16 /

527.

4 Pr

oces

s M

anag

emen

t / C

lass

ific

atio

n of

Rea

l-T

ime

Sche

dulin

g St

rate

gies

Sche

dulin

g st

rate

gies

can

be

dist

ingu

ishe

d by

–st

atic

vs.

dyn

amic

sch

edul

e ca

lcul

atio

n,(s

tatic

= c

alcu

latio

n of

sch

edul

e in

adv

ance

dyna

mic

= r

e-ca

lcul

atio

n w

hene

ver

a ne

w ta

sk a

rriv

es)

–ce

ntra

l vs.

dis

trib

uted

sch

edul

e ca

lcul

atio

n, a

nd–

pree

mpt

ive

vs. n

on-p

reem

ptiv

e ta

sk p

roce

ssin

g

(pr

eem

ptiv

e =

a ta

sk m

ay b

e in

terr

upte

d by

any

task

with

hig

her

prio

rity)

The

y sc

hedu

le–

task

s w

ith p

erio

dic

or a

perio

dic

proc

essi

ng r

equi

rem

ents

, and

–in

depe

nden

t tas

ks o

r ta

sks

with

pre

cede

ncy

cons

trai

ns.

The

y ar

e ap

plie

d to

eith

er–

unip

roce

ssor

sys

tem

s,–

mul

tipro

cess

or s

yste

ms

(neg

lect

ing

com

mun

icat

ion

dela

y), o

r–

mul

ticom

pute

r sy

stem

s (t

akin

g co

mm

unic

taio

n de

lay

into

acc

ount

).

Page 17: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

17 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulab

ility

Tes

ts a

nd O

ptim

al S

ched

uler

s

The

test

to d

eter

min

e w

ethe

r a

sche

dule

exi

sts

for

a gi

ven

task

set

is c

alle

d a

sche

dula

bilit

y te

st. T

here

are

thre

e ki

nds

of te

st: s

uffi

cien

t, ex

act,

and

nece

ssar

y

ones

: –S

uffic

ient

test

s, i.

e. if

the

test

is p

ositi

ve, t

he

task

set

is s

ched

ulab

le. A

neg

ativ

e

r

esul

t is

poss

ible

eve

n if

the

task

set

is s

ched

ulab

le (

“cau

tious

“ te

st).

–N

eces

sary

test

s, i.

e. if

the

test

is n

egat

ive,

the

task

set

is n

ot s

ched

ulab

le. A

posi

tive

resu

lt do

es n

ot g

uara

ntee

a ta

sk s

et´s

sch

edul

abili

ty (

“opt

imis

tic“

test

).

–E

xact

test

s re

turn

a p

ositi

ve r

esul

t if t

he ta

sks

set i

s sc

hedu

labl

e.

Mos

t exa

ct s

ched

ulab

ility

test

s be

long

to th

e cl

ass

of N

P-co

mpl

ete

prob

lem

s.

A s

ched

uler

is c

alle

d op

tim

al if

it a

lway

s fi

nds

a sc

hedu

le f

or ta

sks

sets

sat

isfy

ing

an e

xact

sch

edul

abili

ty te

st.

Page 18: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

18 /

52

A ta

sk is

cha

ract

eriz

ed b

y is

t tim

ing

cons

trai

ns a

nd it

s re

sour

ce r

equi

rem

ents

.

Mos

t tas

ks in

mul

timed

ia s

yste

ms

are

peri

odic

and

hav

e no

pre

cede

nce

cons

trai

nts.

Mod

el f

or a

task

s tim

ing

cons

trai

nt: (

s i, e i,

d i, p i)

whe

re:

–s i s

tart

ing

poin

t, i.e

. rea

dy ti

me

for

first

per

iod

–e i p

roce

ssin

g tim

e fo

r pe

riod

pi

–d i d

eadl

ine

for

perio

d pi

(re

lativ

e to

ist p

erio

d´s

read

y tim

e)

–p

perio

d of

task

T

–r

rate

of T

(w

ith p

= r

-1)

If a

task

set

con

sist

ing

of p

erio

dic

task

s (T

1, ..

., T n)

is s

ched

ulab

le [T i =

(s i,

e i, d i,

p i)]

then

the

proc

esso

r ut

iliza

tion

is g

iven

by

(whe

re e

i/pi =

rea

ltive

pro

cess

or

utili

zatio

n by

task

Ti)

s i ↓

perio

d 1

perio

d 2

perio

d 3

perio

d 4

p id i

e i

∑ =

=n i

ii peU

1

7.4

Proc

ess

Man

agem

ent /

Mod

el f

or R

eal-

Tim

e T

asks

Page 19: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

19 /

527.

4 Pr

oces

s M

anag

emen

t / P

reem

ptiv

e vs

. Non

-Pre

empt

ive

Tas

k Sc

hedu

ling

The

re a

re ta

sks

sets

that

hav

e va

lid p

reem

ptiv

e sc

hedu

les

but n

o no

n-pr

eem

ptiv

e

ones

. If

the

cost

for

pre

empt

ion

is n

egle

cted

, pre

empt

ive

sche

dulin

g is

alw

ays

bette

r or

equ

al th

an n

onpr

eem

ptiv

e sc

hedu

ling.

aab

cd

ef

b1

2

21

11

11

11

Dea

dlin

e vi

olat

ion

Hig

h-R

ated

Tas

k T

1

Low

-Rat

ed T

ask

T2

Non

-Pre

empt

ive

Sche

dule

Pree

mpt

ive

Sche

dule

d ad b

d cd d

d fd e

d 1d 2

Dea

dlin

es

cd

ef

ab

cd

ef

Page 20: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

20 /

527.

4 Pr

oces

s M

anag

emen

t / R

ate

Mon

oton

ic A

lgor

ithm

(R

M)

- B

asic

s

Cla

ssif

icat

on

–st

atic

, pre

empt

ive

algo

rithm

for

perio

dic

task

s

Ass

umpt

ions

–al

l tim

e-cr

itica

l tas

ks h

ave

perio

dic

com

putin

g de

man

ds

–ta

sks

are

mut

ually

inde

pend

ent (

i.e. n

o pr

eced

ence

con

stra

ints

)

–a

task

s de

adlin

e eq

uals

ist p

erio

d (d

i = p

i)

–a

task

s m

axim

um c

ompu

ting

time

is c

onst

ant a

nd a

-prio

ri kn

own

–co

ntex

t sw

itche

s ar

e co

nsid

ered

tim

eles

s

Prin

cipl

es

–sh

orte

st p

erio

d ÌÍ

hig

hest

prio

rity

(i.e.

task

s ar

e or

dere

d by

dec

reas

ing

perio

d)

–pr

iorit

ies

are

reca

lcul

ated

if a

new

task

is a

dded

to th

e ta

sk s

et o

r a

task

is d

elet

ed

fr

om th

e ta

sk s

et [s

ched

ule

calc

ulat

ion

only

onc

e fo

r a

give

n ta

sk s

et]

RM

is o

ptim

al a

mon

g st

atic

sch

edul

ing

algo

rith

m, i

.e. i

f a ta

sk s

et is

sch

edul

able

by a

ny s

tatic

alg

orith

m th

en th

ere

exis

ts a

feas

ible

RM

sch

edul

e.

Í p

reem

ptio

n is

ass

umed

to c

ome

with

out

c

ost (

at le

ast w

ithou

t tim

e co

st)

Page 21: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

21 /

527.

4 Pr

oces

s M

anag

emen

t / R

ate

Mon

oton

ic A

lgor

ithm

- E

xam

ple

T1

rece

ives

pri

ority

ove

r T

2 Í

T1

pree

mpt

s T

2 to

mee

t ist

dea

dlin

es

Perf

orm

ance

of

RM

dep

ends

on

the

arri

val p

atte

rn:

wor

st c

ase

(“cr

itica

l ins

tant

“): e

very

task

with

hig

her

prio

rity

arriv

es a

t the

sam

e tim

ein

stan

t

Dea

dlin

es

Hig

h-R

ated

Tas

k T

1

Low

-Rat

ed T

ask

T2

RM

Sch

edul

e1

ab

12

cd

1

ab

cd

12

peri

od o

f T

2

peri

od o

f T

1

d ad b,

d1

d cd d,

d2

pree

mpt

ion

of T

1T

1 is

res

umed

(pre

empt

ion

wou

ld n

ot h

ave

been

nec

essa

ry in

this

exa

mpl

e in

ord

er to

mee

t the

dea

dlin

es)

Page 22: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

22 /

527.

4 Pr

oces

s M

anag

emen

t / E

arlie

st D

eadl

ine

Firs

t (E

DF)

Cla

ssif

icat

ion

–dy

nam

ic (

i.e. r

e-ca

lcul

atio

n w

hene

ver

a ne

w ta

sk a

rriv

es),

pre

empt

ive

algo

rithm

f

or p

erio

dic

task

sPr

inci

ples

–e

arlie

st d

eadl

ine

<=

> h

ighe

st p

riorit

y–

prio

ritie

s ar

e re

-cal

cula

ted

each

tim

e a

task

bec

omes

rea

dy (

even

for

an u

ncha

nged

task

set)

–ca

lcul

atio

n ha

s w

orst

cas

e co

mpl

exity

of O

(n2 )

1a

b2

cd

ab

cd

12

d ad b,

d1

d cd d,

d2

Dea

dlin

es

Hig

h-R

ated

Tas

k T 1

Low

-Rat

ed T

ask

T 2

ED

F S

ched

ule

Page 23: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

23 /

527.

4 Pr

oces

s M

anag

emen

t / C

ompa

riso

n of

ED

F an

d R

M

RM

sch

edul

es p

oten

tially

req

uire

mor

e co

ntex

t sw

itche

s, i.

e. m

ore

(and

nec

essa

ry)

pree

mpt

ions

, tha

n E

DF.

The

hig

her

num

ber

of p

reem

ptio

ns f

or R

M h

as to

be

com

pare

d w

ith th

e ad

ditio

nal c

ost

for

ED

F (d

ue to

rec

alcu

latio

n of

sch

edul

es).

1a

b2

cd

ab

cd

12

d ad b,

d1

d cd d,

d2

Dea

dlin

es

Hig

h-R

ated

Tas

k T

1

Low

-Rat

ed T

ask

T2

ED

F Sc

hedu

le

1a

b1

2c

d1

RM

Sch

edul

e

Page 24: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

24 /

527.

4 Pr

oces

s M

anag

emen

t / C

ompa

riso

n of

ED

F an

d R

M

ED

F is

bet

ter

than

RM

: If

RM

can

sch

edul

e a

task

set

the

n th

e sa

me

is v

alid

for

ED

F b

ut n

ot v

ice

vers

a.

Rat

e m

onot

onic

vs.

ED

F: p

roce

ssor

util

izat

ion

CA

3A

2C

7

C7

B5

CB

B

12

34 4

56 6

7H

igh

Rat

e

Low

Rat

e

ED

F

Rat

e M

onot

onic

d 1d 2

d 3d 4

d 6d 5

d Ad B

Dea

dlin

es

8

d 7

d C

AB

C

A2

43

AB

56

C8 8

Dea

dlin

e V

iola

tions

d A n

ot m

etd C

not

met

1 1A

B

Page 25: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

25 /

527.

4 Pr

oces

s M

anag

emen

t / A

chie

vabl

e Pr

oces

sor

Util

izat

ion

with

RM

Min

imum

uti

liza

tion

for

all

sets

of

task

s (I

1, ..

., I n

) w

hich

are

sch

edul

able

and

whi

ch “

fully

util

ize“

the

proc

esso

r.

A ta

sk s

et fu

lly u

tiliz

es a

pro

cess

or if

–ta

sk s

et c

an b

e sc

hedu

led,

and

–if

a si

ngle

task

is in

crea

sed

in p

roce

ssin

g tim

e by

ε

> 0

then

the

assi

gnm

ent

beco

mes

infe

asib

le.

Exa

mpl

e:

Giv

en a

task

set

(I 1

, I2,

I3)

wit

h pe

riod

pi a

nd p

roce

ssin

g tim

e e i

for

eac

h ta

sk:

p1

= 3

, e1

= 1

; p

2 =

4, e

2 =

1;

p3

= 5

, e3

= 1

It c

an b

e sh

own

that

in th

is c

ase

[

x] =

sm

alle

st in

tege

r ≥

x

12

12

15

121

232

3m

ax,3

=⋅

−⋅

−=

⋅−

⋅−

=pp

epp

ep

e

Page 26: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

26 /

527.

4 Pr

oces

s M

anag

emen

t / A

chie

vabl

e Pr

oces

sor

Util

izat

ion

with

RM

: The

orem

A s

et o

f n

inde

pend

ent a

nd p

erio

dic

task

s (T

1, ..

., T

n) c

an b

e sc

hedu

led

if

As

a co

nseq

uenc

e: A

low

er b

ound

for

pro

cess

or u

tiliz

atio

n is

:–

ln 2

if R

M is

app

lied

–1

(low

er a

nd u

pper

bou

nd)

if E

DF

is a

pplie

d (a

nd d

eadl

ine

= e

nd o

f per

iod)

() 1

2...

1

22

11−

⋅≤

++

+n

npe

pe

pe

nn

For

n →

thi

s ex

pres

sion

con

verg

es to

ln 2

≈ 0

,693∞

Page 27: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

27 /

527.

4 Pr

oces

s M

anag

emen

t / A

chie

vabl

e Pr

oces

sor

Util

izat

ion

with

ED

F

For

ED

F a

muc

h be

tter

(i.e

. per

fect

) ut

iliza

tion

is p

ossi

ble:

Mix

ed s

chem

e:

Supp

ose

we

have

n p

erio

dic

task

s.

Prio

ritie

s gi

ven

acco

rdin

g to

RM

are

I1,

I2,

...,

I n (I

1 sh

orte

st p

erio

d, I

n =

long

est p

erio

d),

i.e. h

ighe

st p

rior

ity

for

task

1.

Com

prom

ise:

–S

ched

ule

I 1, I 2

, ...,

I k w

ith R

M (

1 ≤

k ≤

n)

–S

ched

ule

I k+1,

I k+

2, ..

., I n

with

ED

F w

hen

the

proc

esso

r is

not

occu

pied

by

I 1, I 2

, ...,

I k

1...

22

11≤

++

+nn pe

pe

pe

Page 28: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

28 /

527.

4 Pr

oces

s M

anag

emen

t / A

chie

vabl

e Pr

oces

sor

Util

izat

ion

with

ED

F

060

A1

A2

A3

A4

A9

A14

A20

B1

B2

B3

B4

B5

C1

C2

C3

A1B

1 C1

A2B

2C2 A3

B3 A

4C3

A5 B

4

A6 B

5C

4

A7

C8

B6A

8 C5

A9

B7C

6 A10

B8

A11 C

7B9 A

12C

8B

10

A13

A14 B

11

C9 A

15B

12A16 C

10A

17B13 C

11A18

A19

C12

B14

B15 A

20

empt

yre

mai

n

slot

s

60 of

out

13

i.e.

, 6047

51

41

31 oc

cupa

tion

=+

+

C1´

C2´

C3´

empt

yre

mai

n

slot

s

60 of

out

1on

ly

i.e

. ,

6059

52

71

31 oc

cupa

tion

=+

+

A1 B

1

C1A

2 C1´

B2

A3

A4

A5

B3

C2´

C3´

C3´

B46

78

910

1112

1314

1516

1718

1920

Tas

k 1

(p1

= 3,

e1

= 1

)

Tas

k 2

(p2 =

4, e

2 =

1)

Tas

k 3

(p3

= 5,

e3

= 1

)

Tas

k 3

with

e3

= 2

RM

Mix

ed

stra

tegy

Page 29: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

29 /

527.

4 Pr

oces

s M

anag

emen

t / D

eadl

ine

Mon

oton

e A

lgor

ithm

Shor

test

dea

dlin

e fi

rst:

–st

atic

alg

orith

m w

hich

giv

es h

ighe

r pr

iorit

y to

a ta

sk w

ith s

hort

er d

eadl

ine,

i.e.

T1 >

T2

if d

1 <

d2

If d

eadl

ine

= p

erio

d Í

RM

alg

orith

m.

Thi

s is

sim

ilar

but

not

iden

tical

to E

DF.

Page 30: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

30 /

527.

4 Pr

oces

s M

anag

emen

t / S

hort

est (

Rem

aini

ng)

Proc

essi

ng T

ime

The

task

wit

h

–sh

orte

st p

roce

ss ti

me

(

if no

n-pr

eem

ptiv

e)

–sh

orte

st r

emai

nin

g tim

e (if

pre

empt

ive

h

as h

ighe

st p

riorit

y.

Thi

s st

rate

gy s

erve

s th

e m

axim

um n

umbe

r of

cus

tom

ers.

In a

n ov

erlo

ad s

ituat

ion

and

if a

ll ta

sks

have

the

sam

e de

adlin

e th

en th

is

stra

tegy

min

imiz

es th

e nu

mbe

r of

dea

dlin

e vi

olat

ions

.

Page 31: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

31 /

527.

4 Pr

oces

s M

anag

emen

t / P

reem

ptiv

e vs

. Non

-pre

empt

ive

“Pre

empt

ive“

is m

ore

com

plic

ated

but

:

–in

crea

ses

the

feas

abili

ty o

f sch

edul

ing

(in s

ome

case

s a

pree

mpt

ive

sche

dule

exis

ts b

ut n

o no

n-pr

eem

ptiv

e sc

hedu

le)

–re

duce

s th

e am

ount

of p

riorit

y in

vers

ion

(i.e.

situ

atio

ns w

here

low

er p

riorit

y jo

bs

are

exec

uted

whi

le h

ighe

r pr

iorit

y jo

bs a

re w

aitin

g).

A ta

sk s

et w

ith p

roce

ssin

g tim

es e

i and

wit

h re

ques

t per

iods

pi i

s sc

hedu

labl

e if

:

In g

ener

al th

e re

sulti

ng s

ched

ule

is a

pre

empt

ive

one.

stra

tegy

)

ED

Fby

e.g.

ad

just

ed,

y dy

nam

ical

l

bem

ay

pr

iori

ties

(i

f 1

assi

gned

)

fixe

d

are

pr

iori

ties

task

(i

f

693

,02

ln

≈≤

∑∑

iiii pepe

Page 32: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

32 /

527.

4 Pr

oces

s M

anag

emen

t / P

reem

ptiv

e vs

. Non

-pre

empt

ive

Sche

dula

bili

ty f

or n

on-p

reem

ptiv

e st

rate

gies

is m

ore

com

plic

ated

:

Tas

k I k

can

be

sche

dule

d (w

orst

cas

e co

nsid

erat

ion)

if it

s de

adlin

e d k

sat

isfi

es

the

follo

win

g:

here

In

is th

e hi

ghes

t pri

ority

task

I1

is th

e lo

wes

t pri

ority

task

(*)

=

ow

n ex

ecut

ion

time

(**)

=

wai

ting

tim

e du

e to

job

foun

d in

ser

vice

at a

rriv

al ti

me

(wor

st c

ase:

max

imum

exe

cutio

n tim

e of

all

jobs

of

othe

r pr

iori

ty c

lass

es)

(***

) =

exe

cuti

on ti

me

of a

ll jo

bs o

f hi

gher

pri

ority

whi

ch a

re p

rese

nt a

t arr

ival

tim

e or

whi

ch a

rriv

e du

ring

the

wai

ting

time

x

job

of p

rior

ity

k ar

rive

shi

gher

pri

o jo

bsar

rive

and

are

ser

ved“m

y se

rvic

e tim

e“

xd

k

!

:tR

equi

rem

en≥

∑ +=

+

⋅+

+≥

n kj

j

jj

ji

ki

kk

p

ed

ee

ed

1

1m

ax(*

)(*

*)

(***

)

Page 33: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

33 /

527.

4 Pr

oces

s M

anag

emen

t / E

xam

ple

for

Ach

ieva

ble

Proc

esso

r U

tiliz

atio

n

Giv

en a

task

set

(I 1

, I2,

I3)

wit

h pe

riod

pi a

nd p

roce

ssin

g tim

e e i

for

eac

h ta

sk:

p 1 =

3, e

1 =

1 ;

p2

= 4

, e2

= 1

; p

3 =

5, e

3,m

ax =

2

Con

ject

ure:

Mix

ed s

chem

e is

nea

rer

to th

e be

tter

side

(na

mel

y E

DF)

than

to th

e “p

oo

r“

side

(na

mel

y R

M).

308.2

to

in

crea

sing

whe

n %

100

15

308,2

41

31

n(

ED

F)U

tiliz

atio

78

%0,

783

51

41

31

(RM

)n

Util

izat

io

%98

983

,052

41

31 sc

hem

e)

(mix

edn

Util

izat

io

* 33

=≈

=+

+

≈=

++

≈=

++

ee

I 1 sc

hedu

led

with

RM

,I 2

and

I 3 sc

hedu

led

with

ED

F

Page 34: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

34 /

527.

4 Pr

oces

s M

anag

emen

t / A

chie

vabl

e Pr

oces

sor

Util

izat

ion

(her

e R

M)

Util

izat

ion:

The

act

ual u

tiliz

atio

n is

slig

htly

bet

ter

than

the

theo

retic

al m

inim

um:

78,0)1

2(331

=−

=th

eore

mU

I 1I 1

I 1I 1 I 2

I 2I 2

I 3I 3

I 1I 2

I 3I 1

I 2I 3

I 1I 2

Tas

k I 1

RM

sch

edul

e

Tas

k I 3

Tas

k I 2

t

%78

783

,051

41

31

33

22

11≈

=+

+=

++

=pe

pe

peU

actu

al

Page 35: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

35 /

527.

4 Pr

oces

s M

anag

emen

t / L

east

Lax

ity F

irst

(L

LF)

Tas

k w

ith s

hort

est r

emai

ning

Lax

ity is

sch

edul

ed f

irst

.

Def

init

ion:

laxi

ty l k

(t)

of ta

sk T

in p

erio

d k

at ti

me

t

The

rem

aini

ng ti

me

from

t to

the

dead

line

d of

task

T in

per

iod

k th

at is

not

use

d

for

proc

essi

ng ta

sk T

.

lk(

t) =

(s

+ (

k-1)

p +

d)

-

(

t + e

rem

(t))

=

(D

eadl

ine

in p

erio

d k)

-

(ac

tual

tim

e +

rem

aini

ng p

roce

ssin

g tim

e)

Page 36: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

36 /

527.

4 Pr

oces

s M

anag

emen

t / L

east

Lax

ity F

irst

(L

LF)

LL

F ha

s no

adv

anta

ge o

ver

the

ED

F fo

r un

ipro

cess

or s

yste

ms.

If

task

s ha

vesi

mil

ar la

xity

val

ues

cont

ext s

witc

hes

can

occu

r fr

eque

ntly

(ca

lcul

atio

nov

erha

ead

com

pare

d to

ED

F). L

Lf

mig

ht b

e su

itabl

e on

ly in

mul

tipro

cess

orsy

stem

s, i.

e. w

hen

seve

ral r

esou

rces

are

sch

edul

ed s

imul

tane

ousl

y.

s

e

s +

(k-

1)p

t 1t

e rem(t

)

t 2

l k(t 1)

l k(t 2) s +

(k-

1) p

+d

Dea

dlin

e in

per

iod

k

s +

k ⋅

p

peri

od k

Page 37: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

37 /

527.

4 Pr

oces

s M

anag

emen

t / L

east

Lax

ity F

irst

- E

xam

ple

for

Tw

o T

asks

Giv

en a

min

imum

CPU

tim

e gr

anul

arity

of

2 Ì

if n

o gr

anul

arity

ass

umed

Í

task

pre

empt

ion

as o

ften

as

poss

ible

Í

“pr

oces

sor

shar

ing“

Lax

ities

do

not c

hang

e du

ring

exe

cutio

n tim

e of

a ta

sk b

ut b

ecom

e sm

alle

r whe

n a

task

is n

otse

rved

. If

the

laxi

ty o

f a

wai

ting

task

bec

omes

sm

alle

r th

an th

at o

f th

e ru

nnin

g ta

sk th

en th

e ru

nnin

gta

sk is

inte

rrup

ted.

I 1I 2

I 1I 2

I 1I 2

I 1t

L2(

I 1) =

20

L2(

I 2) =

14

I 2 in

terr

upts

I1

L8(

I 1) =

14

L8(

I 2) =

14

I 1 in

terr

upts

I2

L10

(I1)

= 1

4L

10(I

2) =

12

I 2 in

terr

upts

I1

I 2 fi

nish

edI 1

fini

shed

...

LL

F Sc

hedu

le

Tas

k I 2

Tas

k I 1

Page 38: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

38 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g A

peri

odic

(bu

t Ind

epen

dent

) T

asks

Mul

tim

edia

app

licat

ions

con

sist

s of

bot

h–

perio

dic

and

–ap

erio

dic

task

s,

like

mos

t rea

l-ti

me

syst

ems.

Peri

od ta

sks

are

used

for

tran

spor

t and

pro

cess

ing

of c

ontin

uous

med

ia d

ata

whe

reas

con

trol

or

man

agem

ent t

asks

are

ape

riod

ic. O

ften

it is

rea

sona

ble

to g

ive

to p

erio

dic

task

s pr

iori

ty o

ver

aper

iodi

c ta

sks.

Prob

lem

:–

How

to s

ched

ule

a ta

sk s

et w

hich

is c

ompo

sed

of p

erio

dic

as w

ell a

s ap

erio

dic

task

s?

Idea

: –O

ne s

peci

al p

erio

dic

task

(ca

lled

serv

er)

is p

ollin

g fo

r re

ady

aper

iodi

c ta

sks

to b

epr

oces

sed.

Page 39: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

39 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g A

peri

odic

(bu

t Ind

epen

dent

) T

asks

Prob

lem

:

–A

perio

dic

task

s ca

n on

ly b

e pr

oces

sed

whe

n se

rver

task

is s

ched

uled

, i.e

. the

y

mis

s th

eir

dead

line

if it

is e

arlie

r th

an th

e ne

xt ti

me

the

serv

er is

sch

edul

ed.

Solu

tion

:

So-c

alle

d ba

ndw

idth

pre

serv

ing

algo

rith

m li

ke

–P

riorit

y E

xcha

nge,

–D

efer

rab

le S

erve

r, o

r

–S

pora

dic

Ser

ver.

Page 40: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

40 /

527.

4 Pr

oces

s M

anag

emen

t / B

andw

idth

Pre

serv

ing

Alg

orith

ms

Prio

rity

Exc

hang

e:

One

per

iodi

c ta

sk T

s ser

ves

all a

peri

odic

task

s. T

he s

erve

r ex

chan

ges

prio

rity

with

alo

wer

pri

or p

erio

dic

task

Ti i

f no

ape

riod

ic ta

sk is

rea

dy. T

he s

erve

r re

ceiv

e its

initi

alpr

iori

ty f

or th

e ne

xt p

erio

d.

Cas

e 1:

Ts s

erve

s >

0 a

peri

odic

task

s

Cas

e 2:

Ts ha

s no

task

to s

erve

, cha

nges

pri

ority

with

Ti a

nd is

rea

ctiv

ated

at t

he

tim

e T

i was

sch

edul

ed.

T1

Ts

T1

Tn

Ti

......

T1´

Ts´

T1´

Tn´

Ti´

......

peri

od k

peri

od k

+1

T1

Ti

T1

Tn

Ts

......

T1´

Ts´

T1´

Tn´

Ti´

......

peri

od k

peri

od k

+1

Page 41: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

41 /

527.

4 Pr

oces

s M

anag

emen

t / B

andw

idth

Pre

serv

ing

Alg

orith

ms

Def

erra

ble

Serv

er:

One

per

iodi

c ta

sk (

calle

d de

ferr

able

ser

ver)

ser

ves

all a

peri

odic

task

s. I

t def

ers

its p

roce

ssin

g ti

me

if n

o ap

erio

dic

task

is r

eady

but

ret

ains

ist p

rior

ity. A

s so

on

as a

n ap

erio

dic

task

req

uest

occ

urs,

it e

ither

–(im

med

iatly

) pr

eem

pts

the

runn

ing

task

s (t

hat h

as a

low

er p

riorit

y), o

r

–re

sum

es p

roce

ssin

g af

ter

the

curr

ent t

ask

term

inat

es.

Ts

T1

T2T

3T

4...

Tn

Inte

rrup

T4 or

wai

tun

til T

4 is

fin

ishe

d

noth

ing

to s

erve

aper

iodi

c ta

sk a

rriv

al

Page 42: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

42 /

527.

4 Pr

oces

s M

anag

emen

t / B

andw

idth

Pre

serv

ing

Alg

orith

ms

Spor

adic

ser

ver:

It c

ombi

nes

the

adva

ntag

es o

f th

e Pr

iori

ty E

xcha

nge

and

the

Def

erra

ble

Serv

er

algo

rith

m. A

spo

radi

c se

rver

exc

hang

es it

s pr

iori

ty w

hen

no a

peri

odic

task

is

read

y. A

ny s

pare

CPU

cap

acit

y, i.

e. ti

me

not u

sed

by p

erio

dic

task

s, is

tran

sfor

med

into

a ti

cket

, tha

t is

give

n to

a s

pora

dic

serv

er, w

hich

then

repl

enis

hes

its in

itial

pri

ority

. Thi

s w

ay, t

he s

pora

dic

serv

er is

allo

wed

to u

se

any

idle

tim

e of

the

CPU

.

Page 43: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

43 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g T

asks

with

Blo

ckin

g

The

blo

ckin

g of

a ta

sk is

cau

sed

by m

utua

l exc

lusi

on w

hen

tryi

ng to

acc

ess

acr

itica

l sec

tion

curr

ently

occ

upie

d by

ano

ther

task

.Pr

iori

ty I

nver

sion

Eff

ect:

Ass

ume

a hi

gh-p

rior

ity ta

sk T

h w

ants

to e

nter

a c

ritic

al s

ectio

n cu

rren

tly o

ccup

ied

by a

low

-pri

ority

task

Tl.

Th

is b

lock

ed u

ntil

Tl l

eave

s th

e cr

itica

l sec

tion.

Unt

il th

en, n

ot o

nly

Tl b

ut a

ll m

ediu

m-p

rior

ity ta

sks

Tm

hav

ing

high

er p

rior

ity th

an T

l and

low

er p

rior

ityth

an T

h w

ill b

e pr

oces

sed

prio

r to

Th.

Thi

s ph

enom

enon

is c

alle

d pr

iori

ty in

vers

ion.

The

rul

e: A

low

pri

ority

task

mus

t wai

t, i.e

. can

not b

egin

exe

cutio

n, if

a h

ighe

r pr

iori

ty

task

is r

unni

ng.

criti

cal s

ectio

n

proc

.bl

ocke

d un

til

unit

(s)

sign

al(s

)pr

oces

sing

Tas

k T

h

Tas

k T

l

Tas

k T

m

Page 44: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

44 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g T

asks

with

Cri

tical

Sec

tions

Seve

ral a

lgor

ithm

s ha

ve b

een

deve

lope

d in

ord

er to

avo

id p

rior

ity in

vers

ion,

e.g

.

–P

riorit

y In

herit

ance

, or

–th

e C

eilin

g P

roto

col.

Prio

rity

Inh

erita

nce:

–A

low

-prio

rity

task

Tl i

nhe

rits

the

prio

rity

of a

hig

h-pr

iorit

y ta

sk T h if

it ca

uses

the

bloc

king

of T

h. T

l ret

ains

ist i

nitia

l prio

rity

whe

n le

avin

g th

e cr

itica

l sec

tion.

Thu

s: –R

eady

jobs

bet

wee

n “lo

w“

and

“hig

h“ a

re b

lock

ed.

Dis

adva

ntag

e:

– L

ower

util

izat

ion

of s

erve

r, p

ossi

ble

dead

line

viol

atio

ns.

Adv

anta

ge:

–S

eque

nce

of s

ched

ules

is p

rese

rved

.

Page 45: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

45 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g T

asks

with

Cri

tical

Sec

tions

Mor

e Pr

oble

ms

wit

h “s

tand

ard“

prio

rity

inhe

ritan

ce:

–T

asks

can

be

bloc

ked

in e

ach

criti

cal s

ectio

n,

–de

adlo

cks

can

occu

r, a

s w

ell a

s

–tr

ansi

tive

bloc

king

is p

ossi

ble,

i.e.

T3

is b

lock

ed b

y T 2

that

is b

lock

ed b

y T 1

Prin

cipl

e (c

eili

ng p

roto

col)

:

Eac

h ta

sk h

as tw

o pr

iori

ties:

–a

stat

ic o

ne a

ssig

ned

by th

e sc

hedu

ler,

e.g

. acc

ordi

ng to

RM

str

ateg

y

–a

dyna

mic

one

, i.e

. the

max

imum

of t

he

stat

ic p

riorit

y an

d th

e hi

ghes

t prio

rity

inhe

rited

Page 46: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

46 /

527.

4 Pr

oces

s M

anag

emen

t / S

ched

ulin

g T

asks

with

Cri

tical

Sec

tions

Eac

h se

map

hore

has

a m

axim

um o

r ce

iling

pri

ority

val

ue o

f al

l tas

ks th

at

actu

ally

use

it. A

sem

apho

re o

nly

can

be lo

cked

by

a ta

sk w

ith a

hig

her

dyna

mic

pri

ority

than

any

cur

rent

ly lo

cked

sem

apho

re. (

com

para

ble

to

“hie

rarc

hy o

f re

sour

ces“

app

roac

h to

dea

dloc

k av

oida

nce)

Ben

efits

:

–A

task

is o

nly

bloc

ked

once

, no

dead

lock

s an

d tr

ansi

tive

bloc

king

.

Pric

e: –R

estr

ictiv

e lo

ckin

g po

licy

(bru

te fo

rce

met

hod)

Í

long

er b

lock

ing

dela

ys fo

r

othe

r ta

sks.

Page 47: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

47 /

527.

5 Pr

otot

ype

Syst

ems

/ Rea

l-T

ime

Mac

h

It is

a d

istr

ibut

ed o

pera

ting

syst

em f

or r

eal-

time

appl

icat

ions

bas

ed o

n th

eA

RT

S (A

dvan

ced

Rea

l-T

ime

Syst

em),

bot

h de

velo

ped

at C

arne

gie

Mel

lon

Uni

vers

ity a

t Pit

tsbu

rgh,

PA

, USA

.

RT

Mac

h:–

supp

orts

mul

ti-pr

oces

sor

–cl

uste

rs n

≥ 1

proc

esso

rs in

to a

pro

cess

or s

et

–as

sign

s a

sepa

rate

run

que

ue a

nd s

ched

ulin

g st

rate

gies

to e

ach

proc

esso

r se

t

–en

able

s an

app

licat

ion

to s

elec

t the

cur

rent

sch

edul

ing

stra

tegy

(at

run

-tim

e)

RT

Mac

h ke

rnel

proc

esso

r se

t

proc

esso

r

sche

dule

r

stra

tegy

run

queu

e

Page 48: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

48 /

52

Gen

eric

Sch

edul

er

Thr

ead

Dis

patc

hing

Mgm

t.

Proc

esso

r Se

t Mgm

t.

RM

RM

/DS

RM

/DS

FP RR

7.5

Prot

otyp

e Sy

stem

s / T

ask

Sche

dulin

g in

RT

Mac

h

RT

Mac

h of

fers

thre

e cl

asse

s of

task

s (c

alle

d R

T T

hrea

ds):

–pe

riodi

c or

ape

riodi

c (s

pora

dic)

task

s w

ith h

ard

dead

lines

, or

–ta

sks

with

sof

t dea

dlin

es.

Tas

ks a

re s

ched

uled

by

one

of th

e fo

llow

ing

stra

tegi

es (

dyna

mic

ally

cha

ngab

le):

–ra

te m

onot

onic

(R

M),

with

def

erra

ble

serv

er (

RM

/DS

), o

r sp

orad

ic s

erve

r (R

M/S

S),

–fix

ed p

riorit

y (F

P),

as

wel

l as

–ro

und

robi

n (R

R).

Thr

ead

disp

atch

ing

man

agem

ent c

ontr

ols

idle

thre

ads

and

aper

iodi

c se

rver

(D

S o

r S

S).

Pro

cess

orse

t man

agem

ent p

erfo

rms

cont

ext s

witc

hing

, thr

ead

pree

mpt

ion,

or

proc

esso

r as

sign

men

t.

Page 49: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

49 /

527.

5 Pr

otot

ype

Syst

ems

/ The

QoS

Tic

ket M

odel

The

QoS

Tic

ket M

odel

com

bine

s re

sour

ce r

eser

vati

on a

nd a

dapt

atio

n.

It h

as b

een

impl

emen

ted

on R

T-M

ach

3.0

supp

rotin

g so

-cal

led

Q-T

hrea

ds.

Qos

Tic

ket a

llow

s us

ers

to s

peci

fy to

lera

nce

rang

es f

or p

erio

d an

d co

mpu

tatio

n tim

e. T

icke

t is

issu

ed f

or e

ach

sess

ion

com

pris

ing

seve

ral t

hrea

ds. Q

oS p

aram

eter

s ar

e ad

apte

d dy

nam

ical

ly

base

d on

the

curr

ent r

esou

rce

cons

umpt

ion.

2. C

alcu

latio

n of

R

esou

rce

Allo

catio

n

QoS

Man

ager

1. Q

oS R

eque

st

4. I

ssue

Tic

ket

Mul

timed

ia S

essi

on

QoS

Tic

ket

3. R

esou

rce

Res

erva

tion

RT

Mac

h ke

rnel

5. C

onsu

mpt

ion

Inf

orm

atio

n

Page 50: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

50 /

527.

5 Pr

otot

ype

Syst

ems

/ Com

pari

son

of R

T-T

hrea

ds a

nd Q

-Thr

eads

invo

catio

n tim

e

thre

ad a

ttrib

utes

invo

catio

n pe

riod

guar

ante

e of

exe

cutio

n

purp

ose

peri

odic

RT

-Thr

ead

Q-T

hrea

dus

er-d

efin

ed e

ntry

poi

nt is

cal

led

peri

odic

ally

fixe

d in

voca

tion

peri

odra

nges

for

per

iod

and

com

puta

tion

time

fixe

d (c

an b

e re

-spe

cifi

ed)

dyna

mic

, with

in r

ange

,ba

sed

on Q

oS c

ontr

ol p

olic

y

none

(po

ssib

le w

ith C

PUre

serv

atio

n)gu

aran

teed

, with

in th

e av

aila

ble

com

puta

tion

time

real

-tim

e pr

oces

sing

cont

inuo

us-m

edia

pro

cess

ing

Page 51: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

51 /

527.

5 Pr

otot

ype

Syst

ems

/ YA

RT

OS

(Yet

Ano

ther

Rea

l-T

ime

Ope

ratin

g Sy

stem

)

Mic

ro k

erne

l im

plem

ente

d in

C o

n IB

M P

S/2

(Int

el 8

0386

pro

cess

or)

at

Uni

vers

ity o

f N

orth

Car

olin

a at

Cha

pel H

ill, N

C, U

SA.

YA

RT

OS

supp

orts

1.ta

sks,

i.e.

inde

pend

ent t

hrea

ds o

f co

ntro

l inv

oked

by

repe

ated

ly

occu

ring

eve

nts,

and

2. r

esou

rces

whi

ch s

ynch

roni

ze c

oncu

rren

t acc

ess

to s

hare

d da

ta.

Its

sche

dule

r gu

aran

tee

that

1. e

ach

task

invo

catio

n co

mpl

etes

pro

cess

ing

befo

re is

t dea

dlin

e, a

nd

2. n

o sh

ared

res

ourc

e is

acc

esse

d si

mul

tane

ousl

y by

mor

e th

an o

ne ta

sk.

Page 52: 7. Multimedia Operating System – Classification of Real

7. M

ultim

edia

Ope

ratin

g Sy

stem

Multimedia Kommunikation SS‘99

52 /

527.

5 Pr

otot

ype

Syst

ems

/ YA

RT

OS

(Yet

Ano

ther

Rea

l-T

ime

Ope

ratin

g Sy

stem

)

It o

ffer

s tw

o se

para

te n

otio

ns o

f de

adlin

es f

or ta

sks,

1. O

ne f

or in

itial

aqu

isiti

on o

f th

e pr

oces

sor,

and

2. O

ne f

or e

xecu

tion

of o

pera

tions

on

reso

urce

s (t

o av

oid

prio

rity

inve

rsio

n).

It p

erfo

rms

on-l

ine

sche

dulin

g of

spo

radi

c ta

sks

exte

ndin

g th

e E

arlie

st D

eadl

ine

Firs

t alg

orith

m w

ith

sync

hron

ized

acc

ess

to s

hare

d re

sour

ces

on a

uni

proc

esso

r

syst

em.

YA

RT

OS

e.g.

ser

ves

for

a w

orks

tati

on-b

ased

aud

io a

nd v

ideo

con

fere

ncin

g

syst

em (

over

a 1

6 M

bit T

oken

Rin

g L

AN

).