Questions tagged [futex]

"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

https://en.wikipedia.org/wiki/Futex

107 questions
0
votes
0 answers

How to implement futex_wait sysccall for pid

I have a code which puts threads to sleep using futex_wait syscall. how can i put a process to sleep using futex_wait syscall? I understand this program, it creates the thread and put them on sleep and then calls the futex_Wake syscall to wake the…
anjali rai
  • 185
  • 1
  • 1
  • 14
0
votes
1 answer

How is WakeByAddressAll ordered?

This is the follow-up of the question How is std::atomic::notify_all ordered? What would be the answer to that question, if I use WaitOnAddress or futex directly. From the answer to that question the conclusion is that the below program does not…
Alex Guteniev
  • 12,039
  • 2
  • 34
  • 79
0
votes
1 answer

Code hangs randomly after 1hr/1day/30 days

I am using Altera Cyclone V FPGA with ARM 7 core, I am running a application with 7 thread with mutexes. The application randomly hangs after 1hr or 1 Day or 1 Month, no defined time. I ran strace when the application is running smoothly and it…
0
votes
1 answer

futex man page demo result incorrect

The futex man page provides a simple demo, but I can't get the result as the page described, the result seems to be deadlock on my machine (linux 5.2.1); the parent process isn't awaken by its child. Is the man page wrong? Example of output on my…
X Ah
  • 11
  • 1
0
votes
1 answer

How to kill thread spawned using CLONE_THREAD and blocked on a shared resource in kernel space?

I have a test case where there are threads spawned using CLONE_THREAD option in clone() .Here if i want to kill a particular thread I suppose we should be using SYS_tgkill in systemcall(). But will the kill actually affect a thread if it is waiting…
notytony
  • 1,032
  • 2
  • 11
  • 13
0
votes
0 answers

sem_timedwait causes "The futex facility returned an unexpected error code"

What is wrong with this code? When the sem object is posted, it is fine. However as soon as it needs to wait for the time out, I get "The futex facility returned an unexpected error code". void* BackgroudProc(void*){ struct timespec ts; …
0x64
  • 124
  • 8
0
votes
1 answer

Retrive the information for a address using gdb

Upon Running strace on a Java Application I notice some long time the syscall(mostly futex). futex(0x7f8578001fd4, FUTEX_WAIT_PRIVATE, 1311, NULL) = 0 <15.082094> I really want to understand the wait on futex is for which shared resources over…
Ratatouille
  • 1,372
  • 5
  • 23
  • 50
0
votes
0 answers

How can I reproduce “Leap Second Bug” on my linux system

I'm using java application on linux system(Redhat 6.6). Some times this application charged CPU 100%. This is proc strace. [chgminer@perpscm CE]$ strace -p 18182 ... sched_yield() = 0 sched_yield() …
정석훈
  • 21
  • 1
0
votes
2 answers

Why Locking in Go much slower than Java? Lot's of time spent in Mutex.Lock() Mutex.Unlock()

I've written a small Go library (go-patan) that collects a running min/max/avg/stddev of certain variables. I compared it to an equivalent Java implementation (patan), and to my surprise the Java implementation is much faster. I would like to…
Christophe
  • 328
  • 5
  • 15
0
votes
0 answers

c++ software in linux with multi-thread programming : overhead found at futex. solution for this?

[update] PROBLEM SOLVED ! THE PROBLEM IS HARDWARE MODULE. I FIXED AFTER RESTARTING IT. I wrote a C++ software with the purpose is to readout data from a hardware module to PC via Gigabit-Ethernet PCIe card (which is mounted in the PC). The library…
0
votes
0 answers

futex return ETIMEDOUT quicker than the parameter timeout

I'm working in a Ubuntu virtual machine on vSphere. My application is waiting on a pthread signal (sem_t) every 1 second. when I strace the system call, find the system call is much quicker returned than 1 second. The result by strace is as…
ptan
  • 169
  • 3
  • 9
0
votes
0 answers

How does Futex is working in my code?

I am seeing jumbled output from my futex code. Here is my code, #include #include #include #include #include #include #include #include #define NUM 15 int…
Prashanth Cm
  • 151
  • 2
  • 4
  • 8
0
votes
1 answer

Tomcat java threads spinning on futex() calls

I have a simple 3 tier setup of an Apache server which sends requests to a Tomcat server, which queries a (MySQL) database to generate HTML results. I'm finding that as soon as Tomcat is started, there are threads in the java process that are…
0
votes
1 answer

Perl's worker don't process connections, waiting on a futex

We have 10 workers processing user's connections. Workers are implemented in Perl, using FCGI and FCGI::ProcManager. Sometimes, one worker stop processing of connections. Strace displays: futex(0x7fa9ebde0e80, FUTEX_WAIT_PRIVATE, 2, NULL That is…
drlexa
  • 197
  • 2
  • 11
0
votes
1 answer

Python ssh library that does not use threading behind-the-scenes?

We are having issues mixing threads and forks that is basically the same as described in this blog article: http://rachelbythebay.com/w/2011/06/07/forked/ (mixing threads and forks is causing some child processes to hang on a FUTEX call) Her…
Cameron Sparr
  • 3,925
  • 2
  • 22
  • 31