Semaphore Vs. Mutex - A Clear Understanding

Поделиться
HTML-код
  • Опубликовано: 15 янв 2020
  • Here you go.. The clear differences between Semaphore and Mutex. All the technical aspects are discussed with examples for each.

Комментарии • 190

  • @bharathiraja6286
    @bharathiraja6286 3 года назад +3

    You saved a lot of time. This clears a lot and lot. Keep doing this!!!

  • @dipanshupayasi790
    @dipanshupayasi790 3 года назад +9

    Thanks for simplifying this in easier manner. I have got doubt, will be glad you can answer it.
    Suppose we have three "writing thread" writing a message into a message queue and one "reading thread" which needs to read the message from the queue. So in this case to synchronize the process we can either go ahead with "Binary Semaphore", which will allow only one thread to read or write at a time or using mutex by locking the resource.
    Now the question is which method should be preferred and why? (in context with RTOS in embedded systems)
    Thanks in advance :)

  • @washiburr9876
    @washiburr9876 4 года назад +9

    Oh my god. Thank you so much. This was confusing me so much when my professor was explaining it.

  • @navya5679
    @navya5679 3 года назад +2

    I finally get what the difference is, after all these years. Will definitely watch this whenever I need to revise.

    • @ShriramVasudevan
      @ShriramVasudevan  3 года назад +4

      Glad Navya. The purpose of my hard work through this channel is getting served when I see these kinds of messages.

  • @celsiusfahrenheit1176
    @celsiusfahrenheit1176 4 года назад +12

    God, thank you, you were able to simplify this so well, after watching many videos and reading other resources I finally got it.

  • @hrishibhagat3281
    @hrishibhagat3281 2 года назад +5

    Best way to differentiate between mutex and semaphore Thank you Sir ! Finally I understood Diffeernce between them

  • @SkandanKA
    @SkandanKA 3 года назад +3

    This was so precise and highly effective..
    Please continue making more and more videos..
    Thanks a lot ❣️

  • @profdurgahere9007
    @profdurgahere9007 2 года назад

    This is one of the best. Hatsoff!

  • @techhunter877
    @techhunter877 4 года назад

    Thanks. This is very informative

  • @sbanavasi
    @sbanavasi Год назад +1

    Thank you Dr.Shriram for the very simple and crystal clear presentation on differences between semaphores and mutex. I look forward to your presentation on oneAPI Hands-on Workshop- Let us SYCL. Thank you

  • @zach6383
    @zach6383 3 года назад +3

    Great explanation and clear english, Thank you!

  • @vishalyadav1064
    @vishalyadav1064 3 года назад

    Thanks a lot. It was little confusing before. Such a clear explanation in this video

  • @ravikumarsivasankar2735
    @ravikumarsivasankar2735 3 года назад

    Thanks Shriram Vasudevan. The video is very simple and easy to understand. The real life examples are very good

  • @stith_pragya
    @stith_pragya 4 месяца назад +1

    Jai Shree Ram🙏🙏🙏🙏🙏🙏🙏🙏🙏
    Excellent explanation...Thanks a ton for the video🙏🙏🙏

  • @cheeku5568
    @cheeku5568 4 года назад

    really it was a clear cut lecture...thanks for the nice session...keep posting such clear cut lectures

  • @saadmanahmed860
    @saadmanahmed860 3 года назад

    a very good illustration. thanks for such great tutorial

  • @anasalamin84
    @anasalamin84 3 года назад

    thanks (Shriram Vasudevan) alot for the best explanation that i found on the web
    I like the symbols you used and the direct simple language you use

  • @ravikishorepochiraju6973
    @ravikishorepochiraju6973 Год назад

    Excellent Explanation Appreciate the effort, Thanks and GoodLuck for other Vids

  • @CosmJJ
    @CosmJJ 24 дня назад

    Thanks a lot! Crystal clear explanation

  • @erigelavani4162
    @erigelavani4162 3 года назад +1

    Sir your explanation is very clear and understandable 👌,Thank you sir keep doing more videos sir.

  • @bandarulekhana2678
    @bandarulekhana2678 3 года назад

    Now i am very very very clear about this topics sir thank you thank you so much sir .......keep going and help the people like us 🙏🙏

  • @jankeshchakravarthy9389
    @jankeshchakravarthy9389 6 месяцев назад +1

    Hi Shriram - Nice and very clear video describing the concept of mutex vs. spin locks vs semaphores. I have couple of follow up question/requests
    1. Can semaphore, mutex, spin locks work across the processors? For example, if the mutex used by two threads running two different CPUs, will it work?
    2. What is the underlying assembly instructions for spin locks? You can take type processor, like ARM.

  • @SSi934
    @SSi934 29 дней назад

    Excellent Teaching - So simple.

  • @sumitnaik1990
    @sumitnaik1990 2 года назад +1

    Is it possible to use multiple mutex object when multiple resource are present ?
    If yes then why we need Semaphore ?

  • @Joyddep
    @Joyddep 2 года назад

    Thank you Sir, really clear explanation!

  • @UdayKumar_G
    @UdayKumar_G Год назад

    Simple and crisp explaination . Thanks :)

  • @techforall9859
    @techforall9859 2 года назад

    Excellent! The best! Superb.

  • @rathanhv4676
    @rathanhv4676 3 года назад

    As a fresher it helped me to understand the concept clearly please add more videos on threads.

  • @chaitanyapai8245
    @chaitanyapai8245 3 года назад

    Awesomely explained sir. Thank you

  • @2109abhishek
    @2109abhishek 3 года назад

    best video on youtube to understand the Semaphore and Mutex

  • @ozanh
    @ozanh Год назад

    Brilliant explanation sir. It helped me a lot on my RTOS project.

  • @teamqis7382
    @teamqis7382 2 года назад

    Woowww. Very easy and excellent insights.

  • @asharafperinchikkal6103
    @asharafperinchikkal6103 2 года назад

    Nice man ..you did great job 👍

  • @nathand256
    @nathand256 2 года назад

    Insightful! Thanks

  • @aayush5474
    @aayush5474 3 года назад +1

    Isn't Mutex and Binary Semaphore the same then because both will allow only one process to access the resource at a time?

  • @sakshiwahi2025
    @sakshiwahi2025 Год назад

    This was the best!

  • @ssrmurthysaka6324
    @ssrmurthysaka6324 3 года назад +1

    Can we call binary semaphore as a mutex? Because counter value 1 means resource is available when counter is 0 resource is blocked for one process.

  • @nikolayd4384
    @nikolayd4384 3 года назад

    Thank you, sir!

  • @anillone9094
    @anillone9094 Год назад

    sir, can we use semaphore for both thread and process? or can we use mutex for both thread and process? means is there any rule that semaphore should be use with process or mutex should be use with thread?

  • @shreyashachoudhary480
    @shreyashachoudhary480 Год назад

    Loved it!

  • @Adiksha08
    @Adiksha08 Месяц назад

    Excellent explaination

  • @MegaUncleDrew
    @MegaUncleDrew 3 года назад

    Now when would you choose a binary semaphore over a mutex?

  • @whistlingpalms2240
    @whistlingpalms2240 2 года назад

    Thanks a lot sir... Very helpful...

  • @yihan4835
    @yihan4835 4 года назад

    Very clear explanations.

  • @mnbvcxz1621
    @mnbvcxz1621 2 года назад

    simple and neat, please provide more examples.

  • @umeshtiwari9249
    @umeshtiwari9249 2 месяца назад

    clear all doubts in semaphore and mutex. thanks Sir

  • @Amunisify
    @Amunisify 3 года назад +1

    You have explained it so clearly! I have one question if semaphore and mutex are different then in book “Operating System Concepts” there’s a Bounded buffer problem. In that they have taken three semaphores. And one semaphore is “semaphore mutex = 1” how’s that possible? Can you/anyone explain?? Please.

  • @Pages_Perfected
    @Pages_Perfected 2 года назад

    any summary?

  • @naveendoki3667
    @naveendoki3667 Год назад

    Very good explanation !

  • @rohitjadhav512
    @rohitjadhav512 2 года назад

    Great explanation n English tooo

  • @sreevanijalagari3863
    @sreevanijalagari3863 2 года назад +1

    that was super clear!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @TheSoorajthevally
    @TheSoorajthevally 3 года назад

    Hello Shriram .. Clean explanation.

  • @user-bn4up9rt1z
    @user-bn4up9rt1z 6 месяцев назад

    What happens in case of mutex when we have mutiple resource?

  • @sstech6695
    @sstech6695 4 года назад

    Nice. Concise.

  • @TheCoolharry123
    @TheCoolharry123 Год назад

    Process and thread word used interchangeably here. Mutex and semaphore used for synchronizing threads in a process. Mutex and semaphore not available across multiple process.

  • @vinothkannanr2804
    @vinothkannanr2804 3 года назад

    such a great video

  • @kotamuralikrishna6851
    @kotamuralikrishna6851 Год назад

    In ubuntu how to change fonts(tamil, telugu) settings to display

  • @selflearner8895
    @selflearner8895 2 года назад

    Thank u sir🙏

  • @archanao4143
    @archanao4143 3 года назад

    thank you Soooooo much sir
    And plz explain abt spin locks also sir.. Plz

  • @adityasahu96
    @adityasahu96 2 года назад

    woah nice explaination !

  • @VagaDuo
    @VagaDuo 3 года назад +5

    Thank you so much for clear explanation.
    I have one question: In you last point, you told:
    - When more than one resources available: use Semaphore (that should be counting semaphore).
    - When only one resource available: use Mutex.
    Can we not use binary semaphore instead of mutex? Why mutex is preferred over binary semaphore?

  • @ankammaraochintala2509
    @ankammaraochintala2509 3 года назад +1

    Thank you

  • @balakrishna121
    @balakrishna121 3 года назад

    Lovely explanation

  • @muralinagraj1983
    @muralinagraj1983 2 года назад

    Whether one or more resources we can always use semaphore only rite ? because binary semaphore works good for one resource and counting semaphores works good when there are many resources.
    Why we have to use mutex and get confused when semaphore works for both ?

  • @user-bn4up9rt1z
    @user-bn4up9rt1z 6 месяцев назад

    Is binary semaphore same as mutex?

  • @srikanthgali9424
    @srikanthgali9424 4 года назад +1

    Hi Shriram, I have one query here .. when only one resource is available, which one to choose .. Binray semaphore or Mutex.

    • @ShriramVasudevan
      @ShriramVasudevan  4 года назад

      Hi. For a single resource it is Binary Semaphore preferred

    • @narayansingh-bu5fk
      @narayansingh-bu5fk 3 года назад

      @@ShriramVasudevan in last you have conclude that for one resource mutex is preferred so Now for one resource mutex is preferred or binary semaphore ?

  • @slowedandreverb2079
    @slowedandreverb2079 Год назад

    Which one is better for windows10 and linux?

  • @biprarshidutta1560
    @biprarshidutta1560 Год назад

    Great Lecture! However I was surprised you didn't talk about priority inversion in Mutexes only

  • @arun.s1059
    @arun.s1059 Год назад

    Very good explanation 👍👍👍

  • @Gamechanger..601
    @Gamechanger..601 5 месяцев назад

    Wow... Thanks

  • @indrajansboorlagadda1706
    @indrajansboorlagadda1706 3 года назад

    If we have one shared resource...we can use binary semaphore also instead of mutex...can you tell me where is the exact usage of these semaphore and mutex !?

    • @ShriramVasudevan
      @ShriramVasudevan  3 года назад +1

      Well.. there wont be a fight for the resources

  • @pammidhun
    @pammidhun 3 года назад

    Suppose I have one resource. Then which one I should go for.? Binary semaphore or mutex.?
    Why.?

    • @HritikV
      @HritikV 3 года назад

      Mutex, as mentioned in the video.
      Mutex is simpler.

  • @elumalair5875
    @elumalair5875 3 года назад

    super sir thank you

  • @adigenius04
    @adigenius04 3 года назад

    Woww! Respect++

  • @shivamkeshri9540
    @shivamkeshri9540 3 года назад

    Great great and only great.

  • @AbhijeeetKumarSrivastavakshiva
    @AbhijeeetKumarSrivastavakshiva 2 года назад

    Mutex types?

  • @mostafayasin1
    @mostafayasin1 Год назад

    Thaanks

  • @roshanrajkumar7827
    @roshanrajkumar7827 3 года назад

    Sir can u make a video on virtual memory ...pages and frames??

  • @indramaniarora7901
    @indramaniarora7901 3 года назад

    So isn't it possible to use semaphores everywhere instead of mutex?

  • @adithyashankar6562
    @adithyashankar6562 4 года назад

    Clear explanation. This video is very useful

  • @its_mee_ssr
    @its_mee_ssr 3 года назад

    Nice explanation

  • @allmighty2000
    @allmighty2000 3 года назад +1

    So just tell the MUTEX Is a kind of BINARY Semaphore that’s it , that’s all I needed to know , this subject is so dramatic 😂😂
    BTW thanks a lot for this video , loved this

    • @preethamdasari
      @preethamdasari 3 года назад

      Nope they are not the same thing.

    • @aayush5474
      @aayush5474 3 года назад

      @@preethamdasari In the OS galvin book the author says on some systems binary semaphore is also called mutex lock

    • @askiny6576
      @askiny6576 3 года назад

      @@preethamdasari the way he explained it, they are the same. did he explain it wrong?

  • @engineering1year734
    @engineering1year734 Год назад

    Good video sir

  • @satyamgaba
    @satyamgaba 3 года назад

    Why is mutex better when there are two resources?

  • @roshanrajkumar7827
    @roshanrajkumar7827 3 года назад

    Sir...who takes care of this..??os huh??btw where is semaphore and mutex stored or implemented???????sec men or RAM?

    • @ShriramVasudevan
      @ShriramVasudevan  3 года назад

      OS that is the kernel does everything. You got to code for the semaphore or mutex..it's just a software piece.

  • @sumitkumarsagar6876
    @sumitkumarsagar6876 2 года назад

    nice!

  • @jameysiddiqui6910
    @jameysiddiqui6910 3 года назад

    so binary semaphore is equal to mutex

  • @KRKUN
    @KRKUN Год назад

    Thanks for explaining that was helpful, if you can improve your accent that will be great

  • @TEXOTALKSPRAVEEN
    @TEXOTALKSPRAVEEN 4 года назад

    superb

  • @finalyearprojects4915
    @finalyearprojects4915 2 года назад +1

    Excellent lesson bro learned lot... thank you

  • @hrishibhagat3281
    @hrishibhagat3281 2 года назад

    Sir can I get these slides?

  • @shaikmahammadusman8543
    @shaikmahammadusman8543 2 года назад

    Good explanation but we need more examples binary semaphore and counting semaphore

  • @tushargoyaliit
    @tushargoyaliit 3 года назад

    Nice

  • @adeli583
    @adeli583 3 года назад

    Thanks Sriram Vasudevan. Can I have your email to communicate you for more lessons?

  • @pavanv4115
    @pavanv4115 4 года назад +1

    Please make all os videos

    • @ShriramVasudevan
      @ShriramVasudevan  4 года назад

      Pl check the same playlist. All os contents are there.

    • @pavanv4115
      @pavanv4115 4 года назад

      Threads virtual memory some important topic are not available

    • @ShriramVasudevan
      @ShriramVasudevan  4 года назад

      @@pavanv4115 threads are there. Check. VM i will make soon.

  • @SUNILRAJAK183
    @SUNILRAJAK183 4 года назад

    nice

  • @ayanchakrabarty2595
    @ayanchakrabarty2595 3 года назад

    wow

  • @pea2nuts809
    @pea2nuts809 2 года назад

    Problem is audio is too quiet

  • @ANKURBARUA
    @ANKURBARUA 3 года назад +1

    That's it !! 😂😂😂

  • @arvindg553
    @arvindg553 3 года назад

    Linux devru 💯❤️