From: | George Neuner <gneuner2(at)comcast(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: spin locks and starvation |
Date: | 2017-04-03 19:15:04 |
Message-ID: | 7c45ectn7m9p0h9dn6k9mofb40vrs4ojge@4ax.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 3 Apr 2017 11:40:29 +0200, Tom DalPozzo <t(dot)dalpozzo(at)gmail(dot)com>
wrote:
>I saw that postgresql implementation makes big use of spin locks.
>I was wondering if I should be concerned about possible starvation problem
>because I looked around and couldn't find an absolute answer about if linux
>spinlocks guarantee protection about starvation or not. I'm using ubuntu
>16.04.
>
>I've noticed no problem so far, I'm just wondering.
No form of locking can guarantee progress - starvation avoidance
requires use of a wait-free arbitration method.
Note that "wait-free" is not the same as "lock-less". Lock-less
methods guarantee only that *some* thread can make progress, not that
all threads will make progress. Any particular thread may starve
under lock-less arbitration.
There are a number of lock-less algorithms to choose from, but truely
wait-free algorithms are complex and difficult to implement correctly.
Outside of hard real-time systems they are quite rare.
http://www.cs.technion.ac.il/~erez/Papers/wfquque-ppopp.pdf
Spin locking is the optimal *locking* technique to use when conflicts
are expected to occur relatively often, but the period of locking is
relatively short [wrt to the unlocked period and for some respective
definitions of "relatively"].
YMMV,
George
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Kliukin | 2017-04-03 20:32:46 | Re: PostgreSQL and Kubernetes |
Previous Message | Joe Conway | 2017-04-03 16:10:32 | Re: PostgreSQL and Kubernetes |