Test and Set Lock

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

КОМЕНТАРІ • 91

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

    From Egypt, You Are A Great Person

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

    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

    • @guts-0077
      @guts-0077 2 місяці тому

      yOU JUST EXPLAIN THE SAME ANALOGY HE EXPLAIN LMAO

    • @xerxes_06
      @xerxes_06 2 місяці тому

      wasnt that "dope". he just explained the same thing in the video using a person working inside a locked room. smh

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

      thanks mate

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

    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

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

    I can say one thing your real teacher and genius

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

    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 !!🙏

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

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

  • @shadespirit11
    @shadespirit11 3 роки тому +50

    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 5 місяців тому

      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?

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

    Thanks for starting Operating Systems Again ♥️

  • @dreamrj3365
    @dreamrj3365 3 місяці тому +1

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

  • @HabibiTau
    @HabibiTau 3 місяці тому

    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 :)

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

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

  • @AhmedMagdyS19
    @AhmedMagdyS19 3 місяці тому +3

    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)

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

    thanks for uploading at freely even they are paid courses

  • @adnanemezrag3809
    @adnanemezrag3809 28 днів тому

    Great Explanation !

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

    3:27 understood everything under 30 second

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

    Thanks a lot. I understood this clearly.

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

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

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

    You are awesome! Thank you so much

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

    owesome explanation. Many thanks

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

    Best Explained

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

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

  • @rumiNITPatna
    @rumiNITPatna 3 місяці тому

    amazing explanation.

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

    Amazing explanation

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

    God Bless You sir, you are awesome!

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

    Great work. Well done

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

    best explanation

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

    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 2 роки тому +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 3 місяці тому

      Exactly

    • @RAJESHKUMAR-bo3ng
      @RAJESHKUMAR-bo3ng 28 днів тому

      Pata nai bc

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

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

  • @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

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

    If it is not satisfying the bounded waiting which is one of the requirement for the solution, how can we say that it is the solution for synchronisation problem. Please explain

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

    wonderful
    Thank you

  • @knowledgeshop9892
    @knowledgeshop9892 7 місяців тому +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.

  • @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.

  • @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

  • @samansidhu9450
    @samansidhu9450 4 місяці тому

    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 3 роки тому

    clearly expained

  • @周志芳-r3t
    @周志芳-r3t 2 роки тому

    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!

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

    Thanks

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

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

  • @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 3 місяці тому

      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

  • @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.

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

    super explanatiion

  • @AbdalrhmanOsama-m9k
    @AbdalrhmanOsama-m9k 29 днів тому

    is not there any questions on every chapter?

  • @kirans5212
    @kirans5212 4 місяці тому

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

    • @vanithakancherla3089
      @vanithakancherla3089 3 місяці тому

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

  • @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.

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

    Is this also called Mutex?

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

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

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

    what makes a solution hardware solution and software solution?

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

    Instead of Room sir you should take example of ATM Machine

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

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

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

      I think passing by reference

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

    ❤❤❤

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

    Can I get slides of the lecture

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

    Best

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

    How is it a hardware-based solution?

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

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

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

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

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

    🙏🙏🙏

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

    I. Love. You

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

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

  • @AdittaMorshed6
    @AdittaMorshed6 3 місяці тому

    where's the english subtitle ?

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

    6:10

  • @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

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

    😍

  • @Nova_Elementum
    @Nova_Elementum 2 місяці тому +1

    only 4.2k likes with 245k views!

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

    *A toilet: Mutual Exclusion.*

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

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

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

    I love you sir❤
    Will you marry me

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

    Thanks a lot! It's much clearer now.