# Thread-safe dict?

**URL:** <https://discourse.julialang.org/t/thread-safe-dict/64024>\
**Category:** General Usage\
**Created:** [July 4, 2021, 8:02am UTC](https://discourse.julialang.org/t/thread-safe-dict/64024 "2021-07-04T08:02:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [July 4, 2021, 8:02am UTC](https://discourse.julialang.org/t/thread-safe-dict/64024/1 "2021-07-04T08:02:51Z")

</div>

Is there any dictionary implementation that can be updated safely within threaded code?

References:

> [@\[ANN\] Dictionaries.jl - Improved productivity and performance of dictionaries in Julia](https://discourse.julialang.org/t/ann-dictionaries-jl-improved-productivity-and-performance-of-dictionaries-in-julia/32074/8):
>
> I have exactly 1.3 questions to ask. Is this Dictionary Thread Safe?

> [@Can dicts be threadsafe?](https://discourse.julialang.org/t/can-dicts-be-threadsafe/27172/6):
>
> Basic data structures are not and probably never will be threadsafe—it introduces way too much overhead when you don’t need thread safety. If you want to safely share a dict between threads, you can use a lock, or better still, take a page out of Go’s playbook and have a single task which manages the dict and let other tasks send it messages to tell it to update the dict instead.

---

<div class="post-metadata">

**Author:** ![wherrera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wherrera/32/5288_2.png) [@wherrera](https://discourse.julialang.org/u/wherrera)\
**Post date:** [July 4, 2021, 9:38am UTC](https://discourse.julialang.org/t/thread-safe-dict/64024/2 "2021-07-04T09:38:36Z")

</div>

> **[GitHub - wherrera10/ThreadSafeDicts.jl: Thread safe Julia Dict](https://github.com/wherrera10/ThreadSafeDicts.jl)**
>
> Thread safe Julia Dict. Contribute to wherrera10/ThreadSafeDicts.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [April 20, 2024, 9:24pm UTC](https://discourse.julialang.org/t/thread-safe-dict/64024/3 "2024-04-20T21:24:23Z")

</div>

See also `ConcurrentDict` in [ConcurrentCollections.jl · ConcurrentCollections](https://juliaconcurrent.github.io/ConcurrentCollections.jl/stable/#ConcurrentCollections.ConcurrentDict)
