I need to solve the following problem:
a. Show how to implement acquire() and release() lock operations using TestandSet instruction.
b. Identify a performance problem, that could occur in your solution when it runs on a multiprocessor, but does not occur on a uniprocessor. Describe a concrete scenario where the performance problem arises.
c. Describe an alternative lock implementation that reduces the performance problem in b, and explain how it helps in the concrete scenario you presented in b.
I have my acquire() and release() setup like these:
acquire() {
while(TestandSet(true)){
//wait for lock to be released
{
}
release() {
TestandSet(false);
}
However, I could not identify any performance issue regarding multiple processors or a single processor. What is the performance issue? Or, is my implementation of acquire() and release() correct?