summaryrefslogtreecommitdiff
path: root/code/snippets/zombies_eg.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/snippets/zombies_eg.rb')
-rw-r--r--code/snippets/zombies_eg.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/code/snippets/zombies_eg.rb b/code/snippets/zombies_eg.rb
new file mode 100644
index 0000000..475c11c
--- /dev/null
+++ b/code/snippets/zombies_eg.rb
@@ -0,0 +1,7 @@
+# Create a child process that exits after 1 second.
+pid = fork { sleep 1 }
+# Print its pid.
+puts pid
+# Put the parent process to sleep so we can inspect the
+# process status of the child
+sleep 5