fork.2

来自「UNIX v6源代码 这几乎是最经典的unix版本 unix操作系统设计和莱」· 2 代码 · 共 51 行

2
51
字号
.th FORK II 8/5/73.sh NAMEfork  \*-  spawn new process.sh SYNOPSIS(fork = 2.).br.ft Bsys fork.br.ft R(new process return).br(old process return).s3.ft Bfork( ).ft R.sh DESCRIPTION.it Forkis the only way new processes are created.The new process's core image is a copy ofthat of the caller of.it fork.The only distinctionis the return location and the factthat r0 in the old (parent) process contains the process IDof the new (child) process.This process ID is used by.it wait..s3The two returning processes share all openfiles that existed before the call.In particular,this is the way that standard input and outputfiles are passed and also howpipes are set up..s3From C, the child process receives a 0 return,and the parent receives a non-zero number which is the process IDof the child;a return of \*-1 indicates inabilityto create a new process..sh "SEE ALSO"wait (II), exec (II).sh DIAGNOSTICSThe error bit(c-bit) is set in the old process if a new processcould not be created because of lack of process space.From C, a return of \*-1 (not just negative)indicates an error.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?