In the following code, mutex is an example of this mechanism for synchronization of processes.
    do {    
       wait(mutex);
       critical section
       signal(mutex);
       remainder section
    } while (1);