Re: DLL load issue
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Thu, 16 Oct 2008 22:07:43 -0700
"Klueless" <klueless@xxxxxxxxxxxxxxxx> wrote:
"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
My question is about on one single machine, no matter how many different
processes need/load a DLL, the DLL is actually load one copy into physical
memory (not virtual memory) or multiple copies.
DLL's are organized into sections, each which can be readonly,
writeable, executable, ... Windows needs single copies of the static
sections. Multiple copies of the virtual memory pages of the non-static
sections are generated after the first writes to those pages.
Right. Put another way, the pages of a DLL are marked as "copy on write".
As long as there are only reads, the original physical page is shared
amongst all process. Once there is a write, the system makes a copy for
the process doing the write.
The
DLL loader tries to fix a DLL to be relocatable, which implies the image
of the executable sections will look the same to all sharing processes.
Addresses are relative to a base register. The value of the base
register may be different for different processes.
This would be handy if it were true. For Win32, at least, it is not true.
Global and static data and function references are all made with absolute
addresses that need to be relocated. The DLL loader can't know which
registers are still available for this kind of use.
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.
- Follow-Ups:
- Re: DLL load issue
- From: George
- Re: DLL load issue
- From: George
- Re: DLL load issue
- From: George
- Re: DLL load issue
- References:
- DLL load issue
- From: George
- Re: DLL load issue
- From: Klueless
- DLL load issue
- Prev by Date: Re: msvcp90d.dll and msvcr90d.dll
- Next by Date: Re: While loop acting weird!
- Previous by thread: Re: DLL load issue
- Next by thread: Re: DLL load issue
- Index(es):
Relevant Pages
|