forked processes are traditional way to structure parallel tasksand they are fundamental part of the unix tool set forking is straightforward way to start an independent programwhether it is different from the calling program or not forking is based on the notion of copying programswhen program calls the fork routinethe operating system makes new copy of that program and its process in memory and starts running that copy in parallel with the original some systems don' really copy the original program (it' an expensive operation)but the new copy works as if it were literal copy after fork operationthe original copy of the program is called the parent processand the copy created by os fork is called the child process in generalparents can make any number of childrenand children can create child processes of their ownall forked processes run independently and in parallel under the operating system' controland children may continue to run after their parent exits this is probably simpler in practice than in theorythough the python script in example - forks new child processes until you type the letter at the console example - pp \system\processes\fork py "forks child processes until you type ' 'import os def child()print('hello from child'os getpid()os _exit( else goes back to parent loop def parent()while truenewpid os fork(if newpid = child(elseprint('hello from parent'os getpid()newpidif input(=' 'break parent(python' process forking toolsavailable in the os moduleare simply thin wrappers over standard forking calls in the system library also used by language programs to start newparallel processcall the os fork built-in function because this function generates copy of the calling programit returns different value in each copyzero in the child process and the process id of the new child in the parent forking processes