I am writing a terminal program using ruby as a launcher for a set of program written in C++ and Java which should be executed in a distributed system.
I would like to translate this instruction in ruby:
for i in {1..40}; do
ssh node$i program & #note & so that that process is detached
done
This is my ruby code:
class Launcher
# Other method that we can ignore
def order(command)
@nodelist.each {#Do something here}
end
end
I though about creating a pool of thread and each thread execute that command. Is it the appropriate way? As I studied threads can not execute "exec" since threads share the same memory address.