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
mojhsa [17]
3 years ago
10

Here are the codes for producer and consumer problems.

Computers and Technology
1 answer:
melomori [17]3 years ago
3 0

Answer:

If a switch happens during counter++ or counter--, we will get a wrong value for the counter.

Explanation:

counter++ counter--

register1 = counter register2 = counter

register1 = register1 + 1 register2 = register2 - 1

counter = register1 counter = register2

Lets consider this example, lets assume that counter=4, this simply means that there are 4 items which are produced already. Lets look at the following steps and value of counter after each step.

a) Producer process is updating counter++, this takes place at machine level, also, during that when it completed register1=counter counter=4

b) Supposing we have a context switch happen to consumer process and it is trying to update counter--, this takes place at machine level, also when it completed

register2=counter counter=4

register2=register2-1

counter=register2 counter=3

c) Lets assume that context switch happened back to producer process and it continues from where it stopped, look at step a

register1=register1+1

counter=register1 counter=5

This will make the value of counter variable to become 5. Consumption of one item is not reflected in the counter variable. To avoid this we need to allow the atomic execution of all these instructions. This implies completion of any updates on the counter, while others wait for its completion.

d) In the event a producer executes all these machine level instructions at once,then there is no inconsistency on this.

You might be interested in
How to stay organized in an online school?
Nitella [24]
To stay organized on an online school is no cursing. and keep your files clean and organized
4 0
3 years ago
Nicotine us a dangerous chemical found in Cigarettes; it is accompanied by two other very harmful chemicals. These are
NNADVOKAT [17]

Answer: Carbon Monoxide and Tar.

4 0
2 years ago
Quick!!!!!
Vlad [161]

Answer:

B. the current affairs page

Explanation:

it's a simple question

8 0
3 years ago
Read 2 more answers
• What advantage does a circuit-switched network have over a packet-switched network? What advantages does TDM have over FDM in
lions [1.4K]

Answer:

Advantages of both circuit switched networks and TDM are given below:

Explanation:

Advantages of circuit switched network over packet switched network:

  • Circuit switched network has the advantage of being physically connected and having a dedicated channel for communication between the sender and the receiver which also makes it more reliable. Packet switched networks do not have a dedicated channel hence, they are not that reliable.
  • Circuit switched networks are used for voice calls because there is no timing jitter or delay in these types of networks while packet switched networks do not offer this advantage.

Advantages of TDM over FDM in a circuit switched network:

  • TDM is time division multiplexing i.e. multiple information is sent in different time intervals but on the same frequency. While FDM sends information using different frequencies. So, the advantage of using TDM is that the information will be sent from the sender to the receiver using only a single frequency.
  • Using TDM, bandwidth is saved because it only sends information on a single frequency unlike FDM.
  • In TDM, there is low chance of interference between signals since they are sent in different time intervals from the sender to the receiver. While FDM has a higher chance of interference.
4 0
3 years ago
__________ BI apps use real-time or near real-time data in order to support line managers who need to monitor performance of his
ruslelena [56]

Answer: Operational BI(Business Intelligence)

Explanation:Operational business intelligence is the tool that works on the organizational performance through evaluation and testing by analyzing the business process and data.It is rapid responding tool for the changing business pattern and demands.

Strategical, tactical and traditional business intelligence tool don't provide the evaluation of the business performance in the accordance with business trends rather having strategical approach, planned approach and traditional approach respectively.

Thus, the correct option is option(b).

8 0
3 years ago
Other questions:
  • Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow
    8·1 answer
  • If a user has just added a simple triangle shape into a diagram, how can the triangle be adjusted? Check all that apply. by maki
    6·2 answers
  • What is the single most important component of a computer? Central Processing Unit DIP Motherboard Chipset
    8·1 answer
  • Microprocessors can’t directly understand programming languages, so programs have to be converted into _____________ that corres
    15·1 answer
  • 7) Which of the following factors determines the structure, features, and functions of an information system used in a company?
    7·1 answer
  • Abby wants to simply share a snapshot of her calendar with another user. Which option should she choose to achieve
    15·1 answer
  • Xavier buys a new laptop for $540. He makes a down payment $75 and pays the rest in 6 equal monthly payments, p. What equation r
    7·1 answer
  • What is cyber security ???​
    8·1 answer
  • I am making a project i have to advertise a product i picked a futureistic car
    10·1 answer
  • A 4"x6" photo is digitized using 10,000 pixels. An 11"x7" photo is digitized using 30,000 pixels. Which image will have the bett
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!