In Java, are static class members shared among programs?

前端 未结 7 2015
独厮守ぢ
独厮守ぢ 2020-12-15 19:38

I imagine that no, they aren\'t, because every process has its own memory space, of course.

But how does the whole JVM thing actually work? Is there

7条回答
  •  天命终不由人
    2020-12-15 20:12

    Depends on the implementation, but yes there are ways things are shared. There is/was work underway to change that, and Sun (via Apple) has done a lot of work in sharing data between instances of the VM. There is a link that discusses some of that here.

    To do any sort of sharing requires the VM implementor to do it, you as a programmer cannot do anything to make it happen.

    The VM spec is here, there are some (older) books about it as well. You can also look at the source for Kaffe which is pretty small.

提交回复
热议问题