Overview
The Solidity Gateway to Arcology Concurrency Control
Last updated
The Solidity Gateway to Arcology Concurrency Control
Last updated
Arcology features a fully parallelized execution engine. In parallel processing, a core assumption is that multiple transactions do not access the same state simultaneously. When they do, conflicts arise, and the affected transactions are reverted to maintain state consistency. To fully leverage Arcology's design, developers must eliminate such contention points in their contracts.
To address this, Arcology provides a Concurrent Library tailored for concurrent programming in Solidity. The tools and data structures in this library are essential to unlocking the full potential of Arcology’s parallel execution model.
The library enables contention avoidance at the source code level, allowing multiple operations to safely modify shared state without triggering conflicts or rollbacks. All components are not only thread-safe but also deterministic by design, ensuring that operations always produce consistent and predictable results—regardless of execution order or timing.
Note: The packages in the guide are not meant for production deployment but rather experimental for now. Developers are encouraged to explore and learn from the code while emphasizing collaboration and feedback to improve the platform.
Arcology’s concurrent arrays follow a conflict model based on preserving : transactions are considered non-conflicting only if executing them in any order yields the same final outcome.
To maximize parallelism in parallel programming, the key is to eliminate shared variables and data structures. The suite is designed with this concept in mind, providing the following components. Efficiently handle concurrent state modifications without locking or contention.
Arcology's concurrent data structures can be considered a form of blockchain-specific designed to enable efficient and conflict-free updates.
Cumulative Variables: A commutative variable can receive concurrent delta updates from multiple transactions, and the final result consistently remains the same, irrespective of the order in which the updates are processed.
Concurrent Arrays: Merging thread-safe design with determinism to facilitate efficient parallel processing in multi-threaded environments. Resembling a conventional array, it permits concurrent push-back operations to the container and supports random reads, as long as they don't target the same elements.
Concurrent Maps: Data structures combining the function of standard maps and arrays. A concurrent map differentiates itself from native mapping by providing the ability to iterate its keys and values deterministically.
Custom Data structures: In addition, users can build the concurrent data structures of their choice based on the built-in ones provided by Arcology.
Multiprocessing: multiprocessing feature enables developers to write code to start subprocesses to handle multiple tasks, similar to using multiple threads in general-purpose languages.
Runtime: The package provides runtime information to developers, enabling Arcology to execute their transitions more effectively.
Once installed, you can start using the library by importing its modules into your contracts. The example below shows how to import the tools.
Please feel free to contact us if you would like to contribute your own examples.