3 ms·
One of the best examples of this I can recall came from an operating systems class at uni, 15 years ago. The professor introduced a problem where two threads ar
by physicles 5y ago
One of the best examples of this I can recall came from an operating systems class at uni, 15 years ago. The professor introduced a problem where two threads are trying to modify the same state at the same time.
Then, instead of saying “there are these atomic locking primitives that we can use,” he asked the class for suggestions about how to make sure the two threads don’t stomp on each other’s updates. For about a half hour, someone would suggest a new way to place an if statement, and he would show how the “lock” would be defeated if contexts switched in such-and-such way.
Finally, when the whole class was thoroughly convinced that it wasn’t possible, he introduced atomic locking primitives.