debugging threads vs processes

Cedric Berger
Fri Jul 13 08:50:00 GMT 2001 wrote:

> Has anybody tried using IBM's new Linux threading library with GCJ?
> My personal experience with the currently released LinuxThreads is that
> multi-threaded applications are almost undebuggable. LinuxThreads
> currently has a bug that causes all threads to wakeup from semaphores
> the first time you connect a debugger to the process. This, of course, immediately
> crashes most multi-threaded applications since they don't expect to wake
> up until the semaphore actually gets signaled.

The "wakeup from semaphore" should not be too much of a problem in Java,
because properly written Java never blindly trust "semaphores", but use code
be written this way:

synchronized myFunction() {
    while(condition not met)
        object.wait();    // this "semaphore" can get glitches, it doesn't matter.

Now, of course, if the "mutex" which is used to implements the "synchronized"
keyword itself suffers the same problem, this would be a disaster....

Anyay, I unfortunately agree with your comments.

More information about the Java mailing list