Get premium membership and access questions with answers, video lessons as well as revision papers.

What is a test-and-set instruction? How can it be used to implement mutual exclusion? Consider using a fragment of psuedo-assembly language aid you explanation

      

What is a test-and-set instruction? How can it be used to implement mutual exclusion?
Consider using a fragment of psuedo-assembly language aid you explanation

  

Answers


Faith
A test and set instruction is a method of using the lock-variable solution, but with hardware support
(instructions are in ASM and called before entering any critical region). Prior to entering the critical
region, it copies the lock variable to a register, sets it to 1 if it was 0 (free), acquire the lock and execute.
If not, another process had it. By being called as ASM instructions, it is guaranteed to be atomic:
26420228301.PNG
26420228302.PNG
Titany answered the question on April 26, 2022 at 05:31


Next: Interrupt disabling and enabling is a common approach to implementing mutual exclusion, what are its advantages and disadvantages?
Previous: What is the producer consumer problem? Give an example of its occurrence in operating systems

View More Operating Systems Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions