Egodystonic.Atomics 1.0.0-alpha1

.NET Standard 2.0
This is a prerelease version of Egodystonic.Atomics.
NuGet\Install-Package Egodystonic.Atomics -Version 1.0.0-alpha1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
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
#r "nuget: Egodystonic.Atomics, 1.0.0-alpha1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Egodystonic.Atomics as a Cake Addin
#addin nuget:?package=Egodystonic.Atomics&version=1.0.0-alpha1&prerelease

// Install Egodystonic.Atomics as a Cake Tool
#tool nuget:?package=Egodystonic.Atomics&version=1.0.0-alpha1&prerelease

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<T> 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<> 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

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

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