The configuration of your Citect project
can cause Citect to consume all of the CPU resources on your
computer. This is typically caused by having background cicode
tasks running it tight loops which don't wait for any events. These
cicode loops are totally CPU bound and Citect will do its best
effort to run these tasks as fast as possible. This will cause
Citect to consume all of the CPU resources. In most cases you can
modify your cicode to wait for an event to greatly reduce the CPU
loading. This requires the putting of a Sleep() in your cicode
loop. To help improve the responsive of your cicode, Citect now has
a SleepMS() which can sleep for a time of milliseconds. This allows
your tight loops to only sleep for a very short period of time. If
you call SleepMS(1) you should find that the CPU loading is greatly
reduced while the loop will be limited to run at 1000 times per
second. If you use Sleep(0), as was popular with previous versions
of Citect, you will still consume 100% CPU resources. Where
possible, you should change Sleep(0) to SleepMS(1).
Even though Citect has consumed 100% of the CPU resources you
will find that other Windows NT tasks will execute quite well. This
is because Citect will consume left over CPU which was not being
used by other tasks. Citect works with the Windows NT schedular to
give CPU resources to other Tasks.
See also Q1457.
|