It's a software engineering problem about race condition, and the purpose of the program is to control p1,p2,p3 program to print 1233->1233 100 times, the only thing can do is add semaphore in origin p1,p2,p3 code.
after compile p1,p2,p3, just type
./p1 &
./p2 &
./p3 &
will work.