You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
What are the "load" and "store" meaning in the lecture note "X.load(acquire); X.store(42,release)"? Are they the instructions on the register?
Could I use it as
Thread A: X=42; F.load(acquire); F.store(1,release);
Thread B: do { f=F } while(f==0); assert(X==42);
or Do I have to use the acquire and release with spinlock? Like:
Thread A: X=42; spinlock_lock(&lock); F=1; spinklock_unlock(&lock)
Thread B: do { spinlock_lock(&lock); f=F; spinklock_unlock(&lock) } while(f==0); assert(X==42)
The text was updated successfully, but these errors were encountered:
Load from the location X, and store to the location X. They are instructions on the memory location represented by X.
The following is also correct:
(thread A) X = 42; F.store(1, release);
(thread B) do { f = F.load(acquire) } while (f == 0); assert(X == 42);
But in the slide, I intentionally used lock to make a point: when in doubt, protect all concurrent accesses with locks. I will not ask questions on the above code in the exam, because I didn't teach it.
I don't know how to use load and store yet.
What are the "load" and "store" meaning in the lecture note "X.load(acquire); X.store(42,release)"? Are they the instructions on the register?
Could I use it as
Thread A: X=42; F.load(acquire); F.store(1,release);
Thread B: do { f=F } while(f==0); assert(X==42);
or Do I have to use the acquire and release with spinlock? Like:
Thread A: X=42; spinlock_lock(&lock); F=1; spinklock_unlock(&lock)
Thread B: do { spinlock_lock(&lock); f=F; spinklock_unlock(&lock) } while(f==0); assert(X==42)
The text was updated successfully, but these errors were encountered: