[PLUG] high cpu utilization

Navin Kabra navin.kabra at gmail.com
Tue Nov 10 19:59:12 PST 2009


On Sun, Nov 8, 2009 at 10:18 PM, Kapil Agrawal <kapil.agl at gmail.com> wrote:

> have to wait in thd_w again and again in a while loop polling for the data
> to be pushed queue from thd_r. Because of this polling using while, huge
> CPU
> is getting consumed.
>

I've forgotten my multi-threaded programming, but isn't there a semaphore or
other such data structure that exists just for this purpose? thr_r sleeps on
the semaphore, and thr_w wakes it up when there is data?

A check of man pages should definitely help you find the appropriate mutex
based datastructure?

navin.


More information about the plug-mail mailing list