mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 14:54:05 -06:00
vault backup: 2022-09-29 09:36:54
This commit is contained in:
parent
8b0fd1a2c4
commit
1ebb7e67cb
@ -15,10 +15,32 @@ defn: independent process - one does not affect the other and they do not commun
|
||||
|
||||
# creating a child process
|
||||
A child process is creating from a parent using fork.
|
||||
everything the same as the parent except the child has a differnent process ID.
|
||||
|
||||
fork returns a value. 0 for the parent, and the id of the child for the child
|
||||
|
||||
everything the same as the parent except the child has a differnent process ID. e.g., when they start they the same heap location etc. but as the child runs it may change.
|
||||
|
||||
if you kill the parent before the child the child becomes an orhpan process
|
||||
if yo ukill the child while the parent is waiting for the child the parent becomes a zombie (defunct) process. -- but only if the parent doesn't wait for the child.
|
||||
|
||||
the child process can also call exexlp (load program) which erases the copy of the parent (itself not the parent)
|
||||
- when initally forked the child and parent share the same space
|
||||
- when the child calls execlp then the child will fully copy the program to a new memory location so it doesn't overwrite the parent
|
||||
|
||||
# communcation between parent and child
|
||||
process create a chld process to do a task. but they need to communicate
|
||||
|
||||
after a process calls a chld process. it can execute a wait system call.
|
||||
|
||||
this moves a process off the ready queue, untill the chld process has terminated
|
||||
when the child process has terminated, it can return its status to the parent.
|
||||
|
||||
# process termination
|
||||
automatically executes exit after the last statement.
|
||||
- may return status to parent who is `wait`ing
|
||||
- all rsouces are dallocated by the OS
|
||||
|
||||
they can also die more violently
|
||||
|
||||
|
||||
# signal and pipe for inter process communication
|
||||
|
||||
Loading…
Reference in New Issue
Block a user