home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man2 / fork.2 < prev    next >
Encoding:
Text File  |  1975-06-26  |  1.1 KB  |  51 lines

  1. .th FORK II 8/5/73
  2. .sh NAME
  3. fork  \*-  spawn new process
  4. .sh SYNOPSIS
  5. (fork = 2.)
  6. .br
  7. .ft B
  8. sys fork
  9. .br
  10. .ft R
  11. (new process return)
  12. .br
  13. (old process return)
  14. .s3
  15. .ft B
  16. fork( )
  17. .ft R
  18. .sh DESCRIPTION
  19. .it Fork
  20. is the only way new processes are created.
  21. The new process's core image is a copy of
  22. that of the caller of
  23. .it fork.
  24. The only distinction
  25. is the return location and the fact
  26. that r0 in the old (parent) process contains the process ID
  27. of the new (child) process.
  28. This process ID is used by
  29. .it wait.
  30. .s3
  31. The two returning processes share all open
  32. files that existed before the call.
  33. In particular,
  34. this is the way that standard input and output
  35. files are passed and also how
  36. pipes are set up.
  37. .s3
  38. From C, the child process receives a 0 return,
  39. and the parent receives a non-zero number which is the process ID
  40. of the child;
  41. a return of \*-1 indicates inability
  42. to create a new process.
  43. .sh "SEE ALSO"
  44. wait (II), exec (II)
  45. .sh DIAGNOSTICS
  46. The error bit
  47. (c-bit) is set in the old process if a new process
  48. could not be created because of lack of process space.
  49. From C, a return of \*-1 (not just negative)
  50. indicates an error.
  51.