Egodystonic.Atomics 1.0.0-alpha1

Library for managing multithreaded program state; providing lock-free, fast, scalable data wrappers for shared variables.

This is a prerelease version of Egodystonic.Atomics.
Install-Package Egodystonic.Atomics -Version 1.0.0-alpha1
dotnet add package Egodystonic.Atomics --version 1.0.0-alpha1
<PackageReference Include="Egodystonic.Atomics" Version="1.0.0-alpha1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Egodystonic.Atomics --version 1.0.0-alpha1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Egodystonic.Atomics

Atomics is a C#/.NET Standard 2.0 library aimed at providing thread-safe wrappers for mutable shared state variables.

Please note: This library is currently in alpha. There is no inline documentation yet and the API is liable to minor changes.

Library Features

  • Provides built-in mechanisms for operating on mutable variables in discrete, atomic operations; including 'basics' like compare-and-swap/increment etc. but also more complex or arbitrary routines, making it easier to reason about potential concurrent accesses and eliminate accidental race conditions.
  • Helps ensure that all accesses to wrapped variables are done in a threadsafe manner. Unlike with other synchronization primitives, mutable variables wrapped in an Atomic&lt;T&gt; wrapper are much harder to accidentally alter in an unsafe way.
  • Almost all operations are "lock-free", resulting in high-scalability for almost any contention level and any number of threads; with a suite of benchmarks used to measure performance and guide implementation.
  • A full suite of unit tests with a custom-built harness for testing the entire library with multiple concurrent threads.
  • Support for custom equality (e.g. compare-and-swap with two IEquatable&lt;&gt; objects will use their Equals() function for comparison).
  • Library is targeted to .NET Standard 2.0 which is supported by most modern .NET platforms.
  • MIT licensed.

Library Advantages

Although the best design for threadsafe code is to have no mutable state at all, sometimes it is a necessity for performance or reasons of complexity.

As growth in single-core computing power is slowing, scaling via parallelism with higher CPU core counts is becoming an increasingly important way to increase application responsiveness. The latest generation of desktop CPUs have more threads than ever before, with the flagship specs currently being Intel's i9 9900k (16 threads) and AMD's Threadripper 2950X (32 threads).

Currently the .NET FCL/BCL offers a great suite of tools for writing parellized/concurrent code with async/await, concurrent & immutable collections, Tasks and the TPL, and more fundamental constructs like locks, semaphores, reader-writer locks, and more.

However, one potentially missing element is the provision for threadsafe single variables, often used as part of a larger concurrent algorithm or data structure. Many other languages provide a similar library, including C++, Java, Rust, and Go.

Documentation

For more documentation, please visit the github page at https://github.com/Egodystonic/Atomics

Egodystonic.Atomics

Atomics is a C#/.NET Standard 2.0 library aimed at providing thread-safe wrappers for mutable shared state variables.

Please note: This library is currently in alpha. There is no inline documentation yet and the API is liable to minor changes.

Library Features

  • Provides built-in mechanisms for operating on mutable variables in discrete, atomic operations; including 'basics' like compare-and-swap/increment etc. but also more complex or arbitrary routines, making it easier to reason about potential concurrent accesses and eliminate accidental race conditions.
  • Helps ensure that all accesses to wrapped variables are done in a threadsafe manner. Unlike with other synchronization primitives, mutable variables wrapped in an Atomic&lt;T&gt; wrapper are much harder to accidentally alter in an unsafe way.
  • Almost all operations are "lock-free", resulting in high-scalability for almost any contention level and any number of threads; with a suite of benchmarks used to measure performance and guide implementation.
  • A full suite of unit tests with a custom-built harness for testing the entire library with multiple concurrent threads.
  • Support for custom equality (e.g. compare-and-swap with two IEquatable&lt;&gt; objects will use their Equals() function for comparison).
  • Library is targeted to .NET Standard 2.0 which is supported by most modern .NET platforms.
  • MIT licensed.

Library Advantages

Although the best design for threadsafe code is to have no mutable state at all, sometimes it is a necessity for performance or reasons of complexity.

As growth in single-core computing power is slowing, scaling via parallelism with higher CPU core counts is becoming an increasingly important way to increase application responsiveness. The latest generation of desktop CPUs have more threads than ever before, with the flagship specs currently being Intel's i9 9900k (16 threads) and AMD's Threadripper 2950X (32 threads).

Currently the .NET FCL/BCL offers a great suite of tools for writing parellized/concurrent code with async/await, concurrent & immutable collections, Tasks and the TPL, and more fundamental constructs like locks, semaphores, reader-writer locks, and more.

However, one potentially missing element is the provision for threadsafe single variables, often used as part of a larger concurrent algorithm or data structure. Many other languages provide a similar library, including C++, Java, Rust, and Go.

Documentation

For more documentation, please visit the github page at https://github.com/Egodystonic/Atomics

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0-alpha1 229 2/14/2019