Coder Social home page Coder Social logo

tommyjd93 / philosophers Goto Github PK

View Code? Open in Web Editor NEW
89.0 1.0 4.0 199 KB

Dining philosophers problem's guide for 42 school

Makefile 7.24% C 92.76%
42born2code 42school c multithreading mutexes philosophers-dinner-problem pthreads 42 42-school 42cursus

philosophers's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ‘‹ Hi, Iโ€™m @TommyJD93 (Tommy)
  • ๐Ÿ–ฅ Iโ€™m currently student at 42Roma Luiss
  • โŒจ๏ธ Iโ€™m currently learning C, C++, Unix, Virtual machines
  • ๐Ÿ“ซ Reach me -> [email protected]
My 42 stats
tterribi's 42 stats
My GitHub stats

Profile views counter

philosophers's People

Contributors

tommyjd93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

philosophers's Issues

Data races and philosopher dies when we make 200 threads

Compiling with -fsanitize=thread gives the following error on the school mac

WARNING: ThreadSanitizer: data race (pid=2438)
  Write of size 4 at 0x7ffee1d15760 by thread T54 (mutexes: write M244, write M16):
    \#0 messages <null>:2 (philo:x86_64+0x1000038bc)
    #1 supervisor <null>:2 philo:x86_64+0x1000030fa)

  Previous read of size 4 at 0x7ffee1d15760 by thread T10:
    \#0 supervisor <null>:2 (philo:x86_64+0x10000306a)

  Location is stack of main thread.

  Mutex M244 (0x7ba800000c58) created at:
    \#0 pthread_mutex_init <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2e913)
    \#1 init_philos <null>:2 (philo:x86_64+0x1000022a1)
    \#2 init <null>:2 (philo:x86_64+0x10000274e)
    \#3 main <null>:2 (philo:x86_64+0x1000019ab)

  Mutex M16 (0x7ffee1d157d8) created at:
    \#0 pthread_mutex_init <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2e913)
    \#1 init_data <null>:2 (philo:x86_64+0x10000265d)
    \#2 init <null>:2 (philo:x86_64+0x1000026f4)
    \#3 main <null>:2 (philo:x86_64+0x1000019ab)

  Thread T54 (tid=91819, running) created by thread T53 at:
    \#0 pthread_create <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2d8fd)
    \#1 routine <null>:2 (philo:x86_64+0x100003334)

  Thread T10 (tid=91775, running) created by thread T9 at:
    \#0 pthread_create <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2d8fd)
    \#1 routine <null>:2 (philo:x86_64+0x100003334)

SUMMARY: ThreadSanitizer: data race (philo:x86_64+0x1000038bc) in messages+0x16c
==================
ThreadSanitizer: reported 1 warnings
[1]    2438 abort      ./philo 200 800 200 200

also when running the below prompt : ./philo 200 800 200 200
a philosopher dies but he is not supposed to according to the subject.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.