{"id":20574658,"url":"https://github.com/llefranc/42_philosophers","last_synced_at":"2026-04-25T03:09:33.444Z","repository":{"id":151135588,"uuid":"307656801","full_name":"llefranc/42_philosophers","owner":"llefranc","description":"School project: introduction to the basics of threading a process and how to work on the same memory space.","archived":false,"fork":false,"pushed_at":"2021-10-26T20:12:10.000Z","size":1614,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T21:40:24.989Z","etag":null,"topics":["42","42born2code","42paris","42school","mutex","philo","philosophers","semaphore","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/llefranc.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":"2020-10-27T10:02:49.000Z","updated_at":"2023-03-28T08:17:32.000Z","dependencies_parsed_at":"2024-03-09T06:00:48.189Z","dependency_job_id":null,"html_url":"https://github.com/llefranc/42_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/llefranc%2F42_philosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llefranc%2F42_philosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llefranc%2F42_philosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/llefranc%2F42_philosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/llefranc","download_url":"https://codeload.github.com/llefranc/42_philosophers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242196023,"owners_count":20087761,"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","42paris","42school","mutex","philo","philosophers","semaphore","threads"],"created_at":"2024-11-16T05:36:25.948Z","updated_at":"2026-04-25T03:09:33.402Z","avatar_url":"https://github.com/llefranc.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# philosophers (@42Paris)\n\n\"I’ve never thought philosophy would be so deadly\"\n\n![Alt text](https://github.com/lucaslefrancq/42_philosophers/blob/main/philo_example.png)\n\n## About\n\nPhilosophers is a project of the mandatory part of the cursus.\nIt's only made in C and the main goal was to understand how threads works in language C and use them to solve a logical problem.\nThe simulation will stop if all philosophers have eaten enough or if one philosopher die.\n\n- There are three different version of the algorithm :\n    - Philo_one is about using threads and mutexs\n    - Philo_two is about using threads and semaphores\n    - Philo_three is about using processes and semaphores\n\n- Here is the [subject][1]\n\n`This project was code for MACOS`\n\n### Building and running the project\n\n1. Download/Clone this repo\n\n        git clone https://github.com/llefranc/42_philosophers.git\n2. `cd` into the root directory, then `cd` into philo_x (one, two or three) and run `make`\n\n        cd 42_philosophers/philo_one\n        make\n\n3.  run `./philo_x arg1 arg2 arg3 arg4 (arg5)` from the directory philo_x.\n    - arg1 is the number of philosopher\n    - arg2 is the time to die in ms\n    - arg3 is the time to eat in ms\n    - arg4 is the time to sleep in ms\n    - arg5 (optional) is the number of time each philosopher needs to eat to end the simulation\n    \n## Sources\n\n- [Programmation système en C sous UNIX (FR)][5]\n- [Processus et threads (FR)][2]\n- [Cours sur les threads (FR)][3]\n- [Optimizing philo algo][4]\n- [Comprendre les sémaphores (FR)][6]\n- [How to use sempahores on fork processes][7]\n\n[1]: https://github.com/lucaslefrancq/42_philosophers/blob/main/philosophers.en.subject.pdf\n[2]: https://zestedesavoir.com/tutoriels/607/les-systemes-dexploitation/processus-et-threads/\n[3]: https://cours.polymtl.ca/inf2610/documentation/notes/chap4.pdf\n[4]: https://www.notion.so/philosophers-VM-c60be9c836084edfbcd9c07e29b429c4\n[5]: https://pub.phyks.me/sdz/sdz/la-programmation-systeme-en-c-sous-unix.html#Lesthreads\n[6]: https://sites.uclouvain.be/SystInfo/notes/Theorie/html/Threads/coordination.html\n[7]: https://stackoverflow.com/questions/16400820/how-to-use-posix-semaphores-on-forked-processes-in-c\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllefranc%2F42_philosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fllefranc%2F42_philosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fllefranc%2F42_philosophers/lists"}