Single answer: xchgl is a x86 machine instruction that reads…
Single answer: xchgl is a x86 machine instruction that reads a 32bit value from a memory location and sets a new value to the same memory location as a single atomic instruction. The following xchg is the mutual exclusion (mutex) implemented in xv6 os kernel using a xchgl x86 instruction. For your understanding, the machine effects are described in C. static inline int xchg(volatile int *addr, int newval) { uint result; /* atomic read followed by update in a C version */ result = *addr; *addr = new; return result;} Select one that *CORRECTLY* implements a mutual lock to enter a critical section (mutual exclusion) using the xchg above.