Linux process synchronization
Hi,
If I have two processes I created (let's say I forked), and both are doing something like:
Code:
while (1)
printf("my pid is %d\n",getpid());
The printouts never overlap. Instead each line is nicely printed.
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...).
Thanks.