I have a list / queue of 200 commands that I need to run in a shell on a Linux server.
I want to have only 10 running processes (from the queue). Some processes will take several seconds to complete, while other processes will take much longer.
When the process is complete, I want the next command to be “popped” out of the queue and executed.
Does anyone have any code to solve this problem?
Further development:
There should be 200 work that needs to be done, in a queue. I want no more than 10 works to go on right away. When the thread finishes a piece of work, it should set the queue for the next work. If there is no more work in the queue, the thread must die. When all threads have passed away, this means that all work has been completed.
The actual problem I'm trying to solve is using imapsync to synchronize 200 mailboxes from the old mail server to the new mail server. Some users have large mailboxes and long tto synchronization, while others have very small mailboxes and synchronization.
python ruby bash shell parallel-processing
mlambie Jan 21 '09 at 2:54 2009-01-21 02:54
source share