I was looking at another question (https://stackoverflow.com/q/47845/537980), and saw an answer, about how much set up this other OS had to do, for every Process Create.
I got wondering. Would it be possible to do the setup (once, then fork), then do a partial exec to load the variable parts? That is only part of the process should be replaced.
A specific example of partial, would be. We want to load some execution environment, then exec to replace the loader, but not the environment. So this is taking control of what gets replaced (I know that exec does not replace everything (e.g. it keeps a COW of the file descriptor table)).
I realise that this may not have any practical use, as fork
and exec
are relatively cheep on many Unixes.
mmap(PROT_EXEC)
pages from another file into your address space, jump into them, and yuppie! "partial exec". I don't know if you can replicate everything exec does in userspace -- but you certainly can replicate most of it. – Jan 10 '19 at 14:54