Multi-threading with pthreads in Linux