01-25-2012 01:43 PM
Hello,
I am runing an CVI user interfaces with 8 thread running test at the same time. Once in a while I get a FATAL RUN-TIME ERROR, see attached. I am runnig CVI2010 on windows 7 and 4GB of memory.
Could some one help?
Regards,
Javier
Solved! Go to Solution.
01-26-2012 12:51 AM
Hello, this document from Wendy L. may help you in debugging this situation.
01-26-2012 11:46 AM
I actually aded static in front of my global variables and that made the system stable when I run the executable in the debug configuration mode. When I switch to release configuration mode the application becomes non responsive about every 10 seconds and keeps doing that. Why is that?
Regards,
Francisco
01-26-2012 11:59 PM - edited 01-27-2012 12:03 AM
Well, wih the informations I have at the moment I could only gaze into my crystal ball to give you an answer
You should try to narrow down the problem to a more reduced and definite environment. Does it happen regularly and consistently? Does it happen even with less threads runnong concurrently? And with a single thread? How are threads defined? Does the freeze affects the user interface only or test threads too? Have you other tasks running at the same time in your system (e.g. virus scanning engines or other background activities)?
01-27-2012 07:18 AM
Thanks Roberto, I will check all those question and see what I come up with. I can tell you that I ran the program in a Windows 7 enviroment for 4 hours with no problems. The program crashes in a Windows XP SP3, I wonder if I have all up dates. I will keep you informed.
REgards,
Francisco
01-31-2012 09:44 AM
Roberto,
I think this comes down to CPU power. I am using a Pentium 4 3Ghz and I think is burly keeping up. I have set the application priority to Real Time from the task manager and the program runs well. This worries me because I shouldn't need to do that. Since the application runs 8 test at the same time on 8 diferent threads, Should I get a faster CPU to run this application? Please share your thoughts...
Regards,
Javier
02-01-2012 02:38 AM
When it comes to multithreaded applications, a number of elements play significan roles in how threads run. Using multicore CPUs is quite a prerequisite for such type of applications when you leave the basic level and move to using several threads and/or performing CPU-intensive tasks.
Going to the software side, first of all you must carefully exclude from your threaded routines all time consuming parts that can be postponed or moved to the main thread.
Second, you could try raising the execution time of threaded functions calling SetSleepPolicy (VAL_SLEEP_NONE); entering them; this usually has better results if you create a thread pool and specify CmtSetThreadPoolAttribute (ThreadPool, ATTR_TP_PROCESS_EVENTS_WHILE_WAITING, TRUE); for the thread pool.
Additionally, individual thread priority can be set if you use CmtScheduleThreadPoolFunctionAdv: see this help topic and related arguments in the online help. I would suggest trying the sleep policy first and playing woth the thread priority only in case you keep having errors.
A prerequisite of all this is that you are sure you don't have code problems in your application and the GPF is due only to CPU load. You should particularly debug all your resource-accessing calls in order to be sure that no concurrent access to shared resources, variables or memory blocks can be possible; using thread-safe variables and/or locks to prevent concurrent access by different threads to critical objects can help in this matter.