Data actions that have properties of atomicity, consistency, isolation and Durability are the definition of a transaction ACID.
D - Durability is the model I was talking about: if data has already been written to disk, we believe that it is there, recorded reliably and will not go anywhere. Actually it is not so, for example, data needs to be backed up, but for our model it does not matter.
Sadly, you can only provide these properties with locks. There are 3 main approaches to transaction scheduling:
- Pessimistic schedulers;
- Optimistic masterworks;
- Hybrid masterworks and based on TimeStamp ordering of the ongoing transaction.
A masterworker is a component that ensures that the transaction is serialized and executed correctly.
Everybody knows about TimeStamp ordering: we look at the time of one transaction, the time of another transaction, who got up first, and the slippers. In fact, for most serious systems this approach has a lot of problems because, for starters, time on the server can go backwards, can jump or go wrong - and we will.
There are different methods to improve this, but as one single method of synchronizing transactions, it does not work. There are also vector clocks, Lamp Clock - I'm sure you've heard these terms - but they also have their limitations.
Optimistic approaches mean that we won't have conflicts like the one I described with the bank account. But in real life they don't work very well, although there are implementations that help to conduct some transactions with optimistic options.
As people working with databases, we are actually always pessimistic. We expect programmers to write bad code, the vendor to supply bad hardware, Mary Ivanna to unplug ibm apm saas
the server when she washes the floor - what can not be!
That's why we like pessimistic transaction scheduling, namely using locks. This is the only guaranteed way to ensure database integrity. There are appropriate theorems to prove and demonstrate this.
We need effective algorithms to capture and unlock the locks, because if we just lock everything we need, we're likely to come up with a very dumb version where we perform all the operations strictly sequentially. As microsoft sql server performance management
we already know this is not effective in terms of recycling parallelism, modern CPUs, number of servers, etc.