ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

Need help in Java? I gotchu


  • Please log in to reply
Need help in Java? I gotchu

#1

LucTheDuke96
LucTheDuke96
    Offline
    2
    Rep
    54
    Likes

    Advanced Member

Posts: 129
Threads: 7
Joined: Dec 12, 2019
Credits: 0

Four years registered
#1

I'm new to the forum and trying to contribute. I'm a software engineer. Shoot me a message if you got any questions!


  • 0

#2

FaithHF
FaithHF
    Offline
    36
    Rep
    234
    Likes

    SESH

Posts: 408
Threads: 36
Joined: Dec 04, 2016
Credits: 0

Seven years registered
#2

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.


  • 0

#3

Boxedpillows
Boxedpillows
    Offline
    0
    Rep
    0
    Likes

    New Member

Posts: 11
Threads: 0
Joined: Dec 04, 2019
Credits: 0
Four years registered
#3
What are ways to reduce cpu utiization by explicitly calling garbage collection?

  • 0

#4

LucTheDuke96
LucTheDuke96
    Offline
    2
    Rep
    54
    Likes

    Advanced Member

Posts: 129
Threads: 7
Joined: Dec 12, 2019
Credits: 0

Four years registered
#4

What are ways to reduce cpu utiization by explicitly calling garbage collection?


It depends what you are doing, however system.gc() will attempt to force a major garbage collection

  • 0

#5

LucTheDuke96
LucTheDuke96
    Offline
    2
    Rep
    54
    Likes

    Advanced Member

Posts: 129
Threads: 7
Joined: Dec 12, 2019
Credits: 0

Four years registered
#5

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.

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

  • 0

#6

FaithHF
FaithHF
    Offline
    36
    Rep
    234
    Likes

    SESH

Posts: 408
Threads: 36
Joined: Dec 04, 2016
Credits: 0

Seven years registered
#6

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.


  • 0

#7

class104
class104
    Offline
    9
    Rep
    37
    Likes

    The Devil Called

Posts: 930
Threads: 155
Joined: Mar 11, 2017
Credits: 0

Seven years registered
#7

I'm new to the forum and trying to contribute. I'm a software engineer. Shoot me a message if you got any questions!

can I have your discord plz


  • 0
<p>BTC:18FB6d3XsiFMYQG7ErnPtMGUxnt5nYdmCX


 Users browsing this thread: