Next: , Previous: , Up: Miscellaneous Topics   [Contents][Index]


6.4 Exchanging Data Packets in a Multithreaded Program [EXPERIMENTAL]

The QSMM framework provides a simple mechanism for exchanging data packets in multithreaded programs. This mechanism can be helpful in organizing interaction of a system you develop with the environment you model, each executing in a separate thread. When the whole program executes in a single thread, it is sometimes hard to set up communication between different parts of the program. Other possible application of the mechanism is the support of parallel invocation of adaptive probabilistic mappings for aggregating results based on their outcomes to get more optimal and precise system behavior.

The mechanism for exchanging data packets will be available if the QSMM package is configured by the configure script to use the POSIX threads API. See the file INSTALL in the root of the package distribution for information about the configure script. The mechanism is represented by part of QSMM API called Side API. This API name was chosen because the mechanism makes it possible for multiple sides to take part in the interaction. Datatypes, functions, and macros of Side API are declared in the header file qsmm/side.h. This file is installed in a directory for C header files set by the configure script.

As of QSMM version 1.17, the Side API is marked as the experimental one. In future versions of the package this API can be removed in favor of such a standard API as POSIX message queues or MPI (Message Passing Interface). On Linux, the API for POSIX message queues is declared in the system header file mqueue.h and its implementation is provided by glibc (GNU C Library). Migration to POSIX message queues seems preferable to migration to MPI because in the latter case the explicit specification of dependency on at least one additional library is required. If and when the Side API is removed or made deprecated, the example programs included in the package distribution will be rewritten to use a replacing API.


Next: , Previous: , Up: Miscellaneous Topics   [Contents][Index]