What is inherited by a child process?

9.2k views Asked by At

Does a forked process inherit any (server) ports bind from the parent process?
I have a java process which forks a child process and from netstat -anpt |grep I see that both parent and child are bound to the same port.
Is this possible? Is there a way to get arround this?

1

There are 1 answers

8
Peter Lawrey On

Does a forked process inherit any (server) ports bind from the parent process?

Its inherits the resources of its parent. This is the way the OS behaves.

Is there a way to get around this?

The child has to close all the resources it doesn't need. This is relatively easy to do in C but not simple in Java. There might be a way to start a Java process with clean set of resources, but I don't know of a way to do this.