LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wait on notification, occurence. is it sleep?

Hai

Am using PXI with RTOS, it has 2 processes . i need to wake up a task on an event, execute it and then sleep again. I wanted to know if i can use Occurence or Notifers to achive this. Since these uses wait on notification and wait on occurence functions i wanted to know if the thread is in sleep mode when in this function, since this is a high priority task if it is waiting on notifier am afraid it will dominate CPU and does not give time for normal priority tasks to execute.

Thnx for any reply
0 Kudos
Message 1 of 4
(3,084 Views)
The thread running your high priority VI in which you wait for notifier (or occurrence) will be "blocked" until you send notification (or set occurrence). While the thread is blocked, other threads will run, including lower priority threads. One way to verify this is with the execution trace tool.

If you don't have the trace tool, there's another way to test this. In a normal priority VI, obtain a notifier and call a while loop*. In parallel, call a time-critical subVI that waits for notification (see attachment). After the loop finishes, send notification. This VI will finish, which means the time-critical subVI had to relinquish the CPU in order for the normal priority parent to send notification. Otherwise, we'd be waiting forever for a notifi
cation in the time-critical subVI.

*Put sleep in the while loop to ensure that LabVIEW reaches the time-critical subVI before the while loop runs to completion.
Message 2 of 4
(3,083 Views)
Thanx Bob

I have followed the arcitecture you have suggested, but i have one more problem regarding this. It would be great if you could help. In my normal priority thread am writing and reading from the COM port, and when there is a notification in the high priority thread, i belive the normal priority thread stops and high priority starts. My problem is i need to write and read from the same COM port which is accesed by normal priority thread in high priority thread as well. This is creating a problem. that is there is no smooth tranistion from normal priority to high priority and back. Is there a way in which i can synchronise b/w the 2 tasks?

Thanx for your Reply

Arun
0 Kudos
Message 3 of 4
(3,083 Views)
I hope my first response was clear. I was not promoting an architecture, rather I was explaining a couple ways to verify that your high priority thread will stop executing when it calls Wait on Notification. Just want to make sure we're on the same page.

About your next question, the COM port is a shared resource - shared by your high and normal priority threads. In LabVIEW RT, shared resources can cause major problems, especially for time-critical threads. If the COM port can be in any arbitrary state during a thread switch (when high priority preempts normal priority), then all bets are off. You should control the COM port from one thread, otherwise, the port and/or software won't behave predictably. An alternative would be to use two
COM ports - one for each thread.
0 Kudos
Message 4 of 4
(3,083 Views)