When calling fork()
the PID of the parent is saved in the child's PCB. In which case would it be useful for the child to know its parent's PID?
A process may wish to know if it was started by the init
process at system startup, for example, and modify its behaviour accordingly.
Or, it may wish to communicate with its parent, say, to indicate something is complete, by sending a signal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.