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
LUCKY_DIMON [66]
4 years ago
15

A file is to be shared among different processes, each of which has a unique number. The file can be accessed simultaneously by

several processes, subject to the following constraint: the sum of all unique numbers associated with all the processes currently accessing the file must be less than n. Write a monitor to coordinate access to the file. 3. Exercise 6.29 (10 points) Your solution should use condition variables. Assume a broadcast() operation can be invoked on a condition variable c to resume all processes suspended on c. Hint: Your monitor should contain two functions: one function is called before a process accesses a file and the other function is called after a process accesses a file.
Computers and Technology
1 answer:
UkoKoshka [18]4 years ago
8 0

Answer:

monitor fileSharer

{

       enum {THINKING, WAITING, READING} state[N];

       condition self[N];

       int total;

       void open(int i) {

               state[i] = WAITING;

               if (i + total >= N)

               { self[i].wait(); }  // Leaves monitor

               state[i] = READING;

               total += i;

       }

       void close(int i) {

               state[i] = THINKING;

               total -= i;

               // Can signal one waiting proc whose ID won't break bank.

               for (int x = N - total - 1; x >= 0; x--) {

                       if (state[x] == WAITING) {

                               self[x].signal(); break;

                       }

               }

       }

       initialization.code() {

               for (int i = 0; i < N; i++) {

                       state[i] = THINKING;

               }

               total = 0;

       }

}

You might be interested in
Users are reporting Internet connectivity issues. The network administrator wants to determine if the issues are internal to the
Anika [276]

Answer:

traceroute.

Explanation:

Traceroute these are the computer networking commands and they are used to determine the path or route that data packets take on the network with the delays that are associated with it.So according to me traceroute is the best tool to determine the issues or outrages are in the internet connectivity.

8 0
3 years ago
What dose it need For a device to be considered a kind of computer
const2013 [10]

Answer:

Micro controller or MCU (Microcontroller Unit)

Explanation:

Micro Controller Unit is basically a computer on a chip with all components fabricated onto it. It is the core component of a computer.

A Micro Controller has:

  • Central Processing Unit CPU
  • Random access memory RAM
  • Read-only memory ROM
  • I/O peripherals
  • Timers
  • Serial COM ports

all fabricated on a single chip so that it may be connected via buses for providing the desired functionality.

<h3>I hope it will help you!</h3>
8 0
3 years ago
Read 2 more answers
Question B_1 (15 points) Please define (describe) local variables and how they are used in computer programming ( e.g. In C, C )
OverLord2011 [107]

Answer and Explanation:

Static variables are variables that still maintain their values outside the score which they are declared. They are declared with the static keyword

Example:

<em>static int score = 30;</em>

Local variables are variables whose scope are restricted to a block. Their values are restricted to the block which they are declared in.

Example:

<em>void abd(){</em>

<em>int score;</em>

<em>}</em>

<em>score is a local variable to abcd() function</em>

5 0
4 years ago
How are cars made in georgia
Talja [164]

Answer:

Its same everywhere.

7 0
4 years ago
How to get points on Brainly?<br> List at least two ways if you can.
GarryVolchara [31]

Answer:

1. Answering questions

2. Logging in everyday

Explanation:

By answering questions, you will earn points. By logging in everyday, I think they give you points as well. Good luck, and hope this helped! :-)

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is the output of the code snippet given below? string s = "aeiou"; int i = 0; do { system.out.print(s.substring(i, i + 1));
    12·1 answer
  • I’m which scenario would someone most likely be using presentation software ?
    6·2 answers
  • This type of handout prints only the text of the presentation.
    7·1 answer
  • Help pls Do you think the current video game industry is likely to experience another ""crash"" (similar to the one in the 1980s
    13·1 answer
  • Do most web queries have fully meets results
    11·1 answer
  • Which three factors should be discussed before planning and building a project?
    15·1 answer
  • What are some personal reading task examples?
    5·1 answer
  • By default, Outlook displays messages in the Content pane grouped by the
    13·1 answer
  • Hey, My paperclips just stoped producing, does anyone have any idea how to start them up again?
    5·1 answer
  • This seems like a good time to ask the basic question, “How’s it going in class?” Feel free to offer constructive feedback about
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!