Lock-based Versioning

Created on 2022-01-20T17:41:08-06:00

Return to the Index

This card can also be read via Gemini.

When read/write locks are used to protect data being changed.

A read lock means someone is currently reading the data.

A write lock means someone is currently changing the data.

Multiple read locks are allowed at any given time.

Only one write lock is allowed at a given time.

A write lock cannot be out while people are reading.

NB you might need a pending-write lock as well so a mutator can wait in a queue for reads to finish and new reads can't block the writer from ever being able to make the changes.