lkml.org 
[lkml]   [2002]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Unifying epoll,aio,futexes etc. (What I really want from epoll)
    On 31 Oct 2002 16:45:58 +0000
    Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

    > What is hard is multiple futex waits and livelock for that. I think it
    > can be done properly but I've not sat down and designed it all out - I
    > wonder what Rusty thinks.

    Hmm... Never thought about it. You mean an API like:

    struct futex_set *futex_set_init();
    struct futex_set *futex_set_add(struct futex_set *, struct futex *);
    /* Returns futex obtained. */
    struct futex *futex_set_wait(struct futex_set *);

    I think a naive implementation of futex_set_wait would look like:

    set = futex_set
    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.

    Rusty.
    --
    there are those who do and those who hang on and you don't see too
    many doers quoting their contemporaries. -- Larry McVoy
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:30    [W:0.022 / U:65.860 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site