LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep Your Priorities Straight

LabVIEW uses two separate but related priority schemes: VI priorities and timed structure priorities. Although it is possible to create a deterministic application using a combination of these two priority schemes, in most cases using a single priority scheme makes the application easier to understand and less error prone.

Timed structure priorities are numeric, and a higher value represents a higher priority relative to other timed structures executing on the target. However, all timed structure priorities fall between the high and time-critical VI priority levels.

Caution  To prevent undesired timing behavior, National Instruments recommends using only one priority scheme in your application. If the application uses timed structures, keep all VIs at normal priority.

The following illustration summarizes the system of priorities and execution systems available from LabVIEW.

Time-Critical Priorities

Time-critical priorities are qualitatively different from all other priorities because time-critical priorities run above the priority of the scheduler itself. Therefore, tasks set to time-critical priority always run to completion.

There are two types of time-critical tasks:

  • VIs set to Time-Critical priority
  • Timed Structures
Caution  Once a time-critical task starts running, it cannot be interrupted, even by another time-critical task of higher priority. To avoid undesired timing behavior, National Instruments recommends creating no more than one time-critical task per CPU.

Scheduling

Scheduling is a key task for any modern operating system, but especially for a real-time operating system (RTOS). Scheduling is the process of determining which task to run at a given time. Typical RT applications include dozens of tasks, known as threads. Even the simplest RT VI running an empty loop includes dozens of driver threads running at various priorities, in addition to the VI thread itself.

At any given time, the scheduler classifies each thread into one of the following categories:

  • Running–The thread is currently executing.
  • Ready–The thread is queued up and ready to execute.
  • Blocked–The thread cannot execute until some event occurs, such as the completion of an I/O operation.

LabVIEW RT uses several different schedulers: the single-CPU scheduler, the Timed Loop scheduler, and the SMP scheduler.

0 Kudos
Message 1 of 1
(2,639 Views)