W6 L4 Bakery Algorithm

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 55

  • @prashantupadhyay5110
    @prashantupadhyay5110 26 วันที่ผ่านมา

    Very clear and exhastive coverage of bug 1 and bug 2, especially with obstacles

  • @achyutprabhakar5440
    @achyutprabhakar5440 7 ปีที่แล้ว +2

    Can't find a better OS video lecture on you tube than this.Long live sir.Thanks

  • @ghostinthedarkness30
    @ghostinthedarkness30 8 ปีที่แล้ว +10

    great video, very clear and explained well, thank you ! it helped me alot!

  • @benvahaba
    @benvahaba 6 ปีที่แล้ว +7

    thats the first time i understand an indian on youtube and i love it. thanks, really helped me.

    • @shivamsharma3595
      @shivamsharma3595 4 ปีที่แล้ว

      Well he is a prof from IIT Madras one of the top and pristine institute in India so this was obvious .

    • @dreambig1564
      @dreambig1564 4 ปีที่แล้ว

      yes I find that he has a clear accent too

  • @vikramthorat707
    @vikramthorat707 8 ปีที่แล้ว

    really great work..best way of explaining algorithm...!Thank You Sir

  • @BalwinderSingh-zh5kx
    @BalwinderSingh-zh5kx 8 ปีที่แล้ว +4

    That was amazing, thanks for such a easy explanation

  • @VarunKaushal-zx9zq
    @VarunKaushal-zx9zq 12 วันที่ผ่านมา

    Fantastic Explanation

  • @tirthpatel20
    @tirthpatel20 3 ปีที่แล้ว

    Great lecture! Thank u Prof. Rebeiro!

  • @arjanbal3972
    @arjanbal3972 2 ปีที่แล้ว +1

    It looks like Bakery algorithm should work for n ≥ 2, but there are simpler ways for mutual exclusion for n = 2, hence the video mentions n > 2.

  • @mehoneybadger999
    @mehoneybadger999 4 ปีที่แล้ว +4

    crystal clear :) thank you sir

  • @biswajeetsethi7689
    @biswajeetsethi7689 5 ปีที่แล้ว +3

    how to ensure atomicity of that MAX(..) operation ? how to ensure there will be no context switch ? please anyone explain

    • @wonder_life0549
      @wonder_life0549 4 ปีที่แล้ว

      we dont need atomicity for MAX() in the original bakery algorithm. if two processes are assigned the same numbers, ties are broken in favor of the process with smaller process id. Check the last part of video its explained.

  • @842Mono
    @842Mono 7 ปีที่แล้ว

    very nice and simple explanation. thank you very much!!

  • @pritisharma9528
    @pritisharma9528 7 ปีที่แล้ว +1

    Thank you sir :) You made it simple .

  • @xiaoyanqu9917
    @xiaoyanqu9917 7 ปีที่แล้ว +6

    Hi, thanks for the great videos! But I'm confused about the while loop around the time 8:00 in the video, if num[p] != 0 and num[p] < num[i] is true, how would it be possible to "break" the loop and enter the critical section?

    • @xiaoyanqu9917
      @xiaoyanqu9917 7 ปีที่แล้ว

      Sorry I was actually referring to 6m:50s in the vidoe, quote: "process with the lowest non-zero value of num would enter into the critical section". Can anyone teach me how does this work? Thanks!

    • @sohom004
      @sohom004 7 ปีที่แล้ว

      Its wrong , wrong explanation of that while loop

    • @sourav5562
      @sourav5562 7 ปีที่แล้ว +1

      it means if num[i]≥num[p] then only it can break the loop and execute critical section.

    • @YogeshPersonalChannel
      @YogeshPersonalChannel 7 ปีที่แล้ว +2

      Xiaoyan Qu Each waiting process i would be stuck in the while loop apart from the one which has the lowest non zero value because it checks itself against all other processes in for loop and break every time. For non waiting process num[p] is zero and for rest waiting process it has the lowest token number so num[other_process] < num[ this process] is false everytime. Hence it goes into critical section.
      Hope that explains.

    • @GokulNathXYZ
      @GokulNathXYZ 6 ปีที่แล้ว +6

      For future reference:
      The basic idea is to implement a FIFO like structure i.e processes with smaller tokens get a higher priority.
      The while loop in the simplified algorithms does the follows: it checks if there exists a value which is not zero and which is less than the current value it has. For example, if P1 has a value of 1. Now it checks through the entire loop to find that there are no such values which is non zero and less than 1. Thus, it can safely go into the critical section.
      Now assume that while it is executing, it gets pre-empted and P2 now executes. P2 will have a value of 2 and it will scan through the entire queue. While scanning, it will find that P1 already has a value of 1 (i.e non zero and less than 2 of P2). Therefore, the condition is met and it loops. When P1 finishes executing, the value of P1 becomes 0 and now, P2 is free to execute as there is no value smaller than 2 present in the loop.

  • @marioburgos8656
    @marioburgos8656 4 ปีที่แล้ว +1

    I finally got it!! Do you know guys whether this teacher has a concurrency course or where I can find the entire course for this video?

    • @shivamsharma3595
      @shivamsharma3595 4 ปีที่แล้ว +1

      it is an NPTEL video so you can find this course NPTEL website. This course url is nptel.ac.in/courses/106/106/106106144/ . You can find many other courses on operating system there

  • @santiagoecheverri4017
    @santiagoecheverri4017 7 ปีที่แล้ว

    Excellent video. Thank you very much!

  • @leonbenjamin7891
    @leonbenjamin7891 5 ปีที่แล้ว

    Excellent video! Thanks.

  • @yatheeshareddy3661
    @yatheeshareddy3661 6 ปีที่แล้ว +1

    WHAT IS THE USE OF CHOOSING ARRAY. THE SAME RESULTS CAN BE OBTAINED WITHOUT USING IT WITH THE HELP OF COMPLEX CHECK..ie AT THE LAST LINE ...........(PROCESS HAVING LEAST I VALUE)

    • @rishabhshirke1175
      @rishabhshirke1175 6 ปีที่แล้ว +3

      How can we decide which is least when there are processes still choosing the token value? Choosing array stops that from happening.
      eg: p1 p2 p3 p4 p5
      6 7 choosing 5 4
      At this point p5 should enter C.R as it has smallest token...but how do you know p5 has smallest of all when p3 is still getting the token.
      it might happen p3 got token 3 and got preempted before setting num[3].
      So while(choosing) loop stops p5 going before p3.

    • @aakankshajaiswal1809
      @aakankshajaiswal1809 5 ปีที่แล้ว

      It would have been better if we would have prevented another process from choosing if one process is already choosing. We wouldn't have to do any other changes.

  • @mskoushik8892
    @mskoushik8892 5 ปีที่แล้ว +1

    why is p1 always 0. Wont it invoke the lock process?

  • @PriyanshuYadav-ct1lv
    @PriyanshuYadav-ct1lv 5 หลายเดือนก่อน

    How do we know that the num[i]=Max(... code line is atomic or non atomic even it's not mentioned in the question having this code

  • @perplex_ed
    @perplex_ed 6 ปีที่แล้ว

    I think, choosing variable should be set to false in unlock function(original bakery algo)

  • @arjanbal3972
    @arjanbal3972 2 ปีที่แล้ว +1

    At around 15:18, if any process dies after setting choosing[i] = True, it will block all other processes from entering the critical section, isn't this a problem?

  • @liveinshyam
    @liveinshyam 2 ปีที่แล้ว

    How is it that all processes have access to num ...don't that defeat the purpose of distributed algorithm?

  • @barongrmel3797
    @barongrmel3797 4 ปีที่แล้ว

    when we are doing tuple comparison then whats the need for choosing array???

    • @harishganesan3575
      @harishganesan3575 10 หลายเดือนก่อน

      Say if process A ( index 3 ), runs the MAX function and adds 1 ( say 2 ), but gets context switched at that point... in this case, the value for process A is still 0, eventhough it has computed its ticket..
      Now process B ( index 5 ), comes in.. calculates the max function and gets a value equal to or greater than process A ( say 2 )
      without the choosing check, the process B can now go into the critical section, since process A's ticket is still not set to its value of 2.
      But unfortunately B is again context switched when it is inside the critical section. and A now gets the CPU. Now A finally gets assigned its ticket of 2, it runs through the loop and finds that only B has a token of 2, but B's index (5) is still higher than A's ( 3 ), so A also now enters the critical section. Which breaks mutual exclusion.
      Now with the choosing check, if the same situation happens.. B would get stuck at the choosing loop, because A has not turned it off. So until A gets assigned the ticket with index 2, B cant proceed to the next loop where it gets entry into the critical section.

  • @ankitsharma8221
    @ankitsharma8221 6 ปีที่แล้ว

    Thank you sir!

  • @jaya733
    @jaya733 5 ปีที่แล้ว +1

    Thankyou

  • @danaperez5005
    @danaperez5005 7 ปีที่แล้ว

    Thanks!

  • @saheel97
    @saheel97 7 ปีที่แล้ว +2

    why is P1 0?

    • @susannah5812
      @susannah5812 7 ปีที่แล้ว

      yeaaaaaaaah why o--O?????

    • @shenkongtube
      @shenkongtube 7 ปีที่แล้ว +1

      p1 doesn't enter the critical section. p2 also can be set to 0 if you like. 0 just mean the process doesn't participate in the competition

    • @Dawntech
      @Dawntech 6 ปีที่แล้ว

      All the processes which don't wanna access their critical sections receive 0 as their values in this algorithm :)

    • @biswajeetsethi7689
      @biswajeetsethi7689 5 ปีที่แล้ว

      becoz p1 does not want to execute critical section. So it does not need to execute the entry section.

  • @83abhinavnigam
    @83abhinavnigam 7 ปีที่แล้ว

    thanx a lot

  • @belwizdadimed3967
    @belwizdadimed3967 4 ปีที่แล้ว

    Since numbering in a C like array starts from 0 why the processes are numbered from 1 to 5 in your example? Should be P0, ...P4

  • @Ace-gw4uk
    @Ace-gw4uk 8 ปีที่แล้ว

    Sometimes I can't understand what you say :/

    • @pr1493
      @pr1493 8 ปีที่แล้ว

      Platwn Ace essentially everything lol

  • @NghiaNguyen-lp1us
    @NghiaNguyen-lp1us 6 ปีที่แล้ว

    sir, please explain base on the code, not the idea of the algorithm!!!

  • @MrC77
    @MrC77 6 ปีที่แล้ว +6

    Why are these videos always made by indians?

    • @ayushpalak
      @ayushpalak 5 ปีที่แล้ว +6

      because these videos come under a free course provided by government of India. Guys who are giving lectures are from IITs.

    • @vineetrathee2070
      @vineetrathee2070 5 ปีที่แล้ว +3

      because india is world's teacher in every field .

    • @heisenberg1844
      @heisenberg1844 5 ปีที่แล้ว +1

      @@vineetrathee2070 Yes, India can't educate it's own people on birth control, but alright.