LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

thread caused general protection

Solved!
Go to solution

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

0 Kudos
Message 1 of 7
(3,692 Views)

Hello, this document from Wendy L. may help you in debugging this situation.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 7
(3,677 Views)

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

0 Kudos
Message 3 of 7
(3,651 Views)

Well, wih the informations I have at the moment I could only gaze into my crystal ball to give you an answer Smiley Wink

 

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)?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(3,643 Views)

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

0 Kudos
Message 5 of 7
(3,633 Views)

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

0 Kudos
Message 6 of 7
(3,615 Views)
Solution
Accepted by JHernan

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(3,606 Views)