Re: Spinlock performance improvement proposal - Mailing list pgsql-hackers

From mlw
Subject Re: Spinlock performance improvement proposal
Date
Msg-id 3BB53F68.3270BB17@mohawksoft.com
Whole thread Raw
In response to Spinlock performance improvement proposal  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Spinlock performance improvement proposal  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:
> 
> > Save for the fact that the kernel can switch between threads faster then
> > it can switch processes considering threads share the same address space,
> > stack, code, etc.  If need be sharing the data between threads is much
> > easier then sharing between processes.
> 
> Just a clarification but because we fork each backend, don't they share
> the same code space?  Data/stack is still separate.

In Linux and many modern UNIX programs, you share everything at fork time. The
data and stack pages are marked "copy on write" which means that if you touch
it, the processor traps and drops into the memory manager code. A new page is
created and replaced into your address space where the page, to which you were
going to write, was.


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: Re: Spinlock performance improvement proposal
Next
From: mlw
Date:
Subject: Re: Spinlock performance improvement proposal