So, as I see in this code, there's actually 1 cout object for each process. If a multi-threaded application tries to use std::cout object, will it be safe?
Yes, however if you run this in two different threads:
cout << "Hello World!" << endl;
then the other thread might get to print something in-between "Hello World" and endl, so you can end up with lines like "Hello World!Hello World!".
So in most cases you still have to synchronize cout access.