2 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.
Atomic-Dict: A library for lock-free shared 64-bit dictionaries
Atomic-Dict provides a shared Map[Int, Int] for 64-bit integer values. Create an AtomicDict(), fork, then update keyed values using atomic operations. Supported operations include compare-and-swap, exchange, increment, etc.
Limitations
This is not a general purpose dictionary implementation. It is designed to be used as a synchronization primitive. Key limitations include:
- The key must be a non-zero 64-bit value.
- The value for freshly allocated keys are always initialized as 0.
- Keys allocated into the dictionary can never be removed.
- The maximum size of the dictionary must be specified upfront.
To support more complex types, build shared a list[XYZ] before fork(), then use indexes into those lists as the keys and values of the AtomicDict.
Performance
While bare bones, AtomicDict is fast. Operations never lock, never wait, and leverage cache locality. It is hard to imagine a faster shared dictionary implementation.
Example use
from atomic_dict import AtomicDict
import multiprocessing
if __name__ == "__main__":
dict = AtomicDict(1024*1024)
context = multiprocessing.get_context("fork")
def worker(id: int) -> None:
for _ in range(32*1024):
idx = dict[1].add(1) # also: sub, bor, bxor, band, swap, cas(expected, replacement)
dict[100 + idx] = id
with context.Pool(8) as p:
p.map(worker, range(16))
Release files for atomic_dict 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atomic_dict-0.5.0.tar.gz | 9.9 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atomic_dict-0.5.0-cp314-cp314-manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.28+ x86-64 | Details |
| atomic_dict-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.28+ x86-64 | Details |
| atomic_dict-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
Total release size: 131.2 kB
Release files / atomic_dict-0.5.0.tar.gz
| Download URL | atomic_dict-0.5.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9eefe28c4acf5a96aa4555ac177f684685cd43ec0932bf30a317f73edc5846b4
|
|
BLAKE2b-256 checksum How to use checksums |
808d473b6829d5adfb237431c4ac2d6a6f02a7cb6294030dcbbc620613055061
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.6 Linux/4.18.0-513.24.1.el8_9.x86_64
|
Release files / atomic_dict-0.5.0-cp314-cp314-manylinux_2_28_x86_64.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | atomic_dict-0.5.0-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 35.8 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
65b2d0e5b2da7fd5b5ab51a11369987c56fb229e8d998b883abdafd4ba2dca42
|
|
BLAKE2b-256 checksum How to use checksums |
406b81ec012c291f5c015e3aab09eaa9764961dbf163a541f990fc7e06448524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.13.1 Linux/4.18.0-553.81.1.el8_10.x86_64
|
Release files / atomic_dict-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | atomic_dict-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 43.6 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9cf26053b59412ae380f4dd033b7c3ce24c612e470cd96c10a22b7ecedb73190
|
|
BLAKE2b-256 checksum How to use checksums |
bed46554ab9f7cdb9ba3d204c9815aec6b78e91371b0a178f5e147f8927eabac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.13.1 Linux/4.18.0-513.24.1.el8_9.x86_64
|
Release files / atomic_dict-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | atomic_dict-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 41.9 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3190da3aeb4e689729f05256b7eb21b69186a462e9af7dd5a1e1e9fbaf2264dd
|
|
BLAKE2b-256 checksum How to use checksums |
358d4491515cc120c48d8999e9a83bf65800479cf9a23a7561dc95b65d4170ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.6 Linux/4.18.0-513.24.1.el8_9.x86_64
|