nagyistoce / multithreadedtc

Automatically exported from code.google.com/p/multithreadedtc
0 stars 0 forks source link

Metronome implementation is incorrect #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
The attached patch file includes comments that characterize the problem.

There is a race condition in the original for-loop below.
Say there are two threads. t[0] is not RUNNABLE when its status is 
determined, but t[1] is RUNNABLE at that time.
Before you get around to testing t[1], it unblocks t[0] and then becomes 
blocked.
The current implementation will wrongly conclude that none of the threads 
are RUNNABLE, and
absent timed waits or deadlocks, will wrongly advance the clock. 

What is the expected output? What do you see instead?
A test which should succeed fails.

What version of the product are you using? On what operating system?
1.01

Please provide any additional information below.
I don't see how this bug can be fixed without enhancing Java. A patch file 
with a workaround that makes it extremely unlikely that you will encounter 
this bug is attached. The patch file includes comments explaining why I 
think a correct fix is not possible without enhancements to Java.

Original issue reported on code.google.com by aah...@gmail.com on 21 Jan 2010 at 9:41

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, could you please provide a minimal test that shows this failure? Thanks.

Original comment by tom...@google.com on 11 Jun 2011 at 9:35