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
gtnhenbr [62]
4 years ago
15

The Sleeping-Barber Problem:

Computers and Technology
1 answer:
s2008m [1.1K]4 years ago
6 0

Answer:

Explanation:

Following are the Semaphores:

Customers: Counts waiting customers;

Barbers: Number of idle barbers (0 or 1)

mutex: Used for mutual exclusion.

Cutting: Ensures that the barber won’t cut another customer’s hair before the previous customer leaves

Shared data variable:

count_cust: Counts waiting customers. ------------copy of customers. As value of semaphores can’t access directly.

// shared data

semaphore customers = 0; semaphore barbers = 0; semaphore cutting = 0; semaphore mutex = 1;

int count_cust= 0;

void barber() {

while(true) { //shop is always open

wait(customers); //sleep when there are no waiting customers

wait(mutex); //mutex for accessing customers1

count_cust= count_cust-1; //customer left

signal(barbers);

signal(mutex);

cut_hair();

}

}

void customer() {

wait(mutex); //mutex for accessing count_cust

if (count_cust< n) {

count_cust= count_cust+1; //new customer

signal(customers); signal(mutex);

wait(barbers); //wait for available barbers get_haircut();

}

else { //do nothing (leave) when all chairs are used. signal(mutex);

}

}

cut_hair(){ waiting(cutting);

}

get_haircut(){

get hair cut for some time; signal(cutting);

}

You might be interested in
¿Cuánta energía consumirá una lavadora de 1200W de potencia, si se deja conectada durante 20 horas? ¿Cuánto deberemos pagar si e
9966 [12]

Answer:

The amount to be paid is €2.88 for the amount of power consumed

Explanation:

The first thing to do here is to convert the power consumption to kilo-watt

1 kilowatt = 1000 watt

x kilowatt = 1200 watt

x = 1200/1000 = 1.2 KW

we now convert this to kilowatt hour by multiplying the number of hours by the number of kilowatt.

That would be 20 * 1.2 = 24 KWh

Now, the charge is 0.12€/kWh

for 24 kWh, we have 24 * 0.12 = €2.88

6 0
3 years ago
Software that manages the resources of the computer is called:
AleksAgata [21]
A. Data management software.
6 0
3 years ago
Which language do you use to add functionality to a web page
Dovator [93]
The answer is Javascript. In partner with HTML/HTML5 (Hypertext markup language : which provides the structure and CSS (Client Side Scripting : Provides the design to the structure). JS or Javascript programming language provides the function at the backend of a webpage. It responds to the input and also calls on the PHP / SQL Scripts to tap the database.
6 0
3 years ago
An information system will be developed to keep track of a utility company's assets, such as buildings, vehicles, and equipment.
Daniel [21]

The four standard layers of a layered architecture are:

  • presentation,
  • business,
  • persistence,
  • database.

<h3>What is a Layered Architecture?</h3>

This refers to the architectural style that is used to show components with similar functions in horizontal layers that have specific roles.

Hence, we can see that no generic info system architecture was attached to the answer, so it would be impossible to create a layered architecture, so a general overview was given about layered architecture.

Read more about layered architecture here:

brainly.com/question/2563702

#SPJ1

8 0
2 years ago
What's 3+3 and stop deleting my question i just wasted 41 points
bazaltina [42]

Answer:

I am pretty confident that the answer is 6

Explanation:

3+3=6

3 0
3 years ago
Read 2 more answers
Other questions:
  • In the retrieval phase of Godden and Baddeley (1975) study of the encoding specificity principle, participants were asked to sup
    9·1 answer
  • The Color Picker tool enables you to work with color selections. Which of the following color models are used by the Color Picke
    11·1 answer
  • Identify the characteristics of logic problems.select all that apply
    5·1 answer
  • Which two tools used for incident detection can be used to detect anomalous behavior, to detect command and control traffic, and
    13·1 answer
  • How is “compromise" defined in the context of information technology and Select one answer.
    5·2 answers
  • Design by contract considers the software system to be a setof:
    10·1 answer
  • Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​
    8·2 answers
  • 1 : What format would you apply to give an entry the appearance of 12-Mar-2014
    8·1 answer
  • Which of the following programming languag
    13·1 answer
  • When it comes to game mechanics, what is the most universal mechanic that is present in virtually every computer game that you c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!