Don't call getpid a so many times.