{"id":15375264,"url":"https://github.com/senthuran16/concurrent-printing-system-demo","last_synced_at":"2025-09-15T00:10:02.042Z","repository":{"id":83477971,"uuid":"312825475","full_name":"senthuran16/concurrent-printing-system-demo","owner":"senthuran16","description":"Demonstration of a concurrent printing system (Java \u0026 FSP), that has several students that share a printer to print documents, and two technicians that refill it with paper and toner cartridges.","archived":false,"fork":false,"pushed_at":"2020-12-20T15:12:17.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T22:14:47.380Z","etag":null,"topics":["concurrent-programming","fsp","java","ltsa","multi-threading","reentrantlock"],"latest_commit_sha":null,"homepage":"","language":"Java","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/senthuran16.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-11-14T13:45:38.000Z","updated_at":"2020-12-20T15:12:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"cfb5828d-2d77-4334-a7a2-e3e594e151dc","html_url":"https://github.com/senthuran16/concurrent-printing-system-demo","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"467b349e35cd527ae0ab88be98db053c2b7d1e5c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/senthuran16/concurrent-printing-system-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senthuran16%2Fconcurrent-printing-system-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senthuran16%2Fconcurrent-printing-system-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senthuran16%2Fconcurrent-printing-system-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senthuran16%2Fconcurrent-printing-system-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/senthuran16","download_url":"https://codeload.github.com/senthuran16/concurrent-printing-system-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senthuran16%2Fconcurrent-printing-system-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275185443,"owners_count":25419930,"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-09-14T02:00:10.474Z","response_time":75,"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":["concurrent-programming","fsp","java","ltsa","multi-threading","reentrantlock"],"created_at":"2024-10-01T14:02:17.994Z","updated_at":"2025-09-15T00:10:01.983Z","avatar_url":"https://github.com/senthuran16.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Concurrent Printing System - Demo\n\nDemonstration of a concurrent printing system, that has several students that share a printer to print documents, and two technicians that refill it with paper and toner cartridges.\n\nContents:\n* [Java Code](src)\n* [FSP Processes](Printer.lts)\n\nThe Java code uses Re-entrant Locks. [PrintingSystem](src/PrintingSystem.java) class has the main method, which can be used to run the demo.\n\nThe corresponding FSP processes are as follows: \n\n```javascript\nconst MAX_SHEETS = 3 // Maximum number of sheets in a printer\n\nset PRINT_ACTIONS = {acquirePrint, print, acquireRefill, refill, release}\n\n// Initialise printer with given number of sheets and continue\nPRINTER (PAPER_COUNT = MAX_SHEETS) = PRINTER[PAPER_COUNT],\nPRINTER[p : 0..PAPER_COUNT] = \n\tif (p \u003e 0)\n\tthen (acquirePrint -\u003e print -\u003e release -\u003e PRINTER[p-1])\n\telse (acquireRefill -\u003e refill -\u003e release -\u003e PRINTER[MAX_SHEETS]).\n\n// Initialise student and print given number of documents\nSTUDENT(DOCUMENT_COUNT = 1) = STUDENT[DOCUMENT_COUNT],\nSTUDENT[d : 1..DOCUMENT_COUNT] = (\n\tacquirePrint -\u003e print[d] -\u003e\n\t\tif (d \u003e 1)\n\t\tthen (release -\u003e STUDENT[d-1])\n\t\telse (release -\u003e END) // Prints the last document\n) + PRINT_ACTIONS / {print/print[d:1..DOCUMENT_COUNT]}. // Exposes print[d] actions as just \"print\"\n\nTECHNICIAN = (\n\tacquireRefill -\u003e refill -\u003e release -\u003e TECHNICIAN |\n\twait -\u003e TECHNICIAN\n) + PRINT_ACTIONS.\n\n||PRINTING_SYSTEM = (s3: STUDENT(3) || s2: STUDENT(2) || t: TECHNICIAN || {s3, s2, t} :: PRINTER).\n\n```\n\nImplemented for the coursework of the module: _Concurrent Programming (6SENG002W)_ in 2018, at Informatics Institute of Technology (IIT), Sri Lanka, in collaboration with University of Westminster.\n\nAuthor: Senthuran Ambalavanar ([github.com/senthuran16](https://github.com/senthuran16))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenthuran16%2Fconcurrent-printing-system-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsenthuran16%2Fconcurrent-printing-system-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenthuran16%2Fconcurrent-printing-system-demo/lists"}