what java virtual machine will do while executing multiple java applications

后端 未结 3 1404
旧巷少年郎
旧巷少年郎 2020-12-06 12:29

By reading this article, I know that each java application will run in a specific Java Virtual Machine Instance. So if I execute the following commands(\"Java -jar test1.jar

相关标签:
3条回答
  • 2020-12-06 12:52

    1) No, but there a ways to launch java applications as services with wrappers (Google for "Java service").

    2) Yes.

    3) You can use communication between processes (v.g. HTTP). But there are no shortcuts due to all processes being run in JVM.

    4) No

    0 讨论(0)
  • 2020-12-06 13:00

    For the OS, JVM like an user application. Each JVM Instance is individual.

    1. No. JVM is normal process as others.But you can run it as deamon process.
    2. Yes. Java application run on JVM just like you application on OS.
    3. Yes. Each JVM thread is individual, but they can communication whith other JVMs through network,RMI...
    4. It depends. Normally they are individual, but if a JVM crash cause the OS crash, other JVMs will be effected.
    0 讨论(0)
  • 2020-12-06 13:08

    The JVM is a standard process, just like any other. As such there's no implicit communication or state sharing between the two. Each will have their own heap, threads etc. If you kill one it won't affect the other.

    What will get shared are the code pages of the JVM itself. The kernel is intelligent enough to identify the same binary (any binary -not just the JVM) running twice and reuse the image. This only applies to the actual binary code - not its state. See here for more info re. Linux.

    The JVM isn't a daemon process, but could be started upon system startup as a Windows service or Unix/Linux process (via /etc/init.d scripts). This is how you'd (say) run a web service written in Java when a machine is booted up.

    0 讨论(0)
提交回复
热议问题