I was having a problem with Solaris threads when implementing a
Single Producer- Multiple consumer problem.
The producer reads requests from a file and assigns them to a pool of threads
which do their own processing. To take care of empty queues, the consumer
threads wait on a semaphore (using sema_wait). If the producer selects a
particular thread, it increments the semaphore (using sema_wait)
I observed that some of the threads do not get scheduled when waiting on a semaphore, even when the semaphore is incremented.
Do I have to put in code that explicitly schedules threads, so that they
do not get starved out?