From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions for Deploying RT applications

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:

 

  • 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. 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? Is there special libraries I need to use for setting priorities for tasks that I'd use for NI Linux RT verses VxWorks?
  • 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?
  • "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?

Thanks, everyone.

0 Kudos
Message 1 of 4
(3,482 Views)

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 

 

0 Kudos
Message 2 of 4
(3,458 Views)
Hi Michael,

Thanks for your timely reply. We're trying to leverage code from C, so we were looking to set the priority of the loop completely in C. This is because we didn't know what platform we were going to use until after the SW was written, so we wrote in C to make it as portable as possible. I'm guessing there's no way to make a "RT" application for this outside of LabView (since this board doesn't come with VxWorks)? In that case, I guess the best approach is to convert our C code to a LabView plug-in and then plug them into theVI module, right? We have practice with something similar on the Windows GUI side, where we took C code and converted it to a DLL and plugged that DLL to the VI module. But since this is Linux, it wouldn't be a DLL, it would be...something else, I guess.

Ok, last thing is making max utilization of our two ARM cores. How would we, say, tell it to run processes 1-3 on core A, and processes 4-5 on core B? Thanks.
0 Kudos
Message 3 of 4
(3,452 Views)
  • 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.

Linux Embedded / Kernel Hacker / BSP / Driver development / Systems engineering
0 Kudos
Message 4 of 4
(2,569 Views)