Before understanding synchronization primitives, we need to understand critical section. Critical section is part of the execution path of a thread that must be protected from concurrent access in order to maintain some invariants. Critical section is not a synchronization primitive in itself but relies on synchronization primitives.
Synchronization primitives are simple software mechanisms that are provided by the underlying platform (the OS). They help in multithreading the kernel. Synchronization primitives internally use low-level atomic operations, as well as memory barriers. This means that users of synchronization primitives don't have to worry about implementing locks and memory barriers themselves. Some common examples of synchronization primitives are locks, mutexes, conditional variables, and semaphores. The monitor is a higher...