The concept of an application having multiple threads has been around for some time. Various microprocessor-based operating systems have supported threads or some form of add-on thread package for years. pthreads library is a typical example on Unix and Linux systems. Multithreaded applications perform best when executing on hardware with multiple CPUs where true multitasking is available.
Each thread of an application can be considered as a separate flow of execution, each thread operating in parallel with the other threads. Different threads may be executing the same code sequence or different code sequences. In the latter case, one thread may handle keyboard input, another thread may handle a communications port, and yet another thread may perform complex calculations.
The power of threads not only resides in the ability to have multiple flows of execution within an application, but also in the clever way these multiple threads may interact and interrelate. Here, we will discuss some fundamentals related to multi-threaded application development, and introduce the ctThrd API, FairCom’s powerful, portable thread control/management subsystem.