Write Through (cache)

alpharithms fallback 1

When cache memory is written over by the CPU it becomes inconsistent with its counterpart in main memory, is referred to as inconsistent. Write Through cache is a process by which data written to the cache memory is also written to the main memory simultaneously. It’s a simple concept but has many performance drawbacks.

Cache memory is located between main disk memory and the CPU to allow faster memory-dependent operations. When the CPU queries a cache it results in either a hit or miss. In the case of misses, the CPU looks to lower-level memory such as the main disk to retrieve information.

When a miss occurs, resulting in an impending retrieval from main memory, the cache may contain data from the main memory that hasn’t yet been saved back. In other words, cache memory and main memory are inconsistent.  In such cases, the CPU must instruct what’s in cache to be written back into main memory.

Write through solves this problem by dictating every write to cache to be reflected back into main memory. It greatly simplifies the process of consistency but does not provide good performance, sometimes reducing performance by several orders of magnitude.

Zαck West
Seasoned engineer with a decade of specializing in Python and backend services for scalable applications, leveraging reusable patterns, OOP, and TDD. Strong background in Full-Stack development, design, and digital marketing. Talk to me about deep reinforcement learning, trading algorithms, web scraping, and meditation.