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
The tricky piece of read/write (in contrast to pread and pwrite) is, changing file offset would imply a serialization point while OCC will pick another serialization point. Such divergence could result in anomalies.
The easiest way to resolve it is to use a lock for file offset. A multithreaded program that has concurrent read/write on a file usually uses pread and pwrite instead.
A better solution is to fully exploit OCC: in BlkTable.update, a thread A acquires the current offset and the last offset-changing thread's tx tail. Then it performs its IO, commits, and leaves the tx tail it has seen (this is the serialization point). Another thread B that does IO concurrently should see A's offset changing and A does not finish (probably implemented as a ticket lock etc); B could proceed and when it is about to commit, it must ensure A has already committed and it must ensure its' commit is after A.
The text was updated successfully, but these errors were encountered:
The tricky piece of
read
/write
(in contrast topread
andpwrite
) is, changing file offset would imply a serialization point while OCC will pick another serialization point. Such divergence could result in anomalies.The easiest way to resolve it is to use a lock for file offset. A multithreaded program that has concurrent read/write on a file usually uses
pread
andpwrite
instead.A better solution is to fully exploit OCC: in
BlkTable.update
, a thread A acquires the current offset and the last offset-changing thread's tx tail. Then it performs its IO, commits, and leaves the tx tail it has seen (this is the serialization point). Another thread B that does IO concurrently should see A's offset changing and A does not finish (probably implemented as a ticket lock etc); B could proceed and when it is about to commit, it must ensure A has already committed and it must ensure its' commit is after A.The text was updated successfully, but these errors were encountered: