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
Write a small program that takes in two numbers from the user. Using an if statement and an else statement, compare them and tel
kap26 [50]

What code is it java, HTML,C++ or lua?  be specific.

4 0
3 years ago
Read 2 more answers
Write a program that prompts the user to enter a positive integer and displays all its smallest factors in decreasing order.
user100 [1]

Answer:

<fact>[ZRjKt9sw6V(gh6E)ehNM3]<zip>

Explanation:

8 0
3 years ago
Complete the sentence about a presentation delivery method.
Nesterboy [21]
A Presentation software allows you to transmit your presentation over the internet using CDs
5 0
3 years ago
Introduction to numbering system
kirill115 [55]
What about it? I need more details
7 0
3 years ago
Does anyone like five finger death punch
irina1246 [14]
Yes I do
Ejennsbdbdh
8 0
3 years ago
Read 2 more answers
Other questions:
  • Is an application that creates electronic worksheets composed of rows and columns?
    7·1 answer
  • What is the purpose of look up tables in spreadsheet software apex
    13·1 answer
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
    9·2 answers
  • Match the expenses to their respective categories.
    6·2 answers
  • Select the parts of a business letter.
    6·2 answers
  • In what order does the Cascade look at factors to determine which CSS rule to follow?
    14·1 answer
  • What is command is used to improve the vocabulary and in which tab is it found​
    14·1 answer
  • How much money did Uta initially invest?$180.00$320.00$352.48$471.70
    14·1 answer
  • Which type of measurement would you use to determine the mass of sugar?
    12·1 answer
  • What is a phone made out of dna
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!