Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Aug 2014 09:04:39 +0200
From: Jens Gustedt <>
Subject: Re: Explaining cond var destroy [Re: C threads, v3.0]


Am Montag, den 11.08.2014, 22:50 -0400 schrieb Rich Felker:
> On Sat, Aug 09, 2014 at 08:47:34AM +0200, Jens Gustedt wrote:
> > > Any further thoughts on the matter? I think we should finish the
> > > private futex support task before starting on this, so that we don't
> > > do new work that's going to conflict with a pending patch.
> > 
> > This looks promissing, but I yet don't know enough about these less
> > common futex operations to comment more on it.
> You may want to see my comments here which relate to it:

thanks for the pointer, I also read up on the subject a bit in the
mean time.

> > Generally I think that the control structures should be as tight as
> > possible, give provable properties in the mathematical sense. The
> > interaction between user- and kernelland should be minimal, and we
> > shouldn't provoque reactions of the kernel that concern threads (or
> > even process) that are not really targetted. 
> The former (provable properties) is definitely a goal we should not
> deviate from. But I don't think the current spurious futex wakes
> conflict with that goal.
> The latter (not provoking reactions in untargetted threads) is a
> desirable goal, but not if it conflicts with more important goals like
> avoiding unnecessary allocation (actually, I don't think it's possible
> to solve the problem with allocation; I think an additional layer of
> allocation just makes it worse), fail-safety, performance, etc.

Did you have a chance to look into my recent implementation of C
threads that I attached to my last post? In particular in
cnd_broadcast you see the advantages, I think:

 - cnd doesn't have to do bookkeeping for the threads waiting on the
   condition, the kernel bookkeeping is used for that

 - threads that had to go into futex wait only touch the temporary
   structure and this only for the reference count

 - a tight spinlock clearly defines the ordering of the cnd_t

> On the other hand, I think it's going to be possible to get both
> without sacrificing anything, and moreover I think we can even, if we
> want to, provide guaranteed mutex acquisition order (whatever order
> the kernel gives, which is probably fifo or fifo within priority
> levels). I'll write up the concept for the latter in case there's
> interest in doing it. It might avoid the problem even without using

I think so, too. Perhaps we should work it from both ends. I will now
try to avoid the need for allocation.


:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: ::

Download attachment "signature.asc" of type "application/pgp-signature" (199 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.