In addition to Chris' great answer, remember to call Process.wait
from your master in order to reap your child process, else you'll leave zombies behind.
Example as requested in comments:
pid = Process.fork do
puts "child, pid #{Process.pid} sleeping..."
sleep 5
puts "child exiting"
end
puts "parent, pid #{Process.pid}, waiting on child pid #{pid}"
Process.wait
puts "parent exiting"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…