def fork_many(n)
      pids = []
      n.times do |i|
        pids << fork do
          yield i
          Kernel.exit!
        end
      end

      pids.each { |pid| ::Process.wait(pid) }
    end
def fork_many(n)
      pids = []
      n.times do |i|
        pids << fork do
          yield i
          Kernel.exit!
        end
      end

      pids.each { |pid| ::Process.wait(pid) }
    end
Fork +n+ processes.  In each, yield the block (passing the process
 number), then call Kernel.exit!  Waits for all processes to
 complete before returning.