when a new process is created using a fork() function, there is a cold start penalty, what is this and why does it happen?
"Cold start penalty" is the penalty for starting a process that has never run. The operating system has to read the code from disk, page tables have to be set up, caches filled in as instructions are executed/data fetched, and so on. If the process has run before, some of the above will already have been set up (and perhaps not fully evicted).
-
$\begingroup$
penalty for starting a process that has never run
even rephrased as a program that has no traces of execution left in the non-permanent machine state, that would apply to a (fork-) exec. I take a fork to create a clone of a process, identical from the inside but for the process id returned by fork. And it does have a start penalty, different from that of another thread. And I think it debatable to use cold in this context. $\endgroup$ – greybeard Mar 1 '20 at 12:33
fork()
's shared state approach, caches all over the memory hierarchy come to mind, starting with address translation. A common combinations seems to be virtually addressed L1 caches with physically addressed L2 (&up), lest it gets too easily comprehensible. $\endgroup$ – greybeard Feb 25 '20 at 19:22