Linux process synchronization
If I have two processes I created (let's say I forked), and both are doing something like:
The printouts never overlap. Instead each line is nicely printed.
printf("my pid is %d\n",getpid());
This means that there is some kind of synchronization mechanism, protecting the stdout.
My question is how exactly is this done?
if I run ipcs -s, I will see no semaphores in the system, but if I write a code which pause() upon a signal, and attempt to synchronize processes with the signal, my printouts will eventually deadlock (and ipcs -s will show one semaphore...).