I was reading a book and came across this sentence: Windows does not maintain parent-child relationships among processes like Unix does.
Unfortunately, there's no further explanation whatsoever. So what is the difference in terms of parent-child relationships between Unix and Windows processes?
1 に答える
Windows does not provide, a direct getppid API, there is no Win32 API to fork a process and inherit all of the memory of the parent (On windows children only inherit the handles when allowed). Even when one gets a parent PID of a process in indirect ways like the ones used by process explorer, one is not guaranteed to get a PID that is pointing to a valid process because the information about the parent PID of the process is only captured at the time of process creation and never updated in cases where parent dies before the child.
So, the indirect methods of getting the parent PID would only tell what was the PID of the process that created this process and nothing more. (Unlike in Unix or others where the init process takes the orphaned processes as it's children) And on windows one does not talk about orphaned processes or zombies.
There is probably more. All of this (and more) amounts to the statement "windows does not maintain parent-child relationships".