This article discusses some of the difficulties involved in trying to use double check locking as the method to avoid race conditions between threads. The conclusion is that DCL is broken in the Java Memory model.
As long as we're on the subject of threads, the biggest problem that I see with their use in Java (and a number of other languages)is that they only support a cooperative model of threading. Java essentially gave up on controlling threads by any means other than cooperation when they deprecated the suspend(), resume(), and stop() methods. That means that all threads must be aware of possible conflicts with all other threads - now and into the future - making for a large amount of coupling between code and breaking any form of encapsulation.
While on the subject of Java, Parsing With JavaCC might be of interest to those that like to write their own grammer.
Posted to OOP by Chris Rathman on 5/30/01; 1:04:39 AM
|