I am trying to understand why the output of this program always starts with 012xxxxxxx
Here is the code:
int main() {
int i;
for (i=0; i<2; i++) {
fork();
printf("%d", i);
}
printf("2");
}
I sketched the process graph:
But I don't understand how this output is possible. Could someone help me see why this is always the case.