views:

34

answers:

2

I am messing with multiple threads accessing a resource (probably memory). What does "readback" mean in this context?

Any guides will be helpful... Google didn't give me any good results.

+1  A: 

When I've encountered that term, it's usually in the context of writing a value to a register or memory location that may also be accessed by some other software or hardware. To check whether someone else has changed it, you might keep a private copy of the data you wrote, and some time later read that shared register or memory location to compare its current value to the stored private copy. That's the "readback".

Jim Lewis
+1  A: 

I can think of several possible meanings for "readback". Here's the most likely; in a multithreaded environment, a lot can happen between your thread reading a value from memory and writing a changed value back to that memory. A simple yet effective way to detect changes is simply to get the value from memory again just before writing, and if it has changed from the value you started with, you know someone else changed it while you were working.

"Readback" may also refer to "repeatable reads", in which a locking mechanism is used to ensure that within the scope of an atomic set of operations, only the thread that obtained the lock on the resource can read OR write to it, ensuring that no other thread can change the value from what would be expected by the task if it ran single-threaded. That way, a thread doesn't have to detect external changes; the locking mechanism prevents such a thing from happening.

KeithS