Skip to content

This is a project for the 42 cursus that focuses on the dining philosophers problem. The goal of this project is to implement a solution to the problem using multithreading and synchronization techniques while writing a C program

Notifications You must be signed in to change notification settings

shexweeknd/42-cursus-Philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

42 Philosophers Project

example of execution

This is a project for the 42 cursus that focuses on the dining philosophers problem. The goal of this project is to implement a solution to the problem using multithreading and synchronization techniques while writing a C program.

Table of Contents

Introduction

The dining philosophers problem is a classic synchronization problem in computer science. It involves a group of philosophers sitting around a table, where each philosopher alternates between thinking and eating. The problem arises when each philosopher requires two forks to eat, but there are only a limited number of forks available.

In this project, we aim to solve this problem by implementing a solution using threads and mutex locks.

Installation

Before any installation, make sure you are unsing an LTS stable Linux version that compiles C programs with cc compiler. If not, proceed with the following command on your terminal in order to install cc compiler:

sudo apt install cc

To install and run the philosophers project, follow these steps:

  1. Clone the repository:
git clone https://github.com/shexweeknd/42-cursus-Philosophers.git
  1. Navigate to the project directory:
cd 42-cursus-Philosophers/philo
  1. Compile the project with the command:
make
  1. Run the program:
./philo [number_of_philosophers] [time_to_die] [time_to_eat] [time_to_sleep] [number_of_times_each_philosopher_must_eat]

Usage

example of execution

Once the program is running, the philosophers will start their dining process. The program will output the actions of each philosopher, such as when they start eating, finish eating, start sleeping, etc. The program will terminate when a philosopher dies or when all philosophers have eaten the required number of times.

Contributing

Contributions to the philosophers project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

42

This project is from 42 School Common Core Cursurs. I do not own any of the concept mentionned above. Instead I own the provided code in the repository.

Licensed under the MIT License.

Acknowledgments

  • 42 Network for providing the project.
  • Axian Group

About

This is a project for the 42 cursus that focuses on the dining philosophers problem. The goal of this project is to implement a solution to the problem using multithreading and synchronization techniques while writing a C program

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published