Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 28 Feb 2015 10:42:48 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: semaphore redesign

On Sat, Feb 28, 2015 at 02:21:22AM +0300, Alexander Monakov wrote:
> Hello,
> 
> As new cancellation has landed (except that __timedwait fails to propagate
> ECANCELED in addition to ETIMEDOUT and EINTR), I'm happy to post semaphore
> redesign.  We discussed this implementation with Rich on IRC once, and
> presently I'm not aware of any issues (finally!), but still testing and
> performance comparison need to be done.

Thanks! I'm attaching a performance testing program I used in the
past. Its time measurement is not very precise, but it should show
large-scale differences. It measures the number of messages that can
be send back and forth between two threads in 2 seconds by cancelling
the two threads after sleep(2).

Some other things we should test for performance:

- Do something like the attached but with multiple threads contending
  on semaphores rather than uncontended message passing.

- Time/cycles per call for sem_post and sem_trywait and uncontended
  sem_wait -- this looks like it should be an obvious win though.

- Perhaps something to hammer posts and trywait -- it's not clear that
  this would model any real-world behavior, but it could show
  something interesting anyway.

I doubt we'll see any measurable differences in usage cases where the
futex syscall is expected; it should dominate there.

Rich

View attachment "sem_bench.c" of type "text/plain" (648 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.