FAQ
Hi Ferdy,

Thanks, I got it. I ignored the loop[1] in each thread before.

[1]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L63



Regards,
DuJun


2014-05-05 9:53 GMT+08:00 Ferran Rodenas <frodenas@gmail.com>:
Actions are always queued on an array [1] before hitting the threads, then
each thread picks one action from the array [2] and calls it [3]. Each
thread loops [4] picking actions until there aren't any other action to
process. To avoid concurrency problems when storing and picking actions,
the ThreadPool class uses a mutex [5][6].

[1]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L45
[2]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L66
[3]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L79
[4]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L79
[5]
https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L7
[6] http://ruby-doc.org/core-1.9.3/Mutex.html

- Ferdy


2014-05-04 5:25 GMT-07:00 <dj199008@gmail.com>:
I have some questions about `class ThreadPool` used in BOSH. Considering
the follow codes(the `process` method):

https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L43

I know the ThreadPool has its max size(32 by default). So, when the
available thread is less than 1, we need to queue the `action`, however, I
can't find the implemention of 'queuing the action' in class ThreadPool. I
can only find a logger record:

https://github.com/cloudfoundry/bosh/blob/master/bosh_common/lib/common/thread_pool.rb#L52

Therefore, what happens if some bosh tasks need more than `max_threads`
worker threads which is configured by user?

Regards,
DuJun

To unsubscribe from this group and stop receiving emails from it, send
an email to bosh-dev+unsubscribe@cloudfoundry.org.
To unsubscribe from this group and stop receiving emails from it, send an email to bosh-dev+unsubscribe@cloudfoundry.org.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
groupbosh-dev @
postedMay 4, '14 at 12:25p
activeMay 5, '14 at 3:40a
posts3
users2

2 users in discussion

Du Jun: 2 posts Ferran Rodenas: 1 post

People

Translate

site design / logo © 2021 Grokbase