Information Technology Reference
In-Depth Information
provided by system libraries. Each thread in the
system executes in either user space or kernel
space, depending upon the work it is doing at
that given time.
Whenever a thread makes a system call, it
transitions (e.g., via a trap) from user space to
kernel space (Soloman, 1998; Beck et al., 1999).
Invoking system calls for thread management
(e.g., thread creation, suspension, or termination)
and synchronization (e.g., mutex or semaphore
acquisition) often require such a transition. System
call transitioning code therefore provides a useful
interception point at which process activity can
be monitored and a profile of system resource use
can be extracted on a per-thread basis.
Figure 7 shows the use of the interpositioning
technique, where libraries are built to mimic the
system API. These libraries contain code that
record a call event and then forward the call to
the underlying system library.
The threadmon (Cantrill & Doeppner, 1997)
tool uses interpositioning to insert trace code
between the user-level threads library and the
application by redefining many of the functions
that the library uses internally to change thread
state. This technique is also used by Broberg's Vi-
sualization of Parallel Program Behavior (VPPB)
tool (Broberg, Lundberg, & Grahn, 1999) to gather
user-level thread information. In both approaches,
data obtained by user library interpositioning is
integrated with data collected from other operat-
ing system services, such as the UNIX /proc
file system or kstat utility. The threadmon
and VPPB tools both target the Solaris operating
system and therefore rely upon Solaris-specific
system utilities, such as memory mapping of /
dev/kmem to access the kernel.
Cantrill and Doeppner (1997) and Broberg et
al. (1999) have also used another tool known as
Trace Normal Form (TNF) (Murayama, 2001).
This tool generates execution event traces from
the Solaris kernel and user processes. Solaris
provides an API for inserting TNF probes into the
source code of any C/C++ program. A TNF probe
is a parameterized macro that records argument
values. The code excerpt below shows how C
macroprobes can be inserted at the beginning and
end of critical code to record the absolute (wall-
clock) time required for the code to execute.
#include <tnf/probe.h>
.
.
extern mutex_t list_mutex;
.
.
TNF_PROBE_1(critical_start, “critical section start”,
“mutex acquire”, tnf_opaque, list_lock, &list_mutex)
mutex_lock(&list_mutex);
.
Figure 7. Systems calls intercepted by system trap profiling library
Search WWH ::




Custom Search