{"id":28492829,"url":"https://github.com/msabr/philosophers_1337","last_synced_at":"2026-03-07T03:31:42.149Z","repository":{"id":294032324,"uuid":"985783520","full_name":"msabr/PHILOSOPHERS_1337","owner":"msabr","description":"The classic dining philosophers problem 🍽️ simulates concurrent philosophers competing for forks, illustrating synchronization techniques to prevent deadlocks, starvation, and race conditions.","archived":false,"fork":false,"pushed_at":"2025-08-29T17:00:46.000Z","size":25642,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-29T19:25:35.856Z","etag":null,"topics":["1337cursus","1337school","42cursus","42projects","42school","c","multiprocessing","multithreading","mutex","philosopher","philosophers","philosophers-42","philosophers-dinner-problem","philosophers-problem","philosophers42","prossesing","semaphore","semaphores","treads"],"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/msabr.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-18T14:18:47.000Z","updated_at":"2025-08-29T17:00:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"1cebf069-bc74-49bc-bef8-382b01006383","html_url":"https://github.com/msabr/PHILOSOPHERS_1337","commit_stats":null,"previous_names":["msabr/philosophers_1337"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/msabr/PHILOSOPHERS_1337","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msabr%2FPHILOSOPHERS_1337","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msabr%2FPHILOSOPHERS_1337/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msabr%2FPHILOSOPHERS_1337/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msabr%2FPHILOSOPHERS_1337/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msabr","download_url":"https://codeload.github.com/msabr/PHILOSOPHERS_1337/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msabr%2FPHILOSOPHERS_1337/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T03:24:23.086Z","status":"ssl_error","status_checked_at":"2026-03-07T03:23:11.444Z","response_time":53,"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":["1337cursus","1337school","42cursus","42projects","42school","c","multiprocessing","multithreading","mutex","philosopher","philosophers","philosophers-42","philosophers-dinner-problem","philosophers-problem","philosophers42","prossesing","semaphore","semaphores","treads"],"created_at":"2025-06-08T08:31:42.218Z","updated_at":"2026-03-07T03:31:42.140Z","avatar_url":"https://github.com/msabr.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  PHILOSOPHERS - 42 Network\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"Philosophers.png\" with=\"600\"/\u003e\n\u003c/div\u003e\n\nImplementation of the **Dining Philosophers Problem**, a classic concurrency challenge, using **threads (mandatory)** and optionally **processes/semaphores (bonus)**.\n\n---\n## 📖 The Dining Philosophers Problem\n\nThe **Dining Philosophers Problem** is a classic concurrency challenge first formulated by **Edsger W. Dijkstra** in 1965. It models synchronization, resource sharing, and deadlock avoidance in concurrent systems.\n\n---\n\n### 🪑 Problem Setup\n\n- A group of philosophers sit around a round table.\n- There are as many forks as philosophers, one between each pair.\n- Each philosopher can:\n  - **Eat**, **sleep**, or **think**\n  - To **eat**, a philosopher must pick up **two forks** (the one to their right and the one to their left).\n- Forks are shared resources and can only be held by one philosopher at a time.\n- Philosophers cannot eat unless they have both forks.\n- Philosophers never do more than one action at a time.\n\n---\n\n### 🔄 The Challenge\n\nNaive implementations lead to issues such as:\n\n- 🛑 **Deadlock**: All philosophers pick up one fork and wait indefinitely for the other.\n- 🧍 **Starvation**: Some philosophers may never get to eat.\n- 💥 **Race Conditions**: Without proper synchronization, concurrent access corrupts shared data.\n\n---\n## ❓ Problem Statement\n\n**How can multiple concurrent threads safely share resources (forks) without deadlocks, starvation, or data races — using only mutexes and thread primitives?**\n\nThe project simulates N philosophers sitting around a table. Each must:\n\n- **Take two forks** (mutexes)\n- **Eat** for a defined duration\n- **Sleep**\n- **Think**\n- Repeat the cycle indefinitely\n\nA monitor thread ensures no philosopher dies from starvation (exceeding `time_to_die` without eating).\n\n---\n\n## 🎯 Objective\n\nSimulate a group of philosophers sitting around a table. Each must:\n\n- 🥢 Take forks\n- 🍝 Eat\n- 😴 Sleep\n- 💭 Think  \nWithout creating **deadlocks** or **data races**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsabr%2Fphilosophers_1337","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsabr%2Fphilosophers_1337","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsabr%2Fphilosophers_1337/lists"}