Answered step by step
Verified Expert Solution
Question
1 Approved Answer
6 . 1 8 Consider a system consisting of processes P 1 , P 2 , dots, P n , each of which has a
Consider a system consisting of processes dots, each of which has
a unique priority number. Write a monitor that allocates three identical
line printers to these processes, using the priority numbers for deciding
the order of allocation.
Answer: Here is the pseudocode:
monitor printers
int numavail ;
int waitingprocesses MAXPROCS ;
int numwaiting;
condition ;
void requestprinter int procnumber
if numavail
numavail;
return;
waitingprocesses numwaiting procnumber;
numwaiting;
sort waitingprocesses;
while numavail &&
waitingprocesses procnumber
cwait ;
waitingprocesses
waitingprocesses numwaiting ;
numwaiting ;
sort waitingprocesses ;
numavail;
void releaseprinter
numavail;
cbroadcast ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started