Skip to content

I never thought philosophy would become so lethal

Notifications You must be signed in to change notification settings

mhernangilp/philo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

🍴 philosophers

I never thought philosophy would become so lethal


screenshot

💡 About the project

In this project, you will learn the basic principles of threading a process. You will learn how to create threads and discover mutex.

For more detailed information, look at the subject of this project.

🛠️ Usage

Requirements

The function is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Compiling

To compile, go to the project path and run:

$ make

📋 Testing

To execute the program, run:

$ ./philo <number_of_philosophers> <time_to_die time_to_eat> <time_to_sleep> [number_of_times_each_philosopher_must_eat]

An example with 4 philosophers, 410 ms to die, 200 ms to eat and 200 ms to sleep:

$ ./philo 4 410 200 200

In this case no one dies, but if we put 310 ms to die instead:

$ ./philo 4 310 200 200

There will be a moment where one of them will die because the time elapsed since the last meal exceeded the time to die.

About

I never thought philosophy would become so lethal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published