Lock the resource while writing the process to the cfg file.
It's for avoiding the conflict.