www.heteroclinic.net
Runtime Deadlock Detection I Here we choose Java because Java is so convenient to deploy such an application. Other programming languages should be sufficient too. Our mission is to study/understand the deadlock phenomenon not to debate the features of different languages. The beginning part requires you set up the following Java program in a same package. For convenience, I used the latest JDK and the latest Eclipse IDE. Util.java Indy.java FindRaceCondition.java By change the two lines in `FindRaceCondition.java', we did some experiments.Finally when we set The deadlock is almost certain to happen. Please notice we say almost. In concurrency programming, nothing is certain (but statistically high probability).
|
||
Runtime Deadlock Detection II
DeadlockThrottle.java ThrottledIndy.java Here are the results that are not certain:
|
||
Runtime Deadlock Detection III Duo.java Resource.java TestDuoDeadlockableVersion.java |
||
Runtime Deadlock Detection IV DeadlockException After we give some training to Duos, it seem they are able to handle a situation we don't want to get into. Please notice the difference of Duo and TrainedDuo. The parameter in duowait(long) for example, is 0 for Duo, value greater than 1 for TrainedDuo. Finally, we want to talk something about topology. Topology is not a secret world jargon. It simply means the way to represent connections of different entities in a space. I once try to do some visualization. We have thread, resource, and time. It is a three-dimensional world thus the diagram is not easy to plot. However, if you deal with computer graphics, you won't be strange to edge pair. With the aiding of edge pairs, we can traverse a connected simplex, may we call it a manifold. The starting function main is in file `TestTrainedDuo.java'. A result that is still not certain to get DeadlockException.java TrainedDuo.java TestTrainedDuo.java |