On 11.12.2006 12:06, Boris Mojo-jojo wrote:
> Suppose you have 1000 devices which are being sent messages, every 
> device has its own queue. devices  are independent so the messages to 
> them must be processed in parallel. Processing message in one device 
> should not stop processing others. However as along as you cannot create 
> 1000 threads, there is a thread pool where every thread waits for 
> message to device X to arrive on one of the 1000 queues and processed it 
> in context of device X. If some thread is processing message which was 
> sent to device X then the queue X is excluded from thread pool to 
> prevent parallel executing of message on the device by two different 
> threads.
> 
> You don't want to use one queue, because when two messages are sent to 
> one device one after another then all other messages will wait because 
> second message will not be processed till first one is processed.

True, in that case "select" would help.  But you can easily write your 
own processor with thread pool.  You can get ideas from Queue internals 
or http://wiki.rubygarden.org/Ruby/page/show/MultiThreading

Kind regards

	robert