I am playing with function fork() (creating few processes)and trying to put some output (with process id,child id and so on) to the shell and sometimes i get output for 2 proccesses mixed up on same line. sometimes I would get something like this...
myShell$ ./a.out
proccess1 processID...... parentID......childID
proccess2 processID...... parentID......childID
proccess4 processID...... parentID......childID
proccess3 processID...... parentID......childID
myShell$
You see how order of processes is mixed up..
Is this happening because prinff buffers outputs and doesn't send them to screen right away? Does fprintf buffers as well..
Sometimes i would get something like this.....
myShell$ ./a.out
proccess1 processID...... parentID......childID
proccess2 processID...... parentID......childID
myShell$ proccess3 processID...... parentID......childID
proccess4 processID...... parentID......childID
Cananyone help me understand what is happening please