title: How to get address information from library to be shared among all processes?
body: <p>In <em>Understanding the Linux Kernel, 3rd edition</em>, it says:</p>
  
  <blockquote>
    <p>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. <strong>This allows the page frames containing the machine code of the library to be shared among all processes that are using the same code.</strong> Clearly, sharing is not possible if the program has been linked statically. (page 817)</p>
  </blockquote>
  
  <p>I am interested in this, want to write a small program in C to verify, given two pids as input such as two gedit processes, and then get the address information from page frames to be shared. Does anyone know how to do it? From that book, I think the bss segment and text segment address from two or more gedit processes are same, is that correct? </p>