I've been reading on the subject of linkers and executable loaders. However, I have been unable to get a clear answer to the following question:
Any windows process links to atleast a couple dynamic link libraries. These libraries are loaded into the process' mememory space by the executable loader when loads the executable.
So does that mean, that EACH process on my computer (with perhaps one or two exceptions) has it's own instance of kernel32.dll in memory? Meaning that at this moment I have around 12 mB's of Kernel32 in my memory?
It seems like such a waist, and not to mention slow way of loading executables. Because, sure, when it's just kernel32 it'd be ok, but this goes for every DLL. And a basic windows process links to atleast 5 (?) standard DLL's which all have to be loaded into memory seperately for each single process that starts.
Also, that leaves me a bit puzzled with how some of the underlying magic of Windows works. For instance, at some point there will be need to call a driver to do low-level IO stuff (like painting something to the screen). Where is this 'priveledge-switch' made? I would then suspect it to be a SYSCALL (?) in the DLL's.
Anyway, if someone could answer any one of these questions it would be much appreciated. Or if you know any literature/links on the subject that do a good job of explaining further I'd love to know about them.
The way I see it... Well, it's all pretty blurry