I'm playing catchup with crossing posts, but yes I think you've got it.
The only change I'd make to your thinking is the line:
- the CPU comes back and starts executing the 1ms "task", and finishes it.
Think of both the 5ms Timer and the 1ms Task as starting simultaneously.
There is no rule that says one must start before the other, or which starts first.
Quote:
Originally Posted by Ether
I've been reading and re-reading the above post and I think I may have had an epiphany.
Is this any closer to the truth:
- the 5ms periodic vi has two parallel "tasks" in it: a 5ms timer, and some code that takes 1ms to execute
- this 5ms periodic vi gets called once to kick-start it
- the first time the 5ms periodic vi gets called, the CPU encounters the 5ms timer task and executes that... which basically just sets a timer interrupt to occur 5ms in the future.
- the CPU comes back and starts executing the 1ms "task", and finishes it.
- since the 5ms timer task hasn't finished yet, the 5ms periodic vi can't "finish". The CPU goes and does something else.
- when the 5ms interrupt occurs, this basically completes the 5ms timer "task", so the periodic vi is now "finished"
- in this scenario, it is required to make the periodic vi loop back and start again
Is the above even remotely correct?
~
|