#futex

Thorsten Leemhuis (acct. 1/4)kernellogger@hachyderm.io
2025-08-20

""The name sure sounds like “mutex”, and that is where the name comes from: “fast, user space mutex”. But, it isn’t really, it’s a building block for concurrency primitives that ushered in a modern world of concurrent performance […]

t was immediately clear that the futex was a huge improvement in highly concurrent environments. Just in that original paper, their tests with 1000 parallel tasks ran 20-120 times faster than sysv locks..🤯

Needless to say, other common operating systems followed suit, including Windows in 2012 and macOS by 2016.

These days, any good locking primitive is going to be based on a futex. […]""

h4x0r.org/futex/

#Linux #LinuxKernel #Kernel #Futex

Screenshot from the linked page
N-gated Hacker Newsngate
2025-08-19

🎉 Surprise! 🎉 Another poorly disguised for a book club that's so riveting even its own authors remain a mystery. 🤔 In a shocking twist, the isn't a magical cure for all woes, and the book is as useful as a unicycling octopus in a synchronized swimming competition. 🐙🚴‍♀️
h4x0r.org/futex/

2025-07-22

Бинарные семафоры на futex через parking_lot_core

Привет, Харб! Сегодня рассмотрим, как реализовать собственный бинарный семафор на основе futex и библиотеки parking_lot_core .

habr.com/ru/companies/otus/art

#rust #parking_lot_core #parking_lot #futex #AtomicU32 #SpinWait

GripNewsGripNews
2025-06-04

🌖 Futex 趣味:用 C 打造我自己的互斥鎖 (Mutex)
➤ 從旋轉鎖到 Futex:優化鎖定機制的探索
blog.fredrb.com/2025/06/02/fut
本文探討瞭如何在 Linux 環境下實作一個高效的鎖定機制。作者首先介紹了簡單的旋轉鎖 (spin lock),並指出其高 CPU 佔用率的缺點。接著,深入研究了 Linux 的 Futex 系統呼叫,利用其將等待鎖的線程置於睡眠狀態,而非不斷迴圈檢測,從而大幅降低 CPU 消耗。作者詳細解釋了 Futex 的運作原理、不同情境下的行為,並提供了使用 Futex 實作互斥鎖的具體程式碼,並與旋轉鎖進行效能比較。
+ 寫得真棒!詳細解釋了 Futex 的原理和使用方法,對理解 Linux 核心的鎖定機制非常有幫助。
+ 程式碼很清晰易懂,實際跑了一下,CPU 佔用率果然有明顯改善。

N-gated Hacker Newsngate
2025-06-03

Some brave soul decided to reinvent the wheel by building their own in C, because, apparently, mastering pre-existing solutions just wasn't challenging (or fun) enough. 🤦‍♂️ Instead of taking a nice walk outside, they've chosen to dance with futexes, as if Linux needed more accidental 'optimizations.' 🧐🔧
blog.fredrb.com/2025/06/02/fut

2024-10-04

[Перевод] Самые быстрые мьютексы

Cosmopolitan Libc хорошо известна своим « полиглотным жирным бинарным » хаком, который позволяем исполняемым файлам запускаться на шести операционных системах для AMD64/ARM64. Вас может удивить, что при этом она может быть лучше С‑библиотекой для вашего продакшена. Чтобы продемонстрировать это, давайте сравним библиотеку мьютексов Cosmo с другими платформами. Мы напишем простой тест, который создает 30 потоков, увеличивающих одно и то же число 100 000 раз. Это поможет проверить, насколько хорошо реализация мьютексов справляется с задачей при интенсивном использовании.

habr.com/ru/companies/beget/ar

#mutex #futex #c++ #cosmopolitan_libc

GripNewsGripNews
2023-08-25

