2

I am looking for a tool or api which allows deterministic execution of Java threads for testing purposes. Thus, allowing context switches in java code at certain locations in byte code. For instance, I want a thread t1 to preempt for another thread t2 at say line N in the bytecode/sourcecode and so on. To make the case simpler lets ignore the synchronization or locks. Is there any tool, if possible open source customized JVM available. I am aware of a few tools like dejavu, LEAP but I would like to know about recommended open source tools from some one who has experience with such tools.

Cheers, Pulkit

2
  • 2
    Interesting. I usually just set up a bunch of breakpoints and then start and stop threads at-will. But it's tedious, error-prone and definitely not automatable. Commented Mar 16, 2011 at 5:53
  • check out Can a multi-threaded program ever be deterministic? Commented Feb 8, 2015 at 14:09

2 Answers 2

1

I'm not aware of any tools that do exactly what you want, and in general that's going to be tough, simply because JITs etc.. will blur what a "line" means. So you'll either get lousy code that meets your goals, or the real code that won't. Either way bugs could slip through. I'd suggest you look at ConTest for a good perspective on how testing in this general area can be done.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Trent, Adam. By line I mean, a byte code instruction. Say, I want the thread T1 to pause its execution at say byte code instruction X, and let the another thread T2 to resume the execution from where ever it paused, or beginning if it is supposed to start. I remember reading about ConTest, but I don't think its opensource.
The JIT certainly will change what it means to be on "bytecode instruction X". And yes, ConTest isn't open source, but I've not seen anything closer to what you want than that, sorry...
0

Here's a comparison of different solutions: http://sites.fct.unl.pt/sites/default/files/synergy-vm/files/2013-middleware-silva.pdf

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.