Це відео не доступне.
Перепрошуємо.

L-3.6: Test and Set Instruction in OS | Process Synchronization

Поділитися
Вставка
  • Опубліковано 8 сер 2024
  • 👉Subscribe to our new channel: / @varunainashots
    Test and set algorithm uses a boolean variable 'lock' which is initially initialized to false. This lock variable determines the entry of the process inside the critical section of the code.
    0:00 - Introduction
    2:46 - "Test & Set" Instruction
    ►Operating System (Complete Playlist):
    • Operating System (Comp...
    Other subject-wise playlist Links:
    --------------------------------------------------------------------------------------------------------------------------------------
    ►Design and Analysis of algorithms (DAA):
    • Design and Analysis of...
    ►Database Management System:
    • DBMS (Database Managem...
    ► Theory of Computation
    • TOC(Theory of Computat...
    ►Artificial Intelligence:
    • Artificial Intelligenc...
    ►Computer Networks (Complete Playlist):
    • Computer Networks (Com...
    ►Computer Architecture (Complete Playlist):
    • Computer Organization ...
    ►Structured Query Language (SQL):
    • Structured Query Langu...
    ►Discrete Mathematics:
    • Discrete Mathematics
    ►Compiler Design:
    • Compiler Design (Compl...
    ►Number System:
    • Number system
    ►Cloud Computing & BIG Data:
    • Cloud Computing & BIG ...
    ►Software Engineering:
    • Software Engineering
    ►Data Structure:
    • Data Structure
    ►Graph Theory:
    • Graph Theory
    ►Programming in C:
    • C Programming
    ►Digital Logic:
    • Digital Logic (Complet...
    ---------------------------------------------------------------------------------------------------------------------------------------
    Our social media Links:
    ► Subscribe to us on UA-cam: / gatesmashers
    ►Subscribe to our new channel: / @varunainashots
    ► Like our page on Facebook: / gatesmashers
    ► Follow us on Instagram: / gate.smashers
    ► Follow us on Instagram: / varunainashots
    ► Follow us on Telegram: t.me/gatesmashersofficial
    ► Follow us on Threads: www.threads.net/@gate.smashers
    --------------------------------------------------------------------------------------------------------------------------------------
    ►For Any Query, Suggestion or notes contribution:
    Email us at: gatesmashers2018@gmail.com

КОМЕНТАРІ • 168

  • @mahimabiswas9491
    @mahimabiswas9491 3 роки тому +165

    Coming here to refer this video after watching my faculty's lecture recordings 5 times, clearly shows the one who isn't charging a penny is here to guide us and the one who is are there to confuse us. Sir, we your virtual students can't thank you enough for what you already are doing for us. An utmost respect to you and your efforts in spreading your knowledge in such an eloquent manner.

  • @AyushMo
    @AyushMo 3 роки тому +145

    Some people are confused about how test_and_set helps at all because the same problem arises if we preempt after executing just the 1st line of test_and_set().
    I agree, and I think the answer is that test_and_set is a special instruction, as he mentioned earlier in the video. So with the help of hardware, it is implemented in such a way that the entire function is atomic, so it will not preempt after the 1st line.
    (The hardware implementation has to do something with DPRAM, Wikipedia has more details).
    In other words, it's guaranteed that if a process is currently performing a test-and-set, no other process may begin another test-and-set until the first process's test-and-set is finished.
    Ofcourse if the user wrote his own test_and_set function, then it fails because of reasons discussed already, so I guess that's why it requires the operating system to support test-and-set instruction.
    And I guess that's why it works.

    • @shubhambairagi4357
      @shubhambairagi4357 3 роки тому +3

      I have same doubt. Thanks for explanation.🙂

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

      @@shubhambairagi4357 glad it helps

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

      true. actually, he did not discussed about that. even semaphores and further stuff are also related to atomic instructions.

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

      ​@@KunwarPratapSingh41951 Yup, that's right.

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

      Thank u so much , i was also quite confused on this

  • @Sam-ur1gs
    @Sam-ur1gs Рік тому +4

    One of the best teachers I have seen..Literally!...Hands down!! Sir makes us learn complex things in such an easy way....That's impeccable! Thankyou sir for all ur efforts..Big fan!!!!!!!

  • @aliiinawaz65
    @aliiinawaz65 2 роки тому +7

    Sir can't thank you enough for what you already are doing for us. An utmost respect to you and your efforts in spreading your knowledge in such an eloquent manner.

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

    You are a true teacher. You just made it so simple by your story telling skill.

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

    Finally my phobia about test and set lock from this video over. Thank you for creating such cc explaination

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

    Awesome lecture.....I have understood the whole concept easily.

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

    you really have clear understanding of these topics ... thanks for choosing to make videos to help students.

  • @saidathanikhil.k6415
    @saidathanikhil.k6415 2 роки тому +1

    One of the great teacher i had ever seen thank u so much sir🙏🙏🙏🙏

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

    I am not understand concept of test and set instruction in college but yours simple explanation I am understand well,Thank you sir

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

    Greatly Explained sir❤️... Thank You So Much ❤️❤️🙏

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

    Thank you so much sir...
    You're cleared my doubt...

  • @dhanashreegodase4445
    @dhanashreegodase4445 3 роки тому +3

    Awesome lecture

  • @POTTERHEAD-df5gi
    @POTTERHEAD-df5gi 3 роки тому +1

    Well explained sir👏👏👏👌

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

    It works! Thanks a lot.

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

    Yes yess getting the point 👍🏻

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

    Example Of Washroom be like : permanent hu sir 😆😆. Thankyou sir for providing us easiest way to understand everything in os ❤️

  • @VishalYadav-ro3eh
    @VishalYadav-ro3eh 7 місяців тому +1

    DPRAM test-and-set instructions. Dual-ported RAM (DPRAM) is a type of random-access memory that allows multiple reads or writes to occur at the same time, or nearly the same time, unlike single-ported RAM which allows only one access at a time.

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

    Thank You❤

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

    tomorrow is my exam and today I am here , completing the playlist

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

    thankyou sir explaining this topic very simply thankyouu sirrr

  • @jaybhati5603
    @jaybhati5603 3 роки тому +30

    what if pre emption occurs when running second instruction of test_and_set()?

    • @madhusudhanan9278
      @madhusudhanan9278 3 роки тому +77

      test_and_set() is not a software solution, it is a hardware solution, so it will execute as a single instruction only. the function call for test_and_set() that he showed is just a software implementation to know how it actually works, but in reality it is not implemented as a software. A dedicated processor opcode is made for this purpose. like for example intel processor (x86) have 86 instruction set right, like that one of the instruction is a test_and_set() operation. Intel's 'xchg' instruction is the one used for this purpose.

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

      @@madhusudhanan9278 Thanks, that cleared it. I had the same doubt as Jay.

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

      @@madhusudhanan9278 Thanks for clearing the doubt.

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

      @@madhusudhanan9278 my doubt is cleared, thanks!!!!

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

      Thanks bro for clearly explaining

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

    Dear Mr Sir welcome to my comment....i requested you to include Computer Graphics also ..

  • @user-en5er8oe4r
    @user-en5er8oe4r 7 місяців тому

    very clear explaintion😍

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

    Simple to understand

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

    Thank you sir!

  • @SumitKumar-ru7kb
    @SumitKumar-ru7kb 3 роки тому

    What an explanation.

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

    while + Test and set also called spin lock(kernel/driver code). Atomic work on the same at Hardware abstraction layer.

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

    Please make placement series

  • @user-fy1dm3st4d
    @user-fy1dm3st4d 7 місяців тому

    Thanks Sir 😊

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

    sir you are great

  • @user-gv1wv1bx2d
    @user-gv1wv1bx2d Місяць тому

    For loop mein lock ki value ko vahin par 1 bhi set kar sakte hain. Is tarah se mutual exclusion satisfied hoga.

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

    Nice sir

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

    The reason for selecting default value as false in the function definition is because initially the critical section will be empty and if any of the the processes calls the function then function will return false at first (i.e for first process) and later that process will set the value of *target to true resulting infinite looping for processes which are trying to interrupt

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

    thank you

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

    Pre-emption can happen even inside the Test_and_Set function? In that case that will be behave similar to the 2 instructions where I1: while(lock == 1);, I2: lock = 1

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

    Thanks

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

    Thank u sooo muchhhhhhhhhhh

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

    RBR SIR---> VARUN SIR (GOD OF COMPUTER SCIENCE) as era changes the believes also changes. This is my personal opinion. Lots of love Varun sir ❤️

  • @MRWOLF-rd6tm
    @MRWOLF-rd6tm Рік тому +2

    8:19 Sir Aapka Ye Wala Dialogue Iss Series Mein Missing Tha (⁠ ⁠◜⁠‿⁠◝⁠ ⁠)⁠♡

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

    I do have a problem i.e. even if we assume the initial value of lock is false then after the first instruction -
    while(test_and_set(&lock)) -> inside while it will always be true(because inside the function we are making it true) even if the initial the value of lock is false and the process will get stuck in the infinite loop making the critical section inaccessible.
    isn't ??????

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

    But still how, test and set instruction achieve mutual exclusion on a multiprocessor system. On multiple cores, test and set instruction can be executed in parallel by two different processes, and so both processes could enter C.S simultaneously. The explanation in the video explains how test and set can help achieve mutual exclusion for uniprocessor systems. test and set inst is hardware solution and is atomic instruction, yet multiple processes can execute them on different cores in parallalel.

  • @shrutisatyams2146
    @shrutisatyams2146 3 роки тому +3

    EXCELLENTLY EXCELLENTLY EXCELLENTLY EXPLAINED 🙂

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

    Great explanation... But the subtitle is coming in the way.... Can hardly see the function code on the board... Please help

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

    Love ❤️

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

    😍

  • @vinayaksharma-ys3ip
    @vinayaksharma-ys3ip 3 роки тому +1

    👍👍💯💯💯

  • @AmandeepKaur-yf2yr
    @AmandeepKaur-yf2yr 2 роки тому

    If we put true in processor p1 then we return true in test and set always or not..?

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

    bestest♥♥♥♥

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

    *Hello Sir, Would you please be able to tell the result date of SBI SO(systems,IT) written exam!*

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

    lekin agar sir critical situation ke baad prempt ho jaye mtlb load=false execute na ho paye then there is no mutual exclusion

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

    mst!

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

    sir, can interrupt occur while executing the test_and_set definition?

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

    but in case while test_and_set method is executing is there any probabililty that after setting r the process will be preempted

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

    Watched this video 2 times as first time got distracted by your hairs and was trying to understand the pattern. 😋

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

    Sir I have 1 doubt,
    Agar hm p1 pre - empt ho gya test and ser function keandar after bool r = * target, r=0 ho gya uske bad pre empt hoke p2 ke pas chla gya and p2 ab critical section m ghus skta h kyonki abhi tak hmne *target =true nhi kiya tha p1 m lekin jab ab p2 pre empt hoga critical section m and p1 wapis ayega to ab r 0 hi return krega to yahan p mutual exclusiveness break ho gya.

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

    Sir process p2 to poora execute hoga na..uske baad hi to priority process p1 ke paas wapas jaayegi?? kyunki aapke example ke hisaab se process p2 me context switching nahi ho rahi

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

    👌👌👌👌👌

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

    sir I have a doubt if the preemption of process will happen in the 2nd line of function then what happen. that if p1 execute the line boolean r= *target and then go for bathroom and p2 execute the all line of the test_and_set (&lock) method then what will happen, then the mutule exclusion stay in the program. please reply me

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

    ❤️❤️

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

    sir what if we set that if the code is preempt between 1 and 2 then it must start from 1 again.

  • @VaishnaviKande-oj4rh
    @VaishnaviKande-oj4rh Рік тому

    👍

  • @Suraj-lo7bg
    @Suraj-lo7bg Рік тому

    Can preemption happen before *target=True in test_and_set function for process 1

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

    can u explain if P1 preempts after executing " boolean r = *target " line and then P2 comes in ?
    I think in this situation it will be same as lock variable code.

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

      yeh ni samajhaya jayega yaha.

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

      nice doubt btw

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

      I wrote this in another comment so I'll just paste it here in case you're still struggling.
      Some people are confused about how test_and_set helps at all because the same problem arises if we preempt after executing just the 1st line of test_and_set().
      I agree, and I think the answer is that test_and_set is a special instruction, as he mentioned earlier in the video. So with the help of hardware, it is implemented in such a way that the entire function is atomic, so it will not preempt after the 1st line.
      (The hardware implementation has to do something with DPRAM, Wikipedia has more details).
      In other words, it's guaranteed that if a process is currently performing a test-and-set, no other process may begin another test-and-set until the first process's test-and-set is finished.
      Ofcourse if the user wrote his own test_and_set function, then it fails because of reasons discussed already, so I guess that's why it requires the operating system to support test-and-set instruction.
      And I guess that's why it works.

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

      @@AyushMo thum hi ho mata ja pita tumhi ho

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

      @@goldenshower8210 haha nahi nahi

  • @LalitSharma-uw9jh
    @LalitSharma-uw9jh 2 роки тому

    Sir please make playlist on iwt

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

    Yai course kb complete hoga?

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

    I think preempting would still make this process incapable of mutual exclusion. What if first process's test_and_set function stopped after assigning r = *target. Now second process's test_and_set function would still think that it can enter critical section. And so would first process's test_and_set function.

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

      Test_and_set will not be preemted as it is made to work like that,after it get called the cpu can't preemt the process until test_and_set is completed

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

      he did not discuss about that. ma'am actually test_and_set is hardware based solution. the function will be non-pre-emptive. this is a special function inbuilt.

    • @akshatshah6413
      @akshatshah6413 9 місяців тому

      @@KunwarPratapSingh41951well this is the most important point that the video didn’t tell
      Thank you for the clarification

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

    Aging algorithm????

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

    Why cant be there preemption in the test_and_set function. It's a 3 line code in itself.

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

      I wrote this in another comment so I'll just paste it here in case you're still struggling.
      Some people are confused about how test_and_set helps at all because the same problem arises if we preempt after executing just the 1st line of test_and_set().
      I agree, and I think the answer is that test_and_set is a special instruction, as he mentioned earlier in the video. So with the help of hardware, it is implemented in such a way that the entire function is atomic, so it will not preempt after the 1st line.
      (The hardware implementation has to do something with DPRAM, Wikipedia has more details).
      In other words, it's guaranteed that if a process is currently performing a test-and-set, no other process may begin another test-and-set until the first process's test-and-set is finished.
      Ofcourse if the user wrote his own test_and_set function, then it fails because of reasons discussed already, so I guess that's why it requires the operating system to support test-and-set instruction.
      And I guess that's why it works.

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

    I think Progress will not work here when if p1,p2 preempt before return r; instruction

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

    Just like there is prob. that P1 can pre-emept after while() and before lock=1; It can pre-emept in that test_and_set() as well. Now what ?

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

    Sir P2 kab aayega CS mai ,kyuki while toh humesha hi true hoga........????

  • @CSERaginiGupta-vc8hd
    @CSERaginiGupta-vc8hd 2 роки тому

    8:59 💯💯

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

    First See than Read 👍

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

    It's humble request

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

    sir jab test_and_set() function chal rha hoga tab bhi toh beech mein preempt ho skta h, dusra process critical section mein aa skta h!!?? Please correct me if I'm wrong.

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

      no. test_and_set operation is an atomic operation here! these instructions are always executed as a whole. they rely on hardware support. here the code is not complete (sir has used simple code for understanding), in real life we use certain keywords that guarantee the atomicity of certain processes. you can search for them.

  • @HIMANSHUKUMAR-se2bu
    @HIMANSHUKUMAR-se2bu 3 роки тому

    I thought the solution should not be hardware dependent . Which is the 4th condition of solving critical section problem .. can someone shine a little light on this .. To sum up testAndSet is hardware solution .. but we studied that hardware solution are not acceptable .. where am i wrong here ?

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

    BHAI MONITORS PR VIDEO BNADO MAI NASS KATLUNGA FAIL HO JAUNGA MARR JAUNGA PROPERTY BECHNI PAD JAEGI

  • @ayanjit9196
    @ayanjit9196 3 роки тому +3

    Sir there is a problem. Mutual exclusion will not be achieved if the process is preempted during execution of the test_set function after line 1. r will have the previous value of lock variable and the while loop will let it go to the critical state if that happens.
    Plz tell if I am getting something wrong 🙏

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

      its the hardware functionality

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

      @@fashionvella730 can u plz explain in details? I am a noob

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

      @@ayanjit9196 test_and_set() is not a software solution, it is a hardware solution, so it will execute as a single instruction only. the function call for test_and_set() that he showed is just a software implementation to know how it actually works, but in reality it is not implemented as a software. A dedicated processor opcode is made for this purpose. like for example intel processor (x86) have 86 instruction set right, like that one of the instruction is a test_and_set() operation. Intel's 'xchg' instruction is the one used for this purpose.

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

      @@madhusudhanan9278 oh. I see. This was bugging me for a long time. 😁

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

      @@madhusudhanan9278 That was extremely helpful. Thanks :)

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

    can any one tell what if preamption occur in the line between test_and_set function that is if line one of the function is executed and the the process is preamptered??

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

      test_and_set() is not a software solution, it is a hardware solution, so it will execute as a single instruction only. the function call for test_and_set() that he showed is just a software implementation to know how it actually works, but in reality it is not implemented as a software. A dedicated processor opcode is made for this purpose. like for example intel processor (x86) have 86 instruction set right, like that one of the instruction is a test_and_set() operation. Intel's 'xchg' instruction is the one used for this purpose.

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

    Hi ☺️

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

    If you want to write before watching video 03:24

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

    I tried so much to write in Hindi...?

  • @abhijitbiswas294
    @abhijitbiswas294 3 роки тому +12

    Sir please make playlist on : 1. Internet Technologies ,
    2. Digital Image Processing ,
    3. Numerical Methods,
    4. Machine Learning,
    6. Software Engineering,
    7. Computer Graphics,
    8. System programming,
    9. Introduction to Data Science.
    Please 🥺 sir make playlist

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

    anyone have written the notes...plz help me out?

  • @SanketSharmasanket7317
    @SanketSharmasanket7317 28 днів тому +1

    ok

  • @amangupta3342
    @amangupta3342 3 роки тому +3

    Sir even in this code mutual exclusion is not achieved.
    Suppose P1 gets the processor first and it executes only first line of function ie (r=*target), now r receives false and CPU preempt .
    And value of lock is still false. (Remember when p1 again gets CPU it will start it's execution from 2nd line of the function). Now p2 gets the CPU and it starts the execution of function . Since the value of lock was not updated to true, r receives false in it and suppose it executes the whole function and function returns false( becoz r is false), and p2 enters the critical section. Now again CPU preempt and P1 gets the CPU. Now value stored in r was false. And when it returns the r ie it will return false and P1 will also get into the critical section.
    ..............
    Plz sir have a look at this and plz notify me if I am correct.🙏🙏😊

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

      I agree, and I think the answer is that test_and_set is a special instruction, like he mentioned earlier in the video. So with the help of hardware it is implemented in such a way that the entire function is atomic, so it will not preempt after the 1st line. If the user wrote his own test_and_set function, then it fails because of reasons you mentioned above, so I guess that's why it requires the operating system to support test-and-set instruction.

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

      @@AyushMo yes the the functions p(), v(), up(),down()etc have a special property that CPU cannot pre-empt unless it fully executes them.

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

      @@amangupta3342 yup, after reading more, I discovered the hardware implementation has to do with something with DPRAM. And so it's guaranteed that if a process is currently performing a test-and-set, no other process may begin another test-and-set until the first process's test-and-set is finished. So, it works :D

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

      @@AyushMo 👍👍

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

      Scene-01:

      Process P0 arrives.
      It executes the test-and-set(Lock) instruction.
      Since lock value is set to 0, so it returns value 0 to the while loop and sets the lock value to 1.
      The returned value 0 breaks the while loop condition.
      Process P0 enters the critical section and executes.
      Now, even if process P0 gets preempted in the middle, no other process can enter the critical section.
      Any other process can enter only after process P0 completes and sets the lock value to 0.

      Scene-02:

      Another process P1 arrives.
      It executes the test-and-set(Lock) instruction.
      Since lock value is now 1, so it returns value 1 to the while loop and sets the lock value to 1.
      The returned value 1 does not break the while loop condition.
      The process P1 is trapped inside an infinite while loop.
      The while loop keeps the process P1 busy until the lock value becomes 0 and its condition breaks.

      Scene-03:

      Process P0 comes out of the critical section and sets the lock value to 0.
      The while loop condition breaks.
      Now, process P1 waiting for the critical section enters the critical section.
      Now, even if process P1 gets preempted in the middle, no other process can enter the critical section.
      Any other process can enter only after process P1 completes and sets the lock value to 0.

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

    P2 washroom gia ta😂

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

    Please make videos on DES and AES algorithms in network security

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

      If not here then u can refer 5 min engineering's channel for that

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

    Test_and_set method should be synchronized.

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

    Ye Hamray Sir hai,
    Ye reply wapas nahi karahy hai .
    Sir hum phir say yahan comment karahy hai...🤣.

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

    1000th view at 2 am❤️

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

    Why are these videos never in english?

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

      depends on the teacher , but ya i can say as i can understand he is the best teacher for this subject .

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

    P1 washroom gaya tha Line Number 1 execute krne ke baad😅

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

    Let me give a analogy.
    Two man want to use a washroom, but since processor is one, only one man can stay conscious at a time and other asleep.
    Now, person A goes to washroom, finds lock open, enters it and before he locks the door, he falls asleep.
    Now person B awakes, he goes to washroom and finds the lock open, so he thinks no one is inside, and enters and locks the door and starts using the washroom.
    Now, person B falls asleep while using washroom, person A awakes. He resumes and locks the locked door, and
    and BANG!
    Now, HOW TEST_AND_SET solves the issue?
    When person A goes to washroom, he first checks if the door is open. If it is open, , then he enters it. (May be through space between door and floor).
    Now, It cannot happen he entered, and door stays open right?

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

    This dude being teached by college faculties......
    Le GateSmashers:
    Nigga whaaaa........ you got it wrong there buddy ...... please take a seat I will clear your misconceptions.....!!!!!

  • @user-pu2bo3ws6b
    @user-pu2bo3ws6b Рік тому +2

    Getting the point?

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

    P2 ko diarrhea hai XD

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

    Bro speak in English... Pls 🥺
    I can't concentrate on both vd n subtitles 🥴😭

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

    Very tough video bouncer ball not good lecture