Process.pid and Process.ppid : Process « Development « Ruby






Process.pid and Process.ppid


proc1 = Process.pid
fork do
  if Process.ppid == proc1
    puts "proc1 is my parent"  # Prints this message
  else
    puts "What's going on?"
  end
end

 








Related examples in the same category

1.use Process.wait to wait for all child processes to finish before continuing.
2.Daemon Processes
3.Use Process.kill