cz.vutbr.fit.racedetector
Class ERVariable

java.lang.Object
  extended by cz.vutbr.fit.racedetector.RDVariable
      extended by cz.vutbr.fit.racedetector.ERVariable

public class ERVariable
extends RDVariable

This class contains information gathered concerning the variable. The main Eraser algorithm is implemented in the updateStatus method.

Author:
zdenek

Nested Class Summary
(package private) static class ERVariable.State
           
 
Field Summary
 
Fields inherited from class cz.vutbr.fit.racedetector.RDVariable
healedByThreads, instance, raceAvoidLock, raceAvoidSemaphore, raceDetected, varName, varNoiseInject, varOmited
 
Constructor Summary
ERVariable(java.lang.Object ins, java.lang.String str)
           
 
Method Summary
 java.lang.String debugPrint()
          Returns string with information which can be helpful for debuging.
 java.lang.String getCandidateLocks()
          Returns String of candidate lock set of this variable.
 java.lang.String getStatus()
          Returns String describing the status of the variable.
 java.lang.String printVarReport()
          This function generate report for variable represented with this object.
 boolean updateState(ERThread thread, java.lang.String programLocation, RaceDetector.Operation operation)
          This method implements Race detection algorithm.
 
Methods inherited from class cz.vutbr.fit.racedetector.RDVariable
prepareHealing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERVariable

ERVariable(java.lang.Object ins,
           java.lang.String str)
Method Detail

updateState

public boolean updateState(ERThread thread,
                           java.lang.String programLocation,
                           RaceDetector.Operation operation)
This method implements Race detection algorithm. Initially the variable is used by one thread - as long as only one thread is accessing the variable Race is not possible. Whenever second thread access the variable we have to be carefull. If second (and any other) thread is just only reading the variable Race is still not possible. Whenever also second (and any other) thread is changing the value of the variable Race is possible and algorithm must check if performed operation is causing the Race. This is done by intersection between sets of so called Candidates locks of variable V (set of locks what could be used for protecting variable V) and locks held by thread T (set of locks what thread is using to protect sensitive parts of the program execution). If the intersection is empty Race is reported.

Parameters:
programLocation - - program location of current operation
operation - - read or write operation flag
Returns:
- true if race is identified

getStatus

public java.lang.String getStatus()
Returns String describing the status of the variable.

Returns:
status

getCandidateLocks

public java.lang.String getCandidateLocks()
Returns String of candidate lock set of this variable.

Returns:
String with candidate locks

printVarReport

public java.lang.String printVarReport()
This function generate report for variable represented with this object. Useful information to find RACE are presented: Threads and their access mode, locks etc.. Some suggestion is also generated here.

Returns:
String to put into output file

debugPrint

public java.lang.String debugPrint()
Returns string with information which can be helpful for debuging.

Returns:
String with info