Thread: Mutex and Semaphore

  1. #1
    Registered User
    Join Date
    Nov 2019
    Posts
    90

    Mutex and Semaphore

    I am trying to understand difference between mutex and semaphore in any operating system

    For example, we have two treads T1 and t2, which are sharing the ame resources. Both T1 and T2 can't share resource at same time. If T1 is using resource then T2 has to wait or if If T2 is using resource then T1 has to wait

    I understand that both restrics the resource but I don't understand clearly difference between them ?

  2. #2
    Registered User
    Join Date
    Feb 2022
    Location
    Canada, PEI
    Posts
    64
    Small correction.. Both T1 and T2 can share a resource at the same time if they don't modify the resource or the resource is immutable.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,131
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 11-14-2010, 11:14 AM
  2. Replies: 1
    Last Post: 06-11-2007, 04:59 PM
  3. semaphore or mutex
    By Micko in forum Windows Programming
    Replies: 2
    Last Post: 07-05-2004, 10:39 AM
  4. Producer-comsumer threads using semaphore mutex
    By Kaiya in forum C Programming
    Replies: 3
    Last Post: 04-29-2004, 08:17 AM
  5. Mutex vs. Semaphore
    By cjschw in forum C++ Programming
    Replies: 1
    Last Post: 07-22-2003, 07:03 PM

Tags for this Thread