Transaction for System Design Interview (5) : concurrent writes and lost updates

SystemDesign
Tech Wrench
Published in
7 min readDec 28, 2022

--

PREV | HOME | NEXT | Sys Design Resource List

Don’t forget to get your copy of Designing Data Intensive Applications, the single most important book to read for system design interview prep! Udacity | Coursera | Pluralsight.

Check out ByteByteGo’s popular System Design Interview Course

Consider signing-up for paid Medium account to access our curated content for system design resources.

Concurrent or distributed systems face an interesting challenge of correctly handling writes that write to the same object, table, data-structure or what you may have, at the same time. Usually concurrent writes occur when two actors read a value, modify the value based on what was read and then update the value. To understand the problem consider two applications that attempt to update a value count in the database. Initially count is set to 5. Consider the following sequence of events that result in loosing the changes made by one of the users. Both users set out to read the current value of count and increment it by one.

If you are interviewing check out our comprehensive preparation course Java Mulithreading for Engineering Interviews.

Get a leg up on your competition with the Grokking Modern System Design for Software Engineers and Managers and land a Big Tech job!
  1. User A reads the count value from the database as 5.

--

--