Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does mean futex_?

Tags:

c

linux

mutex

My appliction all of a sudden, stops working. and i executed following comand,

#ps -elf  | grep aeroServ

and Got the following output,

#0 S binunun   5634  2300  0  80   0 -  7781 futex_ 15:41 pts/0    00:00:04

What i could able to sense is that, application is not running, but i do not understand which state the process is now. Could someone kindly explain.

like image 792
Whoami Avatar asked Mar 06 '12 10:03

Whoami


People also ask

What is futex call?

The futex() system call provides a method for waiting until a certain condition becomes true. It is typically used as a blocking construct in the context of shared-memory synchronization. When using futexes, the majority of the synchronization operations are performed in user space.

How does a futex work?

Simply stated, a futex is a kernel construct that helps userspace code synchronize on shared events. Some userspace processes (or threads) can wait on an event (FUTEX_WAIT), while another userspace process can signal the event (FUTEX_WAKE) to notify waiters.

Does Pthreads use futex?

Modern day user-mode pthread mutex uses the futex kernel syscall [1] to implement the lock, which avoids the syscall in the non-contended case, so it can be very fast, acquiring the lock in the user-mode code entirely.

What is mutex in Linux?

A Mutex is a lock that we set before using a shared resource and release after using it. When the lock is set, no other thread can access the locked region of code.


1 Answers

That's the WCHAN column of the ps output.

As the man page says:

nwchan WCHAN address of the kernel function where the process is sleeping (use wchan if you want the kernel function name). Running tasks will display a dash ('-') in this column.

So your process is blocked on a futex_* call in kernel (these calls are related to mutex locking/unlocking and other synchronization primitives). Why it's blocked there, only you can tell by inspecting your code and/or using a debugger.

(See Futex for information on futexes.)

like image 90
Mat Avatar answered Oct 13 '22 15:10

Mat