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
g100num [7]
3 years ago
15

The L-exclusion problem is a variant of the starvation-free mutual exclusion problem. We make two changes: as many as L threads

may be in the critical section at the same time, and fewer than L threads might fail (by halting) in the critical section. An implementation must satisfy the following conditions:_____.
L-Exclusion: At any time, at most L threads are in the critical section.
L-Starvation-Freedom: As long as fewer than L threads are in the critical section, then some thread that wants to enter the critical section will eventually succeed (even if some threads in the critical section have halted).
Modify the n-process Bakery mutual exclusion algorithm to turn it into an L-exclusion algorithm. Do not consider atomic operations in your answer. You can provide a pseudo-code solution or written solution.
Computers and Technology
1 answer:
vladimir2022 [97]3 years ago
6 0

Answer:

The solution is as follows.

class LFilters implements Lock {

int[] lvl;

int[] vic;

public LFilters(int n, int l) {

lvl = new int[max(n-l+1,0)];

vic = new int[max(n-l+1,0)];

for (int i = 0; i < n-l+1; i++) {

lvl[i] = 0;

}

}

public void lock() {

int me = ThreadID.get();

for (int i = 1; i < n-l+1; i++) { // attempt level i

lvl[me] = i;

vic[i] = me;

// rotate while conflicts exist

int above = l+1;

while (above > l && vic[i] == me) {

above = 0;

for (int k = 0; k < n; k++) {

if (lvl[k] >= i) above++;

}

}

}

}

public void unlock() {

int me = ThreadID.get();

lvl[me] = 0;

}

}

Explanation:

The code is presented above in which the a class is formed which has two variables, lvl and vic. It performs the operation of lock as indicated above.

You might be interested in
What data type would you use for a decimal number?* ​
Elan Coil [88]

Answer:

numeric

Explanation:

The decimal data type is an exact numeric data type defined by its precision (total number of digits) and scale (number of digits to the right of the decimal point).

I hope this answers your question.

3 0
2 years ago
Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar. What will be the ou
lord [1]

Answer:

2

Explanation:

The output of the Java program is 2. The public Vehicle class is defined with the class variable 'counter'. When a Vehicle class object is instantiated, the counter variable increments by one.

In the program, the two instances of the class are created, incrementing the counter variable to two, the print statement outputs 2 as the result of the program.

8 0
3 years ago
"kannst du mir bitte helfen" in German-English from Reverso Context: Hier, kannst du mir bitte helfen?
tatuchka [14]

Answer:

"Come help me, please" "Can you help me here?"

Explanation:

Some form of question or help, i think...

4 0
2 years ago
When you first purchase a notebook, make sure you have a ____ CD containing the installed OS so you can recover from a failed ha
stira [4]

When you first purchase a notebook, make sure you have a RECOVERY CD. It enables the restoration of the notebook computer.

A recovery disc is a disc that enables to restore the computer to the same condition when it was bought.

Moreover, a recovery drive refers to a separate partition in the notebook that must contain the required files to restore the device if the system becomes unstable.

A recovery disc can be considered as a drive used to keep a backup of the files (e.g., images) and other types of restoration data.

Learn more about recovery disc here:

brainly.com/question/14217813

5 0
2 years ago
Identify 3 distractions for young drivers and explain how you plan to minimize these distractions.
Rom4ik [11]
1 distraction is phones , texting and driving . They could have a system in their car which activated by a voice assistant who could do it al for them
4 0
3 years ago
Other questions:
  • A(n) ____________________ stores copies of data or programs that are located on the hard drive and that might be needed soon in
    9·1 answer
  • What are the names of first generation computers?
    12·1 answer
  • HELPPP ASAPP
    8·2 answers
  • Which of the following is a full selector?
    12·1 answer
  • Explain three applications of data mining
    14·1 answer
  • Assume you have an Access database with five different tables, including various pieces of information about your client base. Y
    9·1 answer
  • Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If th
    5·1 answer
  • Alt +f4 is a short cut of close a document in MS word /ture /false​
    15·1 answer
  • Write a pseudocode for the logic of a program that accepts five numbers from a user and displays one of the following messages:-
    8·1 answer
  • Posts that you delete
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!