title: How is the code segment shared between processes in Linux?
body: <p>I have read about the copy-on-write principle which occurs when a new process is being forked in Linux.</p>
  
  <p>I have also read about the fact that if multiple instances of one program are running at the same time, only one instance of the program code can be found in the memory.</p>
  
  <p>I was wondering whether this is a direct consequence of the copy-on-write principle or not, and if it is not, what is the process which ensures that no unnecessary copies of the program's code reside in the memory?</p>