Re: Some interesting results from tweaking spinlocks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some interesting results from tweaking spinlocks
Date: 2002-01-05 22:04:36
Message-ID: 13361.1010268276@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Brent Verner <brent(at)rcfile(dot)org> writes:
> Using a single-processor machine, we're not going to get any lower
> sleep times than ~10ms from either usleep or select on linux, and
> usleep is always longer.

Ah, so usleep is just being stricter about rounding up the requested
delay? That would explain the results all right.

> Looks like increasing spins allows
> the process to get the lock before the usleep/select is run

Right. Up to a point, increasing spins improves the odds of acquiring
the lock without having to release the processor.

What I should've thought of is to try sched_yield() as well, which is
the operation we *really* want here, and it is available on this version
of Linux. Off to run another batch of tests ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Verner 2002-01-06 01:48:45 Re: Some interesting results from tweaking spinlocks
Previous Message Sean Chittenden 2002-01-05 21:52:40 Re: pgcryto strangeness...