Philosophers, 42 School Project. Dining Philosophers Project. C Implementation

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

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

  • @jamshidbekergashev6746
    @jamshidbekergashev6746  Год назад +1

    github.com/Jamshidbek2000

  • @wonderlustking6735
    @wonderlustking6735 9 дней назад

    thanks from 42 Quebec!

  • @uM1d_1115
    @uM1d_1115 Год назад +4

    Waw 👏. that is what we need . Keep doing man . Thanks for help 😉

  • @Jorge0812
    @Jorge0812 Год назад +2

    Hey Jamshidbek! Thanks for the video, helped quite a lot to clarify the path forward! 💪

  • @onaecO
    @onaecO Год назад +8

    HHey bro! Thx very much!! Why you did only one video, i will recommend everyone on my 42 discord community 🔥 keep it up

    • @v4r3j4o9
      @v4r3j4o9 Год назад

      Master!

    • @v4r3j4o9
      @v4r3j4o9 Год назад

      I was about to ask you in telegram if you were already in philosophers, I just started as well. After the FDF project I started to do a really cool thing for the projects, which is to first create a flowchart of how my program is suppose to work, it makes the project so much easy-going, it really helps a lot, if it of you interest I can later share with you my ideas of how I organize my projects now!

    • @onaecO
      @onaecO Год назад

      Master hhahhah! Sure i am interested! 🔥@@v4r3j4o9

    • @jamshidbekergashev6746
      @jamshidbekergashev6746  Год назад +1

      I am glad if I could help) This is my small contribution to 42 community.
      Thanks for engagement, appreciate it!

  • @AminKhodarahmi-mv7or
    @AminKhodarahmi-mv7or Год назад +1

    Thank you for your good explanation. ✌🏼

  • @navidnabaeei
    @navidnabaeei Год назад +1

    Thank you, it was wonderful.

  • @clementroche5183
    @clementroche5183 Год назад +1

    Nice video! thx a lot from France

  • @yopunkyintersectionalmedia1583
    @yopunkyintersectionalmedia1583 4 месяца назад

    Thanks very much!

  • @ilonawynen
    @ilonawynen Год назад +1

    спасибо за объяснение! привет из 42 Мадрид 😊

  • @dinispetrukha4382
    @dinispetrukha4382 9 месяцев назад

    I have a question. In the minute 27:26 you say that philosopher 1 and 3 will eat at the same time, but when you open the visualizer 27:44 only the 3 starts to eat i the first round. Why?

    • @jamshidbekergashev6746
      @jamshidbekergashev6746  9 месяцев назад +2

      Because philo #2 managed to take the fork that is shared with philo #1. Threads work with different speed, thread #1 can stop for a little fraction of a millisecond and thread #2 might be faster. I think this is the reason, may not be true though =)

  • @vanichdrive
    @vanichdrive Год назад

    Thank you very much !)

  • @Annush-bc8cr
    @Annush-bc8cr 8 месяцев назад

    hey thanks a lot! for now everything is clear, but I haven't started coding it😅

  • @FacundoTroitero
    @FacundoTroitero Год назад +1

    what a hunk

  • @amine-o8w
    @amine-o8w Месяц назад

    W

  • @olehendrix9130
    @olehendrix9130 9 месяцев назад +1

    Hey Jamshidbek, in this explanation you saying that there are three ways to synchronize and to manage the order of the routine for the philosophers, odd sleep first, odd take from right, even take from left. Or all philo's take from right except last one.
    However, when I'm checking your code. You only implemented even philo's sleep first. Besided that all philo's start with right fork, and they drop left fork first. This works however its giving a lock-inversion warning with threadsanitize.
    Can you explain why you have only done this implementation? For me the other ones you listed didn't work for me for example ./philo 3 610 200 200 5.

    • @jamshidbekergashev6746
      @jamshidbekergashev6746  9 месяцев назад

      Hello!
      This is a good question. First I used 2 methods, one for mandatory part (taking forks from different sides) and one for bonus (syncronize by making half of them sleep). But later I found out that first of them was not perfect, in the case of odd number of philos (5 650 200 200), or the example you gave.
      In theory this case should work, but I noticed that it didn't. It worked only when time_to_die is in this ration 5 800 200 200.
      When it comes to the 3rd option, when only one philo takes from left and others from right, as I mentioned in the video I didn't use it. I heard some people used it.
      I didn't face lock-inversion warning. When checking my philos I used valgrind and fsanitize with thread checks.
      This is what I know, maybe there are better ways =)

    • @Ole_Hendrix
      @Ole_Hendrix 9 месяцев назад

      @@jamshidbekergashev6746 strange, I'm very stuck to be honest. I tried all the ways, but simulation only works when all philo's start with right fork. And this gives me a lock-inversion warning.

    • @jamshidbekergashev6746
      @jamshidbekergashev6746  9 месяцев назад +1

      @@Ole_Hendrix Problem can be in anything. Try to run it on linux (maybe docker container). Because Mac's valgrind wasn't working well for me.
      Otherwise, try to compare what you do differently than I did. My code is more or less clean and should be easy to follow. If your's is also clean, maybe I could spend 5 minutes to take a look. But can't promise to solve the problem.

  • @MaxKramer0
    @MaxKramer0 Год назад