{"id":19611816,"url":"https://github.com/saidm96/philosophers","last_synced_at":"2026-06-10T06:46:51.051Z","repository":{"id":107408246,"uuid":"470007375","full_name":"SaidM96/philosophers","owner":"SaidM96","description":"The dining philosopher's problem. Solved using mutexes","archived":false,"fork":false,"pushed_at":"2023-07-25T10:08:57.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-09T10:18:56.877Z","etag":null,"topics":["clanguage","mutex-synchronisation","philosophers-dinner-problem","processes","semaphore","threads"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SaidM96.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-15T04:38:08.000Z","updated_at":"2023-07-25T10:09:26.000Z","dependencies_parsed_at":"2024-11-11T10:44:21.059Z","dependency_job_id":"899a7b82-1073-449f-9d1d-e75ecbf4be83","html_url":"https://github.com/SaidM96/philosophers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaidM96%2Fphilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaidM96%2Fphilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaidM96%2Fphilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaidM96%2Fphilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SaidM96","download_url":"https://codeload.github.com/SaidM96/philosophers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240900708,"owners_count":19875589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clanguage","mutex-synchronisation","philosophers-dinner-problem","processes","semaphore","threads"],"created_at":"2024-11-11T10:44:10.751Z","updated_at":"2026-06-10T06:46:46.030Z","avatar_url":"https://github.com/SaidM96.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The dining philosopher's problem\n![shapes-1](https://github.com/Mushigarou/Philosophers/assets/115739322/2c538004-ddde-428e-a1ae-bde719fe3737)\n\n## Overview :\n- One or more philosophers sit at a round table.\nThere is a large bowl of spaghetti in the middle of the table.\n- The philosophers alternatively eat, think, or sleep.\nWhile they are eating, they are not thinking nor sleeping;\nwhile thinking, they are not eating nor sleeping;\nand, of course, while sleeping, they are not eating nor thinking.\n- There are also forks on the table. There are as many forks as philosophers.\n- Because serving and eating spaghetti with only one fork is very inconvenient, a\nphilosopher takes their right and their left forks to eat, one in each hand.\n- When a philosopher has finished eating, they put their forks back on the table and\nstart sleeping. Once awake, they start thinking again. The simulation stops when\na philosopher dies of starvation.\n- Every philosopher needs to eat and should never starve.\n- Philosophers don’t speak with each other.\n- Philosophers don’t know if another philosopher is about to die.\n\n## Usage :\n\n```\n$\u003e make\n$./philo 5 800 200 200\n```\n## Rules :\nThe program should take the following arguments:\n```\n$\u003e ./philo number_of_philosophers time_to_die time_to_eat time_to_sleep [number_of_times_each_philosopher_must_eat]\n```\n- number_of_philosophers: The number of philosophers and also the number\nof forks.\n- time_to_die (in milliseconds): If a philosopher didn’t start eating time_to_die\nmilliseconds since the beginning of their last meal or the beginning of the sim-\nulation, they die.\n- time_to_eat (in milliseconds): The time it takes for a philosopher to eat.\nDuring that time, they will need to hold two forks.\n- time_to_sleep (in milliseconds): The time a philosopher will spend sleeping.\n- number_of_times_each_philosopher_must_eat (optional argument): If all\nphilosophers have eaten at least number_of_times_each_philosopher_must_eat\ntimes, the simulation stops. If not specified, the simulation stops when a\nphilosopher dies.\n- Each philosopher has a number ranging from 1 to number_of_philosophers.\n- Philosopher number 1 sits next to philosopher number number_of_philosophers.\nAny other philosopher number N sits between philosopher number N - 1 and philoso-\npher number N + 1.\n- A message announcing a philosopher died should be displayed no more than 10 ms\nafter the actual death of the philosopher.\n\n![Eating](https://github.com/Mushigarou/Philosophers/assets/115739322/cef600c6-d5e7-4776-9e25-655f0047d614)\n\n## Contributing\n\nContributions to this project are welcome! If you find any issues or have improvements to suggest, please feel free to submit a pull request.\n## License\n\nThis project is licensed under the MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaidm96%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaidm96%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaidm96%2Fphilosophers/lists"}