liveBook · Manning

Serialization

As explained in C++ Concurrency in Action, Second Edition

Serialization is the restriction of concurrent operations so that they execute in a sequential order rather than simultaneously.

Serialization occurs when a mutex makes threads take turns accessing protected data instead of accessing it concurrently. A smaller protected region means fewer operations are serialized, leaving more opportunity for true concurrency. section 6.1

When designing a data structure, consider how to reduce serialization:

  • Restrict lock scope so parts of an operation can run outside the lock, or protect different parts of the structure with different mutexes. section 6.1.1
  • Ask whether operations need the same level of protection. For example, multiple readers may access a structure concurrently while a modifying thread requires exclusive access; std::shared_mutex can support this distinction. section 6.1.1
  • Preserve operational semantics while looking for changes that enable more concurrent access. Some designs allow different operations to run concurrently while serializing threads performing the same operation. section 6.1.1

How C++ Concurrency in Action, Second Edition covers it

How deep it goes
Defines mutex-based serialization and gives design questions for reducing it, while deferring lock-free data structures.
What you can do after
Evaluate lock scope, mutex partitioning, and operation-level protection to reduce serialization while preserving operational semantics.
How it connects
Connects serialization to mutexes, mutual exclusion, shared mutexes, and lock-based concurrent data structures.

Also explained in

Compare how 2 books explain serialization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of C++ Concurrency in Action, Second Edition. The section links point to the parts of the book it draws on.