Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Limit number of concurrent running threads in pool

Reply
Thread Tools

Limit number of concurrent running threads in pool

 
 
Robert Klemme
Guest
Posts: n/a
 
      03-06-2010
On 03/05/2010 09:59 PM, Joe Martin wrote:
> Robert Klemme wrote:
>> For this scenario a thread pool with fixed size seems sufficient.
>>

>
> Very good. This works quite nicely as well.
>
> Just wondering, are there any performance benefits of using one method
> over the other?


Which other method are you referring to?

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Reply With Quote
 
 
 
 
Joe Martin
Guest
Posts: n/a
 
      03-08-2010
Caleb Clausen wrote:
> Yes. Threads use memory (quite a lot of it, in fact). Mostly this goes
> to the thread's stack. Limiting the number of threads saves quite a
> bit of memory. I'm not sure there's any improvement in the amount of
> cpu time either way, other than perhaps some fewer cache misses
> resulting from using less memory.


Thanks! I figured this was the case.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Joe Martin
Guest
Posts: n/a
 
      03-08-2010
Robert Klemme wrote:
> Which other method are you referring to?


Well my original thinking was to create a thread for every single item I
pass to the program. Caleb answered this for me in that threads
themselves are quite heavy, so it further leads me to go with your
solution which creates a low number of threads and re-uses them until
the queue is empty. It seems much more simple and effecient than my
original plan.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Robert Klemme
Guest
Posts: n/a
 
      03-08-2010
2010/3/8 Joe Martin <(E-Mail Removed)>:
> Robert Klemme wrote:
>> Which other method are you referring to?

>
> Well my original thinking was to create a thread for every single item I
> pass to the program. =A0Caleb answered this for me in that threads
> themselves are quite heavy, so it further leads me to go with your
> solution which creates a low number of threads and re-uses them until
> the queue is empty. =A0It seems much more simple and effecient than my
> original plan.


Ah, OK. Then I was just confused because you had used the term
"thread pool" in your original posting. That term is commonly use for
exactly the type of solution I posted (fixed or at least limited
number of threads which get their tasks from some form of queue). You
probably weren't aware of this.

Kind regards

robert


--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic NAT pool doesn't report full when pool contains interface IP tom Cisco 0 10-09-2009 02:22 AM
does python have a generic object pool like commons-pool in Java Rick Lawson Python 8 07-16-2009 11:25 PM
PIX 501 issue routing between VPN pool and local pool eostrike Cisco 3 10-24-2008 09:43 PM
problems locating the concurrent EDU.oswego.cs.dl.util.concurrent package Pep Java 6 08-16-2005 07:26 AM
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Guoqi Zheng ASP .Net 4 06-03-2004 06:39 PM



Advertisments