Re: condition variables - Mailing list pgsql-hackers

From Robert Haas
Subject Re: condition variables
Date
Msg-id CA+TgmoYN7T=VytEGrNh7LQ2sgCcaEvjEB1uMy9O_DAKHeMd8jw@mail.gmail.com
Whole thread Raw
In response to Re: condition variables  (Peter Geoghegan <pg@heroku.com>)
Responses Re: condition variables  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Thu, Aug 11, 2016 at 6:37 PM, Peter Geoghegan <pg@heroku.com> wrote:
> I notice that you acquire a spinlock within the implementation of
> condition variables. Is it worth any effort to consolidate the number
> of spinlock acquisitions? In other words, maybe the most common idioms
> should be baked into the ConditionVariable interface, which could save
> callers from having to use their own mutex variable.

One thing to keep in mind is that spinlocks are extremely fast as long
as you don't have too many processes contending for them.  With
parallel groups (or I/O-in-progress wait queues) of single digit
number of processes, I doubt that consolidating the spinlock
acquisitions will produce any measurable benefit.  If we get to the
point of having parallel groups containing scores of processes, that
could change.

Also, right now we don't have enough users of the CV interface to know
what the most common idioms will be.  We could speculate, but if we
do, I'll start of the speculation by guessing that there will be a lot
of diversity, and not too much that keeps getting repeated.  If that
proves to be wrong, of course, we can always go back and change it
later.  We're not writing this on stone tablets.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: condition variables
Next
From: Robert Haas
Date:
Subject: Re: condition variables