Re: Some interesting results from tweaking spinlocks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Some interesting results from tweaking spinlocks
Date
Msg-id 10199.1010209932@sss.pgh.pa.us
Whole thread Raw
In response to Re: Some interesting results from tweaking spinlocks  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Isn't there tons more lock contention on an SMP machine.

No, one would hope not.  If you can't get the various processes to
run without much interference, you're wasting your time dealing
with multiple CPUs.

In a uniprocessor, we'll suffer from lock contention if one process
happens to lose the CPU while holding a lock, and one of the other
processes that gets to run meanwhile tries to acquire that same lock.
In SMP this gets folded down: the lock holder might not lose its CPU
at all, but some other CPU could be running a process that tries to
acquire the lock meanwhile.  It's not apparent to me why that should
increase the chance of lock contention, however.  The percentage of
a process' runtime in which it is holding a lock should be the same
either way, so the probability that another process fails to acquire
the lock when it wants shouldn't change either.  Where is the flaw
in this analysis?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Some interesting results from tweaking spinlocks
Next
From: Brent Verner
Date:
Subject: Re: Some interesting results from tweaking spinlocks