{"id":27014043,"url":"https://github.com/souleeater99/philosophers","last_synced_at":"2025-04-04T13:20:00.790Z","repository":{"id":284397100,"uuid":"798250726","full_name":"SouleEater99/Philosophers","owner":"SouleEater99","description":"About Section Philosophers 🍝⏳ – A 42 School project implementing the classic Dining Philosophers problem in C.  Core Concepts:  Multithreading (pthreads) \u0026 Mutex synchronization  Multiprocessing (bonus) with Semaphores  Deadlock/starvation prevention strategies  Precise timing \u0026 thread-safe logging  Key Features: ⚙️ Concurrent resource management ","archived":false,"fork":false,"pushed_at":"2025-03-25T16:58:00.000Z","size":1799,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T17:48:34.516Z","etag":null,"topics":["1337","1337cursus","42","42network","42school","c","concurrency","dining-philosophers","dining-philosophers-problem","multiprocessing","multithreading","mutex","operating-system","semaphore"],"latest_commit_sha":null,"homepage":"https://github.com/SouleEater99/Philosophers","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/SouleEater99.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":"2024-05-09T12:00:06.000Z","updated_at":"2025-03-25T16:58:03.000Z","dependencies_parsed_at":"2025-03-25T17:48:35.951Z","dependency_job_id":"15573c4b-0f33-4d0d-87cf-98877333748f","html_url":"https://github.com/SouleEater99/Philosophers","commit_stats":null,"previous_names":["souleeater99/philosophers"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SouleEater99%2FPhilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SouleEater99%2FPhilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SouleEater99%2FPhilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SouleEater99%2FPhilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SouleEater99","download_url":"https://codeload.github.com/SouleEater99/Philosophers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182426,"owners_count":20897381,"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":["1337","1337cursus","42","42network","42school","c","concurrency","dining-philosophers","dining-philosophers-problem","multiprocessing","multithreading","mutex","operating-system","semaphore"],"created_at":"2025-04-04T13:20:00.243Z","updated_at":"2025-04-04T13:20:00.783Z","avatar_url":"https://github.com/SouleEater99.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Philosophers - When Concurrency Meets Spaghetti  \n\n*A 42 School solution to the Dining Philosophers problem using threads/mutex (mandatory) and processes/semaphores (bonus)*  \n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)  \n[![42 Norm](https://img.shields.io/badge/Codestyle-42_Norm-green.svg)](https://github.com/42School/norminette)  \n\n## 🚀 Features  \n### Mandatory  \n- Thread-per-philosopher architecture  \n- Mutex-protected forks to prevent data races  \n- Real-time death checks (millisecond precision)  \n- Thread-safe logging with timestamps  \n\n### Bonus  \n- Process-based philosophers (`fork()`)  \n- Semaphore-managed fork pool  \n- Inter-process communication  \n\n## 🔍 Problem Statement  \nSimulate philosophers alternating between eating, sleeping, and thinking without:  \n- Deadlocks (circular wait)  \n- Starvation (unfair resource allocation)  \n- Data races (using mutex/semaphore)  \n\n## 🛠️ Installation  \n```bash  \ngit clone https://github.com/\u003cyour-username\u003e/Philosophers.git  \ncd Philosophers  \nmake        # Mandatory  \nmake bonus  # Bonus\n```\n\n## 💻 Usage\n#### Mandatory:\n\n./philo 5 800 200 200  # 5 philos, die after 800ms, 200ms eat/sleep  \n#### Bonus:\n\n```\n./philo_bonus 4 500 200 200 3  # Stop after 3 meals per philosopher  \n```\n\n## 📚 Implementation Details\n  * **No Global Variables:** Strict parameter passing between threads/processes\n\n* **Performance:** Optimized death-check algorithm\n\n* **Edge Cases:** 1-philosopher, 0-meals, large input handling\n\n## 🌟 Learning Outcomes\n* **Concurrency Control:** Mutex vs. semaphore tradeoffs\n\n* **Precision Timing:** `gettimeofday` microsecond accuracy\n\n* **Synchronization Patterns:** Resource contention strategies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouleeater99%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsouleeater99%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsouleeater99%2Fphilosophers/lists"}