Groups | Search | Server Info | Login | Register


Groups > comp.lang.java.machine > #2

Re: how JVM works

From Joshua Cranmer <Pidgeot18@verizon.invalid>
Newsgroups comp.lang.java.machine
Subject Re: how JVM works
Date 2011-04-13 17:31 -0400
Organization A noiseless patient Spider
Message-ID <io54nv$8s3$1@dont-email.me> (permalink)
References <mgubq6h0tvmdl29et9cm1t1l8acke7s529@4ax.com>

Show all headers | View raw


On 04/13/2011 03:36 PM, Roedy Green wrote:
> But how does a modern CPU map the various DLLs into the address space
> of a given instance? If they all map to the same slots in a common
> address space of all programs, what stops a program that did not load
> a DLL from using its code if it is visible in its address space?

The standard answer for shared libraries is that the read-only portions 
of the library--i.e., .text, .rodata, etc. are loaded as read-only pages 
in virtual memory, and each process that needs it has a pointer to this 
page. Note that these pages are only created when they are loaded by the 
DLL.

Looking at the PE format, it appears that it isn't PIC, although it also 
appears that being non PIC messes up the page-sharing characteristics.

To make it short: the OS does magic at the virtual memory layer to make 
it work. As far as a process can tell, each process has its own copy of 
the DLL; the OS plays a lot of games to make sure that this lie is 
believable.

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

Back to comp.lang.java.machine | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

how JVM works Roedy Green <see_website@mindprod.com.invalid> - 2011-04-13 12:36 -0700
  Re: how JVM works Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-13 17:31 -0400
    Re: how JVM works Roedy Green <see_website@mindprod.com.invalid> - 2011-04-13 14:36 -0700
      Re: how JVM works Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-04-13 19:26 -0400
    Re: how JVM works Roedy Green <see_website@mindprod.com.invalid> - 2011-04-13 14:42 -0700

csiph-web