I'm studying Windows system internals and the question is just a guess.
I learn that DLL is a form of shared libraries, so at least the code section of the same DLL is shared between processes using it. (By adding the same page entries into the page table of these processes) The code section usually has something like jump tables, which need to be relocated (i.e. write the run-time virtual address to fix the pointer) before it's ready to be executed.
Assume that the same DLL aa.dll
is mapped in two different processes at different virtual addresses. (e.g. a.exe
0x00400000 b.exe
0x00410000) The same pointer (at .text+0x100
) will be fixed into different addresses. (e.g. a.exe
0x00400100 b.exe
0x004100100). So we have to make a copy of the code section and change it to adapt one process. Then how can the code section be shared?
Am I right?