Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ugolinolle/philosophers

💻・Philosophers is a project to solve the dining philosophers problem.
https://github.com/ugolinolle/philosophers

42 c philosophers42 thread

Last synced: about 18 hours ago
JSON representation

💻・Philosophers is a project to solve the dining philosophers problem.

Awesome Lists containing this project

README

        

# Philosophers


Philosophers 42 project badge

[![42 School Project](https://img.shields.io/badge/42%20Project-Philosophers-blue)](https://github.com/your-username/philosophers)
[![Language: C](https://img.shields.io/badge/language-C-green.svg)]()

## 💻・Description

Philosophers is a project that introduces the basics of threading a process and how to work with mutexes. It simulates a classic synchronization problem: the dining philosophers problem.

**Features:**
- Simulates philosophers eating, thinking, and sleeping
- Uses threads to represent each philosopher
- Implements mutexes to handle resource sharing (forks)
- Ensures no philosopher starves

**Technologies Used:**
- C Language
- POSIX Threads
- Mutexes

## ⌨️・Usage

1. Compile the program:

```bash
make
```

2. Run the program with the following arguments:

```bash
./philo number_of_philosophers time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]
```

### Example:
```bash
./philo 5 800 200 200 7
```

## 🧑‍🤝‍🧑・Contributing

Contributions to this project are welcome. If you find any issues or want to improve the code, please feel free to open a pull request or issue.

## 📑・License

This project is licensed under the [MIT License](https://github.com/UgolinOlle/philosophers/blob/master/LICENSE) - see the LICENSE file for details.

## 📩・Contact

If you have any questions or would like to collaborate, please do not hesitate to contact me at [email](mailto:[email protected]) or [LinkedIn](https://linkedin.com/in/ugolin-olle)