1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
katrin [286]
3 years ago
14

Consider a system consisting of processes P1 , P2 , ..., Pn , each of which has a unique priority number. Write a monitor that a

llocates three identical printers to these processes, using the priority numbers for deciding the order of allocation.
Computers and Technology
1 answer:
adelina 88 [10]3 years ago
7 0

Answer:

See explaination

Explanation:

The code

type printer = monitor

var P: array[0…2] of boolean;

X: condition;

procedure acquire (id: integer, printer-id: integer);

begin

if P[0] and P[1] and P[2] then X.wait(id)

if not P[0] then printer-id := 0;

else if not P[1] then printer-id := 1;

else printer-id := 2;

P[printer-id]:=true;

end;

procedure release (printer-id: integer)

begin

P[printer-id]:=false;

X.signal;

end;

begin

P[0] := P[1] := P[2] := false;

end ;

Note:

Monitors are implemented by using queues to keep track of the processes attempting to become active int he monitor. To be active, a monitor must obtain a lock to allow it to execute the monitor code. Processes that are blocked are put in a queue of processes waiting for an unblocking event to occur.

You might be interested in
This is a wise and hard question.....What is the hardest question in the world? I know the answer do you?
SpyIntel [72]
Is it this question? I think the hardest question in the world is the one you just asked! Am I right?
8 0
2 years ago
Summarize the five stages of cultural shock
Anton [14]
1. Honeymoon stage
2. Distress and anxiety
3. Adjustment
4. Adaption
5. Re-entry shock
8 0
3 years ago
Read 2 more answers
Lonic compounds are also known as <br> a. salts <br> b. valence <br> c.organic <br> d.elements
shutvik [7]
I'm not quite sure but it maybe b
6 0
3 years ago
Read 2 more answers
What is the purpose of the literature review section of research paper
navik [9.2K]

variation of colored sediment

5 0
3 years ago
How do Brainly experts and verified users format their answers to look like this:
koban [17]

{ \dashrightarrow{ \green{ \tt{use \: the \: latex}}}} \\  \\  { \blue{ \sf{ \: refer \: to \: the \: pdf \: available}}} \\ { \blue{ \sf{at \: https : \  \:  \ \: latex \: on \: brainly}}}

3 0
2 years ago
Read 2 more answers
Other questions:
  • In dt.py, you will implement a basic decision tree classifier for
    5·1 answer
  • Enter a formula in cell b7 to calculate the average value of cells b2:b6
    13·1 answer
  • A router is a device that addresses a packet on a network to the next router along the line. Under which layer of the OSI model
    5·1 answer
  • How can you keep your files organized on your computer?
    13·2 answers
  • What is the benefit of a cloud computing infrastructure? ○ Companies have full control over the data that is hosted. ○ Companies
    11·1 answer
  • Jason Has A Science Video Project, As He Creats His Project, He Saves, Then Comes Back A Minute Later. The File Is Now Unreadabl
    8·2 answers
  • The theory of logic set the foundation for what aspect of computing today?
    11·1 answer
  • You implement basic version control and go through the phase of creating a local repository. Initiate the commands to set up tha
    7·1 answer
  • Do you know the energy unit question?
    10·1 answer
  • ! (( i &gt; ( f + 1)) es verdadero o falso segun la logica de programación.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!