Skip to contentSkip to conversation

How to get the next periodic task awakening

Xenomai-core Nocia 2 participants 2 messages Jul 1, 2009

lore
Share & tools
lore

Nocia

author
#0 lore raw

Hi all,

I'm a beginer in the Xenomai world.

I'm working on the Xenomai kernel in order to minimize the power consumption, for my university final project (/http/://xenomaiote.googlecode.com).

To do that I'm trying to implement OTE (one time extension).

For OTE, I need to know if tasks are in the ready queue that I can do with countpq(&sched->readyq)

However I have also to know when the next periodic task will wake up to know the available time that I can use to extends the current task.

But I didn't find this information.

I try this following things in the schedule function xnpod_schedule (pod.c):

To get the next timer that will wake up :

xntimerq_head(&sched->timerqueue)

To get the date of the next wake up :

xntimerh_date(&timer->aplink)

Then I compare this date with the date of the next ingoing task (except the root task) with xnarch_get_cpu_tsc()

But the results aren't convincing :

Jul 1 11:13:23 rt-nocia kernel: [ 252.872275] now: 263916522565

Jul 1 11:13:23 rt-nocia kernel: [ 252.872285] Name thread out : trivial2

Jul 1 11:13:23 rt-nocia kernel: [ 252.872292] Name thread in : ROOT/0

Jul 1 11:13:23 rt-nocia kernel: [ 252.872297] nb in queue 0

Jul 1 11:13:23 rt-nocia kernel: [ 252.872303] next event *263920282098*

Jul 1 11:13:23 rt-nocia kernel: [ 252.872317]

Jul 1 11:13:24 rt-nocia kernel: [ 253.879348] now: *264923529578*

Jul 1 11:13:24 rt-nocia kernel: [ 253.879362] Name thread out : ROOT/0

Jul 1 11:13:24 rt-nocia kernel: [ 253.879369] Name thread in : trivial

Jul 1 11:13:24 rt-nocia kernel: [ 253.879374] nb in queue 1

The next event is 263920282098 and when the task is scheduling, the current time is 264923529578.

Maybe it's because I have to get the second timer ?

Thanks in advance for any help!

Lucien

#1 lore raw
Quoted 10 lines · Nocia

Hi all,

I'm a beginer in the Xenomai world.

I'm working on the Xenomai kernel in order to minimize the power consumption, for my university final project (/http/://xenomaiote.googlecode.com).

To do that I'm trying to implement OTE (one time extension).

Ok, I have found this
http://www.google.com/url?sa=t&source=web&ct=res&cd=8&url=http%3A%2F%2Fwww.embeddedcomputingconference.ch%2Fdownload_sec%2F1B-Evequoz.pdf&ei=-UhLSsLDGJaRjAfwm4Fl&rct=j&q=%22one+time+extension%22+operating+system&usg=AFQjCNGPkM9-VpD8jFNIa38xmu4hruEdkw

Is this what you are talking about?

Quoted 6 lines

(...)
To get the next timer that will wake up :

xntimerq_head(&sched->timerqueue)

Quoted 7 lines

To get the date of the next wake up :

xntimerh_date(&timer->aplink)

Then I compare this date with the date of the next ingoing task (except the root task) with xnarch_get_cpu_tsc()

xntimerq_head is the next timer which is going to fire, this is not necessarily attached to a task, and even if it was, there is no guarantee that nothing else will happen between now and this next event. Another task may be woken up by an interrupt, or even by the current task, tasks are not necessarily time-triggered.

xntimerh_date(&timer->aplink) only works for aperiodic timers.

I think you are looking in the wrong direction. What you really need is to implement a new scheduler class (EDF with OTE or something like that), and implement things in this abstraction, not by patching xnpod_schedule.

Also note that the default scheduler classes (FIFO and RR) do their job without knowing what the WCET of a task is, and from what I saw, skimming the document mentioned above, you need this information, so, you absolutely need a new scheduler class.

Signature · 1 line
					    Gilles.