owaiskazi19 / inproc Goto Github PK
View Code? Open in Web Editor NEWThis repository contains spinning up a child process in a JVM using ProcessBuilder and Runtime.exec
This repository contains spinning up a child process in a JVM using ProcessBuilder and Runtime.exec
With the current extension framework, extensions are running out of process or remote node from OpenSearch cluster. This proposal talks about the multiple approaches a process can be run within the same JVM.
ProcessBuilder pb = new ProcessBuilder(<Process>);
Process process = pb.start();
Process process = Runtime.getRuntime().exec("ls");
new Thread() {
public void run() {
<Process>
}
}.start();
Results:
Using the command Java Virtual Process Status(jps) the results were found that only a single JVM is spun up for the Main
method of the Java File and all the 3 approaches mentioned above doesn't create a new JVM to run rather runs in the same process as the JVM of Main
When a simple java file is running which prints Hello World!:
77587 jdk.jcmd/sun.tools.jps.Jps -mlv -Dapplication.home=/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home -Xms8m -Djdk.module.main=jdk.jcmd
77541 jdk.compiler/com.sun.tools.javac.launcher.Main ProcessBuilderExtensions.java --add-modules=ALL-DEFAULT
31564 -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=512m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=/Users/kazabdu/java_error_in_idea_%p.log -XX:HeapDumpPath=/Users/kazabdu/java_error_in_idea.hprof -Xmx2500m -Djb.vmOptionsFile=/Users/kazabdu/Library/Application Support/JetBrains/IntelliJIdea2021.3/idea.vmoptions -Dsplash=true -Didea.home.path=/Applications/IntelliJ IDEA.app/Contents -Didea.jre.check=true -Didea.executable=idea -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.paths.selector=IntelliJIdea2021.3 -Didea.vendor.name=JetBrains
When the any of the above 3 approach is running a new process within the same JVM:
77861 jdk.compiler/com.sun.tools.javac.launcher.Main ProcessBuilderExtensions.java --add-modules=ALL-DEFAULT
31564 -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=512m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=/Users/kazabdu/java_error_in_idea_%p.log -XX:HeapDumpPath=/Users/kazabdu/java_error_in_idea.hprof -Xmx2500m -Djb.vmOptionsFile=/Users/kazabdu/Library/Application Support/JetBrains/IntelliJIdea2021.3/idea.vmoptions -Dsplash=true -Didea.home.path=/Applications/IntelliJ IDEA.app/Contents -Didea.jre.check=true -Didea.executable=idea -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.paths.selector=IntelliJIdea2021.3 -Didea.vendor.name=JetBrains
78044 jdk.jcmd/sun.tools.jps.Jps -mlv -Dapplication.home=/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home -Xms8m -Djdk.module.main=jdk.jcmd
The above result clearly shows that only a single JVM process is running with the above 3 approaches mentioned.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.