05-22-2016 12:16 AM
Please excuse me if this question sounds too basic, but I couldn't quite find the answer to my questions from either google or a forum search. I have several questions on how to implement a RT application on my device, which is an sbRIO-9651 SOM dev kit we're using for prototyping. The basic question revolves around how to build and deploy a RT application using NI Linux Real-Time. First of all, I have already figured out how to make a C application, and have that application running in Linux interact with the FPGA, using the DMA FIFOs. Good to go there. Where I'm having difficulty is in the following areas:
Thanks, everyone.
05-23-2016 05:49 PM
Hi,
Are you trying to program this in the LabVIEW RT module now?
If so, in a RT application you can used timed while loops. In those loops you can set the priority of the loop (in reference to other timed loops in that VI), and also what processor they run on. Here is the help page for the Timed loop that explains it in more detail.
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/timed_loop/
To answer your third question, the below article gives a good description of what a RT application is. What makes a piece of code Real Time is that it runs on an RT OS, and that it accomplishes tasks deterministically. LabVIEW does this with the timed while.
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/timed_loop/
Cheers,
Michael
05-23-2016 06:07 PM
04-02-2017 09:09 PM
- I plan to have several applications running in parallel. Some will have higher priorities than the other. My question is how to assign prorities for these.
cgroups
- How do I set the priorities with the task scheduler for these tasks? Do I use the exact same code for this as I would in VxWorks?
no. you'll use cgroups
split your program into smaller ones and use the usual linux cgroups tools to start these processes with the proper settings.
- Is there special libraries I need to use for setting priorities for tasks that I'd use for NI Linux RT verses VxWorks?
libcgroup. but that's expert-only ...
- Virtualization: This is a dual core processor. To make efficient use of my code, how do I assign certain tasks to run on processor A and others on processor B?
See linux scheduling -> cpu affinity
But in 99.99% the scheduler will do better choices. If that's all new to you, better just let the scheduler do its job
- "RT Application" as in what does this mean? What makes a piece of C code a "real time application"? Is it the fact that it has some set priority in the task scheduler? Is there something defined in the code to let the processor know this? Does it make a difference?
A lot ... it's a matter of the sw architecture as a whole ... for beginner:
* make sure the're no deadlocks, try get around w/o locking at all
* use the kernel infrastructure (timer etc) and dont try to be more clever than it
* dont use big loops etc - split into smaller programs that can run in parallel
(and possibly are forked on demand)
...
We'd need a more specific usecase - there is no general answer.