Re: Microsecond sleeps with select() - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Microsecond sleeps with select()
Date
Msg-id 200102171836.NAA26349@candle.pha.pa.us
Whole thread Raw
In response to Re: Microsecond sleeps with select()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> So *if* some I/O just completed, the call *might* do what we need,
> which is yield the CPU.  Otherwise we're just wasting cycles, and
> will continue to waste them until we do a select with a nonzero
> delay.  I propose we cut out the spinning and just do a nonzero delay
> immediately.

Well, any backend with a higher piority would get run over the current
process.  The question is how would that happen.  I will say that
because of CPU cache issues, the system tries _not_ to change processes
if the current one still needs the CPU, so the zero may be bogus.

> 
> > I think the 0 and 10000 are correct.  They would be zero ticks and one
> > tick.  You think 5000 and 10000 would be better?  I can see that.
> 
> No, I am not suggesting that, because there is no difference between
> 5000 and 10000.
> 
> All of this stuff probably ought to be replaced with a less-bogus
> mechanism (POSIX semaphores maybe?), but not in late beta.

Good question.  We have sched_yield, that is a threads function, or at
least only in the pthreads library.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Microsecond sleeps with select()
Next
From: Tom Lane
Date:
Subject: Re: WAL and commit_delay