Re: Unifying epoll,aio,futexes etc. (What I really want from epoll)

Alan Cox
2002-11-01T12:57:08Z

On Thu, 2002-10-31 at 22:00, Rusty Russell wrote:
> try:
> for each futex in set {
> if (grab in userspace) {
> close fds;
> return with futex;
> }
> close old fd for futex if any
> call FUTEX_FD to get fd notification of futex;
> }
>
> select on fds
> set = fds which are ready
> goto try
>
> You could, of course, loop through the fast path once before making any
> syscalls. Another optimization is to have FUTEX_FD reuse an existing fd
> rather than requiring the close.
>
> Not sure I get the point about livelock though: deadlock is possible if
> apps seek multiple locks at once without care, of course.

Think about 1000 futexes where one task wants to grab them all and other
tasks want any one of them - done wrongly at that point busy traffic
will starve the 1000 futex waiter.