4-5 Atomic Transaction

  • Why not keep using lock?

    1. reduce concurrency
    2. lead to deadlock
    3. lead to priority inversion. low priority blocks high priority thread, caused high priority thread starved. example: Mars Pathfinder
    4. lead to convoying. a performance problem caused by the overhead of repeated context switches from each time a thread attempts to acquire the lock and fails.
    5. lack of soft&hard composability: it is hard to combine small, correct lock-based modules into equally correct larger programs without modifying the modules or at least knowing about their internals.
  • Transaction: groups of operations executed by a thread.

  • Serializability:
    • idea: go without