Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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.

NotificationsYou must be signed in to change notification settings

senthuran16/concurrent-printing-system-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp