“Cannot reproduce” – is java deterministic multithreading possible?
•
Java
Can this run multithreaded Java applications in a deterministic manner? I mean, always use the same thread switch in two different runs of my application
The reason is that the simulation is run under exactly the same conditions in each run
Similarly, when the random number generator is used to obtain the always same "random" sequence, some arbitrary seeds are given
Solution
I don't know any practical way to do this
Theoretically, a bytecode interpreter with completely deterministic behavior can be implemented under some assumptions. 1 You need to simulate multiple threads by implementing threads and thread scheduling entirely in software and using a single native thread
1 – for example, there is no I / O and no system clock is used
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码