Complete the code to create a child process using fork.
pid = [1]spawn instead of fork.fork.In Ruby, fork creates a child process and returns its process ID.
Complete the code to check if the current process is the child process.
if pid == [1] puts "Child process" end
nil instead of 0.In Ruby, fork returns 0 in the child process.
Fix the error in the code to wait for the child process to finish.
Process.[1](pid)Process.wait which waits for any child process.waitchild.The correct method to wait for a specific child process is Process.waitpid.
Fill both blanks to create two child processes and print their PIDs.
2.times do pid = [1] if pid == [2] puts "Child PID: #{Process.pid}" exit end end
spawn instead of fork.pid == 1 instead of 0.Use fork to create child processes and check if pid == 0 to identify the child.
Fill all three blanks to collect child PIDs and wait for them to finish.
pids = [] 3.times do pids << [1] end pids.each do |pid| Process.[2](pid) puts "Child process [3] finished" end
wait instead of waitpid for specific PIDs.Use fork to create child processes, waitpid to wait for each, and print a message when done.
