NPTL POSIX Thread Trace Toolkit (PTT)
-- DRAFT --
The goal of this project is to build a
tool able to generate a trace describing the
behavior of the POSIX threads during the execution of a
program using the NPTL functions.
This tool will help to understand multithreaded
programs, in order to visualize and check threads actions, or to detect
deadlock situation in multithreaded programs. It creates a text file
used for building a graphical visualization by means of the graphic
tool PAJE.
At the moment, to exercise our tool, we have chosen
NPTL objects: thread, mutex,
barrier, and cond-variable and
functions which use them.
So, when the tool will be ready, we will extend PTT to other
objects and functions.
Contents
For each objects we have chosen
some interesting properties to trace, and each one of
these properties has attributes which states change
according to their use.
These changes are thus gathered in events which will constitute our
trace points in the nptl functions.
It is important to detail these events for each
object because they have consequences on the other objects.
In particular about threads: each time a running thread has the lock of
an object or a mutex, the competiting threads which requiers this lock
or this mutex pass in a blocked state ,thus suspending the
execution their of "start-routine".
When the state of an object changes, we mark an event.
A trace point is a group of events which follow themselves,
without be interrupted in a NPTL function.
To create the trace text file we have to collect the trace points
and write them in the text file.
We are obliged to use a buffer firstly because of POSIX contraints,
secondly to work faster, and tirdly to avoid some interruptions caused
by the system.
This graphic tool allowed us to visualize the trace. It gives the
graphic version of the text file.
An example of a simple program using NPTL function. We can obtain
the trace in a text file and with a graphic with Pajé.