PID | Registers | File Descriptors | … |
---|---|---|---|
324 | %rax, %rbx… | 1, 2, 0, 3 | |
2481 |
Fork will copy a PID exactly:
PID | Registers | File Descriptors | … |
---|---|---|---|
324 | %rax, %rbx… | 1, 2, 0, 3 | |
325 | %rax, %rbx… | 1, 2, 0, 3 | |
2481 |
However, some differences:
%rax
will have different values based on child or parent.getpid
, also getppid
which gets parent’s PIDWhat if we want some process a to talk to some process b? In other words, make fd 1
of process a talk to fd0
of process b.
a > tmpfile &
b < tmpfile
What’s wrong with this approach?