test-and-set

How would one code test and set behavior without a special hardware instruction?

Most of the implementations I find require a hardware instruction to do this. However I strongly doubt this is required (if it is, I can't figure out why...) ...

Atomic Instruction

What do you mean by Atomic instructions? How does the following become Atomic? TestAndSet int TestAndSet(int *x){ register int temp = *x; *x = 1; return temp; } From a software perspective, if one does not want to use non-blocking synchronization primitives, how can one ensure Atomicity of instruction? is it possible only a...

.NET memory model, volatile variables, and test-and-set: what is guaranteed?

I know that the .NET memory model (on the .NET Framework; not compact/micro/silverlight/mono/xna/what-have-you) guaranteed that for certain types (most notably primitive integers and references) operations were guaranteed to be atomic. Further, I believe that the x86/x64 test-and-set instruction (and Interlocked.CompareExchange) actuall...

How to use TestAndSet() for solving the critical section problem?

I'm studying for an exam and I'm having difficulty with a concept. This is the pseudo code I am given: int mutex = 0; do { while (TestAndSet(&mutex)); // critical section mutiex = 0; // remainder section } while (TRUE); My instructor says that only two of the three necessary conditions (mutual exclusion, progress, and bounded ...