 <p>I had answer it in another topic, here is my answer: You are using fork(). It creates a process that is a exactly copy of your actual process, but it don't share the same memory. If you use threads all the memory addressing is going to be shared and you need to synchronized the access to the shared memory position in order to satisfy the data's consistency.</p>