Question

I have been tracing a process with strace and have seen entries such as:

futex(0x7ffff79b3e00, FUTEX_WAKE_PRIVATE, 1) = 1                                                                
futex(0x7ffff79b3e00, FUTEX_WAIT_PRIVATE, 2, NULL) = 0 

However, when I looked at the man page for futex I have only seen entries such as FUTEX_WAIT and FUTEX_WAKE. So my question is what does _PRIVATE that is appended to the end of these names in my strace output mean? For instance is there any difference between something like FUTEX_WAKE that is documented in the futex man page and FUTEX_WAKE_PRIVATE that I see in the strace output or can I assume that they are the same when I am trying to understand what is happening with the program I am debugging.

Was it helpful?

Solution

This is an optimization done by linux/glibc to make futexes faster when they're not shared between processes. Glibc will use the _PRIVATE versions of each of the futex calls unless the PTHREAD_PROCESS_SHARED attribute is set on your mutex

It's explained in more detail here: http://lwn.net/Articles/229668/

For the purposes of your debugging, you can just ignore the _PRIVATE suffixes

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top