Re: Adjustment of spinlock sleep delays

From: "Mendola Gaetano" <mendola(at)bigfoot(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Adjustment of spinlock sleep delays
Date: 2003-08-06 11:23:54
Message-ID: 000e01c35c0d$5b4f4dc0$32add6c2@mm.eutelsat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>

> To forestall this scenario, I'm thinking of introducing backoff into the
> sleep intervals --- that is, after first failure to get the spinlock,
> sleep 10 msec; after the second, sleep 20 msec, then 40, etc, with a
> maximum sleep time of maybe a second. The number of iterations would be
> reduced so that we still time out after a minute's total delay.

What about use the same algorithm used in ethernet when a collision is
detected?

When a collision occurs:

1) Stop sending.
2) Wait for some random amount of time between 0-T seconds
3) Try again.
4) If collision occurs again, increase T using an algorithm, go to
Step 2.

algorithm:

T = rand ( 2n -1 ) * 51.2 ms

where n- number of collisions

Regards
Gaetano Mendola

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marco Roda 2003-08-06 11:48:18 Oracle to PostgreSQL
Previous Message Martin Brommer 2003-08-06 09:23:40 Using rowtype as function argument