Read-Modify-Write (RMW)

What is Read-Modify-Write (RMW)?

Read-Modify-Write (RMW) is a memory operation commonly used in computing systems where a processor or controller reads a data value from memory, modifies it, and writes the updated value back—all as a single atomic transaction. This technique is essential in multi-threaded and multi-core environments to ensure data consistency and prevent race conditions during concurrent access to shared memory.

How RMW works

The RMW cycle begins with a read of the target memory location. The processor then performs a modification—such as incrementing a counter, toggling a bit, or applying a mask—and finally writes the result back to the same location. Crucially, the entire sequence is treated as atomic, meaning no other thread or device can access or alter the data in between the read and write steps. This is typically enforced using hardware-level locking or cache coherency protocols.

In memory controllers, RMW is often used when updating partial data in a memory word, especially in systems with ECC (Error Correction Code). For example, modifying a single byte in a 64-bit word requires reading the full word, updating the byte, recalculating ECC, and writing the entire word back.

What are the key features of RMW?

  • Supports partial updates to memory blocks
  • Integrated with ECC and parity logic
  • Common in cache controllers and memory subsystems
  • Enables synchronization primitives (e.g., compare-and-swap, fetch-and-add)
  • Critical for transactional memory and lock-free data structures
 

What are the benefits of RMW?

  • Atomicity: Prevents data corruption in concurrent environments.
  • Data Integrity: Ensures ECC and parity bits are correctly updated.
  • Efficiency: Reduces the need for multiple memory transactions.
  • Consistency: Maintains coherent memory views across processors and devices.

 

Enabling Technologies

RMW operations are foundational in:

  • Multi-core processors with shared memory
  • Memory controllers for DDR4, DDR5, and LPDDR5
  • Cache-coherent interconnects like CXL and AXI
  • Operating systems and hypervisors managing concurrent threads
  • Embedded systems requiring deterministic behavior
 

Rambus Technologies

Rambus offers Interface IP solutions that support Read-Modify-Write add-on cores with our GDDR and LPDDR solutions. To learn more about the add-on core, click here.

Rambus logo