Skip to end of banner
Go to start of banner

Approaches from thesis(Inter-Thread)

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Previous inter-Thread tracing approaches

Thread Variables

In Java its possible to store thread specific variables. The class ThreadLocal provides this functionality. This class is internally implemented with a map. The keys for this map are generated by an AtomicInteger starting on 0.

InheritableThreadLocal  are thread variables that can be tnherit to other threads. The whole map with values are inherit to the child thread. This allows it to give each new thread information about its parent thread, so that the new threads can access it.

In thread pools each thread is reused, so it would be enough to set all thread variables on null every time a thread starts and exits execution.
To achieve this it would be necessary to use the finalize() method. But there is no guarantie that and when the garbage collector will run this method, so this aproach cant be used for the tracer.

Threads can be reused, but Runnables are unique.

  • No labels