Hello all,
I'm a bit confused regarding threads and scheduling in labview RT for the cRIO. I have three timed-loop structures that each write to a CAN bus, running at the following setup:
Thread 1: prio 3 (high), period 1 000 000 μs
Thread 2: prio 2 (med), period 20 000 μs
Thread 3: prio 1 (low), period 10 000 μs
What I'm trying to achieve is that thread 1 always executes first each 1000ms multiple, followed by the other threads in priority order. However, when monitoring the actual start and finish iterations of the timed-loop structures I have the following running scheme (as percieved by the actual start and finish times from the structure):
Around time 0:
Time: 2, Thread 1 Start
Time: 294, Thread 1 Finishes
Time: 10040, Thread 3 Starts
Time: 13513, Thread 3 Finishes
Time: 20023, Thread 2 Starts
Time: 21990, Thread 2 Finishes
Around time 1 000 000:
Time: 1000022, Thread 2 starts.
Time: 1000029, Thread 1 starts. (most likely interupts thread 2)
Time: 1000230, Thread 1 finishes.
Time: 1000262, Thread 3 starts.
Time: 1001974, Thread 2 finishes. (most likely interupts thread 3)
Time: 1008045, Thread 3 finishes.
My questions are:
* Why aren't thread 2 and 3 ready to execute at time 0 together with thread 1? This causes thread 3 to run before thread 2 and is not desirable in my case.
* Why do thread 2 and 3 get to execute after time 1 000 000, even though there is a higher priority thread in the ready queue and thus get interupted?
Thanks in advance
Mattias