This paper discusses an effective synchronization algorithm. It is different from the existing synchronization methods by inserting appropriate synchronization instructions between statements according to different kinds of data dependences. The overhead caused by too many synchronization instructions in a loop can be a critical problem. Synchronization optimization is a method which discriminates and eliminates the redundant synchronization instructions in a loop. In this paper, a new synchronization optimization algorithm - ICPG (Improved Controlled Path Graph) - is developed, and the algorithm is extended to the case of nested loops. In case of nested loops, the existing methods were not safe because of the incomplete management in hyper-rectangle areas, etc. But, the errorneous methods are completely corrected in this paper. Finally, performance analysis using simulation on the UNIX operating system is carried out. It is shown that the ICPG algorithm is much more effective than the existing methods.