03-19-2007 08:58 AM
@kovalenkov wrote:
Hi David,
I would not normally ask this as I know this is well protected information.
However, If you look at OS thread dispatcher and how it works it is quite apparent that thread priority could be an issue. For example: There are threads A, B and C. If of same priority, OS thread dispatcher would normally run each thread 33% of it's processing time. Now, let's say that thread B has higher priority than A and C. In this case, thread dispatcher would spend more time on thread B (depending on priority level) and less on A and C. As far as I know, if thread priority is set to highest (god forbids) and this is a sole thread with this priority level, it would mean that the thread is run 90% of dispatcher processing time. Real life application with highest thread priority is Windows Task Manager.
Now imagine that thread B, despite it's higher level of processing, contains a critical section, semaphore or mutex. It could quite likely happen that thread A and C would suffer from starvation. The funny thing about it is that even if thread priority would be low, and critical section, semaphore or mutex are wrongly implemented, starvation of other threads could occur. However, I believe that the later is not the case. Thus, thread priority is higher than normal.
Thread starvation would also explain, why the application works with Traditional DAQ, and why it fails to read INIT file in other threads with DAQmx. It also explain why a simple command Sleep (10) would solve this issue. In our example it would mean that thread B would be thrown out of processing queue of thread dispatcher and put into waiting queue. Meanwhile A and C could process normally. My application uses timeouts for every action any thread has to do. Thus, starvation would cause timeouts to occur.
All I am asking you is to check if this could be an issue. I do not expect an exact answer to my question, but I do need some answer, as this issue in the application should be addressed ASAP and I am far behind schedule as is. The only thing that saves me is that application runs superbly with Traditional DAQ. However, upgrade to DAQmx is inevitable.
Best regards,
VladimirMessage Edited by kovalenkov on 03-17-2007 02:01 PM
03-20-2007 10:58 AM - edited 03-20-2007 10:58 AM
Message Edited by kovalenkov on 03-20-2007 06:00 PM
03-20-2007 12:25 PM
03-20-2007 02:04 PM
Vladimir,
The CFile exception and the current working directory issue allowed us to
completely narrow down the debugging avenues, and it appears that one of the
infrastructure components is causing the anomaly. Of course this is not really
news to you, because that's what you have been saying all this time, but we
actually got down to the module, the source file, and the offending function.
We will file a bug report to the responsible infrastructure group, and at this
moment I really cannot tell you when a fix might be available. One good news might
be that the fix does not necessarily have to wait for the new version of
NI-DAQmx because this particular infrastructure component is distributed by
other National Instruments applications and drivers.
For now, the sleep seems to be one way to work around the issue, but as you
might guess this might work for some systems and not others. You could also add
code that will ensure that all of your threads successfully read the
configuration data in the INI files, and then call any DAQmx functions. I regret that this bug caused this much pain, but at least now we know the scope of the issue.
By the way, now that you have at least one bug resolved, will pivovarna.exe be any closer to hitting production, and might this result in some brew exports over to this side of the pond?
03-21-2007 01:21 AM - edited 03-21-2007 01:21 AM
Message Edited by kovalenkov on 03-21-2007 08:22 AM
03-21-2007 02:10 AM
@sead_suskic wrote:
Hello Vladimir,
Given this latest information about the default working directory, can you please confirm that your application does not raise the CFileException::badPath if you put a delay before your first DAQmx call? By the way, this is really weird!!!!
What does your current workding directory print-out report from all threads when you add the delay?
07-05-2007 11:05 AM
07-06-2007 05:03 PM