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
Write technical term of following statements: a.The set of programs to perform specific task. b.A feature of computer which tell
ExtremeBDS [4]

Answer:

a) Application software

d) Lady Augusta Ada Lovelace

b) (it may be versatility

6 0
2 years ago
Create the setStyles() function using the commands listed in the steps below. Christine wants one of five fancy style sheets to
jolli1 [7]

Answer:

Hi there! This can be implemented in a simple Python function which uses the "random" module to generate the number.

Explanation:

Using Python as the languge, we can write a the below code in a file called styles.py. The first line imports the randint function from the "random" module. The setStyles() function declares an array or 5 elements (here I have just used numbers but these could be string names of the stylesheets as well). Next, styleNum is assigned the random number and the associated stylesheet is selected from the array of stylesheets.

styles.py

from random import randint

def setStyles():

   stylesheets = [1,2,3,4,5];

   styleNum = randint(1,5);

   stylesheet = stylesheets[styleNum];

   print(stylesheet);

setStyles();

3 0
3 years ago
Five indicators of computer illiteracy​
melisa1 [442]

1. Isn't fluent in "geek language"

2. Doesn't know how to use a web browser and it's features

3. Doesn't understand what a computer is and how it works

4. Doesn't know the basic parts of computer hardware

5. Doesn't know how to use a computer or any other electronics

8 0
3 years ago
Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
CaHeK987 [17]

Answer:

The answer is below

Explanation:

Given that the three-point lighting techniques require one to have three sources of lights in a scene. These three lights are known as Back light, key light, and fill light.

The Back light is expected to be placed at the back of the subject. In this scenario, there is a lit fireplace behind the subject, this is serving as the backlight already.

The glow from a window on the subject's left is serving as a Fill light which is not going to be bright as that of the Key lights.

Then Laura would now only need the Key Light. This will be the main light and will be the brightest. Laura will have to place this Key Light on the right side of the subject on the scene, directly at the opposite of the glowing light serving as the Fill light.

6 0
2 years ago
What is an instance of a computer program that is being executed?
Lostsunrise [7]
It is processing because it is processing the data on the program.
7 0
3 years ago
Other questions:
  • A group of computers that are interconnected in order to share information or documents is called a _____.
    7·1 answer
  • 20 points
    6·2 answers
  • Write a function named "isValidPassword" that takes in a string and returns 1 if it stores a valid password and 0 otherwise, A v
    12·1 answer
  • The function of network switch is to _____.
    5·1 answer
  • A student has a ten-year-old desktop computer that she only uses for word processing, but she would like to start using it to pl
    8·1 answer
  • Write an application named Perfect that displays every perfect number from 1 through 10,000. A number is perfect if it equals th
    5·1 answer
  • You attempt to telnet to system 192.168.1.240. You receive the following message: "Connecting To 192.168.1.240...Could not open
    5·1 answer
  • What will happen to the tools and equipment, if it is not store propely?​
    7·1 answer
  • Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This
    14·1 answer
  • Which phrase is the best definition of sparklines in Excel 2016?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!