Queue throughput.

G

Guest

Hi,

I have an application that uses a queue.

I have one thread that populates the queue and a second that takes items off
of the queue and processes them

At the moment all i have is these 2 threads. I may use another thread to
process the items separately so that i now have one thread that puts items on
the queue, another that takes items off the queue and a third that processes
the item.

My question is how do I control the throughput of the queue. What I would
like is the queue to not grow past a certain limit, for arguments sake 100
items.

It is important that items come off the queue and are processed quickly.

Is there a way to control this throughput?

Thanks In Advance
Macca
 
W

William Stacey [MVP]

I have built a generic bounded queue for just this use. Consumers will
block on empty Q and Producers will block on full Q.
The project also has a stream Pipe and a Pipe<T> built on the queue with a
sample app for ideas.
http://channel9.msdn.com/ShowPost.aspx?PostID=161030

--
William Stacey [MVP]

| Hi,
|
| I have an application that uses a queue.
|
| I have one thread that populates the queue and a second that takes items
off
| of the queue and processes them
|
| At the moment all i have is these 2 threads. I may use another thread to
| process the items separately so that i now have one thread that puts items
on
| the queue, another that takes items off the queue and a third that
processes
| the item.
|
| My question is how do I control the throughput of the queue. What I would
| like is the queue to not grow past a certain limit, for arguments sake 100
| items.
|
| It is important that items come off the queue and are processed quickly.
|
| Is there a way to control this throughput?
|
| Thanks In Advance
| Macca
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top