Re: Microsecond sleeps with select()

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Microsecond sleeps with select()
Date: 2001-02-17 18:36:00
Message-ID: 200102171836.NAA26349@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-17 18:46:22 Re: WAL and commit_delay
Previous Message Tom Lane 2001-02-17 18:30:31 Re: Microsecond sleeps with select()