Enhancing JSWAT For Monitor-based Executions




Journal Title

Journal ISSN

Volume Title


Computer Science & Engineering


Concurrent programs contain more than one thread that executes concurrently to accomplish a particular task. Since the threads in a concurrent program work together to accomplish a common goal, they share the data, code, resources and address space of their process. This reduces the overhead involved in creating and managing the threads but leads to side effects like race conditions, critical section problem and deadlocks. There are several operating system constructs to solve these issues such as locks, semaphores, monitors etc. Locks are associated with each object to control access of shared resources. Semaphores can be described as counters used to control access to shared resources. A monitor by definition encapsulates shared data, all the operations on the data and any synchronization required for accessing the data. JSwat is a stand-alone graphical Java debugger front-end that uses the Java Platform Debugger Architecture. It has features including sophisticated breakpoints, colorized source code display with code navigator, byte code viewer, movable display panels showing threads, call stack, visible variables and loaded classes, command interface for more advanced features, and Java-like expression evaluation, including method invocation. These advanced features make JSWAT an ideal debugger for a Java concurrent programmer. The main disadvantage of concurrent programs is that they are extremely difficult to test and debug. This is because multiple executions of a concurrent program with the same input may produce different results. This nondeterministic execution behavior creates several problems during the testing and debugging cycle of a concurrent program. To alleviate this problem to a certain extent this thesis proposes integrating a visualization tool with JSWAT for viewing the status of the monitor and the different threads in a concurrent program during runtime. The visualization will be viewed in a panel in the graphical user interface of JSWAT. When concurrent programmers view the status of the threads with respect to the monitor at runtime, they can understand the working of the program better. Hence, they can easily identify, analyze and rectify bugs in the program. The tool parses the program to identify data pertinent to visualization such as number of condition variables involved in a concurrent program and their names, sections where threads interact with the monitor and the condition queues. These sections are then mapped to their corresponding visual interpretations or rules. The visualization rules decide how each action of the thread is depicted in the visualization panel. This depiction also depends on the signaling discipline of the monitor. The signaling disciplines are Signal-and-Continue, Signal-and-Urgent-wait and Signal-and-exit. Based on the method's executed by the thread and signaling discipline, the visualization panel decides if a particular thread has to be placed at the entry queue, reentry queue, a condition queue or the monitor. Therefore, the programmer can view the interaction among the threads and the monitor in a particular execution and identify any bugs in the program easily. The programmer can also set breakpoints in JSWAT and view the current status of the threads at that point in the visualization panel. This user-friendly visualization tool along with the feature-rich JSWAT debugger aims to reduce the time and effort spent by Java programmers in testing and debugging concurrent programs and hence increase their productivity. This tool also aims to function as an aid to understand the nuances of concurrent programming