3 ms·
Sure, just as you'd understand a library or function to be "thread safe" it could be considered "transactional." I'm saying STM is to be used in as fine a grain
by rbranson 15y ago
Sure, just as you'd understand a library or function to be "thread safe" it could be considered "transactional." I'm saying STM is to be used in as fine a grain as possible, even if it's composing "larger grains." Just as thread-safety doesn't mean entering a shared, global critical section at the beginning of every function, STM doesn't mean that every block of code should be wrapped in a transaction. STM should really only be applied to writes that would cause the system to be in an improper state if partially applied.
- jrockway 15y agoI'm not sure I agree. Reads also need to be in transactions in order to prevent deadlocks. I think the paper I linked is pretty accessible, so it's worth a read. I agree that most of your program should be pure, though, but that's just a good practice in general, not something tied to transactional memory.