Git Product home page Git Product logo

concurrencytoolkit's Introduction

ConcurrencyToolkit

Concurrent collections and synchronization primitives for writing fast multithreaded and asynchronous code. This library is experimental and provided without warranty, so use it carefully.

Features

  • lockless semaphores
  • priority semaphore
  • lockless object and array pools
  • memory compact single writer multiple readers hash map
  • memory compact thread safe (but locked) hash map
  • write optimized lock-free counter

Types

ConcurrencyToolkit.Synchronization

  • QueueSemaphore: uses ConcurrentQueue to order waiters
  • StackSemaphore: uses ConcurrentStack to order waiters
  • SimpleSegmentSemaphore: uses segment queue to order waiters (similar to the Semaphore from kotlinx.coroutines)
  • SegmentSemaphore: uses segment queue with support of early removal of cancelled waiters
  • PrioritySemaphore: lock-based semaphore (like SemaphoreSlim), but releases waiters in specified priority

ConcurrencyToolkit.Pooling

  • LocklessArrayPool<T>.Shared: similar to ArrayPool<T>.Shared but uses bounded concurrent queue instead of lock protected arrays to store pooled items.
  • IObjectPool<T>, ObjectPool<T>

ConcurrencyToolkit.Collections

  • SingleWriterDictionary<TKey, TValue, TComparer>: memory-compact hash map that supports single writer and multiple readers simultaneously. Writes are lock-free (except for resizes, which may trigger GC), but reads may be retried when a parallel update occurs.
  • StripedDictionary<TKey, TValue, TComparer>: memory-compact hash map, designed to avoid ConcurrentDictionary GC overhead. It is not general purpose ConcurrentDictionary replacement, and generally is slower, especially for reads.
  • DefaultComparer<TKey>: default comparer for ConcurrencyToolkit hash maps
  • ComparerWrapper<TKey>: struct wrapper over the reference type comparer

ConcurrencyToolkit.Metrics

  • ThreadSafeCounter64: scalable atomic counter that distributes writes across per-core variables

ConcurrencyToolkit.Threading

  • InterlockedFloatingPoint: methods for atomic floating point arithmetics
  • LowLatencySpinWait: SpinWait implementation that achieves low latency (~0.5ms) on sleeps instead of standard 15ms

concurrencytoolkit's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.