W7 L1 Dining Philosophers Problem

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 27

  • @danielch8299
    @danielch8299 4 года назад +6

    2020 and its still the best video i saw about it

  • @stacks2hell187
    @stacks2hell187 4 года назад +1

    Ye perfect explanation and the solutions are really good aswell! Really like the progress of problem to solution

  • @pavanchytanya1283
    @pavanchytanya1283 2 года назад +1

    amaaaaaaaaaaaazing extraordinarily explained , literally like a cake walk simple superb

  • @paulfalke6227
    @paulfalke6227 2 года назад

    I compared your solution with EWD310, the original Dijkstra paper. I think you corrected a bug in the original source code. Dijkstra does not use "state[i] == HUNGRY" in test(). Did you come up with this correction yourself? I prefer the scoped_lock() solution that is possible since C++17. But Dijkstra did not like the parallel P-operation. This is the problem with genies: they assume that everybody else can do the same.

  • @ayushjain7714
    @ayushjain7714 6 лет назад +5

    Nicely explained! Thanks a lot Sir! :)

  • @HimanshuNailwalrhce
    @HimanshuNailwalrhce 6 лет назад +3

    I LOVE YOU for this, sir. Thanks a ton. :D

  • @vinoth3895
    @vinoth3895 4 года назад +2

    You re a man of culture

  • @mohsinkirmani1833
    @mohsinkirmani1833 8 лет назад +2

    Well explained, it was helpful. Thanks man!

  • @jennychen927
    @jennychen927 7 лет назад +2

    Thanks so much, it explains very well.

  • @SuyashGaurav
    @SuyashGaurav 8 месяцев назад

    Why don't they eat with just one fork? Do they think forks have separation anxiety?

  • @andreeasonda31
    @andreeasonda31 8 лет назад +2

    very well explained.thanks!!

  • @learnwithdounia6946
    @learnwithdounia6946 4 года назад

    thanks for explanation , have you a code in java or c of this dining philosophers ?

  • @KSMuralidhar
    @KSMuralidhar 7 лет назад +1

    here State[i] is critical section . when execution moves from take_fork() to test() how it is possible to change from hungry to eating when that section is locked by a mutex?

    • @bollywoodhub2167
      @bollywoodhub2167 4 года назад

      Actually void putforks() invoke test, so it will wake up suspended process, does not change S[4] to 1 and after returning from test() function it will unlock (mutex).
      By mistake this faculty wrongly explained the last part

    • @vinoth3895
      @vinoth3895 4 года назад

      @@bollywoodhub2167 test will bring S[4] to 1 and it will be immediately taken back to 0 by the suspended take_fork of P4. He is right.

    • @vinoth3895
      @vinoth3895 4 года назад

      The state[i] is locked by the same thread that runs test().

  • @erlanggadewasakti
    @erlanggadewasakti 3 года назад

    the best , thanks sir

  • @radhapandey6281
    @radhapandey6281 6 лет назад +2

    Thankyuu so much sir

  • @adithyavarma758
    @adithyavarma758 2 года назад

    Thank you sir

  • @zahreddinesoualem3213
    @zahreddinesoualem3213 4 года назад

    what if P1 comes after P3 and P3 is eating but the lock(mutex) prevents P3 to pass ? couldn't P1 and P3 eat at the same time bcs thier fork L and R are available ?

    • @robinjoseph369
      @robinjoseph369 3 года назад

      I think by initializing mutex as N/2 (here 2) we can have a work around. with mutex initialized to 2 P1 and P3 can work together.

  • @nikhilvidhani7635
    @nikhilvidhani7635 3 года назад

    are these lectures enough for gate

  • @sharnam506
    @sharnam506 7 лет назад +1

    Thanks a lot

  • @stk1526
    @stk1526 6 лет назад +1

    great!

  • @Baxtexx
    @Baxtexx 7 лет назад +2

    Here is my java implementation for this video: gist.github.com/Baxtex/c34b8931e5675c1fc3d7e6f7be6f84b0

    • @akashroy3851
      @akashroy3851 7 лет назад

      Baxtexx in solution using mutex what if the first guy who just ate is successful in invoking mutex again (since it's in a while loop) just after the second guy ate every time ?
      Won't this lead to starvation for others ?
      I know I'm Missing something ...

  • @tejas12365
    @tejas12365 7 лет назад +1

    cant the eat in 1 fork lol,