Giter Site home page Giter Site logo

ridwane-el-filali / philosophers Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 5.41 MB

In this project, you will learn the basics of threading a process. You will see how to create threads and you will discover mutexes.

Home Page: https://github.com/RIDWANE-EL-FILALI

License: MIT License

C 97.68% Makefile 2.32%
1337 42 42born2code 42cursus 42projects concurrency concurrent-programming dinning-phillospher mutex mutex-synchronisation

philosophers's Introduction

image

Sumary :

The Dining Philosophers problem is a classic computer science problem that illustrates the challenges of concurrency and resource allocation in a multi-process environment. The problem involves a group of philosophers who are seated at a circular table, with each philosopher having a bowl of rice and a single chopstick on either side of their bowl. The philosophers spend their time alternating between thinking and eating. However, each philosopher needs two chopsticks to eat, and there are only five chopsticks available for the group to share.

The challenge is to design an algorithm that ensures that each philosopher can pick up both chopsticks and eat without causing a deadlock, where each philosopher is waiting for the chopstick held by their neighbor. This problem is a classic example of a deadlock situation in which each philosopher is waiting for the other to release a chopstick before they can eat.

One possible solution to the Dining Philosophers problem is to use a synchronization mechanism to ensure that only one philosopher can pick up a chopstick at a time. This approach involves assigning a unique ID to each chopstick and using a semaphore to control access to the chopsticks. The semaphore can be used to enforce mutual exclusion, ensuring that only one philosopher can access a chopstick at a time.

Overall, the Dining Philosophers problem is a classic example of a synchronization problem that requires careful consideration of the use of shared resources and concurrency management in a multi-process environment.

⛓️LINKS:

🥇Badge:

image

📚Skills:

  • Unix
  • Imperative programming
  • Rigor

📱REACH ME

Made by RIDWANE EL FILALI 👋 See my linkedin

If you like this repo star it

philosophers's People

Contributors

ridwane-el-filali avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.