JThreadSpy: teaching multithreading programming by analyzing execution traces

  • Authors:
  • Giovanni Malnati;Caterina Maria Cuva;Claudia Barberis

  • Affiliations:
  • Politecnico di Torino, Corso Duca degli Abruzzi, Torino, Italy;Politecnico di Torino, Corso Duca degli Abruzzi, Torino, Italy;Politecnico di Torino, Corso Duca degli Abruzzi, Torino, Italy

  • Venue:
  • Proceedings of the 2007 ACM workshop on Parallel and distributed systems: testing and debugging
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Multithreading introduces a degree of complexity that is often difficult to grasp by beginners both because of many false assumptions made about the scheduling process and because it is not possible to adopt a trial and error strategy aimed at figuring out what exactly happens during the execution, as a consequence of the intrinsic non determinism of threaded execution. This article describes JThreadSpy, a tool for dynamic instrumentation of Java programs, aimed at registering execution traces of each thread and displaying them with a selectable level of detail. JThreadSpy relies on the ASM framework to dynamically instrument methods during class loading, in order to insert suitable method calls that produce an execution trace that is later used to display an annotated UML sequence diagram, highlighting different threads and synchronization constructs. JThreadSpy proved to be a valuable tool for students engaged in an object-oriented programming course at Politecnico di Torino. By graphically analysing execution flows, students could understand, in an easier way, the non-determinism introduced by the scheduler, the effects of synchronization constructs, the impact of multicore processor architectures, as well as identify critical sections, deadlocks and other anomalies of concurrent programs.