What are multithreaded applications, and can I run them using the IEEE-488 bus?
A thread is a path of execution through a program. Normally, each thread operates independently, and is unaware of other threads in a process, unless the programmer uses semaphores or other methods of interprocess communication. The OS scheduler controls the thread execution based on thread priority and CPU load.
Multithreaded test and measurement applications are complex to write because it is a challenge to ensure system stability and to avoid hardware conflicts that can result from multiple threads running in parallel. Before attempting to write multithreaded applications, you need to make sure all device drivers and libraries used in the system are threadsafe. A software call is considered threadsafe if it can be used safely in a multithreaded application. If the call is not threadsafe, then multiple threads using that call can collide and corrupt data. An example of this would be a multithreaded application that communicates with a DMM and a power supply at the same time. Let's say thread 1 is writing data to the DMM and thread 2 is writing data to the power supply simultaneously, using one IEEE-488 controller board in the system. If the GPIB 'write' call is not threadsafe, the application would fail and the data would become corrupted.
In addition to threadsafety, the programmer has a greater responsibility to coordinate the execution of all threads in the application. Considering the GPIB protocol and the Talk/listen modes, software interlock via semaphore flag is most often necessary to ensure that the right data is associated with the proper thread. Otherwise, a thread could communicate with the wrong GPIB device on the bus.
常见问题 ID 70566查看所有常见问题 »