Modern operating systems also provide system calls that allow process threads to create other threads and wait for them to terminate ("join" them) in a similar fashion.
An operating system may provide variations of the wait call that allow a process to wait for any of its children processes to exit, or to wait for a single specific child process (identified by its process-ID) to exit.
Some operating systems issue a signal (SIGCHLD) to the parent process when a child process terminates, notifying the parent process and allowing it to then retrieve the child process's exit status.
The exit status returned by a child process typically indicates whether the process terminated normally or abnormally. For normal termination, this status also includes the exit code (usually a small integer value) that the process returned to the system.
A child process that terminates but is never waited on by its parent becomes a zombie process. Such a process continues to exist as an entry in the system process table even though it is no longer an actively executing program. Such situations are typically handled with a special "reaper" process that locates zombies and retrieves their exit status, allowing the operating system to then deallocate their resources.
Similarly, a child process whose parent process terminates before it does becomes an orphan process. Such situations are typically handled with a special "root" (or "init") process, which is assigned as the new parent of a process when its parent process exits. This special process detects when an orphan process terminates and then retrieves its exit status, allowing the system to deallocate the terminated child process.