Groups | Search | Server Info | Login | Register


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

Re: how JVM works

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

Show all headers | View raw


On 04/13/2011 05:36 PM, Roedy Green wrote:
> On Wed, 13 Apr 2011 17:31:41 -0400, Joshua Cranmer
> <Pidgeot18@verizon.invalid>  wrote, quoted or indirectly quoted someone
> who said :
>
>>
>> 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.
>
> so every loaded DLL is visible to every process?? And appears at the
> same virtual address to every process?

No. Each process has its own virtual memory space. DLLs try to load to 
the same virtual address, but can be shunted to other positions if 
necessary. The OS kernel plays some games to try to share the virtual 
memory taken up by a DLL between multiple processes if possible.

In essence, the low-level architecture that most program sees is, by and 
large, a complete fabrication; the processor and the OS kernel play a 
lot of tricks to make this fiction actually work. A process's model is 
that it is the only thing that exists in memory, and it gets to use all 
of the "memory" and other resources dedicated to it by itself. The OS 
kernel and hardware conspire to make this work by having the kernel 
provide tables to list what memory a process actually has access to, 
which the hardware uses to map virtual memory onto real memory.

> So DLLs are all public?  Any process can examine the code of any
> loaded DLL?

Hell no, that would be a security risk. A process only gets access to a 
DLL if it loads it itself. Except if the DLL is loaded in memory, some 
of that memory may be mapped to multiple processes at once.

-- 
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