{"id":21868728,"url":"https://github.com/vsadov/nonblocking","last_synced_at":"2025-04-10T06:11:58.034Z","repository":{"id":33999652,"uuid":"37754268","full_name":"VSadov/NonBlocking","owner":"VSadov","description":"Implementation of a lock-free dictionary on .Net.","archived":false,"fork":false,"pushed_at":"2025-02-24T06:09:04.000Z","size":1559,"stargazers_count":499,"open_issues_count":3,"forks_count":34,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-03T03:01:39.262Z","etag":null,"topics":["dictionary","fast","high-performance","lock-free","wait-free"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VSadov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-20T01:59:45.000Z","updated_at":"2025-03-24T23:53:46.000Z","dependencies_parsed_at":"2025-01-01T14:00:26.786Z","dependency_job_id":"0c379bec-bacb-4ca5-bee1-638ef36cc256","html_url":"https://github.com/VSadov/NonBlocking","commit_stats":{"total_commits":119,"total_committers":5,"mean_commits":23.8,"dds":0.05882352941176472,"last_synced_commit":"24f6f83d2bde39bc20508bce5ecabf5fb094e00a"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VSadov%2FNonBlocking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VSadov%2FNonBlocking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VSadov%2FNonBlocking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VSadov%2FNonBlocking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VSadov","download_url":"https://codeload.github.com/VSadov/NonBlocking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166925,"owners_count":21058481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dictionary","fast","high-performance","lock-free","wait-free"],"created_at":"2024-11-28T05:15:05.183Z","updated_at":"2025-04-10T06:11:57.998Z","avatar_url":"https://github.com/VSadov.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NonBlocking\nImplementation of a non-blocking dictionary.  \nhttps://www.nuget.org/packages/NonBlocking\n\n## Overview\n\nNonBlocking dictionary:\n\n- NonBlocking dictionary has the same API as ConcurrentDictionary.\n- No locks are taken during any operation including Get, Add, Remove, internal resizes etc...\n- While multiple threads accessing NonBlocking dictionary will help each other in operations such as table resizing, there is no dependency on such behavior. If any thread get unscheduled or delayed for whatever reason, other threads will be able to make progress independently.\n\n## Implementation notes\nCore algorithms are based on NonBlockingHashMap, written and released to the public domain by Dr. Cliff Click.\nA good overview is here https://www.youtube.com/watch?v=HJ-719EGIts\n\nMost differences of this implementation are motivated by the differences in public APIs on .Net platform:\n- .Net has structs and reified generics.\n- platform APIs such as Interlocked.CompareExchange have differences.\n- ConcurrentDictionary API differs from a typical java dictionary.\n\n## Tested on platforms:\n* x86\n* x64\n* arm\n* arm64\n\n## Performance\n\nOn most operations NonBlocking dictionary is faster than ConcurrentDictionary. It is particularly faster in write-heavy scenarios.  \nRead/Write oprations scale linearly with the number of active threads if hardware/OS permits.  \n\n## Benchmarks\n\nThe test machine is  \n\tAMD EPYC 7V12 64-Core Processor \n\n\tBase speed:\t2.44 GHz\n\tSockets:\t2\n\tCores:\t128\n\tLogical processors:\t256\n\t\n\tConfigured as: 4 NUMA nodes  \n\nThe following sample benchmarks perform various operations on {int --\u003e string} dictionaries and run as 64bit process on net6.0 runtime.\n\n![Get](/../pictures//Graphs/Read.png?raw=true \"Random Get\")\nThe machine is configured as 4-node NUMA and Windows scheduler would use cores from one node, then their HT siblings, and only then use another node. Thus we see \"steps\".\n\n![Write](/../pictures//Graphs/Write.png?raw=true \"Random Write\")\nNot taking locks makes writes cheaper and scale better as number of threads increases.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsadov%2Fnonblocking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsadov%2Fnonblocking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsadov%2Fnonblocking/lists"}