1. Why is the following not ideal? /* implementation of a lock */ void lock ()...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Why is the following not ideal? /* implementation of a lock */ void lock () { DisableInterrupts (); } void unlock () { EnableInterrupts (); } /* a process that accesses some shared data */ Process { lock_t mutex; lock (&mutex); /* begin accessing shared data */ /* end accessing shared data */ unlock (&mutex); 2. Why is the following not ideal? boolean test_and_set (boolean *target) { boolean rv = *target; *target TRUE; return rv: do { while (test_and_set (&lock)) ; /* do nothing */ /* critical section */ lock = false; /* remainder section */ } while (true); 1. Why is the following not ideal? /* implementation of a lock */ void lock () { DisableInterrupts (); } void unlock () { EnableInterrupts (); } /* a process that accesses some shared data */ Process { lock_t mutex; lock (&mutex); /* begin accessing shared data */ /* end accessing shared data */ unlock (&mutex); 2. Why is the following not ideal? boolean test_and_set (boolean *target) { boolean rv = *target; *target TRUE; return rv: do { while (test_and_set (&lock)) ; /* do nothing */ /* critical section */ lock = false; /* remainder section */ } while (true);
Expert Answer:
Answer rating: 100% (QA)
Any solution to the critical section problem must satisfy three requirements mutual exclusion progre... View the full answer
Related Book For
Posted Date:
Students also viewed these operating system questions
-
Why is the following not a probability model? Color ..... Probability Red ..... 0.1 Green ..... 0.1 Blue ..... 0.1 Brown ..... 0.4 Yellow ..... 0.2 Orange ..... 0.3
-
1 Why is the functional organisation prevalent in modern business?
-
Why is the following situation impossible? Two identical loudspeakers are driven by the same oscillator at frequency 200 Hz. They are located on the ground a distance d = 4.00 m from each other....
-
How does national culture relate to business structures?
-
A company asserts that 80% of the customers who purchase its special lawn mower will have no repairs during the first two years of ownership. Your personal study has shown that only 70 of the 100...
-
A long, straight wire carries a current of 2.50 A. An electron is travelling in the vicinity of the wire. At the instant when the electron is 4.50 cm from the wire and travelling with a speed of 6.00...
-
Once a litigation matter is appealed, what are the four types of decisions that an appellate court may make? Explain each type.
-
In Problem 12.7 on page 424, you used the plate gap on the bag sealing equipment to predict the tear rating of a bag of coffee. The data are stored in Starbucks. a. Construct a 95% confidence...
-
Explain the following Strength and Opportunities of the given T-Shirt business of a retail shop. STRENGTHS: Top quality and attractive product New release version The location can be easily seen and...
-
If you drop a piece of buttered toast on the floor, is it just as likely to land buttered side up as buttered side down? It sure seems like mine always lands buttered side down! Suppose that 7 of the...
-
THE BUZZ IN BOOZE FREE BEVERAGES Ruffell and Garage Project join a growing number of brewers and retailers who are discovering what has been dubbed the NoLo market: a growing market for no- to...
-
Can you elaborate on the iterative nature of your strategic planning process, highlighting mechanisms for continuous learning, adaptation, and refinement in response to evolving environmental...
-
As a standard practice, the company does not recognize a provision for a guarantee of good operation of the products sold. Based on past statistics, the cost of repairing damage of products sold in...
-
1) What are the benefits of a long-term perspective on value creation? For companies? For the economy? 2) What is the relationship between the stock market and the real economy in terms of measures...
-
Parker Inc. makes and sells toys. The information on the cost per unit is as hillews. Direct materials $2.55 Direct labor 1.20 Variable overhead 1.90 Variable marketing expense 0.40 The Tooed...
-
What is the present value of the following future amount? $47,727, to be received 19 years from now, discounted back to the present at 7.85 percent, compounded daily.
-
State both a positive and negative position on the following question. then, take one position and defend it. 1. Is it appropriate for a professional educator to advise a more capable student to go...
-
Simplify the expression. Assume that all variables are positive. 23VI1 2 V44 8
-
According to the American Time Use Survey, adult Americans spent 42.6 minutes per day on phone calls and answering or writing email in 2006. (a) Suppose that we want to judge whether the amount of...
-
Explain the phrase outside the scope of the model. Why is it dangerous to make predictions outside the scope of the model?
-
What is the role of randomization in a designed experiment? If you were conducting a completely randomized design with three treatments and 90 experimental units, describe how you would randomly...
-
The following questions relate to the use of computer-assisted audit techniques. Select the best response. a. Which of the following is true of generalized audit software packages? 1. They can be...
-
The following questions relate to the control risk assessment in computerized systems. Select the best response. a. In obtaining an understanding of a client's EDP controls, the auditor will...
-
On page 324 is a flowchart that depicts the payroll processing function of Campbell Company. Write your own word descriptions for each of the numbered blank symbols. C Supervisor Payroll department...
Study smarter with the SolutionInn App