09-24-2011 08:27 AM
What is a tight loop?
09-24-2011 08:35 AM
- 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
09-26-2011 10:07 AM - edited 09-26-2011 10:08 AM
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.
10-20-2011 08:19 AM
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
10-20-2011 08:22 AM
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. "
10-21-2011 01:52 AM
That is helpful.
Thanks
Dsk001