Subj : Re: why my threads do not wake up To : comp.programming.threads From : Eric Sosman Date : Thu Aug 18 2005 02:59 pm Jingbo wrote: > Hi, > > I created 8 threads to do some tasks in parallel. I ran my program on a > SunFire which has 8 CPUs. I found that only 2 or 3 threads are working > on their tasks. Other threads are waiting in pthread_cond_wait(). I > print a message after pthread_cond_wait(), and found out they are never > waken up. > > I'm sure that there are plenty of jobs on the queue and > pthread_cond_broadcast() is called and there is no other processes > running on the server therefore CPUs are idel and sometimes my program > can use all 8 CPUs. > > My question is, why Solaris did not put my threads on CPU even if there > are idel CPUs? One possibility is that Solaris is completely broken and unable to run multi-threaded processes correctly, and that you are the first person to discover this. A somewhat more likely possibility is that you have a bug in your code -- but since you didn't show any code, it's hard to be sure. Try reducing the program to the shortest complete compilable example that demonstrates the problem, and post the code for that reduced version. Disclaimer: I work for Sun, but don't speak for Sun. -- Eric.Sosman@sun.com .