O'Reilly logo

Checking Java Programs by Ian F. Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamic Checking with NASA's Java PathFinder

It's not the Mars PathFinder (http://mpfwww.jpl.nasa.gov/default.html), but the Java PathFinder (http://javapathfinder.sourceforge.net) has been to space. Quoting the web site, Java PathFinder was developed "at the NASA Ames Research Center. Started in 1999 as a feasibility study for software model checking, JPF has found its way into academia and industry, and has even helped detect defects in real spacecraft."

NASA's Java PathFinder (JPF for short) is an instrumented JVM that provides a state model checker. It runs your program by trying all potential execution paths through it, checking properties as it goes to detect problems like deadlocks or unhandled exceptions. JPF is good at finding those rarely occurring, unpredictable and impossible-to-see concurrency defects in multithreaded programs. In trying to execute all potential paths through your program, JPF uses two important optimizations:

  • Backtracking lets JPF back up from, for example, the end of a method and try different paths, instead of starting the program over from the beginning.

  • State Matching lets JPF compare previous values of your program's state (which is stored as a heap and thread-stack snapshot) to see if it's already "been there, done that."

Even so, there is the possibility for the number of states that have to be tried, particularly in the presence of threading, to become computationally infeasible. So they use some additional techniques:

  • Configurable (user-provided) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required