Hardware instructions implementing mutual exclusion

Provide mainly two hardware instructions and their definitions which are used in order to implement the mutual exclusion.

E

Expert

Verified

Test and Set are those two hardware instructions used to implement the mutual exclusion:

boolean TestAndSet (boolean &target)
{
boolean rv = target;
target = true;
return rv;
}
Swap
void Swap (boolean &a, boolean &b)
{
boolean temp = a;
a = b;
b = temp;
}

   Related Questions in Operating System

©TutorsGlobe All rights reserved 2022-2023.