Its obvious that when a program is exec’d kernal basically replace the current one with the exec one and it uses the same address space for the execution.If the newer one is small in size then there would be no issue.So my question here is what happens when we exec a program larger than the address space of older one.
Its obvious that when a program is exec’d kernal basically replace the current one
Share
In Linux address space of a process that does exec() is replaced with a new one that is big enough for executed binary. I guess the same is true for other operating systems. And it’s reasonable. If an address space wouldn’t be replaced, then a program you execute inherits all your memory mappings (including shared), libraries that are mapped to your address space (and new program probably doesn’t need them), files and so on. It’s a bit odd.