Is there one JVM per Java application?

前端 未结 8 1622
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 18:52

Is the same JVM used by all Java applications running or, does \'one JVM per Java application\' apply? (say the applications are IntelliJ IDEA, a server and NetBeans for exa

相关标签:
8条回答
  • 2020-11-28 19:30

    Little late here however this info may be useful for somebody. In a Linux system, if you want to know how many JVMs are running you can try this command

    $ ps -ef | grep "[j]ava" | wc -l
    

    ps to list process, grep to search process containing "java" and wc to count lines returned

    0 讨论(0)
  • 2020-11-28 19:38

    Generally speaking, each application will get its own JVM instance and its own OS-level process and each JVM instance is independent of each other.

    There are some implementation details such as Class Data Sharing, where multiple JVM instances might share some data/memory but those have no user-visible effect to the applications (except for improved startup time, hopefully).

    A common scenario however is a single application server (or "web server") such as Glassfish or Tomcat running multiple web applications. In this case, multiple web applications can share a JVM.

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