Receive all updates via Facebook. Just Click the Like Button Below

What are Semaphores?

Semaphores are IPC mechanism which allow different processes to synchronize their access to certain resources.


Semaphores in Linux


The simplest kind of semaphores is called a binary semaphore and they have two states ( locked or unlocked ).
These act like traffic lights, which allows certain processes to exclusively access certain resources. When a process wants exclusive access to a resource, example: shared memory, they attempt to lock the semaphore associated with that resource. If the semaphore they are attempting to lock is already locked, the caller is suspended, otherwise they are granted to lock.

When the process completes the task, it unlock the resource and any processes that have attempted to lock that semaphore in the meantime are woken up again to attempt the lock again. This way only one process can have access to the resource at once.

In addition, semaphores can also be used as a signaling mechanism.


Related posts:

Advertise here

picture picture

Follow us


- Tech-Tutorials

Like us

About Techcuriosity

I am Telson, the webmaster of and through this site, I share my knowledge and curiosities in the Tech World.

What We Offer

  • What is ..?
  • How to ..?
  • Difference between ..?
  • How .. works?
  • Get in Touch
    UK : +44 77 33 890 678

    picture picture

    Our Partners

  • Website Design Dubai
  • SEO Link Exchange
  • picture