tags:

views:

172

answers:

1

If you have round robin enabled in Vxworks and your task gets preempted by a higher priority task, what happens to the remaining time slice?

+2  A: 

Your task will resume execution and finish the remainder of the time slice.

Note that you will have some jitter that occurs for one time tick, since time slicing has a granularity of 1 clock tick.

For example:
You have round robin enabled with a 10 clock tick time slice. One clock tick is 10 ms. You expect 100 ms per time slice.
You get pre-empted at 5 ms (the middle of your 1st tick). You should run for 95ms more, but VxWorks considers that you still have 10 ticks to go.

If the task gets the cpu back at 11ms, you will execute 99ms more.
If the task gets the cpu back at 19ms, you will execute 91ms more.

Every time you get pre-empted, your task might execute +/- 1 tick in absolute time.

Benoit