C++/MULTITHREADINDING PRIORITY IN VC++
Hi Bill, I am working VC++ 6.0 platform. For my application I needed multithreaded concept implementation. I included three threads for example
I want to give priority to different threads. If I give THREAD_PRIORITY_NORMAL or THREAD_PRIORITY_ABOVE_NORMAL to all the threads my application is working correctly. But if I give higher priority to Thread1_Acquisition the application is not working exactly what I expect. What is the reason behind this? I need to give highest priority to Thread1_Acquisition, Second priority to Thread3_Ejection and lowest priority to Thread2_Processing in my application.
Even if higher priority(THREAD_PRIORITY_ABOVE_NORMAL) is given to Thread2_Processing , the application is working correctly. And also if higher priority(THREAD_PRIORITY_ABOVE_NORMAL)is given to Thread2_Processing and
Thread3_Ejection , the application is working correctly. Can u send me the better solution for this problem . I am waiting for your reply.
If Thread1_Acquisition doesn't yield or give up processor time, then it will take much more time than the other 2 threads possibly causing odd behavior. Are there times that Thread1_Acquisition can lower its priority - like if it does an aquisition, there has to be time before it does another one. This would be a good time to lower the priority.
When I looked at thread priorities years ago, I recall reading that changing them can cause erratic behavior. I think the intent is to give processes different priorities by the setting the threads in them the same. This is the mechanism for having background programs that use very little processor time.
What is the problem of running all 3 threads the same?