#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Binary semaphore and mutex


    What is the main difference between binary semaphore and mutex?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    1
    Rep Power
    0
    This comes from a link (which I can't post yet):

    "
    Strictly speaking, a mutex is locking mechanism used to synchronize access to a resource. Only one task (can be a thread or process based on OS abstraction) can acquire the mutex. It means there will be ownership associated with mutex, and only the owner can release the lock (mutex).

    Semaphore is signaling mechanism (I am done, you can carry on kind of signal). For example, if you are listening songs (assume it as one task) on your mobile and at the same time your friend called you, an interrupt will be triggered upon which an interrupt service routine (ISR) will signal the call processing task to wakeup.
    "

    Regards
    Pieter
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    both used for synchronization but
    semaphore used in child process and mutex is used in thread.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    3
    Rep Power
    0

    Smile Difference between binary semaphore and mutex


    * Binary semaphore if the lock is not available, respective process will be stored in its own wait queue but in case of mutex they don't have its own wait queue and it should give the thread to the scheduler and the scheduler will execute the program when the CPU is free or when its turn comes.

    * Mutex have ownership (owners can only release the lock) but the semaphores don't have the ownership over the process (if the process is completed the lock will be automatically released).

    Please correct me if i am wrong.

    Regards,
    Sathishkumar.

IMN logo majestic logo threadwatch logo seochat tools logo