# Read/write locks and wait/wake on atomics: are there Julia futexes?

**URL:** https://discourse.julialang.org/t/read-write-locks-and-wait-wake-on-atomics-are-there-julia-futexes/130602
**Category:** General Usage
**Tags:** parallel, operating-system, atomic
**Created:** [July 10, 2025, 10:20am UTC](https://discourse.julialang.org/t/read-write-locks-and-wait-wake-on-atomics-are-there-julia-futexes/130602 "2025-07-10T10:20:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![iago-lito](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iago-lito/32/31924_2.png) [@iago-lito](https://discourse.julialang.org/u/iago-lito)
#### Post date: [July 10, 2025, 10:20am UTC](https://discourse.julialang.org/t/read-write-locks-and-wait-wake-on-atomics-are-there-julia-futexes/130602/1 "2025-07-10T10:20:10Z")

</div>

I wished there was a [read-write lock](https://doc.rust-lang.org/std/sync/struct.RwLock.html) in Julia but I couldn’t find any. But there are [atomics](https://gist.github.com/vtjnash/11b0031f2e2a66c9c24d33e810b34ec0) so I figured I could write one myself, inspiring from this [(inspiring) book](https://marabos.nl/atomics/building-locks.html#reader-writer-lock) on the nasty-gritty low-level details of concurrency.

Unfortunately, I can’t manage to get it right without the [`wait/wake`](https://docs.rs/atomic-wait/latest/atomic_wait/) functionalities provided by futexes or equivalent. By “right” I mean without potential deadlocks, and yet without busy-waiting and without sleeping.

Do these exist in julia? Or would I need to make my own system calls? Or is there already a read-write lock in the standard library that I’d have overlooked?

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [July 10, 2025, 11:08am UTC](https://discourse.julialang.org/t/read-write-locks-and-wait-wake-on-atomics-are-there-julia-futexes/130602/2 "2025-07-10T11:08:57Z")

</div>

There is [`Base.Semaphore`](https://docs.julialang.org/en/v1/base/parallel/#Base.Semaphore), which may help you here.
