Thread scheduling in Solaris threads

Thread scheduling in Solaris threads

Post by Srinivas Sesha Vemu » Wed, 30 Jun 1999 04:00:00



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?

 
 
 

Thread scheduling in Solaris threads

Post by Srinivas Sesha Vemu » Fri, 02 Jul 1999 04:00:00



Sorry,
 The semaphore is incremented using sema_post and not sema_wait as I said.

Srinivas

: 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?
:
: