semaphore is like a key one who have it can use it.
I will give u example.....if two concurrent threads are using the same variable race condition can persist but if u use semaphore
at one time only one thread can have access to it.
just try to understand the concept of Automatic variable....same way semphores are used.
Used in verification.
Most famous example is memory read and write operation.
If you are doing memory read and write operation to same address from ur verification env,but the dut can allow only one operation at a time.
So semaphore gives you the keys like a car keys.Many drivers may be there to drive a car ,u got only one key.so get the keys, do ur work,put back the keys so some one can use it..