If you run a couple of threads, but they should all print on the same stdout, does that mean they should wait for each other? so tell me, does all 4 threads have something to write, they need to pause and wait for stdout to be free so that they can continue their work?
Deep deep (deep deep ...) down in the OS system calls, yes. Modern operating systems have thread-safe terminal printing procedures that usually simply block critical sections that actually access the device (or buffer, depending on what you are writing and what its settings are). However, these expectations are very short. Keep in mind that this is the IO you are dealing with, so the latency is likely to be small relative to the actual execution of the I / O.
It depends. If stdout is a pipe, each channel receives a 4 KB buffer, which you can override when creating the channel. Buffers are cleared when the buffer is full or invoked flush().
flush()
stdout , . , , . , , , , .
, , . .
: (, Linux, ). , , .