Process Synchronization: Solution for Critical Section Problem | L 14 | Operating System | GATE 2022

Поділитися
Вставка
  • Опубліковано 9 вер 2024
  • The Great Learning Festival is here!
    Get an Unacademy Subscription of 7 Days for FREE!
    Enroll Now - unacademy.com/...
    .. Click for free access to Educator's best classes: : www.unacademy....
    For regular updates follow : unacademy.com/...
    To purchase please click : unacademy.onel...

КОМЕНТАРІ • 44

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

    GATE Unlock25 Offer
    Get flat 25% & FREE Extension
    Join the new Foundation batches for GATE, ESE*, & PSUs 2024
    ➤ Subscribe today: unacademy.com/goal/gate-cs-it/NVLIA/subscribe?referral_code=VDEEP10

  • @rashmidhawan4783
    @rashmidhawan4783 2 роки тому +13

    I never learn synchronization in such a interesting way!!! Love the way you teach. And examples are mind blowing... I wonder how you create it🤩

  • @itsmytechnology9285
    @itsmytechnology9285 2 роки тому +15

    Can't believe such an amazing content for free.... Thanks sir🥰🥰

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

    Exit section helps in letting us know that cs execution has completed

  • @vaibhavkumar4951
    @vaibhavkumar4951 11 місяців тому +7

    sorry sir lekin ye lecture bilkul nhi samaj aaya...........bs ye rat liya hai maine ki peterson soln is perfect.......baki kuch zyada samaj me nhi aaya

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

    if flag[0] = true and than process p1 preempts and than p2 enters it will no be able to enter in the loop.

  • @AbdurRahman-wt5tf
    @AbdurRahman-wt5tf 2 роки тому +5

    Great sir

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

    Superab , comparison with real life example make it very easy

  • @devatal3767
    @devatal3767 Місяць тому +1

    start 8:35

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

    The most interesting and best lecture

  • @akshaykushwaha7003
    @akshaykushwaha7003 3 роки тому +45

    Start 8:30

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

      You're the best. Checking your timestamp is the first thing I do before starting the video

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

      @@roopalsood9817 +1

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

      Bro, Whenever I open the Video, I search for ur comment. Ur doing great Job. Thnx Dude

  • @priyankakalra8584
    @priyankakalra8584 Рік тому +5

    No doubt sir boht acha teach krte hain.. but agr video ki speed normal h to pakka tum sone Wale ho it happens with me many times. I always in 1.5 speed

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

    Make preemption at all possible instructions to check for solution requirements

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

    See solution 2 for more understanding it emphasizes mainly on progress I.e if a process is interested to enter cs it can enter if the cs section is free of any process

  • @DeepakYadav-rr6dx
    @DeepakYadav-rr6dx 3 роки тому +11

    54:50 Peterson's solution

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

    Ready sir

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

    28:42 english me kuch bol deta hu ....... cool lagunga

  • @Punitkumar-rs4wp
    @Punitkumar-rs4wp 2 місяці тому +1

    In Using lock variable, how P0 process starts while ke andr true likha hai. Aur lock false pe set hai😢

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

    thank you sir

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

    Best...

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

    Bhagwan 🙏🙏

  • @Rahul-iv3xm
    @Rahul-iv3xm 2 роки тому +1

    22:56

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

    There is a deadlock in Peterson's solution
    How it is correct??
    If flag 0 true turn =1
    Premept
    Now flag 1 true
    Premept
    Now we can't execute any process
    Deadlocked

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

      It's not actually deadlock, it doesn't satisfy progress if there is only two processes.
      Let's proceed further,
      If flag 0 true turn =1
      Premept
      Now flag 1 true
      Premept
      condition for P0 satisfied, P0 waiting .... preempt
      turn = 0
      condition for P1 satisfied, P1 waiting ... preempt
      condition false for P0 as turn != 1
      P0 enters into the critical section.

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

      Nope. Deadlock won't occur. Check out the following explanation:-
      Initially, status of variables -
      flag[0] = false
      flag[1] = false
      turn = 0 // could be either 0 or 1. Let's assume that it's 0, it won't make a difference.
      Process 0 running:
      flag[0] = true
      turn = 1
      Preempts
      Status of variables -
      flag[0] = true
      flag[1] = false
      turn = 1
      Process 1 running:
      flag[1] = true
      Preempts
      Status of variables -
      flag[0] = true
      flag[1] = true
      turn = 1
      Process 0 running:
      while(flag[1] && turn == 1); // while condition resolves to true, process 0 is stuck in an infinite loop
      After some time, preempts
      Status of variables -
      flag[0] = true
      flag[1] = true
      turn = 1
      Process 1 running:
      turn = 0
      while(flag[0] && turn == 0); // condition resolves to true, process 1 also stuck in an infinite loop
      After some time, preempts
      Status of variables -
      flag[0] = true
      flag[1] = true
      turn = 0
      Process 0 running:
      while(flag[1] && turn == 1); // now it resolves to false because process 1 had changed the value of turn to 0
      Process 0 executes the critical section and sets flag[0] as false
      Preempts
      Status of variables -
      flag[0] = false
      flag[1] = true
      turn = 1
      Process 1 running:
      while(flag[0] && turn == 0); // resolves to false as flag[0] is false
      Process 1 executes the critical section and sets flag[1] as false
      Preempts
      Status of variables -
      flag[0] = false
      flag[1] = false
      turn = 1
      Both processes have executed the critical section one time till now.
      Let's say process 0 wants to enter the critical section again
      Process 0 running:
      flag[0] = true
      turn = 1
      while(flag[1] && turn == 1); //resolves to false as flag[1] is false
      Process 0 enters the critical section, executes it, and leaves the section after setting flag[0] as false
      Preempts
      Status of variables -
      flag[0] = false
      flag[1] = false
      turn = 1
      Process 1 running:
      flag[1] = true
      turn = 0
      while(flag[0] && turn == 0); // resolves to false as flag[0] is false
      Process 1 enters the critical section, executes it, and leaves the section after setting flag[1] as false
      Preempts
      And the story goes on...
      I hope that I have cleared your doubt ;)

    • @AmandeepSingh-is5bg
      @AmandeepSingh-is5bg Рік тому

      @@mandeepdaksh376 ik number bhai. Maza aagya

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

      If flag 0 = true
      turn =1
      Premept
      Now flag 1 = true
      Premept
      Now we can't execute any process
      If preemption can happen while process 0 is not able to enter the CS (The way you preempted). Then in the same way we can achieve "Progress" for "Turn variable method".
      (However Process 0 should enter because then now we can say that the "Progress" is holding.)
      please clarify...

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

      @@mandeepdaksh376 thanks 👍

  • @aks2375
    @aks2375 5 місяців тому

    46:27

  • @give-me-guts-to-accept-truth
    @give-me-guts-to-accept-truth Рік тому +2

    Mujhe to sir ye samajh main nehi aata ki , khasne par , ya chinkh ne par sorry bolne ki kya zaroorat hai ? Sarir hai to hoga hi sabka hota hai

    • @Punitkumar-rs4wp
      @Punitkumar-rs4wp 2 місяці тому

      Zarrorat to aapke comment ki bhi nhi thi bhai. Aur na hi mere reply krne ki. But krrhe h na dono hi.
      Aur ye etiquettes m aate h... Agr aap sorry nhi bhi bologe to aapko jail nhi hogi na hi koi FIR..

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

    Sir lock is'nt a shared variable for P0 and P1 ??

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

    One thing I can say is these Desi teachers r no where close to the calibre of foreign teachers..

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

    Nptel os and harry.

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

    Padhate kam bak***di jyaada krte hain ye.

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

    Prices rising by 10% on 30th April'23 11:59 PM
    Flat 25% off & up to 4 Months Extra*! Save up to 53%
    Subscribe Now - unacademy.com/goal/gate-cs-it/NVLIA/subscribe?plan_type=iconic
    Unacademy GATE & ESE Ultra Combat
    23rd April at 11:00 AM
    Enroll Now: unacademy.com/scholarship/ULTRACOMBATGATEESE

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

    ..

  • @JUSTDOIT-bp2cf
    @JUSTDOIT-bp2cf 7 місяців тому

    27:26