Question: Problem C . Use compare _ and _ swap ( ) , an atomic hardware instruction to fix the race condition and solve the critical
Problem C Use compareandswap an atomic hardware instruction to fix the race condition and solve the critical section
problem in the code given in Problem A
MSU Denver, M&CS CS : Operating Systems, Summer Dr Weiying Zhu
a Write a C statement to declare and initialize a shared variable lockTop, whose value is when unlocked and when locked
b Rewrite the push function to call the compareandswap function defined in the PPT Slide
c Rewrite the pop function to call the compareandswap function defined in the PPT Slide Hint: other than the end of
a function, the return statement also deserves some attention.
d Does this solution satisfy the mutualexclusion requirement? Does it satisfy the boundedwaiting requirement
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
