Composable Memory Transactions

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Introduction

The problem with multi-threads is that you'll end up stepping on each other's feet. Using Composable Memory Transactions [...] it is possible to have performant systems while handling these issues in the most appropriate way.

This model follows closely the model that modern SQL systems should use to ensure ACID compliance while also being fast.

The concepts are:

  • Atomic Blocks: A bit of code that either has to run all at the same time, with a consistent view of memory, or not at all.
  • Optimistic Synchronization: The idea that you can run that code, and then back it out if it turns out that it either saw an inconsistent view of the world or could not be committed. This is like what you can do in PostgreSQL. Just run the queries you want to run, and it will let you know when you can't do that anymore because you're stepping on someone else's feet.
  • Transaction Log: Records what you did during the transaction, so that it can be backed out if necessary.
  • Commit: Applies the changes you made to memory as if it happened all at once.

Implementation

blah