Copy-on-write
Copy-on-write is a technique that shares data until modification requires creating an independent copy, preserving the original for existing users.
Grokking Simplicity
A data-management technique that creates a copy before modifying data so the original remains unchanged.
- How it is used
- Applies immutability to writes in JavaScript, including array, object, and nested-data updates.
- How deep it goes
- Explains three procedural steps, read-write separation, shallow copies, nested updates, and reusable callback wrappers.
- Examples
- Uses shopping carts, mailing lists, array methods, object updates, nested prices, and callback-based array utilities.
- What you can do after
- Build it from scratch by converting mutating JavaScript operations into immutable functions that return updated values.
Architecting an Apache Iceberg Lakehouse
Copy-on-write is a data-modification pattern that rewrites affected base files immediately to materialize updates or deletions.
- How it is used
- Applies row-level updates and deletes while favoring fast reads and simpler file-retention management.
- How deep it goes
- Explains write-time rewriting, snapshots, manifests, file retention, and read-write tradeoffs, but stops short of implementation commands.
- Examples
- Demonstrates deleting rows by rewriting data files, publishing replacement manifests, preserving older snapshots, and later cleaning up unreferenced files.
- What you can do after
- Evaluate COW against merge-on-read by balancing read speed, write amplification, update latency, and cleanup complexity.
Read how Architecting an Apache Iceberg Lakehouse explains copy-on-write →
Learn Docker in a Month of Lunches, Second Edition
Copy-on-write is a storage technique that copies shared data into a writable location only when a modification is made.
- How it is used
- Explains how Docker containers modify image files while preserving shared read-only image layers.
- How deep it goes
- Works through the writable-layer mechanism and a file-edit exercise, but stops short of storage-driver internals.
- Examples
- Uses Docker commands to replace /input.txt, rerun a file-display container, and compare original and changed contents.
- What you can do after
- Apply it via Docker commands to edit container files and distinguish writable-layer changes from image contents.
Read how Learn Docker in a Month of Lunches, Second Edition explains copy-on-write →
Kubernetes in Action, Second Edition
A copy-on-write mechanism preserves shared data until a modification causes a private copy to be created.
- How it is used
- Explains how Docker containers isolate file changes while sharing image layers.
- How deep it goes
- Explains layered reads, whole-file copying, deletion markers, and storage consequences without detailing filesystem-driver internals.
- Examples
- Uses three containers sharing layers, file modification, file deletion, and permission changes as concrete cases.
- What you can do after
- Evaluate how container file operations affect isolation and writable-layer storage.
Read how Kubernetes in Action, Second Edition explains copy-on-write →
The Joy of JavaScript
A mutation strategy in which changes are made by creating modified copies rather than altering an existing value in place.
- How it is used
- Supports pure manipulation of custom data objects and composable functional code.
- How deep it goes
- Defines return-new-object behavior and connects it to frozen value objects and lenses, without detailing lens implementation.
- Examples
- Uses Money arithmetic, frozen and sealed objects, and lenses for targeted immutable property updates.
- What you can do after
- Apply it via value objects or lenses to update data without mutating existing values.
Also covered in
- Learn Concurrent Programming with Go
- API Design Patterns
- Idiomatic Rust
- Learn Rust in a Month of Lunches
- Fast Python: High performance techniques for large datasets
- Code Like a Pro in Rust
- Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more
What to know first
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- containerA software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
- global variableA global variable is a variable whose binding is accessible from broad program or module scopes according to the language’s name-resolution rules.
- immutable collectionAn immutable collection is a collection whose contents cannot be changed after it is created.
Related concepts
- shallow copyuses · A shallow copy creates a new outer data structure while retaining references to its nested values rather than copying them recursively.
- Cowimplemented by · Cow is Rust’s standard-library clone-on-write type, representing either borrowed or owned data and creating owned data when necessary.
- immutable collectionimplements · An immutable collection is a collection whose contents cannot be changed after it is created.
- CopyOnWriteArrayListused by · CopyOnWriteArrayList is a thread-safe Java list implementation that copies its backing array when modified, providing iterators over stable snapshots.
- defensive copyalternative to · A defensive copy is an independent copy of data made to prevent changes through another reference from altering retained data or internal state.
Questions about copy-on-write
What is copy-on-write?
Copy-on-write is a technique that shares data until modification requires creating an independent copy, preserving the original for existing users.
Which Manning books explain copy-on-write?
Grokking Simplicity, Architecting an Apache Iceberg Lakehouse, Learn Docker in a Month of Lunches, Second Edition, Kubernetes in Action, Second Edition and The Joy of JavaScript.
What should I know before learning copy-on-write?
Manning books that teach copy-on-write usually introduce array, container, global variable and immutable collection first.
What is the difference between copy-on-write and defensive copy?
Copy-on-write is a technique that shares data until modification requires creating an independent copy, preserving the original for existing users. A defensive copy is an independent copy of data made to prevent changes through another reference from altering retained data or internal state.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




