- Notifications
You must be signed in to change notification settings - Fork1
senthuran16/concurrent-printing-system-demo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Demonstration 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.
Contents:
The Java code uses Re-entrant Locks.PrintingSystem class has the main method, which can be used to run the demo.
The corresponding FSP processes are as follows:
constMAX_SHEETS=3// Maximum number of sheets in a printersetPRINT_ACTIONS={acquirePrint, print, acquireRefill, refill, release}// Initialise printer with given number of sheets and continuePRINTER(PAPER_COUNT=MAX_SHEETS)=PRINTER[PAPER_COUNT],PRINTER[p :0..PAPER_COUNT]=if(p>0)then(acquirePrint->print->release->PRINTER[p-1])else(acquireRefill->refill->release->PRINTER[MAX_SHEETS]).// Initialise student and print given number of documentsSTUDENT(DOCUMENT_COUNT=1)=STUDENT[DOCUMENT_COUNT],STUDENT[d :1..DOCUMENT_COUNT]=(acquirePrint->print[d]->if(d>1)then(release->STUDENT[d-1])else(release->END)// Prints the last document)+PRINT_ACTIONS/{print/print[d:1..DOCUMENT_COUNT]}.//Exposesprint[d]actionsasjust"print"TECHNICIAN=(acquireRefill->refill->release->TECHNICIAN|wait->TECHNICIAN)+PRINT_ACTIONS.||PRINTING_SYSTEM=(s3:STUDENT(3)||s2:STUDENT(2)||t:TECHNICIAN||{s3, s2, t} ::PRINTER).
Implemented 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.
Author: Senthuran Ambalavanar (github.com/senthuran16)
About
Demonstration of a concurrent printing system (Java & FSP), that has several students that share a printer to print documents, and two technicians that refill it with paper and toner cartridges.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.