title: When is heap memory made separate for a process? What happens in the exec system call?
body: <p>please bear with me as I am not good at framing question. and upto best of my knowledge this is not repeated question. and for sure this is not home work.</p>
  
  <p>When we call fork, a thread is created, which shares the heap memory with the parent process. what will happen if I overlay this thread's address space with a different process image (using exec)</p>
  
  <p>1) each segment will be overwritten by corresponding segment of the new process or Is it like, full virtual address space will be overwritten by new process's full address space ?</p>
  
  <p>2) <strong>extra heap memory would be assigned by OS for this new process</strong> ? &amp; heap (shared before) will no more be accessible to new process ?</p>
  
  <p>3) all this confusion is because I don't know whether executable (ready to load) has heap segments or not.</p>