{"id":21285344,"url":"https://github.com/izenynn/philosophers","last_synced_at":"2026-05-11T02:49:58.478Z","repository":{"id":134168001,"uuid":"424342259","full_name":"izenynn/philosophers","owner":"izenynn","description":"42 Cursus - philosophers: this project is a training to multi-threads/multi-process programming.","archived":false,"fork":false,"pushed_at":"2022-02-21T21:18:53.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T05:15:34.110Z","etag":null,"topics":["42","42born2code","c","linux","macos","mutex","mutex-lock","mutex-synchronisation","philosophers","philosophers-dinner-problem","semaphore","sempahores","threading","threads"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/izenynn.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-03T18:44:02.000Z","updated_at":"2021-12-21T16:46:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b6fa3ae-b514-49d3-970c-af853e641d19","html_url":"https://github.com/izenynn/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/izenynn%2Fphilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izenynn%2Fphilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izenynn%2Fphilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izenynn%2Fphilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izenynn","download_url":"https://codeload.github.com/izenynn/philosophers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243746200,"owners_count":20341203,"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":["42","42born2code","c","linux","macos","mutex","mutex-lock","mutex-synchronisation","philosophers","philosophers-dinner-problem","semaphore","sempahores","threading","threads"],"created_at":"2024-11-21T11:19:51.683Z","updated_at":"2026-05-11T02:49:53.433Z","avatar_url":"https://github.com/izenynn.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# philosophers\n\n## Info\n\n42 Cursus - philosophers: this project is a training to multi-threads/multi-process programming.\n\n- Status: finished\n- Result: 125%\n- Observations: (null)\n\n## The philosophers problem\n\nThe classic dining philosopher problem.\n\nThis problem states that N philosophers seated around a circular table with one fork between each pair of philosophers. A philosopher may eat if he can pick up the two forks adjacent to him. One fork may be picked up by any one of its adjacent followers but not both. \n\nEach time a philosopher finish eating, they will drop drop their forks and start sleeping. Once they have finished sleeping, the will start thinking and waiting to eat.\n\nSimulation stops when a philosopher dies.\n\nEvery philosopher needs to eat and they should never starve.\n\nPhilosophers do not speak with each other.\n\nPhilosophers do not know when another philospher is about to die.\n\nAnd of course, philosophers should avoid dying.\n\n## Solutions\n\n[philo](https://github.com/izenynn/philosophers/tree/main/philo): philosophers with threads and mutex.\n\n- One fork between each pair of philosophers.\n\n[philo_bonus](https://github.com/izenynn/philosophers/tree/main/philo_bonus): philosophers with processes and semaphore.\n\n- All the forks are in the middle of the table.\n\n## How to use\n\nClone the repo\n\n```sh\ngit clone https://github.com/izenynn/libft.git\n```\nGo to `philo` or `philo_bonus` folder and run `make`\n\n```sh\ncd ./philo \u0026\u0026 make\n```\n```sh\ncd ./philo_bonus \u0026\u0026 make\n```\n\n- *Makefile rules: `all`, `clean`, `fclean`, `re`).*\n\nUsage\n\n```sh\n./philo [N PHILOS] [DIE TIME] [EAT TIME] [SLEEP TIME] (OPT)[PHILO EAT N TIMES]\n```\n\n- last argument is optional.\n\n- `philo_bonus` takes the same arguments as `philo`.\n\nExample\n\n```sh\n./philo 4 800 200 200\n```\n\n```sh\n./philo_bonus 10 410 200 200 7\n```\n\n##\n\n[![forthebadge](https://forthebadge.com/images/badges/made-with-c.svg)](https://forthebadge.com)\n[![forthebadge](https://forthebadge.com/images/badges/it-works-why.svg)](https://forthebadge.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizenynn%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizenynn%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizenynn%2Fphilosophers/lists"}