Consider the following example:
#include <stdio.h> #include <iostream> int main() { std::cout << "Hello "; printf("beautiful "); std::cout << "world!"; printf("\n"); } |
With synchronization, the program prints on a line by itself
Hello beautiful world! : |
Without synchronization, the output gets scrambled.