▲ | lxgr 4 days ago | |
If my memory of parallel algorithms class serves me right, you can build any synchronization algorithm on top of compare-and-swap as an atomic primitive. As a (horribly inefficient, in case of non-trivial write contention) toy example, you could use S3 as a lock-free concurrent SQLite storage backend: Reads work as expected by fetching the entire database and satisfying the operation locally; writes work like this: - Download the current database copy - Perform your write locally - Upload it back using "Put-If-Match" and the pre-edit copy as the matched object. - If you get success, consider the transaction successful. - If you get failure, go back to step 1 and try again. |