{"id":18319921,"url":"https://github.com/mushigarou/philosophers","last_synced_at":"2025-04-09T14:23:22.477Z","repository":{"id":158441429,"uuid":"633999709","full_name":"Mushigarou/Philosophers","owner":"Mushigarou","description":"The dining philosopher's problem was solved using mutexes in the C Language.","archived":false,"fork":false,"pushed_at":"2023-06-05T10:31:25.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T08:20:56.264Z","etag":null,"topics":["c-language-programming","concurrent-programming","multithreading","mutex-synchronisation","parallel-programming","philosophers-dinner-problem"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mushigarou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-28T19:22:57.000Z","updated_at":"2023-07-27T02:58:41.000Z","dependencies_parsed_at":"2023-07-13T04:33:15.474Z","dependency_job_id":null,"html_url":"https://github.com/Mushigarou/Philosophers","commit_stats":null,"previous_names":["leakedbytebuster/philosophers","mushigarou/philosophers"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mushigarou%2FPhilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mushigarou%2FPhilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mushigarou%2FPhilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mushigarou%2FPhilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mushigarou","download_url":"https://codeload.github.com/Mushigarou/Philosophers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054274,"owners_count":21039968,"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":["c-language-programming","concurrent-programming","multithreading","mutex-synchronisation","parallel-programming","philosophers-dinner-problem"],"created_at":"2024-11-05T18:14:41.379Z","updated_at":"2025-04-09T14:23:22.444Z","avatar_url":"https://github.com/Mushigarou.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 git clone https://github.com/Mushigarou/Philosophers.git\n$\u003e cd Philosophers\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%2Fmushigarou%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmushigarou%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmushigarou%2Fphilosophers/lists"}