Skip to content

This project utilizes threads and semaphores to simulate philosophers at a round table, showcasing concurrent programming techniques and resource synchronization.

Notifications You must be signed in to change notification settings

Ziko909/Philosophers_42Network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Philosophers

Intro

Table of Contents

Description

This project is about writing a program that simulates a group of philosophers dining at a round table. The philosophers take turns eating, thinking, and sleeping. There is a bowl of spaghetti in the middle of the table, and each philosopher needs two forks to eat. The philosophers must follow certain rules, such as not talking to each other and not knowing when another philosopher is about to die. The goal of the program is to avoid deadlocks and ensure that all philosophers eat.

Bonus Part

The bonus part of this project involves adding support for philosophers with processes and semaphores. In this part, all the forks are put in the middle of the table and they have no states in memory. Instead, the number of available forks is represented by a semaphore. Each philosopher should be a process, but the main process should not be a philosopher.

Usage

To build the project, run the following command in the project directory:

make

This will create the philo or philo_bonus executable.

To run the program, run the following command in the project directory:

./philo_bonus or ./philo number_of_philosopher  time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]

Learning Resources

Related Projects

  • Minishell: This project is about creating a feature-rich shell program.
  • Webserv: This project is aimed to create a feature-rich webserver.

Contact Information

About

This project utilizes threads and semaphores to simulate philosophers at a round table, showcasing concurrent programming techniques and resource synchronization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published