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
Do you guys know if there's a way for me to find a Google doc that I typed but forgot to save if you do it for points i will rep
ValentinkaMS [17]

Answer:

Usually, Google Docs save automatically. If you remember some keywords that you typed, try searching for it. For example, if you typed up a report about dogs, search "dogs" when you're on the Google Docs home screen.

Explanation:

If this doesn't help, leave a comment and I'll try to help more!

4 0
3 years ago
Read 2 more answers
In which conditions, a trial balance does not tally?
Nostrana [21]

Answer:

A trial balance will not balance if both sides do not equal, and the reason has to be explored and corrected.

Explanation:

The debit side and the credit side must balance, meaning the value of the debits should equal the value of the credit

4 0
3 years ago
Cuando hablamos de entornos digitales de enseñanza aprendizaje a que nos estamos refiriendo
olga2289 [7]

Answer:

Al hablar de entornos digitales de enseñanza y aprendizaje, la frase apunta al avenimiento de medios informáticos y tecnológicos al proceso metodológico de enseñanza de los distintos sistemas educativos a nivel mundial.

Así, la irrupción del internet como medio de búsqueda de información y las herramientas digitales como vídeos, diapositivas y libros electrónicos como métodos de presentación de información han facilitado el acceso de los alumnos y docentes al conocimiento a través de la generación de un entorno digital que permite a estos un acceso mas rápido y abarcativo al conocimiento.

7 0
3 years ago
A router is connected to a network 192.169.1.0/24 and network 192.168.2.0/24. The router is configured to use RIP and has learne
Mnenie [13.5K]

Answer:

Forward the packet to the next hop router specified by the route network 0.0.0.0

Explanation:

8 0
3 years ago
Which feature of dart helps in making the code readable,maintainable and finds type error during compile time
devlian [24]

Answer:

Sound

Explanation:

Dart is object oriented. It's sound feature helps to make codes more maintainable and readable. The sound type system means that one can never experience w state where where an expression would evaluate to a value that wouldn't match that expressions static type.

The sound system makes the code to be unambiguous. It makes the code to be easier to read as types cannot lie, also your code would be more maintainable since when a piece of code gets to be changed, you would be warned of other pieces that may have gotten broken.

3 0
3 years ago
Other questions:
  • Consider the relation Courses(C, T, H, R, S, G), whose attributes can be thought of informally as course (C), teacher (T), hour
    10·1 answer
  • A software license gives the owner the to use software.
    12·2 answers
  • Upon looking out at the
    8·2 answers
  • Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use
    6·1 answer
  • String[][] arr = {{"Hello,", "Hi,", "Hey,"}, {"it's", "it is", "it really is"}, {"nice", "great", "a pleasure"},
    11·1 answer
  • Technology changes rapidly. Do you think the development of new technology will slow down at some point? At some point will cons
    12·1 answer
  • The maximum number of characters that a cell can contain is
    11·2 answers
  • Computer science - algorithms - flowcharts
    11·1 answer
  • A binary search algorithm ____________ an ordered list in<br> half to find an item.
    13·1 answer
  • ___ is a form of electronic money that is decentralized and whose transactions are encrypted, processed, and recorded via peer-t
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!