Semaphores

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024

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

  • @murshedaziz3742
    @murshedaziz3742 2 года назад +87

    This channel is a blessing. During my undergrad, I used to refer to your videos to clear out my doubts. Now doing the same in my postgrad. Why on earth teachers can not teach like this.

    • @yajie7756
      @yajie7756 Год назад +2

      Some teachers just try to talk for how long a lecture lasts...

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

      Capitalized Education 👍

    • @shamveerapan2875
      @shamveerapan2875 10 месяцев назад

      Cause they want to complete the portion.... they too want to make the students clear. ..but some can't because they dont know.. and many can't because they dont have much time.. they can give you only a outline...what to do???. Its out fate.. 😅😅😇😊😉

  • @abdelghanimoumen2524
    @abdelghanimoumen2524 Год назад +163

    This perfect mini-course is better than my college's 10 hours course

  • @elmass3662
    @elmass3662 3 года назад +55

    NESO academy really be pulling through. Thank you so much sir!

  • @bagos1997
    @bagos1997 3 года назад +467

    If anyone is confused from the word Semaphore know that in Greek the word Σημαφόρος (Semaphoros) means Signal-bearer. Hope that helps.

    • @omardumet120
      @omardumet120 2 года назад +31

      we call traffic lights "semaforos" in Spanish lol

    • @shivamxsingla
      @shivamxsingla 2 года назад +2

      @@omardumet120 lol

    • @sasankv9919
      @sasankv9919 2 года назад +4

      Thanks, this opened up lot more meaning to this concept

    • @manuelconte2127
      @manuelconte2127 2 года назад +6

      in italian "SEMAFORO"

    • @189Blake
      @189Blake Год назад +2

      @@omardumet120 Yeah, my language is Spanish and when I heard the concept it was rather logical to know what it does

  • @nojoodothmanal-ghamdi1026
    @nojoodothmanal-ghamdi1026 2 года назад +14

    Thank you so much the idea is clear now, I cannot express how much you helped me

  • @tanish_mavi
    @tanish_mavi Год назад +3

    Best explaintion of semaphoros on the entire Internet. Thank you so much sir

  • @rupambiswas953
    @rupambiswas953 Год назад +2

    Became a fan of this channel, it saved my degree 🙏🙏💙💙

  • @rohitkandula8493
    @rohitkandula8493 11 месяцев назад +1

    One an only king for Operating Systems🔥🔥🙏🙏

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

    Djiktra himself explaining the Semaphore. Thanks

  • @dharanyuvi6951
    @dharanyuvi6951 2 года назад +6

    Legendary explanation .., thank you champ

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

    Best explanation on RUclips.

  • @captureit4410
    @captureit4410 3 года назад +6

    saviors for engineering students

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

    what an amazing explanation thankyou so much neso academy it is very heplfull !! thankyou again

  • @khangpiano549
    @khangpiano549 2 года назад +2

    Thank you

  • @divyasrisatyavada965
    @divyasrisatyavada965 2 года назад +2

    Wow what a explanation sir .I am very cleared about this topic after watching your video thank you so much for such a valuable information sir

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

    Great video🙂

  • @darshil-oh2le
    @darshil-oh2le 10 месяцев назад +1

    Nicely Explained 👌👌

  • @coding_unicorn2
    @coding_unicorn2 Год назад +2

    Well explained 🧡

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

    really awesome.

  • @aiqabusov6926
    @aiqabusov6926 2 года назад +2

    Great Content

  • @YuganNimsara
    @YuganNimsara 25 дней назад

    was really helpful. thank you very much.

  • @DopetheKid
    @DopetheKid 2 года назад +2

    SIR YOU ARE GREAT

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

    neso, you are saviour🙌

  • @MatheusSilva-dragon
    @MatheusSilva-dragon 2 года назад +1

    Damn! THANK YOU!
    You guys always help me!

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

    Amazing Explanation Sir..
    Thank you so much 💓💓🥰🥰

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

    What if s=1, hence both P and V execute simultaneously and during s++ and s-- we face the original producer consumer problem and instead of s being 1, takes value 0 or 2?

  • @amanprajapati6301
    @amanprajapati6301 7 месяцев назад

    very valuable lacture for us thanks you 🤩

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

    very nicely explained. Thanks

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

    very good explanation

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

    why test and lock is a hardware solution? we also used a variable Lock, whereas semaphore is software solution

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

    Well elaborated

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

    Thank you so much for this video.

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

    Best explanation ever🤌🤌

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

    sir you are the best

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

    Very very amazing thank you

  • @muhammadmaawaz1221
    @muhammadmaawaz1221 8 месяцев назад

    Thanks

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

    Nice 😊☺️👍👍

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

    What problem is there in critical section problem?

  • @nilou-s8l
    @nilou-s8l Год назад

    Are sem_signal and sem_post the same thing? I’m a bit confused

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

    It's wrong. In semaphore loops are not present. To avoid busy waiting symbols are used .

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

    🙂 hi.. holaaa... Good to be here again 😇

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

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

    I have a doubt. Let's say I am using s=1 and have 4 threads(t1,t2,t3,t4) that I want to allow in the critical section one by one. Now let's say t1 is scheduled first and it passes the while condition. But what if at this very moment(i.e before t1 can do s--) context is switched and t2 now checks while condition and also passes through. Now, we have two threads t1 and t2 that can enter the critical section which we don't want. Isn't this a problem? The only way it would work is if entire wait() can be atomic. But i don't think any language supports atomic blocks or functions.

    • @AMITKUMAR-dj2fv
      @AMITKUMAR-dj2fv Год назад

      In the beginning of the video, sir told that both wait and signal is an atomic operations.

  • @huhhzy
    @huhhzy 9 месяцев назад

    👍

  • @01.abhishekkumar33
    @01.abhishekkumar33 2 года назад +1

    I am your big fan joshy sir ,you are my hero sir ,can you please give your no sir

  • @jiangzhenni741
    @jiangzhenni741 11 месяцев назад

    you are my daddy from now on

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

    S-- can never happen if S is already 0. If P1 set S to 0. If P2 did P(), it will be stuck in loop forever and can never make S as -1. The code belongs to binary semaphore and not true for counting semaphore that can take negative values. The code in P() should be while(S==0) instead.

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

      have been thinking about this for an hour now. just realized he said the initial value of S is assumed 1.

  • @diassaiynov8360
    @diassaiynov8360 Год назад +7

    too much unnecessary information

    • @aun5252
      @aun5252 4 месяца назад

      Just skip that man he clears all misunderstandings if anyone has. You should thank him for teaching freely

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

      @@aun5252100%

  • @karamvirsinghbatra9646
    @karamvirsinghbatra9646 10 месяцев назад

    mera naam puss hai

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

    bad, you need animation or history, ... something like that. Don't talk so much

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

      Then what are the subtitles added for ?

  • @kavyabanka4482
    @kavyabanka4482 3 года назад +11

    Please send memory management in you tube not only in neso fuel please release in u tube

  • @klaik30
    @klaik30 2 года назад +8

    The point of mutex is to lock a critical section so that it is thread safe but the call for P() itself is not, right? If two processes each read the check for S they will both see that S > 0 and continue to both run S--. How is this accounted for? I dont think the video talked about this specific scenario?

  • @hetaeramancer
    @hetaeramancer 3 года назад +53

    Wow a new video on OS, finally I can continue my learning on OS that has begun since 2018 LOL

  • @ashishchawla9035
    @ashishchawla9035 2 года назад +7

    But as the critical section can only be accessed by one process at a time so how two processes are entering the critical section at the same time and using it in counting semaphore?

    • @ahmedrateb5867
      @ahmedrateb5867 5 месяцев назад

      Counting semaphores are a generalisation of binary semaphores, whereas binary allows a maximum of 1 process to enter the critical section, counting allows up to n where n is a positive integer

    • @SOWProgramming
      @SOWProgramming 4 месяца назад

      Counting semaphores are used when processes need to access a resource which has n instances, so N processes can access that resource.

  • @alokendughosh7013
    @alokendughosh7013 2 года назад +14

    This presentation is too good.
    Understood it perfectly. Thank you so much sir❣️

  • @eswarpethraj9099
    @eswarpethraj9099 3 года назад +7

    In counting semaphores, if S is set to 4, then 4 processes enter the critical section at the same point of time, how it's possible because only one process can access the critical section. And what do you mean by an instance of a resource? Any example with c++ 20 code using counting semaphores.

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

      Same doubt .if you know plz explain

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

      S is set to 4 means there are 4 instances of the resource so 4 processes can enter in critical section at once.

    • @wasalawyer.1179
      @wasalawyer.1179 3 месяца назад

      does that violate Mutual Exclusion principle?​@@apurvkumar1808

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

    How can a Resource have multiple instances?! What kind of Resources are you talking about?

  • @Makerelax444
    @Makerelax444 16 дней назад +1

    IN COUNTING SEMAPHORE :
    Two processes goes to critical section at same time then it disobey mutual exclusion.
    How it is a solution

  • @Account-fi1cu
    @Account-fi1cu 2 года назад +5

    Thank you!

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

    well explained.

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

    Thanks a lot for your clear explanation , Is there any
    video for MUTUX?

  • @mihneapostoaca5044
    @mihneapostoaca5044 2 года назад +13

    You are a master,sir!Great job!

  • @venkataswamykadiyam977
    @venkataswamykadiyam977 3 года назад +6

    Sir, please upload remaining videos in youtube. We can't be able to take screenshots of the lectures in neso app to revise them whenever we want...

  • @Lawleit_L
    @Lawleit_L 11 месяцев назад +2

    But what is the different between locks / semaphores and the other algorithms that we have seen like FCFS, RR and SJF , because all of them are synchronize and arrange the prosses.

  • @Bearded_Dragon_Sir
    @Bearded_Dragon_Sir 2 года назад +2

    Thanks!

  • @kerematasen399
    @kerematasen399 2 года назад +4

    Best explanation ever.

  • @fullstackcourse
    @fullstackcourse 5 месяцев назад +1

    You're the best!!

  • @nguyeninhan8542
    @nguyeninhan8542 11 месяцев назад +2

    this is absolutely better than my university's course

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

    always the best

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

    Thanks for this valuable video 💗

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

    Why is there no while loop in signal's def. i mean if it's a binary semaphore and is already 1 won't it overflow ?

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

      S never exceeds one in binary semaphore , because to access the critical section wait operation is done. And after accessing signal operation is used . As signal and wait operations are used indivisibly , Semaphore value doesn't overflow , it remains between 0 and 1.

  • @HabibiTau
    @HabibiTau 20 часов назад

    Best way to cover syllabus in less time is to watch your videos.

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

    So tough:(

  • @ahmedrateb5867
    @ahmedrateb5867 5 месяцев назад +1

    Outstanding, makes it so easy and the way it s presented is great

  • @zero4one-A13
    @zero4one-A13 5 дней назад

    I'm watching this video for tomorrow my os exam lol

  • @mohammadadrees5263
    @mohammadadrees5263 2 года назад +2

    Thank you sir. explained very well.

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

    All the videos are great, only the lacking thing is coding part.

  • @samarthtandale9121
    @samarthtandale9121 Год назад +3

    To prevent/protect a shared resource from being accessed by multiple processes at the same time we use Semaphore S, and wait() and signal() operations. But for wait() and signal(), again, the Semaphore is shared resource and they have critical section in them, so we have to again implement mutex for Semaphore S and so on. So, If you got what I just said, to solve a problem of mutex, we are generating another problem of mutex and that will recursively generate another and so on... So how do you solve this problem or where exactly did I go wrong?

    • @Mehraj_IITKGP
      @Mehraj_IITKGP Год назад +2

      You are correct that using a semaphore to protect a shared resource can introduce its own synchronization issues, particularly if multiple threads or processes need to access the semaphore itself. This can lead to a problem known as "semaphore contention," where threads or processes contend for the semaphore itself, rather than the shared resource it is protecting.
      To address this issue, it is important to carefully design the critical sections for the semaphore and ensure that they are as small and simple as possible. In particular, the critical section for the semaphore should be limited to the code that directly modifies the semaphore's value, such as the wait() and signal() operations.
      One common approach to minimizing semaphore contention is to use a variant of the semaphore known as a "spinlock." A spinlock is a type of lock that repeatedly checks the value of the semaphore in a loop until it becomes available, rather than blocking the thread or process. This can reduce the overhead of context switching and thread synchronization, particularly in high-concurrency environments.
      Another approach to reducing semaphore contention is to use techniques such as "reader-writer locks" or "lock-free algorithms," which are designed to allow multiple threads or processes to access a shared resource in a more fine-grained and efficient manner, without relying on traditional locks or semaphores.

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

      @@Mehraj_IITKGP Thank You very much for taking time to resolve my doubt !!!

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

      @@Mehraj_IITKGP wow , wrote an long ass para for solving a strangers doubt

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

    How could we ensure that S will never be altered from different sources simultaneously?

    • @raaj7256
      @raaj7256 2 года назад +2

      It's because they're atomic. I guess they're internally atomized using test_and_set or compare_and_set, and my faculty told test_and_set and compare_and_set cannot be called at the same time, there for you can't really call them at the same time (Don't know if the "cannot be altered part" is correct though).

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

      ​@@raaj7256 Thank you for your answer!! I have to learn how atomic works.

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

    Is there any platform to get the notes of the lectures?

  • @farahmohamed2104
    @farahmohamed2104 10 месяцев назад +1

    The session is too good. and precise Helps to understand very clearly. Thank you

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

    very well explained sir.Thank you so much

  • @huhhzy
    @huhhzy 9 месяцев назад +1

    i really appreciate you

  • @abdi.
    @abdi. 2 года назад +1

    thx dawg, gotta exam this morning. this really helped

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

    one of the best explanation.

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

    God level explanation💥👌

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

    Great explanation ❤

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

    ive learnt more things from neso academy (and other youtube tutorials ) than in UNI

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

    Excellent and crisp explanation. Thank you.

  • @aboudejeber1976
    @aboudejeber1976 2 года назад +6

    Thank you sir , that's the explanation i was looking for 🌹

  • @MrMaschine999
    @MrMaschine999 9 месяцев назад

    Why is it possible for different processes to be in the critical section for counting semaphores? I thought you sad we only want one process at a time in the critical section. Did I misunderstood something?

  • @akarshta8087
    @akarshta8087 8 месяцев назад

    good

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

    In counting semephore..mutual exclusion is not followed..then how is it solving critical section problem?

  • @manoharacharyasakec
    @manoharacharyasakec 4 месяца назад

    7:21

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

    please make me understand why S-- is there pleaseeeeeeeeeeeeeeeeee

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

    damn, my professor literally took months to explain this simple concept

  • @Abhishek-fc2cj
    @Abhishek-fc2cj 2 года назад

    Plz upload all lectures on youTube 🙏

  • @leducphuclong
    @leducphuclong 10 месяцев назад

    Thank you so much !!

  • @user-ytuser
    @user-ytuser Год назад

    very nice explanation

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

    Really it's awesome