. .
Chapter 14. Tools
Static Lock Analyzer
Using a Thread-Aware, Graphical Debugger
In which we consider the kinds of new tools that a reader would want when writing a threaded
program. An overview of the Solaris tool set is given, as representative of what should be looked
Programming with threads adds new challenges to the development tools that you use. "Normal"
toolsets, in most cases, will not work well with threaded programs, because they were designed
with single-threaded programs in mind. All the vendors have some set of products to be used with
multithreaded programs--debuggers, code analyzers, and performance analysis programs.
This chapter focuses on some of the current tools that Sun Microsystems provides for the
development of multithreaded programs. Tool offerings from Symantec, IBM, etc., are fairly
Static Lock Analyzer
For C programs there is a tool called LockLint, which is a lint-type program for locks. It verifies
consistent use of mutexes and RWlocks in multithreaded ANSI C programs. LockLint performs a
static analysis of the program and looks for inconsistent or incorrect use of these locking
techniques. It can tell you definitively if your program is subject to deadlock as long as the calling
structure of your program is predictable. Unfortunately, there is no similar tool for Java.
Using a Thread-Aware, Graphical Debugger
All of the different vendors have some version of a graphical debugger, all of which have the same
basic functionality. We'll look at a few screen shots from Sun's Java Workshop Debugger. To say
the least, the value of a graphical debugger for multithreaded programs is enormous.
Figure 14-1 uses the debugger to take a look at the code in An Example: Create and Join. We
started by loading the program into the debugger and then setting a breakpoint in main(). Then
we started the program and let it hit the breakpoint.
Figure 14-1. Sun's Debugger [Program Stopped in sleep()]
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks