The man page on my systems describes the fork call like this:
fork() creates a new process by duplicated the calling process. The new process, referred to as the child, is an exact duplicate of the calling process, referred to as the parent, except for …
Here’s an example using ruby
When a process is forked the file descriptors in the parent process are shared with the child process. When I run this example this is the output:
This shows that the child process has a separate process id from the parent process and that when a file descriptor is closed in the child process it does not affect the parent process.
When I run pstree on the parent process I get something like the following output:
This shows two processes with two different process id’s. One for the parent process (21707) and one for the child process (21710). They also both belong to the same process group (32376).