Semaphore is used to restrict access to shared resources, such as shared memory or to limit the number of processes that may simultaneously use a resource, in a multi-process or multi-threaded environment.

In php using semaphore a process must wait while accessing a shared resource currently used by another process. But this may not be required for all cases. Sometimes we need to just verify whether a resource has been locked and move on. Unfortunately we have no way to check the status of a semaphore lock in php. Let's see how we can implement non-blocking semaphore access in PHP.
Full article (352 words) »