Multicore & Synchronization
Which describes the idea of hardware transactional memory?
- ACritical sections run speculatively; with no conflict with other threads they commit as a whole, and on conflict they abort and retry
- BAll memory reads and writes are logged to disk like bank transactions
- CMemory writes are forbidden and only reads are allowed
Show answer and explanation
Answer: A. Critical sections run speculatively; with no conflict with other threads they commit as a whole, and on conflict they abort and retry
In transactional memory, a critical section runs as a transaction whose writes stay tentative and invisible to others. If no other thread touched the same data, all writes commit at once at the end; on conflict, everything is rolled back and retried or the code falls back to an ordinary lock. When conflicts are rare, even coarse locks can achieve parallelism close to fine-grained locking.
- A. Correct. It can sometimes run in parallel without taking the lock.
- B. It has nothing to do with logging to disk.
- C. Writes are performed too.