{"id":24733732,"url":"https://github.com/hex01e/philosophers","last_synced_at":"2026-05-16T17:34:56.908Z","repository":{"id":272648475,"uuid":"655270039","full_name":"hex01e/philosophers","owner":"hex01e","description":"Philosophers is a project designed to teach the basics of threading and process management in C. Through this project, you will learn to implement and manage threads, mutexes, and semaphores while simulating the classic dining philosophers problem.","archived":false,"fork":false,"pushed_at":"2025-01-15T18:36:20.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-30T12:43:35.527Z","etag":null,"topics":["c","makefile","threads"],"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/hex01e.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":"2023-06-18T12:03:37.000Z","updated_at":"2025-01-15T18:38:46.000Z","dependencies_parsed_at":"2025-01-15T21:23:37.723Z","dependency_job_id":"bd40625b-2bde-4992-bc84-660b12190785","html_url":"https://github.com/hex01e/philosophers","commit_stats":null,"previous_names":["hex01e/philosophers"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hex01e/philosophers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex01e%2Fphilosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex01e%2Fphilosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex01e%2Fphilosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex01e%2Fphilosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex01e","download_url":"https://codeload.github.com/hex01e/philosophers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex01e%2Fphilosophers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020348,"owners_count":26086866,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c","makefile","threads"],"created_at":"2025-01-27T18:44:08.597Z","updated_at":"2025-10-14T18:38:39.298Z","avatar_url":"https://github.com/hex01e.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Philosophers\n\n## Overview\n\n**Philosophers** is a project designed to teach the basics of threading and process management in C. Through this project, you will learn to implement and manage threads, mutexes, and semaphores while simulating the classic dining philosophers problem.\n\n---\n\n## Features\n\n### Mandatory Part\n- **Program Name**: `philo`\n- **Key Concepts**:\n  - Each philosopher is represented by a thread.\n  - Forks are shared resources, protected by mutexes.\n  - The simulation manages states like eating, thinking, and sleeping while avoiding data races.\n- **Simulation Rules**:\n  - Philosophers alternate between eating, sleeping, and thinking.\n  - Forks are placed between philosophers; each philosopher requires two forks to eat.\n  - The simulation ends if a philosopher dies of starvation or when all philosophers have eaten a defined number of times.\n\n### Bonus Part\n- **Program Name**: `philo_bonus`\n- **Key Concepts**:\n  - Each philosopher is represented by a separate process.\n  - Forks are shared resources, tracked using semaphores.\n  - The simulation ensures synchronization and avoids race conditions.\n- **Enhanced Features**:\n  - All forks are placed in the center of the table and managed using a semaphore.\n  - The main process orchestrates the simulation, while child processes represent philosophers.\n\n---\n\n## Setup Instructions\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/hex01e/philosophers\n   cd philosophers```\n2. Run\n   - Make and run the mandatory part\n   ```bash\n   cd philo\n   make \n   ./philo \u003cnumber_of_philosophers\u003e \u003ctime_to_die\u003e \u003ctime_to_eat\u003e \u003ctime_to_sleep\u003e [number_of_times_each_philosopher_must_eat```\n  - Make and run the bonus part\n    ```bash\n    cd philo_bonus\n    make\n    ./philo_bonus \u003cnumber_of_philosophers\u003e \u003ctime_to_die\u003e \u003ctime_to_eat\u003e \u003ctime_to_sleep\u003e [number_of_times_each_philosopher_must_eat]```\n  Replace the arguments with appropriate values:\n\n  - number_of_philosophers: Total number of philosophers.\n      - `time_to_die`: Time in milliseconds before a philosopher dies if they do not start eating.\n      - `time_to_eat`: Time in milliseconds a philosopher spends eating.\n      - `time_to_sleep`: Time in milliseconds a philosopher spends sleeping.\n      - `number_of_times_each_philosopher_must_eat` (optional): Stops the simulation after all philosophers have eaten this many times.\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex01e%2Fphilosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex01e%2Fphilosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex01e%2Fphilosophers/lists"}