🌗 Linux的新futex API [LWN.net]
➤ Linux的futex API得到改進
lwn.net/Articles/940944/
這個新的patch系列展示了futex的未來可能會是什麼樣子。這個系列包括了三個新的系統調用,並提供了一些新的功能,通常使用flags參數。其中一個新標誌是FUTEX2_NUMA,旨在提高NUMA系統的性能。此外,新的系統調用還需要一個標誌值,指示要操作的futex的大小。這項工作應該使開發人員更容易處理常見情況,並有可能在將來支持GNU C庫中的futexes。
+ 這個新的API將使開發人員更容易處理常見情況,並有可能在將來支持GNU C庫中的futexes。
+ 讓用戶空間選擇futex的大小是一個好主意,這意味著嵌入式控制系統應該(最終)能夠具有PI和巨型系統仍然可以有許多同時的futexes。

GripNewsGripNews
2023-08-16

🌘 調試 futex 崩潰
➤ 調試 futex 崩潰的過程
rustylife.github.io/2023/08/15
這篇文章描述了作者在調試一個應用程序崩潰時的過程。作者發現了一個有趣的應用程序核心文件,並通過檢查glibc源代碼找到了崩潰的原因。最終,作者將這個bug報告給了Veeam進行修復。
+ 這是一個很有趣的調試過程,作者很好地解釋了他的思路。
+ 這個故事告訴我們在調試時要仔細檢查代碼,並通過檢查源代碼找到問題的根源。

2023-06-18

Playing with #emscripten #webassembly workers brought me to `emscripten_wasm_wait/notify` functions. They are like Linux #Futex objects or WaitOnAddress on #Windows.

I was thinking about introducing an own "Futex" class ... but such a feature is not available on all platforms, so I stayed with regular mutex and atomic spinlocks abstractions which are well known everywhere.

It is always fun to learn how similar and different some platforms are and how to build generic layers on top of them.

sporksmith :unicycle: :rust:sporksmith@hachyderm.io
2023-04-12

"Programming error in your favor" - we were surprised this morning to find our nightly benchmark runtime went from about 7h to 3h.

It turns out we had introduced a bug in a call to `futex` such that we were always spinning forever waiting for a latch to open instead of ever blocking on the `futex`.

Spinning a bit before blocking is a common optimization for such constructs, but in my experience isn't often such a clear win.

github.com/shadow/shadow/pull/

#programming #futex

2022-02-14

ICYMI 👉 Over the past 18 months, we've been on a roller-coaster ride developing #futex2, a new set of kernel system calls. As part of this effort, the futex_waitv() syscall has now landed in #Linux 5.16. But what exactly is #futex? Let's dive in! col.la/futex #coding

2022-02-09

Over the past 18 months, we have been on a roller-coaster ride developing #futex2, a new set of kernel system calls. As part of this effort, the futex_waitv() syscall has now landed in #Linux 5.16. But what exactly is #futex? Let's dive in! col.la/futex #coding

2022-01-20

Released earlier this month, kernel 5.16 is full of great features, including two that had been in development for some time by our kernel team: the new #futex syscall & the new #fanotify event! Here's a look at our contributions: col.la/lk516 #futex2 #embedded

2021-02-09

Video: Presented last month at #lca2021, André Almeida gives an update on futex2, a work in progress system call to replace the current futex implementation in the #Linux kernel col.la/lcafx #OpenSource #Linux #Futex #Proton

2021-01-22

#lca2021: André Almeida provides an update on the current status of futex2 - Wine & Proton now have support for futex2! #OpenSource #Linux #Futex #Proton

2020-11-27

Video: Presented at #OSSummit, André Almeida discusses futex2(), a new version of the system call that can enable not only more complex use cases, but also key performance improvements inside the #Linux kernel. col.la/anfsc #SoftwareDevelopment #Coding #Futex #lfelc

2020-10-28

One final talk to end #OSSummit & #lfelc EU 2020! Join us at 19:30 GMT today as André Almeida presents "A New Futex2() System Call". sched.co/eCBF #Linux #OpenSource #Futex

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst