This program uses a variable semaphore to implement mutual exclusion between two asynchronous processes. Each process has four states: idle , entering , critical and exiting. The entering state indicatesthat the process wants to enter its critical region. If the variable semaphore is false , it goes to the critical state and sets semaphore to true. On exiting itsd critical region , the process semaphore to false again.