I'm new to the forum and trying to contribute. I'm a software engineer. Shoot me a message if you got any questions!
Need help in Java? I gotchu
#2
Posted 14 December 2019 - 06:36 PM
Is there any easy way to make a true fork of a process in Java? I don't mean threading, since the thread dies after it's done its purpose. I mean something like fork() from the C language which returns an int, either the new PID for the child process or 0 if it's the parent.
I know I can use JNI as a complete last resort, but I'd like to stay away from JNI calls if I'm already using Java for more abstraction.
EDIT: I'd also like to kill the parent process once forked, hence why threads really don't work for this. But for that I can just use runtime(taskkill) or maybe a JNI call to system(), since at least I won't need to be using JNI to manage everything afterwards.
#5
Posted 16 December 2019 - 05:38 PM
Short answer, no there isn’t really.Is there any easy way to make a true fork of a process in Java? I don't mean threading, since the thread dies after it's done its purpose. I mean something like fork() from the C language which returns an int, either the new PID for the child process or 0 if it's the parent.
I know I can use JNI as a complete last resort, but I'd like to stay away from JNI calls if I'm already using Java for more abstraction.
EDIT: I'd also like to kill the parent process once forked, hence why threads really don't work for this. But for that I can just use runtime(taskkill) or maybe a JNI call to system(), since at least I won't need to be using JNI to manage everything afterwards.
Generally speaking in Java you can’t kill the parent process and work on the children, because it will kill all of its children.
I’m not sure what exactly you’re using this for. But you may be able to use RMI to have a controlling process and then spawn anything you want off there and use invocation to kill/create/do work
#6
Posted 16 December 2019 - 05:57 PM
Short answer, no there isn’t really.
Generally speaking in Java you can’t kill the parent process and work on the children, because it will kill all of its children.
I’m not sure what exactly you’re using this for. But you may be able to use RMI to have a controlling process and then spawn anything you want off there and use invocation to kill/create/do work
Using it for malware lol
JVM has been extremely good to me regarding detection rates, literally going 0/56 on any kind of basic sample I write, and some bigger projects too.
Actually, it's so good that some people even use it to mask their cheats for online games, see Charlatano which has been undetected for 3-4 years.
Can't go super indepth on why I need process forking entirely and not threads, since I haven't really seen any examples of it being used publicly and I don't want people to jump on the hype train, but it's worked pretty well with some of the C stuff I've written, so I was wondering if I could just port it over for Java.
Thanks for the response, though. RMI looks pretty promising for an alternative.
Users browsing this thread: