Synchronization is an important problem in the design and development of the software, which has been resolved in the object-oriented programming (OOP). However, the implementation of OOP is easy to leads to code-tangling and code-scattering between functional properties and crosscutting properties. Aspect-oriented programming (AOP) can solve the problem of code-tangling and code-scattering, and provide a mechanism of the modularization of crosscutting properties. Synchronization, as a typical aspect, is resolved based on AOP in this paper. Taking the classical producer-consumer problem as a case study, this paper identifies the synchronization as a crosscutting concern, modularizes it as an Aspect and implements the program with AspectJ. The execution result shows AOP can not only resolve the problem of synchronization, but also gain the effect of modularization better than OOP. Furthermore, compared execution time of AOP program with that of OOP program, the result shows that the execution time of AOP is similar to OOP.