skillfed

atomic_dict

A library for lock-free shared 64-bit dictionaries

atomic-dict v0.5.0 266.0K downloads/30d#8,310 on PyPI0
Permissive license BSD-3 DORMANT released

What it is and what it does

Atomic-Dict is a specialized synchronization primitive for multiprocess Python programs that need to share and atomically update 64-bit integer values across process boundaries. It implements a fixed-size Map[Int, Int] with lock-free operations—no mutexes, no waits—using cache-local memory layout for speed. The library is deliberately minimal: keys and values are 64-bit integers only, keys cannot be deleted once allocated, and the dictionary size is fixed at creation. It is not a general-purpose dictionary but rather a building block for inter-process coordination in performance-critical code.

The package supports atomic operations including compare-and-swap, exchange, increment, decrement, bitwise OR/XOR/AND, and swap. To work with complex types, you pre-allocate a shared list before forking and use list indices as keys and values. The design trades flexibility for speed and simplicity—operations never block, making it suitable for tight loops in worker processes that need to coordinate counters, flags, or indices without contention.

Use it for:

  • Coordinate counters across worker processes in a multiprocessing pool without locks or synchronization overhead.
  • Implement lock-free work-stealing or load-balancing primitives where processes update shared state atomically.
  • Build inter-process synchronization for real-time systems where latency and cache locality matter more than feature richness.
  • Share and update indexed references to complex objects across processes by using the dictionary as a pointer map.
  • Implement fast, contention-free metrics or telemetry collection in parallel workloads.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Atomic-Dict provides a lock-free, shared 64-bit integer key-value map for multiprocess synchronization using atomic operations like compare-and-swap, exchange, and increment.

Yes, if you need lock-free inter-process integer coordination in Python and accept the constraints: fork-based multiprocessing, fixed-size dictionary, 64-bit integers only, and manylinux_2_28 x86_64 platform dependency. The dormant maintenance status and zero community stars suggest limited adoption; verify it fits your exact use case before committing. Not suitable for general-purpose shared data structures or non-fork multiprocessing contexts.

Install

atomic-dict on PyPI

pip

pip install atomic-dict

uv

uv add atomic-dict

poetry

poetry add atomic-dict

Installing atomic_dict

Before you install

Medium install friction due to platform-specific wheels (manylinux_2_28 x86_64 only for Python 3.10–3.14). Repository is dormant (last commit 2024-08-17, no stars), suggesting limited ongoing maintenance or community adoption.

License in practice

BSD-3 permissive license allows commercial and private use with minimal restrictions; attribution required.

Quickstart

from atomic_dict import AtomicDict
import multiprocessing

dict = AtomicDict(1024*1024)
context = multiprocessing.get_context("fork")
def worker(id: int) -> None:
    dict[1].add(1)  # atomic increment
    dict[100 + id] = id
with context.Pool(8) as p:
    p.map(worker, range(16))

Requires fork-based multiprocessing context; keys must be non-zero 64-bit integers; maximum dictionary size must be specified upfront.

Verify before relying

  • Whether the manylinux_2_28 wheel constraint limits deployment to recent Linux distributions or if other platforms are supported.
  • Whether the 0 stars and dormant status reflect low adoption or simply a niche use case with satisfied users.

Package facts

License BSD-3 (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance dormant — 727 days since the last release
Last repo commit
First released
Downloads 266,027/month — #8,310 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: atomic_dict-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl; atomic_dict-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl; atomic_dict-0.5.0-cp314-cp314-manylinux_2_28_x86_64.whl

License :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12

Tags

lock-free shared dictionaryatomic operations multiprocessing64-bit integer mapcompare-and-swap synchronizationshared memory dictionarymultiprocess atomic updatescache-local synchronization primitive
lock-freemultiprocessingsynchronization-primitive

More Distributed Computing packages