title: Can a Boolean flag be used instead of a semaphore?
body: <p>Semaphore does the job of signalling whether a resource is free or being used.Can we not replace the same with a boolean flag. How is a semaphore different from flag?</p>