"A futex (short for “fast userspace mutex”) is a kernel system call that programmers can use to implement basic locking, or as a building block for higher-level locking abstractions such as semaphores and POSIX mutexes or condition variables." -- From Wikipedia
Questions tagged [futex]
107 questions
1
vote
2 answers
boost interprocess ipc deadlocks
This is my second post in connection with the boost ipc libraries.
I'm facing baffling deadlocks so I thought I'll explore some existing examples available on the web
My current problem is just a trial of the example provided…

Aditya Sihag
- 5,057
- 4
- 32
- 43
1
vote
2 answers
Segmentation fault while calling malloc and program in deadlock futex
The code that I am working on has a lot of calls to create a new strings and stuff.. But recently after upgrading the servers to 12.10 Ubuntu, I have started facing some troubles. Some of the child processes get stuck in futex. So I went and…

Prasanth Madhavan
- 12,657
- 15
- 62
- 94
0
votes
2 answers
fclose hang after cloned threads on Linux
When calling fclose on the global file descriptor, the program hang.
It happened after exits of several threads created by clone.
Below is the sequence:
FILE * fid = fopen("filename", "w");
...
for(int i=0; i<4; i++){
clone((int (*)(void*))do_work,…

user1200759
- 91
- 7
0
votes
0 answers
Hadoop hangs on a FUTEX_WAIT process
While running some hadoop commands I noticed that running hadoop binary from some machines (but not others!) takes a whole lot of time. E.g., a simple fs -ls /tmp is ~20min (otherwise this was seconds). When stack-trace-dumping the hadoop process, I…

sdgaw erzswer
- 2,182
- 2
- 26
- 45
0
votes
1 answer
Futex wakeup after thread exit
I have strace'd a correctly working program to compare with a faulty one. In the correct one, I have two threads (using pthreads) with one waiting for the other with regular pthread_join. Under the hoods I can see that the waiting (primary) thread…

Radim Vansa
- 5,686
- 2
- 25
- 40
0
votes
1 answer
Kernel Module, Call get_futex_key
I am working on a Linux kernel module, and I want to call function get_futex_key. How can I do this? The eventual goal is to use kernel functions to return a list of threads that hold a given futex.
I followed this tutorial to create a "hello world"…

Jacob Quisenberry
- 1,131
- 3
- 20
- 48
0
votes
1 answer
Release Python Thread Lock or Futex Using GDB
I would like to find a way to release a Python thread Lock using GDB on Linux. I am using Ubuntu 18.04, Python 3.6.9, and gdb 8.1.1. I am also willing to use the gdb package in Python.
This is for personal research and not intended for a production…

Jacob Quisenberry
- 1,131
- 3
- 20
- 48
0
votes
1 answer
Futex using boost, threads never wakeup
I am studying about futex synchronisation
Following up the manual , I tried to syncroniaze threads using boost futex
However the threads never wake up
#include
#include
#include
#include…

getsoubl
- 808
- 10
- 25
0
votes
2 answers
Deferred bcast wakeup for condition variables - is it valid?
I'm implementing pthread condition variables (based on Linux futexes) and I have an idea for avoiding the "stampede effect" on pthread_cond_broadcast with process-shared condition variables. For non-process-shared cond vars, futex requeue operations…

R.. GitHub STOP HELPING ICE
- 208,859
- 35
- 376
- 711
0
votes
1 answer
Futex code walkthrough- returning EFAULT
In the futex_wake_op function of futex.c in the Linux kernel source,I was trying to understand how the control reaches this point.This happens when in the above said function,the futex_atomic_op_inuser returns -EFAULT,and yet the uaddr2 is…

itisravi
- 3,406
- 3
- 23
- 30
0
votes
0 answers
On Linux program exit, calling function futex(... FUTEX_WAIT_PRIVATE...) leaves the process hanging
I have many multithread C++ programs built in Red Hat 2.6.18-164.11.1.el5
and they run and exit properly e.g. in Red Hat 4.18.0-240.15.1.el8_3.x86_64 - no matter if daemonized or not.
But if I build and run them in 4.18.0-372.16.1.el8_6.x86_64,…

WeakIce
- 1
- 1
0
votes
0 answers
Create Futex function using nop instruction or even create own futex
I have a question about making a thread lock method ... I'm not talking about pthread lock or any other lock ... I'm talking about atomic operations and finally, futex (on Linux (we are talking about Linux only)) ...
I know there is a function named…

HelloMachine
- 355
- 2
- 8
0
votes
0 answers
opendir/readdir hangs on futex
I have a program that has been running fine for months, and 2 days before being shown to the brass, it just hangs at the beginning, while exploring a file structure. Here's a backtrace:
#0 futex_wait (private=0, expected=2,…

dargaud
- 2,431
- 2
- 26
- 39
0
votes
1 answer
gdb wont break on "futex"
I'm running strace on my process to monitor performance and I see a lot of calls like so:
futex(0x3d89d68, FUTEX_WAKE_PRIVATE, 1) = 0
...
I'm trying to catch where this call is being done in gdb ( just like I do for other system calls ). However…

ByteMe95
- 836
- 1
- 6
- 18
0
votes
1 answer
How compare to a constant with WaitOnAddress
In Linux, futexs have the following signature
long futex(uint32_t *uaddr, int futex_op, uint32_t val, const struct timespec *timeout), so I can say syscall(SYS_futex, &m_address, FUTEX_WAIT_PRIVATE, 1, nullptr); which will pause the current thread…

Ebony Ayers
- 350
- 1
- 3
- 9