You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terry Kim edited this page Feb 6, 2017
·
4 revisions
How Epoch Queue works
Epoch Queue is an array where its index represents time (epoch time), ti, which is always increasing. Its value represents reference counts at ti.
In the following code, when GetContext() is called, the reference count at that epoch time is incremented by 1. Note that this requires a lock for a brief time, but after this, any Get() calls on any hashtables are lock-free.
Now, let's assume that the record1 in the above code gets deleted by another thread at the same epoch time. This record is not deleted from the memory (but it's immediately invisible from the hash table, meaning another Get() on this record will return an empty record) until reference count becomes zero (when the context object gets destroyed). Therefore, record1 above is guaranteed to point to the correct record.