200 likes | 478 Views
Java Pathfinder. Rafael Duarte rmd@cin.ufpe.br. Agenda. Motivation Model-Checking Java Pathfinder Why Java Pathfinder? Conclusion. Motivation. Assuring the correctness of concurrent Java programs is a difficult task Java primitives for concurrency are very error prone
E N D
Java Pathfinder Rafael Duarte rmd@cin.ufpe.br
Agenda • Motivation • Model-Checking • Java Pathfinder • Why Java Pathfinder? • Conclusion
Motivation • Assuring the correctness of concurrent Java programs is a difficult task • Java primitives for concurrency are very error prone • synchronized, wait(), notify() can easily introduce deadlocks • Model Checking can be a powerful tool to help addressing these issues
Model Checking Algorithms, rather than proof calculi, for system verification which operate on a system model (semantics), rather than a system description (syntax). (Tom Henzinger)
Model Checking From CSP, Promela, Java Graph traversing algorithm Answer Yes if model satisfies specification Counter-example if model does not satisfy specification Model CheckingTool System Model Specification (System Properties) Temporal logic formulas, refinement
Model Checking • Drawbacks • State explosion • scalability
Java Pathfinder Java PathFinder (JPF) is a system to verify executable Java bytecode programs. In its basic form, it is a Java Virtual Machine (JVM) that is used as an explicit statesoftware model checker, systematically exploring all potential execution paths of a program to find violations of properties like deadlocks or unhandled exceptions(JPF site)
Model Extraction • Reducing the state explosion • Symmetry reductions • Abstract interpretation • Static analysis • Runtime analysis
What can be checked with JPF • Out of the box • Deadlock and unhandled exceptions • Race conditions and heap bounds • Almost every java applications • Closed systems • No support for java.awt and java.net • Limited support for java.io and reflection • No support for libraries with native code • Application size ~10Kloc
Java Pathfinder Extensibility • Users can implement their own properties to be checked • Search/VMListener • Provide an Listener to specific JPF events
Running JPF • Download it from the svn repository (strongly recommended) • Run the JPF class passing the class to be checked as parameter • Lots of possible parameters • Lacks an usable interface (GUI)
Parallelizing Java • Automatic transformations to convert a sequential Java program into a concurrent one. • Issues concerning the transformation’s correctness • It should not introduce errors in the original program • Take advantage of multiprocessors
Parallelizing Java Sequential Concurrent com1; com2; com3; com4; com5; Splitting com1; com2; com5; com3; com4;
Why Java Pathfinder? • We believe in the possibility of extending it to check data sharing • Semantic verification would allow us to deal with reference aliasing • Independent commands would be put in parallel • Data flow analysis would tell us which commands are independent (work in different data partitions)
Dataflow Analysis Conta c = new Conta(“1234-5”); Conta d = c; int i = Math.random() * 10; d.setSaldo(100.0); c.creditar(50.0); int j = i + 50;
Final Remarks • Java Pathfinder is a powerful tool to verify java programs • But its use requires some expertise • Very useful when working with concurrency • Its extensibility mechanism greatly increases the way it can be exploited
References • Java Pathfinder site • http://javapathfinder.sourceforge.net/ • Model Checking Programs (JPF paper) • Four Lectures on Model Checking