NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do waits/timeouts work inside of timed structures?

I have a situation where a while loop waits for data (eg on a queue), and then as soon as data is available I would like it to execute with highest priority. I've seen the recommendation that the best way to handle this is to put a regular while loop inside of a timed sequence. The image shows an oversimplified version of what I'm doing.

 

First of all, I'd like to confirm whether this is actually the right way to handle this situation?

 

And if so, I could use some clarification on how this actually gets handled. Without the timed sequence, I know that while the Dequeue Element is waiting it allows other threads to takeover the processor and run. Does this work differently when inside a timed structure? Will it consume greater resources while waiting than if it was not in a timed sequence? Does it matter if its a timed sequence vs a timed loop? Or whether the wait is from a dequeue, event structure, an actual Wait, or other similar mechanisms? It seems like having several structures like this may be preventing my other code from running, even when they are just sitting and waiting.

 

0 Kudos
Message 1 of 5
(144 Views)

You'd be better off trying the VI priorities (Execution category of VI Properties Ctrl+i) first IMO. Putting code in a timed structure limits the execution to a single thread. That is desirable for some operations but doesn't sound like what you're after. Put the code you want to run at a higher priority in a SubVI and set that VI's execution priority to... a higher priority.

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
Message 2 of 5
(95 Views)

Modern processors have multiple cores, so several threads can run in parallel and LabVIEW takes full advantage of that. Just make sure to not overload the processor with a huge number of parallel menial greedy tasks and you should be OK. What CPU do you have for the RT system?

 

Can you define your use of the vague term "highest priority"? What are the requirements in terms of e.g. jitter? How long does it take to finish that highest priority task? How big can the queue get? Do you have control of other aspects of the chain, such as the enqueueing? Looking at the dequeue in isolation seems a bit narrow. You mention "other code". What does it all do? Can you expand on the big picture?

 

Do you actually have documented performance issues that you are trying to solve or are you just maybe overthinking all this? The bottleneck might be elsewhere.

 

0 Kudos
Message 3 of 5
(82 Views)

If I remember correctly, the doc says that the priority property of a vi doesn't do anything on Linux


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 5
(76 Views)

@TiTou wrote:

If I remember correctly, the doc says that the priority property of a vi doesn't do anything on Linux


Never heard that and it would be pretty unexpected considering the importance of controlling jitter on Linux. I'm looking at docs about prioritizing parallel tasks and absolutely no mention of that anywhere:
https://www.ni.com/docs/en-US/bundle/labview/page/prioritizing-parallel-tasks.html

 

The execution engine is just about identical and it is LabVIEW controlling the execution of LV code, not the OS, with the exception of using OS level priorities for threads that are spun up to run timed structure code.

~ The wizard formerly known as DerrickB ~
Gradatim Ferociter
0 Kudos
Message 5 of 5
(62 Views)