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
Help please fast
Pachacha [2.7K]
Bookmark because you can go back to it at any given time to re use it
4 0
3 years ago
Read 2 more answers
During the maintenance phase of the sdlc, the team must _____ if a system's objectives are not being met
Darya [45]

During the maintenance phase of the sdlc, the team must take the correct action if a system's objectives are not being met

<h3>What are the 5 phases of the traditional SDLC Software Development process)?</h3>

Software process is the set of activities that constitute the development of a computer system. These activities are grouped into phases, such as: requirements definition, analysis, design, development, testing and deployment.

The main focus of this phase of the SDLC is to ensure that the needs continue to be met and that the system continues to function as per the specification mentioned in the first phase.

See more about SDLC at brainly.com/question/14096725

#SPJ1

8 0
2 years ago
Optimizing a PC’s performance often involves utilities that can defragment disks, clean a system’s Registry, scan for malware, r
KATRIN_1 [288]

Answer:

a. True

Explanation:

PC's sometimes runs slowly and on the long run cost money. Optimizing performance involves running software utilities that could restore speed and efficiency.

Scanning for malware/ virus , cleaning system registry, uninstalling unused program,  deleting unnecessary files, disk defragment , updating of windows software and setting up the browser are ways to optimize your pc's performance.

3 0
3 years ago
Which protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication?
amid [387]

The L2TP or Layer 2 Tunneling Protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication.

<h3>What is vpn?</h3>

VPN is known as a Virtual Private Network extends a private network across a public network and activates users to send and receive data across shared or public networks as if their computing devices were directly connected to the private network.

The main difference between VPN proxy and a VPN is encryption and VPNs hides all the web activities performed by the user as well as user's private IP address.

Therefore, the L2TP or Layer 2 Tunneling Protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication.

Learn more about VPN here:

brainly.com/question/17272592

#SPJ4

3 0
2 years ago
2. Sometimes, validating the HTML code for a web page will help you debug an application, because a. the page won’t run in a bro
aleksandrvk [35]

Answer:

Option c. you can be sure that a validated page will work correctly in a browser

Explanation:

A faulty HTML codes can result in various types of unexpected error when running the web page in different platforms or browsers. This will cause an inconsistent style or layout. HTML code validation can check if the code adopt the standard tag and structure. A validated HTML code can guarantee a web application running smoothly in different browsers and always present consistent web page layout to users. HTML code validation has become part of the standard workflow before a web page go live in internet.

4 0
3 years ago
Other questions:
  • Business ethics the intranet is a private piece of a company's internet network that is made available to computers and/or vendo
    11·1 answer
  • Exterior brick veneers are used to support the entire weight of the roof structure
    12·2 answers
  • To extend the bottom border of a hyperlink across the complete width of a navigation list, change the ____ property of each hype
    9·1 answer
  • Jason is working on a project that requires him to manage a huge amount of data. The spreadsheet he is working on has data relat
    12·1 answer
  • Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
    9·1 answer
  • Which type of microphone uses two metal plates?
    7·1 answer
  • A Raycast returns a float that tells you how far away an Object is
    8·1 answer
  • Which key is used to indent the first line of a paragraph to the right?
    15·2 answers
  • Describe the uses of computer in different fileds? please help me ​
    14·1 answer
  • One way to check if a website is secure is to look for a/an<br> in the address bar.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!