Created
May 5, 2013 14:49
-
-
Save barek2k2/5521021 to your computer and use it in GitHub Desktop.
Parallel processing on Ruby On Rails using fork
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fork do | |
ActiveRecord::Base.establish_connection | |
for i in 0..20000 | |
puts 'I m in sub process-1' | |
end | |
exit | |
end | |
fork do | |
ActiveRecord::Base.establish_connection | |
for i in 2001..40000 | |
puts 'I m in sub process-2' | |
end | |
exit | |
end | |
....... | |
fork do | |
ActiveRecord::Base.establish_connection | |
for i in 40000..N | |
puts 'I m in sub process-M' | |
end | |
exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment