Skip to content

Instantly share code, notes, and snippets.

@Happytreat
Created April 2, 2021 06:44
Show Gist options
  • Save Happytreat/847bfec27cc68dcad9dacf158bbb0292 to your computer and use it in GitHub Desktop.
Save Happytreat/847bfec27cc68dcad9dacf158bbb0292 to your computer and use it in GitHub Desktop.
Race Condition 1
# Credits to https://pdos.csail.mit.edu/6.824/notes/l-memcached.txt
k not in cache
C1 get(k), misses
C1 v1 = read k from DB
C2 writes k = v2 in DB
C2 delete(k)
C1 set(k, v1)
now mc has stale data, delete(k) has already happened
will stay stale indefinitely, until k is next written
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment