3. Consider two processes po, pland a shared variable int buffer [2] which takes only two...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Consider two processes po, pland a shared variable int buffer [2] which takes only two 6 values 0 or 1. If value of buffer [0] is 1 then p0 will enter into the critical section and p1 [1] is 1 then pl will enter into the critical section. Initially both values of buffer variable is zero. For the above scenario I have proposed a "solution to the critical- section problem. Determine its correctness. If it is incorrect then show an example that violates mutual exclusion and write the correct statement that can solve the problem. int turn=0; int flag[2]={0}: Process i{ } while (true){ } j = other process's ID; flag[i] = 1; while (flag[i]): turn = i: CRITICAL_SECTION flag[i] = 0; 3. Consider two processes po, pland a shared variable int buffer [2] which takes only two 6 values 0 or 1. If value of buffer [0] is 1 then p0 will enter into the critical section and p1 [1] is 1 then pl will enter into the critical section. Initially both values of buffer variable is zero. For the above scenario I have proposed a "solution to the critical- section problem. Determine its correctness. If it is incorrect then show an example that violates mutual exclusion and write the correct statement that can solve the problem. int turn=0; int flag[2]={0}: Process i{ } while (true){ } j = other process's ID; flag[i] = 1; while (flag[i]): turn = i: CRITICAL_SECTION flag[i] = 0;
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
A force of 24N is applied to a wrench which is 0.4m in length. If the force is applied at an angle of 15 degrees, find the torque in N-m. Round off to two decimal places.
-
A $5000 bond that pays 7% semi-annually is redeemable at par in 15 years. Calculate the purchase price if it is sold to yield 5% compounded semi-annually (Purchase price of a bond is equal to the...
-
The trial balance of Mr. Rosiak Fashion Center contained the following accounts at November 30, the end of the company's fiscal year. Adjustment data: 1. Supplies on hand totaled $2,100. 2....
-
What type of exploratory research design (observation, projective technique, in-depth interview, focus group, case study, ethnography, netnography, ZMET) would you suggest for each of the following...
-
The following information relates to a new computer chip that Hand Held has developed for its new cell phone that contains a personal organizer: CHIP DIVISION Market price of finished chip to...
-
What is the current Remote Access Protocol used in Windows 2012? Explain.
-
Please consider the attached video link for this week's DQ. Please offer ideas, suggestions, solutions, etc. to these common issues in financial reporting. Use material from our first three weeks to...
-
Suppose you are thinking of buying a 6-year, $1,000 par value bond with a 7% annual coupon bond. If interest on this bond is paid semi-annually and you required rate of return is 7% annually, how...
-
You are planning to make monthly deposits of $120 into a retirement account that pays 12 percent interest compounded monthly. If your first deposit will be made one month from now, how large will...
-
Jill Price has an incredible memory. Since she was 15 years old, she can remember everything that she has done and every t.v. show she has watched. What type of memory is special for Jill Price?
-
Assuming Just Right Services' fiscal year (FY) runs from January 01 to December 31 each year, which months have actual balances to compare to the operating budget thus far for FY 2021?
-
Complete the sentences using the given conjunctions. Punctuate the sentences correctly. The most visible way to stand out is to wear outrageous fashions therefore The most popular sport in Canada is...
-
Graphical Analysis: Pertaining to the production of health, we considered the role of several factors that influence the marginal and absolute productivity of inputs of medical care. Plot a...
-
You purchase a bond with a coupon rate of 6.7 percent, a par value $1,000, and a clean price of $905. Assume a par value of $1,000. If the next semiannual coupon payment is due in two months, what is...
-
Write the rate law for the reaction 2A + B C if the reaction 1. is second order in B and overall third order, r A = ______ 2. is zero order in A and first order in B, r A = ______ 3. is zero order...
-
The second-order, elementary liquid-phase reaction 2Ak1AB is carried out in a nonideal CSTR. At 300 K, the specific reaction rate is k 1A = 0.5 dm 3 / mol min. In a tracer test, the tracer...
-
Using tha data file usmacro, estimate the ARDL \((2,1)\) model Your estimates should agree with the results given in equation (9.42). Use these estimates to verify the forecast results given in Table...
-
Using the data file usmacro, estimate the \(\operatorname{AR}(1)\) model \(G_{t}=\alpha+\phi G_{t-1}+v_{t}\). From these estimates and those obtained in Exercise 9.16, use the results from Exercise...
-
Consider the \(\operatorname{ARDL}(p, q)\) equation and the data in the file usmacro. For \(p=2\) and \(q=1\), results from the LM test for serially correlated errors were reported in Table 9.6 for...
Study smarter with the SolutionInn App