17. Consider the solution to the Producer-Consumer problem that we have studied in Synchronization. As you...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
17. Consider the solution to the Producer-Consumer problem that we have studied in Synchronization. As you are aware that this solution uses a shared variable counter that is used by both the Producer and the Consumer processes. You may refer to your class notes/book for having a look at the pseudocode. For this problem, assume BUFFER_SIZE = 15. The rest of the producer-consumer code is same as that we had discussed during lecture. Suppose that there is only one producer process and one consumer process. Both processes are executing concurrently. Currently, counter = 8. At the machine language level, counter++ and counter-- are implemented in the same manner that we have discussed in class. Producer uses register and consumer uses register2. Now consider the following sequence of interleaved machine-level instructions shown in the Table below. What is the final value of the counter variable? Only write the answer. You do not have to show any calculation or give any explanation. Time Instant To T₁ T2 T3 T4 Ts Execution consumer executes register2 = counter consumer executes register2 = register2 - 1 producer executes register1 = counter consumer executes counter = register2 producer executes register1 = register1 + 1 producer executes counter = register1 17. Consider the solution to the Producer-Consumer problem that we have studied in Synchronization. As you are aware that this solution uses a shared variable counter that is used by both the Producer and the Consumer processes. You may refer to your class notes/book for having a look at the pseudocode. For this problem, assume BUFFER_SIZE = 15. The rest of the producer-consumer code is same as that we had discussed during lecture. Suppose that there is only one producer process and one consumer process. Both processes are executing concurrently. Currently, counter = 8. At the machine language level, counter++ and counter-- are implemented in the same manner that we have discussed in class. Producer uses register and consumer uses register2. Now consider the following sequence of interleaved machine-level instructions shown in the Table below. What is the final value of the counter variable? Only write the answer. You do not have to show any calculation or give any explanation. Time Instant To T₁ T2 T3 T4 Ts Execution consumer executes register2 = counter consumer executes register2 = register2 - 1 producer executes register1 = counter consumer executes counter = register2 producer executes register1 = register1 + 1 producer executes counter = register1
Expert Answer:
Answer rating: 100% (QA)
Based on the given sequence of interleaved machinelevel instructions lets analyze the c... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
What are the HR-related issues? The CEO of Clampett Oil, J.D. Clampett, has asked you as the Human Resource Director, to update its out-of-date dress code policy. The policy currently provides, in...
-
Compare the stock performance of the below companies, from week 1 results -vs- week 6 results. Week 1: Company Name Stock Price Beta EPS P/E Market Capitalization Amazon $1,864.72 1.51 22.57 82.63...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
In April 1999, one of Capital Blue Cross' health-care insurance plans had been in the field for three years, but hadn't performed as well as expected. The ratio of premiums to claims payments wasn't...
-
In a certain two-dimensional field of force the potential energy of a particle has the form U = ax2 + y2, where a and are positive constants whose magnitudes are different. Find out: (a) Whether this...
-
A stock is expected to increase or decrease by 20% every 6 months over the next year. The current stock price is $50. The 6-month riskfree rate is 10% (semi-annually compounded). (a) (15 pts) What...
-
Suppose that a probability of \(\frac{1}{16}\) is assigned to each point of the sample space of part (a) of Exercise 3.1 on page 65 . Find the probability distribution of the total number of units of...
-
Robinson Tools has $50,000 of quick assets, $135,000 of total current assets, and $100,000 of total current liabilities prior to the following transactions. 1. Made sales on account of $10,000 2....
-
An option's premium is 1.50 and has a delta of 40 with an underlying future at 100. If the underlying future moved from 100 to 102, what would the option's new premium be based on delta?
-
Why is there a trend toward giving an increasing fraction of chip area to cache memory?
-
"Do you think that the media plays apart in how we view certain topics?" and "How often do you see fake news? If recent, provide an example"
-
- Fine office company produces two products P100 and P200. - Sales price per P100 is 660. - sales price per P200 is 759. There are 800 units from P100 in finished goods inventory at the end of 2020...
-
Consider a monopolist who faces 11 identical high-income consumers, each with an inverse demand PH=-3.Q+16 and 57 identical low-income consumers, each with an inverse demand The monopolist has the...
-
At January 1, 2021: Paris Company paid $280,000 for a 80% interest in Shallby Comp In this moment Shallby's Stockholders' Equity consisted: $150,000 $50,000 - Capital Stock - Retained Earnings Book...
-
6.23 The data in Table 6.24 were obtained in a south Louisiana wel! using a shale density column. a. Determine the shale density in grams per cubic cen- timeter at each depth using the calibration...
-
6.20 The data in Table 6.23 were taken in shale on a well drilled in south Louisiana. a. Using the short-interval drilling data of Table 6.23 between 10,000 and 10,050 ft, estimate values for as. a6,...
-
Find a path that traces the circle in the plane y = -3 with radius r = 3 and center (0, -3, 4) with constant speed 6. r(s) = (
-
Les has collected stamps in his spare time for years. He purchased many of his stamps at a price much lower than the current market value. Les recently lost his job as a carpenter. Since his wife...
-
This is an action by purchasers of 5 percent convertible subordinated fifteen year debentures of BarChris Construction Corporation (BarChris). * * * The action is brought under Section 11 of the...
-
Since the 1950s, Qualitex Company has used a special shade of green-gold color on the pads that it makes and sells to dry cleaning firms for use on dry cleaning presses. In 1989 Jacobson Products (a...
-
Plaintiffs children purchased an Aero Cycle exercise bike for their mother to use in a weight-loss program. The Aero Cycle bike was manufactured by DP and purchased from Wal-Mart. The second time the...
-
Scuba divers are warned that if they must make a rapid ascent, they should exhale on the way up. If a diver rapidly ascends to the surface with lungs full of air, his lungs could be damaged. Explain...
-
A higher level of hemoglobin in the blood increases the bloods density. This is the basis for a simple test that can be used to see if a prospective blood donor has a high enough hemoglobin level to...
-
Freshwater fish tend to have larger swim bladders than saltwater fish. Explain why you would expect this to be true.
Study smarter with the SolutionInn App