Tech Report CS-93-53
The Thread-Monitor Library: A System Monitoring Solaris-Threads Programs
Thomas W. Doeppner Jr.
Debugging a multi-threaded program involves all the difficulties of debugging a single-threaded program with the additional concern of the interaction among threads. Multithreaded programs can be nondeterministic-the outcome of the program depends upon the ordering of the executions of the various threads. When testing a program, one would like to exert some control over this ordering, to force certain execution sequences to occur so that they can be tested.
The Thread-Monitor Library is an experimental system that allows one to monitor and control the execution of a multithreaded program (written using the Solaris Threads package). It creates separate windows for controlling each thread and separate windows for monitoring each synchronization object (currently, only mutexes and condition variables are supported). Whenever a thread enters a synchronization construct, its execution is immediately suspended and the programmer is prompted for permission to resume execution. The operations applied to each of the synchronization objects are listed in the synchronization object windows, allowing one to keep track of their state.
All of this is accomplished through a collection of "wrappers" for the Solaris Threads API. Rather than call the standard Solaris routine, one instead calls the appropriate wrapper which calls upon the monitor code as well as completing the call to the Solaris routine.