{"id":21626003,"url":"https://github.com/pamaldi/many-virtual-dining-philosophers","last_synced_at":"2026-07-06T01:31:27.340Z","repository":{"id":160659236,"uuid":"628995592","full_name":"pamaldi/many-virtual-dining-philosophers","owner":"pamaldi","description":"Classical dining philosophers concurrency problem with java virtual threads","archived":false,"fork":false,"pushed_at":"2023-04-21T20:03:54.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-04T17:57:54.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/pamaldi.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":"2023-04-17T12:09:23.000Z","updated_at":"2023-04-20T14:08:18.000Z","dependencies_parsed_at":"2023-05-11T16:45:12.561Z","dependency_job_id":null,"html_url":"https://github.com/pamaldi/many-virtual-dining-philosophers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pamaldi/many-virtual-dining-philosophers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamaldi%2Fmany-virtual-dining-philosophers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamaldi%2Fmany-virtual-dining-philosophers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamaldi%2Fmany-virtual-dining-philosophers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamaldi%2Fmany-virtual-dining-philosophers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pamaldi","download_url":"https://codeload.github.com/pamaldi/many-virtual-dining-philosophers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pamaldi%2Fmany-virtual-dining-philosophers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271727572,"owners_count":24810561,"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-08-22T02:00:08.480Z","response_time":65,"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":[],"created_at":"2024-11-25T01:11:38.672Z","updated_at":"2025-10-24T06:37:43.810Z","avatar_url":"https://github.com/pamaldi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Many virtual dining philosophers.\n\nMany virtual dining philosophers is a Java implementation of a classic concurrency problem:\n[Dining Philosophers](https://en.wikipedia.org/wiki/Dining_philosophers_problem)\nusing [communicating sequential processes (CSP)](https://en.wikipedia.org/wiki/Communicating_sequential_processes).\n\nIt's an extension of the original one problem, from five to many philosophers.\n\nThe purpose of this extension is to compare a Virtual Threads based implementation with a Native Threads based one.\n\n## CSP solution\n\nThe CSP solution is based on a number of channels.\nFor each philosopher there are two channels, one for the left fork and one for the right fork.\nTo avoid deadlock there is an any to one channel for every philosopher, which is used to signal that the philosopher is done eating.\nThe any to one channel il an n-1 blocking queue, where n is the number of philosophers.\n\n## Virtual Threads implementation\n\nEvery philosopher is a virtual thread, which is started by the main thread, which is also the coordinator.\n\n## Native Threads implementation\n\nEvery philosopher is a native thread, which is started by the main thread, which is also the coordinator.\n\n## Build\n\n [OpenJDK 20](https://www.oracle.com/java/technologies/javase/jdk20-archive-downloads.html) \nis required.\n\n\n## Command Line Arguments\n1.   PhilosopherType philosopherType: GREEK for native Threads, GERMAN for virtual Threads\n2.   Integer numberOfPhilosophers\n3.   Long thinkingTime (in milliseconds)\n4.   Long eatingTime (in milliseconds)\n5.   Integer cycles:  number of eating cycles for each philosopher\n\n## Benchmark\n\nSome benchmark results\n![](bench2.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamaldi%2Fmany-virtual-dining-philosophers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpamaldi%2Fmany-virtual-dining-philosophers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpamaldi%2Fmany-virtual-dining-philosophers/lists"}