Re: [HACKERS] fork/exec for backend

From: Tom <tom(at)sdf(dot)com>
To: Goran Thyni <goran(at)bildbasen(dot)se>
Cc: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] fork/exec for backend
Date: 1998-01-24 22:53:22
Message-ID: Pine.BSF.3.95q.980124145035.19914D-100000@misery.sdf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 24 Jan 1998, Goran Thyni wrote:

> On 24 Jan 1998, Goran Thyni wrote:
>
> > Fork on modern unices (linux and (a think) *BSD) cost
> > almost nothing (in time and memory) thanks to COW (copy-on-write).
> > Exec in expensive as it breaks COW.
>
> Not so. Modern Unixs will share executable address space between
> processes. So if you fork and exec 10 identical programs, they will share
> most address space.
>
> 1. Code is probably not shared between postmaster and postgres
> processes.

A backend is execed for every connection. All the backends will share
code space.

> 2. Some inits may be done once (by postmaster) and not repeated
> by every child.

Not relevant. I'm only concerned with the children.

> 3. (and most important)
> With no exec COW is in action, meaning:
> data pages in shared until changed.
>
> COW is the key to how Linux can fork faster than most unices
> starts a new thread. :-)

COW is old news. Perhaps you can find some old SCO systems that don't
do COW :)

> Again, this only applies to "modern" systems, but FreeBSD definitely has
> this behaviour.
>
> I don't know if *BSD has COW, but if should think so.

I'm not speaking just about COW, but about being able share code between
separately execed processes.

> best regards,
> --
> ---------------------------------------------
> Gran Thyni, sysadm, JMS Bildbasen, Kiruna

Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brett McCormick 1998-01-24 23:02:09 Re: [HACKERS] Re: Browsing the tables and why pgsql does not perform well
Previous Message Brett McCormick 1998-01-24 22:46:58 Re: [QUESTIONS] Re: [HACKERS] Show stopper ? (was: Re: "cruising" or "browsing" through tables using an index / ordering)