LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is a tight loop?

What is a tight loop?

0 Kudos
Message 1 of 6
(3,821 Views)

 - A term used to describe a code construct that results in repeated execution of the same code with the same results and not releasing the processor for use by other processes. Tight loops exibit themselves as a CPU bound application. Tight loops can be avoided in LV by using a "zero ms wait" (literally a "0" wired to a ms wait timer) in the loop thereby allowing other tasks to be processed. Search this site for the term "cooperative multitasking".

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(3,819 Views)

Also known as a Greedy Loop

 

Of course, sometimes you actually want something like this, but that's more the exception rather than the rule.

Message 3 of 6
(3,773 Views)

Can you please explain, what happens when you place a "zero ms wait" in a tight loop.

Isn't wiring a zero equilant to not placing the wait function?

 

Thanks

Dsk001

0 Kudos
Message 4 of 6
(3,716 Views)

No, it's not the same. Wiring a zero allows the operating system to give time to other processes running and return to your program as soon as possible. Wiring a 1 means your program is telling the operating system "go ahead and do other stuff, but when you come back, make sure it's been at least 1 msec before you get back to me. "

Message 5 of 6
(3,711 Views)

That is helpful.

 

Thanks

Dsk001

0 Kudos
Message 6 of 6
(3,680 Views)