在了解Linux内核第3版中,它说:
Shared libraries are especially convenient on systems that provide file memory mapping,because they reduce the amount of main memory requested for executing a
program. When the dynamic linker must link a shared library to a process,it does not copy the object code,but performs only a memory mapping of the relevant portion of the library file into the process’s address space. This allows the page frames containing the machine code of the library to be shared among all processes that are using the same code. Clearly,sharing is not possible if the program has been linked statically. (page 817)
我对此感兴趣,想要在C中编写一个小程序来验证,给出两个pid作为输入,例如两个gedit进程,然后从页面帧中获取要共享的地址信息.有谁知道怎么做?从那本书中,我认为来自两个或更多gedit进程的bss段和文本段地址是相同的,这是正确的吗?
最佳答案