On Linux & Mac, is there anyway that I can pre-cache the JVM (either in RAM, or a state of it) so taht when I start a Java program, it starts as fast as C/C++ programs?
I am willing to waste memoory to make this happen.
On Linux & Mac, is there anyway that I can pre-cache the JVM (either in RAM, or a state of it) so taht when I start a Java program, it starts as fast as C/C++ programs?
I am willing to waste memoory to make this happen.
No. Unfortunately :(
On second thought, the reason why Java programs start faster on Windows these days, is because there is a process (Java Quickstart) which aggressively keeps a copy of the runtime library files in the memory cache which apparently helps immensely. I do not know if this approach has been ported to Linux.
Would that not load the JVM binary and libs into memory so that they can be shared?
Yes, but only in the same JVM instance. So you have to load your application into this instance, as servlet container do.
The whole bootleneck of the JVM invocation is class loading, that is the reason for the Java Quickstart that Thorbjørn mentioned.
So you can put the class libs on faster media (ram disk) this will probably fasten your (first) startup. I once installed Netbeans + JSDK on a RAM disk and it starts really fast but once started it will run equal fast than loaded from disk.