What is the value of Loop Count Out following execution of the VI?
NOTE: More than one answer may apply.
Unlike the Occurrence, the Ignore Previous defaults to FALSE for a Notifier. Therefore we will see the final notification. So that eliminates D.
Six notifications are sent, so the maximum the lower loop's i could be is 5.
That just leaves A
Since While is a Independent loop without any Delay the loop has no control of iterations till 11 is reached so you may get different Loop counts from 1,2,3,4,5 so which is a Undefined Value.
Ans is A.....!!! y bcoz for loop iterates 5 times ,it sends notifiations to while loop ie 5times....nd after d for loop one send notifiation is der...so onemore time while loop iterates..so totally while loop iterates 6 times....ie iteration terminal indicates from zero onwards ....so d loop count iz 5.....
answer may be A,
when if the for loop and while loop run at the same time. for that we have to assign same time delays for the two loops. if we do not assign same time delays to the loops we could not get same number of Iterations every time vi runs because of race condition.
today i want to thank SercoSteveB,crossrulz and my friend Samson because every time i am learning so many things from you people,from your blogs and explanations. thank you for that.
My answer is 'Undetermined'.
The lower loop will see the final notification for sure, so the programm will finish. But because of the racing condition between the loops the Loop Count Out could be any integer value from 0 to 5.
I thought, answer was d (because while cycle can iterate independently), but everyone is sure about a, that i wanted to check, made a VI and it returns numbers between 1 and 4.
my vi screen here
Yes, it's undefined (d). There is no deterministic outcome.
Same code, may different results, Never any of the numbers in a-c.
I ran the code in a FOR loop and got values from 0 through 5. So it does not depend on other settings.
After reading the question again, D did not specify that the VI will not stop like in other recent questions. So I would go with A and D.
A, since the timeout is -1 doesn't the wait for notification wait until the send notification action is completed?
The Wait does wait. But notifications are not queued, so if if multiple sends happen before the Wait or between the Wait iterations the older notifications are lost.
It will wait until a notification is sent. But as soon as a notification is sent, it is processed. And since the Notifier will only see the latest sent. Since the 11 is the last value ever sent, we can guarantee that that value will be read and the bottom loop will stop.
Tim: "I ran the code in a FOR loop and got values from 0 through 5. So it does not depend on other settings."
You cannot guarantee to get a value of 5 but since it is one of the possible outcomes, "A" is one of the correct solutions in the way the question is asked but I stick with "D". I don't like "A&D", because it cannot be undefined or a defined value at the same time. (Before opening the box, is Schrödinger's cat: (1) dead, (2) alive, (3) undetermined. You might answer "1,2,3", but "3" seems more reasonable )
All this probably strongly depends on the CPU architecture (# of cores, etc. I7-5600U in my case and I have not tried on other processors) and the way the code is compiled. It might even depend on the LabVIEW version. As I said, I can only ever get 1 or 2 with debugging enabled and with debugging disabled I always get 0. This means that the FOR loop in my case completes nearly instantly, before the while loop can even get a single iteration in and the while loop stops on the first iteration once it starts. I can only get a reliable result of "5" by placing a 0ms wait inside the FOR loop. This is as expected, because even if the wait is zero, the compiler will now yield control to other scheduled tasks after each iteration. Without the wait, the compiler will try to get multiple iterations in to minimize thread switching. It might well be different if the FOR loop contains more massive calculations.
Can anyone explain the difference between all synchronisation functions like queue, semaphore, notifier, Rendezvous, occurrences? Because I learned a lot them separately but couldn't understand them where the functions are varied exactly in real time application & operations? Thank you
Queue - FIFO (First In First Out), so this is a lossless buffer to send data from 1 or many loops to a single loop where every value is used.
Notifier - Single element buffer that is useful for sending data from 1 or many to many loops where only the latest value is used.
Rendezvous - Loops wait until everybody makes it to their rendezvous and then move on. As I have said before, if you really need this, you should consider just using a single loop.
Occurrence - Similar to a Notifier, but has no data associated with it.
Semaphore - Locking mechanism to keep multiple parts of code from causing race conditions with data and/or hardware. I find Action Engines much more efficient since it lets the non-reentrant property of the VI act as the semaphore.
A&DOr (to follow Altenbach's explanation) just D
the answer is A or D? i think A but after reading this discussion i'm confused ... if the while loop run indipendently from the rest of the program it can be undefined answer D but there is a dipendency of data flow ... so if i find in my clad exam this question i have to respond A or D???
Correct answer is D. A would be correct if you put some delay inside for loop to make sure that while loop has enough time to process all notification. Although you can randomly receive 5 (D) as a result it is not what you should mark on your CLAD exam.
what is the name of the block before release notifier?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.