I always thought that child processes were always executed after the parent process was completed but after running the following program i get results like sometimes only printing parent or child or alternate at first i thought it was the scheduler that was changing the processes but in the task manager even if both are on S state they are still printing so when child processes are executed and when the parent Thank you!
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main (){
int pid=fork();
while (1){
if(pid==0){
puts("child");
}else{
puts("parent");
}
}
}