<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4" -->

---
title: Landing a new syscall: What is futex? | daily.dev
description: A deep dive into the futex (fast userspace mutex) Linux system call, explaining the race condition problem it solves, how mutexes work conceptually, and the...
canonical: https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Landing a new syscall: What is futex? | daily.dev
og:description: A deep dive into the futex (fast userspace mutex) Linux system call, explaining the race condition problem it solves, how mutexes work conceptually, and the...
og:url: https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4
og:image: https://api.daily.dev/og/posts/yCUt6J9r4.png
og:image:alt: Landing a new syscall: What is futex?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Landing a new syscall: What is futex?

**[Collabora Blog](https://daily.dev/sources/collabora)** · 9 min read · 0 upvotes · 0 comments

## Summary

A deep dive into the futex (fast userspace mutex) Linux system call, explaining the race condition problem it solves, how mutexes work conceptually, and the clever design that keeps most mutex operations in userspace to avoid costly kernel context switches. Includes annotated pseudocode for mutex_lock() and mutex_unlock() using cmpxchg atomic operations and FUTEX_WAIT/FUTEX_WAKE opcodes. The post is part of a series prompted by the landing of futex_waitv() in Linux 5.16, a new syscall developed over 18 months as part of the futex2 effort.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2022/02/08/landing-a-new-syscall-part-what-is-futex>

## Questions this post answers

### How does the Linux futex syscall work to implement a userspace mutex?

Futex (fast userspace mutex) keeps the mutex state as a userspace uint32 value and only calls into the kernel when a thread must sleep or wake another thread. On lock, an atomic cmpxchg sets the value from UNLOCKED to LOCKED; if it fails, FUTEX_WAIT is called. On unlock, the value is atomically set to UNLOCKED and FUTEX_WAKE is called with count 1. The common case — uncontended lock — requires zero syscalls.

_Developers building multithreaded Linux software track futex internals and kernel synchronization changes on daily.dev._

### Why does futex check the expected value before sleeping in FUTEX_WAIT?

FUTEX_WAIT takes a third argument — the value expected at the mutex address — and returns -EAGAIN immediately if the actual value differs. This guards against a race between the failed cmpxchg and the futex() call: if another thread releases the lock in that window, the mutex is already free and waiting would block indefinitely. The caller loops and retries acquisition instead.

_Engineers navigating Linux synchronization edge cases find kernel-level discussions like this on daily.dev._

### What is futex_waitv and which kernel version introduced it?

futex_waitv() is a new syscall introduced in Linux 5.16, developed as part of the futex2 project over roughly 18 months. It is a follow-up to the original futex syscall and aims to overcome long-standing limitations in how applications interact with the Linux kernel for process synchronization, particularly around waiting on multiple futex addresses simultaneously.

_Teams tracking Linux kernel releases and new syscall interfaces stay current on daily.dev._

## Similar posts on daily.dev

- [Inside Rust's std and parking\_lot mutexes - who wins?](https://daily.dev/posts/inside-rust-s-std-and-parking-lot-mutexes---who-wins--1mfqrkl67) · Hacker News · 1 upvotes · 0 comments
- [How a System Call Actually Works in Linux](https://daily.dev/posts/how-a-system-call-actually-works-in-linux-kj1mr4pdv) · freeCodeCamp · 1 upvotes · 0 comments
- [The Staggering Complexity And Subtlety Of Concurrency](https://daily.dev/posts/the-staggering-complexity-and-subtlety-of-concurrency-e4mpqhp2q) · Hackaday · 1 upvotes · 0 comments
- [Designing microkernel IPC](https://daily.dev/posts/designing-microkernel-ipc-vbk2mhr0m) · Lobsters · 0 upvotes · 0 comments
- [IonStack part II: GhostLock, a stack-UAF that has existed in ALL Linux distributions for 15 years](https://daily.dev/posts/ionstack-part-ii-ghostlock-a-stack-uaf-that-has-existed-in-all-linux-distributions-for-15-years-wznoxduhk) · Hacker News · 2 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux)

[View this post on daily.dev](https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Landing a new syscall: What is futex?","url":"https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4"},"datePublished":"2026-08-11T08:53:32.216Z","dateModified":"2026-08-11T09:10:07.832Z","description":"A deep dive into the futex (fast userspace mutex) Linux system call, explaining the race condition problem it solves, how mutexes work conceptually, and the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8801e8576d167a4b6e21782787c9e14f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8801e8576d167a4b6e21782787c9e14f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"Landing a new syscall: What is futex?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/landing-a-new-syscall-what-is-futex--ycut6j9r4#faq","mainEntity":[{"@type":"Question","name":"How does the Linux futex syscall work to implement a userspace mutex?","acceptedAnswer":{"@type":"Answer","text":"Futex (fast userspace mutex) keeps the mutex state as a userspace uint32 value and only calls into the kernel when a thread must sleep or wake another thread. On lock, an atomic cmpxchg sets the value from UNLOCKED to LOCKED; if it fails, FUTEX_WAIT is called. On unlock, the value is atomically set to UNLOCKED and FUTEX_WAKE is called with count 1. The common case — uncontended lock — requires zero syscalls. Developers building multithreaded Linux software track futex internals and kernel synchronization changes on daily.dev."}},{"@type":"Question","name":"Why does futex check the expected value before sleeping in FUTEX_WAIT?","acceptedAnswer":{"@type":"Answer","text":"FUTEX_WAIT takes a third argument — the value expected at the mutex address — and returns -EAGAIN immediately if the actual value differs. This guards against a race between the failed cmpxchg and the futex() call: if another thread releases the lock in that window, the mutex is already free and waiting would block indefinitely. The caller loops and retries acquisition instead. Engineers navigating Linux synchronization edge cases find kernel-level discussions like this on daily.dev."}},{"@type":"Question","name":"What is futex_waitv and which kernel version introduced it?","acceptedAnswer":{"@type":"Answer","text":"futex_waitv() is a new syscall introduced in Linux 5.16, developed as part of the futex2 project over roughly 18 months. It is a follow-up to the original futex syscall and aims to overcome long-standing limitations in how applications interact with the Linux kernel for process synchronization, particularly around waiting on multiple futex addresses simultaneously. Teams tracking Linux kernel releases and new syscall interfaces stay current on daily.dev."}}]}
```

