Test and Set Lock

Поділитися
Вставка
  • Опубліковано 23 жов 2024

КОМЕНТАРІ • 81

  • @alandaniels2095
    @alandaniels2095 2 роки тому +78

    Hey guys a dope analogy for y'all, assume the critical section as washroom and people wanting to get in as the process. When you want to get in you check if it's locked if so you wait, else you get in, lock it and do the thing and get out unlocking the lock.

    • @philly2k148
      @philly2k148 Рік тому +1

      I was just thinking the samething lol

  • @CyberJuke5
    @CyberJuke5 Місяць тому +4

    I needed to watch it again to understand it very well. It's amazing how this code works and how someone managed to create it from scratch. Great content btw

  • @avneeagarwal1044
    @avneeagarwal1044 2 роки тому +22

    Thanks a lot Sr, for these videos......, they are like another form of Galvin book but in a very simpler way, u saved me from reading the long long chapters of galvin at the exam time !!🙏

  • @shadespirit11
    @shadespirit11 2 роки тому +44

    For the people who are wondering why the same problem of concurrency wouldn't take place with the atomic operation (because saying that it just won't interrupt is not sufficient and wouldn't oblige one process calling the Test-And-Set at the same time to wait for another one to make the same Test-And-Set call) is just because the definition of an atomic operation is not only it being uninterruptible, but also (since this is a hardware based solution; and this is the part that the video doesn't cover) the fact that atomic operations translate to CPU hardware bus locks so that other CPU physical/logical cores won't be able to do the same operations. Think of it as a smart CPU who wouldn't allow its cores to do the same task (as in: that same tagged operation in the assembly level; which is the atomic operations 'Op') in a concurrent manner, and instead would let them wait for the bus #LOCK to be clear again to allow such execution of 'Op'. (From Intel: Intel processors provide a LOCK# signal that is asserted automatically during certain critical memory operations to lock the system bus or equivalent link)

    • @eylulmood4830
      @eylulmood4830 2 роки тому +3

      what makes a solution hardware solution and software solution?

    • @markoantonijevic9683
      @markoantonijevic9683 Місяць тому

      So in extremely simplified terms, while the atomic operation TestAndSet() is called and executing, it sets the #LOCK signal on the physical bus connecting physical/logical cores of the CPU, effectively banning them from executing the same operation?

  • @Mohamed-baroudy
    @Mohamed-baroudy 3 роки тому +5

    From Egypt, You Are A Great Person

  • @thepowerofpositivethinking2593
    @thepowerofpositivethinking2593 2 роки тому +5

    I can say one thing your real teacher and genius

  • @dreamrj3365
    @dreamrj3365 21 день тому +1

    Thump up. You explain in just wonderful way. Keep going

  • @Jose-cp4tj
    @Jose-cp4tj 2 роки тому +5

    Great video!! i have an exam tomorrow and this is so helpful. Greetings from Argentina!

  • @Haseebkhan-yd9ud
    @Haseebkhan-yd9ud Рік тому +4

    I have my OS exam Tomorrow,thank you so much , l❤️ from Pakistan🇵🇰

  • @HabibiTau
    @HabibiTau 25 днів тому

    Best video. Thank you very much.
    Ur videos must be getting a lot of traffic now, as it is time of our mid term exams :)

  • @jatingarg1897
    @jatingarg1897 3 роки тому +8

    Thanks for starting Operating Systems Again ♥️

  • @modemharikumar9232
    @modemharikumar9232 3 роки тому +19

    thanks for uploading at freely even they are paid courses

  • @vijaylaxmikilledar427
    @vijaylaxmikilledar427 Рік тому +2

    Thanku so much sir for making such simply understandable video... It's very helpful to all student.. 😊

  • @yusuf-ue5be
    @yusuf-ue5be 2 роки тому +2

    thank you sir, please we need a video about SWAP instruction please !!

  • @farahmohamed2104
    @farahmohamed2104 11 місяців тому

    Amazing explanation

  • @AhmedMagdyS19
    @AhmedMagdyS19 17 днів тому

    For those who don't know how we need hardware support:
    The atomicity is not done using the provided C code, but it is done using special Assembly instructions and the provided C code is for educational purposes only (The C code here is considered pseudocode).
    (Not sure if my comment is correct but it seems logically to me after doing some research)

  • @jenijoseph6477
    @jenijoseph6477 3 роки тому +1

    owesome explanation. Many thanks

  • @NiranjanND
    @NiranjanND 8 місяців тому +2

    3:27 understood everything under 30 second

  • @samuelko2400
    @samuelko2400 Рік тому +1

    You are awesome! Thank you so much

  • @knowledgeshop9892
    @knowledgeshop9892 4 місяці тому +1

    You mentioned SetAndTest function has to be atomic in order to implement this solution, but does not cover how this function is going to be atomic. It would be better if you add the atomic functionality code too in this video.

  • @ripalnakiya
    @ripalnakiya 3 роки тому +1

    Sir please make a video on THIS pointer and and also chaining of functions...I've gone through many yt videos and Google articles....but I couldn't find through which I could understand it

  • @learningpoint19
    @learningpoint19 3 роки тому +1

    Best Explained

  • @yasinkaya9038
    @yasinkaya9038 3 роки тому +2

    i have followed a few couse of neso academy which were full free and i appriciate them and also share with my friends. but i shocked when i saw this paid course. making them paid cause lost your community, since there many people (like stutdent etc) can not afford. you can think over alternative revenue models like adding advertisment etc. i hope you publish whole serias as free soon.

    • @abhiie18
      @abhiie18 3 роки тому +5

      99 rupees per month is not costly brother and they provide all other courses as well, they are teaching this concepts from Galvin so quality of resources is also best :p

  • @Xoro162
    @Xoro162 3 роки тому +6

    Please upload all videos of chapter 6,7,8 quickly i have papers next week

    • @nesoacademy
      @nesoacademy  3 роки тому +6

      They’re already available on our app and website. Please access them there.

  • @esamm5527
    @esamm5527 8 місяців тому

    first of all Thanks for your efforts.and please I need the subtitle of the video

  • @susovandutta622
    @susovandutta622 8 місяців тому

    best explanation

  • @周志芳-r3t
    @周志芳-r3t Рік тому

    thank u sir! But I got a question, is test and set a privileged instruction? I check a lot of paper still can't get the answer.thanks for your sharing!

  • @babashankarsn1477
    @babashankarsn1477 3 роки тому +7

    It would be very helpful if you provide link for all your slides to download

  • @hudaankara5616
    @hudaankara5616 2 роки тому +1

    Great work. Well done

  • @nisharathod2945
    @nisharathod2945 2 роки тому +1

    God Bless You sir, you are awesome!

  • @ryanmamboudjemtchemeu4289
    @ryanmamboudjemtchemeu4289 2 роки тому

    Thanks

  • @joematt3575
    @joematt3575 Рік тому

    wonderful
    Thank you

  • @rahulaga
    @rahulaga Рік тому

    Thanks !! when you say Process P1 & P2, do you means two threads ? because else how the lock variable would be shared among them.

  • @samansidhu9450
    @samansidhu9450 Місяць тому

    What if there are two processes and first one gets preempted after storing rv, the same for second one, now both will return false and will enter the critical section?

  • @lmkne3124
    @lmkne3124 2 роки тому

    clearly expained

  • @mdshafi7043
    @mdshafi7043 2 роки тому +3

    There is some bug in the code.In the parameter of the setAndTest() method the type of *target will be of int, because address will always be an integer value.

    • @Kuchhnhinhi
      @Kuchhnhinhi 2 роки тому +2

      It is actually passing by reference. So the thing means that target is passed by reference. Infact target itself is an address and *target is value at that address which is boolean here.

  • @janeduoz576
    @janeduoz576 3 роки тому +4

    How is this h/w based solution. I mean how can we tell whether a solution is h/w based or s/w based ?

    • @aashreykumar9886
      @aashreykumar9886 24 дні тому

      test and set is provided by the hardware as an atomic instruction i.e., multiple processes cannot concurrently perform test and set. This ensures test and set works perfectly which was the drawback of peterson's solution

  • @nikhilchandrareddygajjala7694
    @nikhilchandrareddygajjala7694 2 роки тому

    super explanatiion

  • @talktimewithJohnny
    @talktimewithJohnny Рік тому +1

    Is this also called Mutex?

  • @kirans5212
    @kirans5212 Місяць тому

    While (0) means it will not enter critical section right? @11.10

    • @vanithakancherla3089
      @vanithakancherla3089 21 день тому

      No
      If while ( 0 ) loop becomes false,it breaks loop and enters critical section

  • @learningpoint19
    @learningpoint19 3 роки тому

    Instead of Room sir you should take example of ATM Machine

  • @kanikakhare6430
    @kanikakhare6430 3 роки тому +54

    Why is it called a hardware based solution when we are writing a program to solve it?

    • @sharmilasiram5438
      @sharmilasiram5438 3 роки тому +23

      because atomic operation requires special hardware support

    • @samarthtandale9121
      @samarthtandale9121 Рік тому +3

      I'm not sure but I think it is because for the test and set instructions to be atomic ibm addes it to their instruction set which required to add some new control logic in the processor which is a hardware modification...

    • @CrazyGlobeCreations
      @CrazyGlobeCreations Рік тому +2

      Lack design is embedded to processor i.e definition of the lock ,and the calling is done from your application ,I e being an app developer of you want to use the hardware lock ,you can do it by declaring and initialising a Boolean vareable 'lock' to false ,and pass it as a parameter to the test and set function ,hope it clears your doubt

    • @ChitragaarAshokaraju
      @ChitragaarAshokaraju 21 день тому

      Exactly

  • @unfinishedsentenc9864
    @unfinishedsentenc9864 2 роки тому +2

    what makes a solution hardware solution and software solution?

  • @bhaskarmishra8479
    @bhaskarmishra8479 3 роки тому

    How is it a hardware-based solution?

  • @sandipdas5684
    @sandipdas5684 2 роки тому +1

    I cant understand how lock value is changhed by 1 by target variable ?

    • @abhilashk4607
      @abhilashk4607 5 місяців тому +1

      I think passing by reference

  • @konran2031
    @konran2031 Рік тому +3

    feeling bad for P2 who never got the chance to get executed. RIP

  • @ayeshahabib7925
    @ayeshahabib7925 10 місяців тому

    Can I get slides of the lecture

  • @continnum_radhe-radhe
    @continnum_radhe-radhe Рік тому +1

    ❤❤❤

  • @rajarshimondal6309
    @rajarshimondal6309 3 роки тому

    sir please upload videos on c++ 🙏it is very important

  • @AlanSchooll
    @AlanSchooll 2 роки тому

    There also exist solution to the this problem that satisfies all the three required conditions, you have not uploaded that solution.

  • @amitrajiitIndore
    @amitrajiitIndore 3 роки тому

    Best

  • @nooni213
    @nooni213 Рік тому

    I. Love. You

  • @AdittaMorshed6
    @AdittaMorshed6 2 дні тому

    where's the english subtitle ?

  • @sarangmhase8435
    @sarangmhase8435 2 роки тому +1

    🙏🙏🙏

  • @lakshanchamod1208
    @lakshanchamod1208 8 місяців тому

    😍

  • @angphamminh6247
    @angphamminh6247 3 роки тому

    Can you check your neso app, I can't make a payment until now :(((

    • @nesoacademy
      @nesoacademy  3 роки тому

      We checked, and the app is working fine. Please update the app or try using our website www.nesoacademy.org

    • @angphamminh6247
      @angphamminh6247 3 роки тому

      @@nesoacademy I updated and when I pay with visa card it didn't send me OTP and if i retype my card it will show payment failed

    • @nesoacademy
      @nesoacademy  3 роки тому

      You may also try PayPal as the payment option.

    • @learningpoint19
      @learningpoint19 3 роки тому

      @@angphamminh6247 same with me i tried many time also notify nesso at app

  • @onurcanisler
    @onurcanisler 2 роки тому +1

    *A toilet: Mutual Exclusion.*

  • @KAMLESHSINGH-vr3bl
    @KAMLESHSINGH-vr3bl 6 місяців тому

    6:10

  • @c.d.premkumar6867
    @c.d.premkumar6867 2 роки тому

    Why is this called a Hard Ware solution when it is only a program ? Even Peterson's solution is also a program.

  • @manjunathkotabal
    @manjunathkotabal 2 роки тому

    you should be a Tamilian cuz your accent is same as Abdul Kalam's accent

  • @messi7715
    @messi7715 7 місяців тому

    I love you sir❤
    Will you marry me

  • @LL-oj3cs
    @LL-oj3cs 2 роки тому +4

    Thanks a lot! It's much clearer now.