Two processes are trying to enter their critical sections using the shared varia
ID: 3902544 • Letter: T
Question
Two processes are trying to enter their critical sections using the shared variable lock (boolean) to control access. Before entering its CS, each process tests the variable lock, and if it is false sets it to true and enters its CS. If lock is true, it simply keeps waiting until lock is false. Initially lock is set to false.
What is the implication of implementing the test and set(&lock) instruction as a software procedure and not as a hardware instruction?
How is this problem solved when test and set(&lock) is implemented as a hardware instruction?
Explanation / Answer
do{
While (TestAndSet(&lock));
//do nothing
//critical section
lock =FALSE;
// reminder section
} while (TRUE);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.