Skip to content

moop250/philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 

Repository files navigation

Philosophers

100/100

Description

The Philosophers project at 42 explores the concepts of threading and process synchronization within the context of the famous Dining Philosophers Problem. The challenge involves simulating a scenario where philosophers sit around a table, alternating between eating, thinking, and sleeping without running into deadlocks.

Features

  • Utilizes POSIX threads to simulate the actions of each philosopher.
  • Implements mutexes for managing access to shared resources, such as forks.
  • Avoids potential deadlocks and ensures no philosopher starves.

Compatibility & Size

Usage

To clone the repository, use:

git clone https://github.com/moop250/philosophers.git

Compilation & cleanup:

  • make : Compiles the code.
  • make clean : Would clean up object files (.o) if there were any.
  • make fclean : Cleans up all files generated by the make command, including the executable.
  • make re : Executes make fclean followed by make to recompile all the code.

Example usage:

./philosophers number_of_philosophers time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors