{"id":20269492,"url":"https://github.com/iker-gonzalez/philosophers","last_synced_at":"2026-05-06T17:35:41.823Z","repository":{"id":109131243,"uuid":"499788965","full_name":"iker-gonzalez/philosophers","owner":"iker-gonzalez","description":"Classic dining philosophers problem resolved using multithreading with mutex (mandatory) and multiprocessing with semafores (bonus)","archived":false,"fork":false,"pushed_at":"2022-06-05T18:01:52.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-31T02:16:12.381Z","etag":null,"topics":["42cursus","bash","c","linux","multiprocessing","multithreading","mutex","semaphores"],"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/iker-gonzalez.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":"2022-06-04T10:06:58.000Z","updated_at":"2024-01-24T11:10:58.000Z","dependencies_parsed_at":"2023-03-16T07:31:08.077Z","dependency_job_id":null,"html_url":"https://github.com/iker-gonzalez/philosophers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iker-gonzalez/philosophers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iker-gonzalez%2Fphilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iker-gonzalez%2Fphilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iker-gonzalez%2Fphilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iker-gonzalez%2Fphilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iker-gonzalez","download_url":"https://codeload.github.com/iker-gonzalez/philosophers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iker-gonzalez%2Fphilosophers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32704685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["42cursus","bash","c","linux","multiprocessing","multithreading","mutex","semaphores"],"created_at":"2024-11-14T12:25:30.281Z","updated_at":"2026-05-06T17:35:41.806Z","avatar_url":"https://github.com/iker-gonzalez.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    🍝 Philosophers 🤓\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cb\u003e\u003ci\u003eDevelopment repo for 42cursus' philosophers project\u003c/i\u003e\u003c/b\u003e\u003cbr\u003e\n\tFor further information about 42cursus and its projects, please refer to \u003ca href=\"https://github.com/iker-gonzalez/42_cursus\"\u003e\u003cb\u003e42cursus repo\u003c/b\u003e\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/iker-gonzalez/philosophers?color=blueviolet\" /\u003e\n\t\u003cimg alt=\"Number of lines of code\" src=\"https://img.shields.io/tokei/lines/github/iker-gonzalez/philosophers?color=blueviolet\" /\u003e\n\t\u003cimg alt=\"Code language count\" src=\"https://img.shields.io/github/languages/count/iker-gonzalez/philosophers?color=blue\" /\u003e\n\t\u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/iker-gonzalez/philosophers?color=blue\" /\u003e\n\t\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/iker-gonzalez/philosophers?color=brightgreen\" /\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n\t\u003ca href=\"#%EF%B8%8F-about\"\u003eAbout\u003c/a\u003e\n\t\u003cspan\u003e · \u003c/span\u003e\n\t\u003ca href=\"#%EF%B8%8F-usage\"\u003eUsage\u003c/a\u003e\n\u003c/h3\u003e\n\n---\n\n## 🗣️ About\n\n\u003e In this project, you will learn the basics of threading a process. You will learn how to make threads. You will discover the mutex.\n\n\n42's take on the classic [Dining philosophers problem](https://en.wikipedia.org/wiki/Dining_philosophers_problem). The mandatory part was done using the phtread API to execute n numbers of threads at once that eat, sleep, then start eating again. Mutex was used to manage the limited resources available.\nGiven the right parameters, philosophers keep repeating their cycle virtually forever, unless a maximum number of times each philosopher must eat before the simulation ends is given.\nExamples:\n\n```\nn_philosophers  time_before_death time_eat  time_sleep  [time_eats]\n4 410 200 200\n5 800 200 200 5\n```\n\nFor detailed information, refer to the [**subject of this project**](https://github.com/iker-gonzalez/42_cursus/blob/main/_PDFs/en.subject_philosophers.pdf)\n\n ## 🛠️ Usage\n\nClone the repo and open the corresponding folder.\n\nCompile the program\n```\nmake\n```\nExecute program with parameters: `n_philosophers time_before_death time_eat time_sleep [numbers_of_eats]` (last parameter is optional)\n```\n./philo 4 410 200 200 1\n```\nExpected output:\n```\n0 1 has taken a fork\n0 1 has taken a fork\n0 1 is eating\n0 3 has taken a fork\n0 3 has taken a fork\n0 3 is eating\n200 3 is sleeping\n200 1 is sleeping\n200 2 has taken a fork\n200 2 has taken a fork\n200 4 has taken a fork\n200 4 has taken a fork\n200 4 is eating\n200 2 is eating\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiker-gonzalez%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiker-gonzalez%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiker-gonzalez%2Fphilosophers/lists"}