This applies to characteristics, but also about the ability to accept multi-threaded loads:
locks provide exclusive access to part of the code : while a thread has a lock, other threads rotate (looping when trying to get a lock) or lock, sleeping until the lock is released (which usually happens if the spinning takes too long) ;
Operationsatomic provides exclusive access to a resource (usually a word-size variable or pointer) using non-interruptive internal CPU instructions.
As BLOCK blocks other threads, the program slows down. Since atomic operations are performed sequentially (one after the other), blocking does not occur.
(*) if the number of simultaneous processors trying to access the same resource does not create a bottleneck - but we do not have enough processor cores to make this a problem.
I worked on writing without waiting (without locking without waiting states). The keystore for the server I'm working on.
Libraries such as Tokyo Cabinet (even TC-FIXED, a simple array) rely on locks to maintain database integrity:
"while the flow of letters works with the database, other threads of reading and writing flows are blocked" (documentation of the Tokyo cabinet)
Test results without concurrency (single-threaded test):
SQLite time: 56.4 ms (a B-tree) TC time: 10.7 ms (a hash table) TC-FIXED time: 1.3 ms (an array) G-WAN KV time: 0.4 ms (something new which works, but I am not sure a name is needed)
Using concurrency (multiple threads are written and read in the same database), only the G-WAN KV survived the same test, because (unlike others) it never blocks.
So, yes, this KV store simplifies development as they donβt need to worry about threading issues. To do so, but it was not trivial.
source share