How does Thread scheduling work?
843811Aug 10 2001 — edited Aug 10 2001I'm having a problem with a Java application which uses C++ code. My program consists of multiple threads, most of which at any time are either inside a Thread.sleep() method or an Object.wait() [with timeout] method. I'm running on SCO OpenServer 5.0.6.
My program will run fine for several hours and then the JVM will stop scheduling threads. The sleep methods are sleeping for only 500 ms but those threads never return from the sleep. If I send a SIGALRM to the JVM it will reschedule the threads, so I'm thinking somewhere in the excecution of the program a SIGALRM got dropped. The C++ code does make use of alarms to implement timeouts, but so far I have found no evidence of it getting the alarm signal. The amount of time the program runs before encountering this problem appears to be random.
Does anyone know how the JVM schedules threads, and can tell me whether I'm on the right track? I'd appreciate any help I can get. Thanks!
Robert