12-16-2005 12:07 PM
12-16-2005 12:54 PM
Could be a memory resource issue, in that the computer is swapping to virtual memory.
Labview its self won't access your hard disk just to handle a loop, my LabVIEW 6.1 stuff is neat and lowish overhead compared to the fatware around today.
What is the memory available, use the task manager to dig a bit deeper. If the hard disk is fragmented then it could be thrashing as well when the virtual memory is being swapped.
There's not really enough information (OS, Memory .....) for a profesional analysis but I think it's safe to say the problem probably isn't with LabVIEW
12-16-2005 01:04 PM
12-16-2005 01:30 PM
12-17-2005 11:42 AM
Like Altenbach said, when you have no wait, the loop tries to run as fast as possible, regardless of what you have in it and regardless of what other programs want. This is probably specific to the LV compiler. I'm not sure how parallel programming works in other languages. Can you write a loop which will be truly stand-alone (from the compiler's point of view)? If you can, how do you control its timing? Using wait statements?
If you put a 0 ms wait, LV should try to run the loop as fast as it can as long as no other tasks are requesting the CPU, which is probably why you're seeing a high CPU usage there.
12-17-2005 12:54 PM
Thanks all.
I went home and wrote my simple C program with a while statement:
int _tmain(int argc, _TCHAR* argv[])
{
while( true)
{}
return 0;
}
When I ran it my cpu usage went up to 50%, just like with LV. Opened my eyes. I thought the OS would somehow regulate this. Now I know better.
I also now know why I see the Wait for nearest ms vi in so many examples. I'll just start to include it myself.
Chuck Gantz
12-17-2005 01:09 PM
@cgantz2000 wrote:
I have a simple while loop. It doesn't call vi's or do anything except loop. In fact, it is completely empty except for a boolean control attached to the conditional terminal.As soon as I run the vi, my cpu usage goes up to 50%. Is this normal. I know I could put a delay in the loop and reduce the usage. When I do this if I put a 1ms delay in my usage stays close to zero. When I put in a 0ms delay, my usage is again about 50%.
Cases (1) and (2) both should consume 100% CPU. There is always something to do, no time for idling. Right?
12-17-2005 01:59 PM
On my main machine at work running LV with just a while loop and no delays, and my pc at home running the C while loop, 50% of the resources were used. On the machine at work running the "real" LV program, the one that actually does something, 100% of the resources were used. No dual processors.
I don't know the last machine used twice as many resource as the other two, but it is an older machine and may have other issues. I don't really know what was causing the noise on my desktop pc when the while is running. I assumed it was disk access simply because there is not much else in the pc that causes noise, but it could be something else.
Chuck Gantz