Well, it is obvious, let’s say we have two processes A and F. F wants to fork A when it has the CPU control (and A is suspended since CPU is on F).
I have Googled however nothing related showed up. Is such a thing possible in Unix environments?
I don’t think it’s a good idea in any way, but it may be possible for process
Fto attach toAusing a debugger interface such asptrace. Doing something like suspending the target process, saving its state, diverting the process to runfork, then restoring its original state.It should be noted that your cloning process will probably need to handle some odd cases around threads and the like.