/Philosophers

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

Primary LanguageCMIT LicenseMIT

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