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
The following method public String removeFromString(String old, String frag) removes all occurences of the string frag from the
Mashutka [201]

private static String removeFromString(String old, String frag)

{

int i = old.indexOf(frag);

while (i> -1) {

String rest = old.substring(i + frag.length());

System.out.println("rest = " + rest);

old = old.substring(0, i);

System.out.println("rest = " + old);

old = old + rest;

System.out.println("rest = " + old);

i = old.indexOf(frag);

System.out.println("i = "+ i);

}

return old;

}

Here the index of first occurrence is obtained outside the “while loop” and if this loop runs until index value is >-1. It extracts the rest of the characters other than “frag” from the index and all the characters for which the given set of characters are removed.

4 0
3 years ago
Both UDP and TCP use port numbers to identify the destination entity when delivering a message. Give at least one reason for why
raketka [301]

Answer:

Follows are the solution to this question:

Explanation:

The process ID is not static because this can't be used to identity, therefore, it includes excellent service providers like HTTP since it is allocated dynamically only to process whenever a process is initiated.

Sometimes its instance connectors are managed on numerous TSAPs. This can be implemented unless the process ID is being used as each procedure could have an identity.

4 0
2 years ago
Match the limits of the user with an appropriate design response. 1. severe arthritis, unable to type or use a mouse on a reliab
ololo11 [35]
Idk........................
4 0
3 years ago
While all pages use HTML code, not all pages are written in
creativ13 [48]
Is this a question?

*Answer: not much information to answer with*
7 0
3 years ago
Read 2 more answers
Drag the tiles to the correct boxes to complete the pairs. Match the conversion systems with their steps. To convert a decimal f
bixtya [17]

Answer:

1

Explanation:

8 0
3 years ago
Other questions:
  • A pacing calendar is provided to students so they can:
    8·2 answers
  • What is the relationship between ionic bonds and cleavage
    13·1 answer
  • ____ is the name of a particularly nasty automated program that attacks a network by exploiting Internet Protocol (IP) broadcast
    15·1 answer
  • The difference between a want and a need is a want is not necessary for survival. Things necessary for survival are known as ___
    6·1 answer
  • 1.
    12·1 answer
  • An ironworker standing 30 feet in the air is safe wearing a full body harness that is not tied off
    15·2 answers
  • Each device attached to your computer comes with a special program called a(n ________ that enables the device and operating sys
    15·1 answer
  • A(n) ____ local area network is a network in which devices use high-frequency radio waves to communicate with a base station, wh
    11·1 answer
  • Which letter shows the ball when it has the maximum kinetic energy
    15·1 answer
  • Assume the user responds with a 3 for the first number and a 5 for the second number.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!